From a85171624b99432b6cd69bb01f2b781b7b4855f4 Mon Sep 17 00:00:00 2001 From: SuspiciousActivity <38253929+SuspiciousActivity@users.noreply.github.com> Date: Tue, 9 Mar 2021 23:58:38 +0100 Subject: [PATCH] Deleted some unused files --- .../modes/ActionScriptTokenMaker.flex | 495 - .../modes/ActionScriptTokenMaker.java | 1383 -- .../modes/AssemblerX86TokenMaker.flex | 1032 -- .../modes/AssemblerX86TokenMaker.java | 1289 -- .../modes/BBCodeTokenMaker.flex | 273 - .../modes/BBCodeTokenMaker.java | 660 - .../modes/CPlusPlusTokenMaker.flex | 685 - .../modes/CPlusPlusTokenMaker.java | 1596 -- .../rsyntaxtextarea/modes/CSSTokenMaker.flex | 558 - .../rsyntaxtextarea/modes/CSSTokenMaker.java | 1228 -- .../modes/CSharpTokenMaker.flex | 514 - .../modes/CSharpTokenMaker.java | 1240 -- .../ui/rsyntaxtextarea/modes/CTokenMaker.flex | 647 - .../ui/rsyntaxtextarea/modes/CTokenMaker.java | 1453 -- .../modes/ClojureTokenMaker.flex | 561 - .../modes/ClojureTokenMaker.java | 1534 -- .../ui/rsyntaxtextarea/modes/DTokenMaker.flex | 663 - .../ui/rsyntaxtextarea/modes/DTokenMaker.java | 1502 -- .../rsyntaxtextarea/modes/DartTokenMaker.flex | 660 - .../rsyntaxtextarea/modes/DartTokenMaker.java | 1637 -- .../modes/DelphiTokenMaker.flex | 559 - .../modes/DelphiTokenMaker.java | 1263 -- .../modes/DockerTokenMaker.flex | 282 - .../modes/DockerTokenMaker.java | 696 - .../rsyntaxtextarea/modes/DtdTokenMaker.flex | 347 - .../rsyntaxtextarea/modes/DtdTokenMaker.java | 769 - .../modes/FortranTokenMaker.flex | 477 - .../modes/FortranTokenMaker.java | 842 - .../modes/GroovyTokenMaker.flex | 930 - .../modes/GroovyTokenMaker.java | 3448 ---- .../rsyntaxtextarea/modes/HTMLTokenMaker.flex | 1349 -- .../rsyntaxtextarea/modes/HTMLTokenMaker.java | 2715 --- .../modes/HostsTokenMaker.flex | 256 - .../modes/HostsTokenMaker.java | 621 - .../modes/HtaccessTokenMaker.flex | 500 - .../modes/HtaccessTokenMaker.java | 1158 -- .../rsyntaxtextarea/modes/IniTokenMaker.flex | 225 - .../rsyntaxtextarea/modes/IniTokenMaker.java | 589 - .../rsyntaxtextarea/modes/JSPTokenMaker.flex | 1960 -- .../rsyntaxtextarea/modes/JSPTokenMaker.java | 5583 ------ .../modes/JavaScriptTokenMaker.flex | 990 - .../modes/JavaScriptTokenMaker.java | 2042 --- .../modes/JshintrcTokenMaker.java | 24 - .../rsyntaxtextarea/modes/JsonTokenMaker.flex | 316 - .../rsyntaxtextarea/modes/JsonTokenMaker.java | 713 - .../modes/LatexTokenMaker.flex | 275 - .../modes/LatexTokenMaker.java | 662 - .../rsyntaxtextarea/modes/LessTokenMaker.java | 43 - .../rsyntaxtextarea/modes/LispTokenMaker.flex | 429 - .../rsyntaxtextarea/modes/LispTokenMaker.java | 1057 -- .../rsyntaxtextarea/modes/LuaTokenMaker.flex | 369 - .../rsyntaxtextarea/modes/LuaTokenMaker.java | 834 - .../modes/MakefileTokenMaker.flex | 333 - .../modes/MakefileTokenMaker.java | 782 - .../rsyntaxtextarea/modes/MxmlTokenMaker.flex | 813 - .../rsyntaxtextarea/modes/MxmlTokenMaker.java | 2021 --- .../rsyntaxtextarea/modes/NSISTokenMaker.flex | 742 - .../rsyntaxtextarea/modes/NSISTokenMaker.java | 2001 --- .../rsyntaxtextarea/modes/PHPTokenMaker.flex | 2574 --- .../rsyntaxtextarea/modes/PHPTokenMaker.java | 14903 ---------------- .../rsyntaxtextarea/modes/PerlTokenMaker.flex | 808 - .../rsyntaxtextarea/modes/PerlTokenMaker.java | 1626 -- .../modes/PropertiesFileTokenMaker.flex | 233 - .../modes/PropertiesFileTokenMaker.java | 610 - .../modes/PythonTokenMaker.flex | 438 - .../modes/PythonTokenMaker.java | 857 - .../rsyntaxtextarea/modes/RubyTokenMaker.flex | 760 - .../rsyntaxtextarea/modes/RubyTokenMaker.java | 1449 -- .../rsyntaxtextarea/modes/SASTokenMaker.flex | 672 - .../rsyntaxtextarea/modes/SASTokenMaker.java | 1161 -- .../rsyntaxtextarea/modes/SQLTokenMaker.flex | 473 - .../rsyntaxtextarea/modes/SQLTokenMaker.java | 932 - .../modes/ScalaTokenMaker.flex | 383 - .../modes/ScalaTokenMaker.java | 866 - .../rsyntaxtextarea/modes/TclTokenMaker.flex | 401 - .../rsyntaxtextarea/modes/TclTokenMaker.java | 837 - .../modes/TypeScriptTokenMaker.flex | 951 - .../modes/TypeScriptTokenMaker.java | 2002 --- .../modes/UnixShellTokenMaker.java | 1056 -- .../modes/VisualBasicTokenMaker.flex | 460 - .../modes/VisualBasicTokenMaker.java | 1152 -- .../modes/WindowsBatchTokenMaker.java | 575 - .../rsyntaxtextarea/modes/XMLTokenMaker.flex | 487 - .../rsyntaxtextarea/modes/XMLTokenMaker.java | 977 - .../rsyntaxtextarea/modes/YamlTokenMaker.flex | 236 - .../rsyntaxtextarea/modes/YamlTokenMaker.java | 618 - 86 files changed, 97122 deletions(-) delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/ActionScriptTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/ActionScriptTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/AssemblerX86TokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/AssemblerX86TokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/BBCodeTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/BBCodeTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/CPlusPlusTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/CPlusPlusTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/CSSTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/CSSTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/CSharpTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/CSharpTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/CTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/CTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/ClojureTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/ClojureTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/DTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/DTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/DartTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/DartTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/DelphiTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/DelphiTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/DockerTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/DockerTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/DtdTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/DtdTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/FortranTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/FortranTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/GroovyTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/GroovyTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/HTMLTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/HTMLTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/HostsTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/HostsTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/HtaccessTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/HtaccessTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/IniTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/IniTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/JSPTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/JSPTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/JavaScriptTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/JavaScriptTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/JshintrcTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/JsonTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/JsonTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/LatexTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/LatexTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/LessTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/LispTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/LispTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/LuaTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/LuaTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/MakefileTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/MakefileTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/MxmlTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/MxmlTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/NSISTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/NSISTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/PHPTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/PHPTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/PerlTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/PerlTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/PropertiesFileTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/PropertiesFileTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/PythonTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/PythonTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/RubyTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/RubyTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/SASTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/SASTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/SQLTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/SQLTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/ScalaTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/ScalaTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/TclTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/TclTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/TypeScriptTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/TypeScriptTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/UnixShellTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/VisualBasicTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/VisualBasicTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/WindowsBatchTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/XMLTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/XMLTokenMaker.java delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/YamlTokenMaker.flex delete mode 100644 src/org/fife/ui/rsyntaxtextarea/modes/YamlTokenMaker.java diff --git a/src/org/fife/ui/rsyntaxtextarea/modes/ActionScriptTokenMaker.flex b/src/org/fife/ui/rsyntaxtextarea/modes/ActionScriptTokenMaker.flex deleted file mode 100644 index b10572f..0000000 --- a/src/org/fife/ui/rsyntaxtextarea/modes/ActionScriptTokenMaker.flex +++ /dev/null @@ -1,495 +0,0 @@ -/* - * 04/27/2010 - * - * ActionScriptTokenMaker.java - Scanner for ActionScript. - * - * This library is distributed under a modified BSD license. See the included - * RSyntaxTextArea.License.txt file for details. - */ -package org.fife.ui.rsyntaxtextarea.modes; - -import java.io.*; -import javax.swing.text.Segment; - -import org.fife.ui.rsyntaxtextarea.*; - - -/** - * Scanner for the ActionScript.
- *
- * This implementation was created using
- * JFlex 1.4.1; however, the generated file
- * was modified for performance. Memory allocation needs to be almost
- * completely removed to be competitive with the handwritten lexers (subclasses
- * of AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around).
- * We can achieve this because RText always scans exactly 1 line of tokens at a
- * time, and hands the scanner this line as an array of characters (a Segment
- * really). Since tokens contain pointers to char arrays instead of Strings
- * holding their contents, there is no need for allocating new memory for
- * Strings.
- * - * The actual algorithm generated for scanning has, of course, not been - * modified.
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
ActionScriptTokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
.
- * You should hand-delete the second of each definition (the ones
- * generated by the lexer), as these generated methods modify the input
- * buffer, which we'll never have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would
- * with any other TokenMaker
instance.text
. This method must be implemented by
- * subclasses so they can correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing
- * the syntax highlighted text.
- */
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
-
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
-
- // Start off in the proper state.
- int state = Token.NULL;
- switch (initialTokenType) {
- case Token.COMMENT_MULTILINE:
- state = MLC;
- start = text.offset;
- break;
- default:
- state = Token.NULL;
- }
-
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
-
- }
-
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise
- * false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos>=s.offset+s.count;
- }
-
-
- /**
- * Resets the scanner to read from a new input stream.
- * Does not close the old reader.
- *
- * All internal variables are reset, the old input stream
- * cannot be reused (internal buffer is discarded and lost).
- * Lexical state is set to YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(java.io.Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill
- * no longer "refills" the buffer (since the way we do it, it's always
- * "full" the first time through, since it points to the segment's
- * array). So, we assign zzEndRead here.
- */
- //zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtBOL = true;
- zzAtEOF = false;
- }
-
-
-%}
-
-Letter = [A-Za-z]
-LetterOrUnderscore = ({Letter}|"_")
-NonzeroDigit = [1-9]
-Digit = ("0"|{NonzeroDigit})
-HexDigit = ({Digit}|[A-Fa-f])
-OctalDigit = ([0-7])
-AnyCharacterButApostropheOrBackSlash = ([^\\'])
-AnyCharacterButDoubleQuoteOrBackSlash = ([^\\\"\n])
-EscapedSourceCharacter = ("u"{HexDigit}{HexDigit}{HexDigit}{HexDigit})
-Escape = ("\\"(([btnfr\"'\\])|([0123]{OctalDigit}?{OctalDigit}?)|({OctalDigit}{OctalDigit}?)|{EscapedSourceCharacter}))
-NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\']|"#"|"\\")
-IdentifierStart = ({LetterOrUnderscore}|"$")
-IdentifierPart = ({IdentifierStart}|{Digit}|("\\"{EscapedSourceCharacter}))
-
-LineTerminator = (\n)
-WhiteSpace = ([ \t\f])
-
-CharLiteral = ([\']({AnyCharacterButApostropheOrBackSlash}|{Escape})*[\'])
-UnclosedCharLiteral = ([\']([\\].|[^\\\'])*[^\']*)
-ErrorCharLiteral = ({UnclosedCharLiteral}[\'])
-StringLiteral = ([\"]({AnyCharacterButDoubleQuoteOrBackSlash}|{Escape})*[\"])
-UnclosedStringLiteral = ([\"]([\\].|[^\\\"])*[^\"]?)
-ErrorStringLiteral = ({UnclosedStringLiteral}[\"])
-
-MLCBegin = ("/*")
-MLCEnd = ("*/")
-LineCommentBegin = ("//")
-IntegerHelper1 = (({NonzeroDigit}{Digit}*)|"0")
-IntegerHelper2 = ("0"(([xX]{HexDigit}+)|({OctalDigit}*)))
-IntegerLiteral = ({IntegerHelper1}[lL]?)
-HexLiteral = ({IntegerHelper2}[lL]?)
-FloatHelper1 = ([fFdD]?)
-FloatHelper2 = ([eE][+-]?{Digit}+{FloatHelper1})
-FloatLiteral1 = ({Digit}+"."({FloatHelper1}|{FloatHelper2}|{Digit}+({FloatHelper1}|{FloatHelper2})))
-FloatLiteral2 = ("."{Digit}+({FloatHelper1}|{FloatHelper2}))
-FloatLiteral3 = ({Digit}+{FloatHelper2})
-FloatLiteral = ({FloatLiteral1}|{FloatLiteral2}|{FloatLiteral3}|({Digit}+[fFdD]))
-ErrorNumberFormat = (({IntegerLiteral}|{HexLiteral}|{FloatLiteral}){NonSeparator}+)
-BooleanLiteral = ("true"|"false")
-
-Separator = ([\(\)\{\}\[\]])
-Separator2 = ([\;,.])
-
-NonAssignmentOperator = ("+"|"-"|"<="|"^"|"++"|"<"|"*"|">="|"%"|"--"|">"|"/"|"!="|"?"|">>"|"!"|"&"|"=="|":"|">>"|"~"|"|"|"&&"|">>>")
-AssignmentOperator = ("="|"-="|"*="|"/="|"|="|"&="|"^="|"+="|"%="|"<<="|">>="|">>>=")
-Operator = ({NonAssignmentOperator}|{AssignmentOperator})
-
-Identifier = ({IdentifierStart}{IdentifierPart}*)
-ErrorIdentifier = ({NonSeparator}+)
-
-URLGenDelim = ([:\/\?#\[\]@])
-URLSubDelim = ([\!\$&'\(\)\*\+,;=])
-URLUnreserved = ({LetterOrUnderscore}|{Digit}|[\-\.\~])
-URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
-URLCharacters = ({URLCharacter}*)
-URLEndCharacter = ([\/\$]|{Letter}|{Digit})
-URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
-
-
-%state MLC
-%state EOL_COMMENT
-
-%%
-
-
- *
- * This implementation was created using
- * JFlex 1.4.1; however, the generated file
- * was modified for performance. Memory allocation needs to be almost completely
- * removed to be competitive with the handwritten lexers (subclasses of
- * AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around). We can
- * achieve this because RText always scans exactly 1 line of tokens at a time,
- * and hands the scanner this line as an array of characters (a Segment really).
- * Since tokens contain pointers to char arrays instead of Strings holding their
- * contents, there is no need for allocating new memory for Strings.
- *
- * - * The actual algorithm generated for scanning has, of course, not been - * modified. - *
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
ActionScriptTokenMaker.java
file will contain
- * two definitions of both zzRefill
and yyreset
. You
- * should hand-delete the second of each definition (the ones generated by the
- * lexer), as these generated methods modify the input buffer, which we'll never
- * have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would with
- * any other TokenMaker
instance.aState
- */
- private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
- private static final String ZZ_ATTRIBUTE_PACKED_0 = "\3\0\6\1\1\11\4\1\1\11\17\1\2\11\3\1"
- + "\1\11\24\1\1\11\5\1\1\11\15\1\1\11\14\1" + "\1\11\1\1\1\11\35\1\1\0\43\1\1\11\10\0"
- + "\2\1\1\0\22\1\1\11\2\1\1\0\105\1\10\0" + "\2\1\1\11\14\1\1\11\5\1\1\0\61\1\2\0"
- + "\1\1\2\0\22\1\1\0\43\1\4\0\17\1\1\0" + "\40\1\1\0\26\1\1\11\66\1";
-
- private static int[] zzUnpackAttribute() {
- int[] result = new int[528];
- int offset = 0;
- offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
- return result;
- }
-
- private static int zzUnpackAttribute(String packed, int offset, int[] result) {
- int i = 0; /* index in packed string */
- int j = offset; /* index in unpacked array */
- int l = packed.length();
- while (i < l) {
- int count = packed.charAt(i++);
- int value = packed.charAt(i++);
- do
- result[j++] = value;
- while (--count > 0);
- }
- return j;
- }
-
- /** the input device */
- private java.io.Reader zzReader;
- /** the current state of the DFA */
- private int zzState;
- /** the current lexical state */
- private int zzLexicalState = YYINITIAL;
- /**
- * this buffer contains the current text to be matched and is the source of the
- * yytext() string
- */
- private char zzBuffer[];
- /** the textposition at the last accepting state */
- private int zzMarkedPos;
- /** the current text position in the buffer */
- private int zzCurrentPos;
- /** startRead marks the beginning of the yytext() string in the buffer */
- private int zzStartRead;
- /**
- * endRead marks the last character in the buffer, that has been read from input
- */
- private int zzEndRead;
- /** zzAtEOF == true <=> the scanner is at the EOF */
- private boolean zzAtEOF;
- /* user code: */
-
- /**
- * Constructor. This must be here because JFlex does not generate a no-parameter
- * constructor.
- */
- public ActionScriptTokenMaker() {
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- * @see #addToken(int, int, int)
- */
- private void addHyperlinkToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so, true);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int tokenType) {
- addToken(zzStartRead, zzMarkedPos - 1, tokenType);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- * @see #addHyperlinkToken(int, int, int)
- */
- private void addToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so, false);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param array The character array.
- * @param start The starting offset in the array.
- * @param end The ending offset in the array.
- * @param tokenType The token's type.
- * @param startOffset The offset in the document at which this token occurs.
- * @param hyperlink Whether this token is a hyperlink.
- */
- @Override
- public void addToken(char[] array, int start, int end, int tokenType, int startOffset, boolean hyperlink) {
- super.addToken(array, start, end, tokenType, startOffset, hyperlink);
- zzStartRead = zzMarkedPos;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String[] getLineCommentStartAndEnd(int languageIndex) {
- return new String[] { "//", null };
- }
-
- /**
- * Returns the first token in the linked list of tokens generated from
- * text
. This method must be implemented by subclasses so they can
- * correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing the syntax
- * highlighted text.
- */
- @Override
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
- // Start off in the proper state.
- int state = Token.NULL;
- switch (initialTokenType) {
- case Token.COMMENT_MULTILINE:
- state = MLC;
- start = text.offset;
- break;
- default:
- state = Token.NULL;
- }
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
- }
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos >= s.offset + s.count;
- }
-
- /**
- * Resets the scanner to read from a new input stream. Does not close the old
- * reader.
- *
- * All internal variables are reset, the old input stream cannot be
- * reused (internal buffer is discarded and lost). Lexical state is set to
- * YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(java.io.Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill no longer
- * "refills" the buffer (since the way we do it, it's always "full" the first
- * time through, since it points to the segment's array). So, we assign
- * zzEndRead here.
- */
- // zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtEOF = false;
- }
-
- /**
- * Creates a new scanner There is also a java.io.InputStream version of this
- * constructor.
- *
- * @param in the java.io.Reader to read input from.
- */
- public ActionScriptTokenMaker(java.io.Reader in) {
- this.zzReader = in;
- }
-
- /**
- * Creates a new scanner. There is also java.io.Reader version of this
- * constructor.
- *
- * @param in the java.io.Inputstream to read input from.
- */
- public ActionScriptTokenMaker(java.io.InputStream in) {
- this(new java.io.InputStreamReader(in));
- }
-
- /**
- * Unpacks the compressed character translation table.
- *
- * @param packed the packed character translation table
- * @return the unpacked character translation table
- */
- private static char[] zzUnpackCMap(String packed) {
- char[] map = new char[0x10000];
- int i = 0; /* index in packed string */
- int j = 0; /* index in unpacked array */
- while (i < 190) {
- int count = packed.charAt(i++);
- char value = packed.charAt(i++);
- do
- map[j++] = value;
- while (--count > 0);
- }
- return map;
- }
-
- /**
- * Closes the input stream.
- */
- public final void yyclose() throws java.io.IOException {
- zzAtEOF = true; /* indicate end of file */
- zzEndRead = zzStartRead; /* invalidate buffer */
- if (zzReader != null)
- zzReader.close();
- }
-
- /**
- * Returns the current lexical state.
- */
- public final int yystate() {
- return zzLexicalState;
- }
-
- /**
- * Enters a new lexical state
- *
- * @param newState the new lexical state
- */
- @Override
- public final void yybegin(int newState) {
- zzLexicalState = newState;
- }
-
- /**
- * Returns the text matched by the current regular expression.
- */
- public final String yytext() {
- return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
- }
-
- /**
- * Returns the character at position pos from the matched text.
- *
- * It is equivalent to yytext().charAt(pos), but faster
- *
- * @param pos the position of the character to fetch. A value from 0 to
- * yylength()-1.
- *
- * @return the character at position pos
- */
- public final char yycharat(int pos) {
- return zzBuffer[zzStartRead + pos];
- }
-
- /**
- * Returns the length of the matched text region.
- */
- public final int yylength() {
- return zzMarkedPos - zzStartRead;
- }
-
- /**
- * Reports an error that occured while scanning.
- *
- * In a wellformed scanner (no or only correct usage of yypushback(int) and a
- * match-all fallback rule) this method will only be called with things that
- * "Can't Possibly Happen". If this method is called, something is seriously
- * wrong (e.g. a JFlex bug producing a faulty scanner etc.).
- *
- * Usual syntax/scanner level error handling should be done in error fallback
- * rules.
- *
- * @param errorCode the code of the errormessage to display
- */
- private void zzScanError(int errorCode) {
- String message;
- try {
- message = ZZ_ERROR_MSG[errorCode];
- } catch (ArrayIndexOutOfBoundsException e) {
- message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
- }
- throw new Error(message);
- }
-
- /**
- * Pushes the specified amount of characters back into the input stream.
- *
- * They will be read again by then next call of the scanning method
- *
- * @param number the number of characters to be read again. This number must not
- * be greater than yylength()!
- */
- public void yypushback(int number) {
- if (number > yylength())
- zzScanError(ZZ_PUSHBACK_2BIG);
- zzMarkedPos -= number;
- }
-
- /**
- * Resumes scanning until the next regular expression is matched, the end of
- * input is encountered or an I/O-Error occurs.
- *
- * @return the next token
- * @exception java.io.IOException if any I/O-Error occurs
- */
- public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
- int zzInput;
- int zzAction;
- // cached fields:
- int zzCurrentPosL;
- int zzMarkedPosL;
- int zzEndReadL = zzEndRead;
- char[] zzBufferL = zzBuffer;
- char[] zzCMapL = ZZ_CMAP;
- int[] zzTransL = ZZ_TRANS;
- int[] zzRowMapL = ZZ_ROWMAP;
- int[] zzAttrL = ZZ_ATTRIBUTE;
- while (true) {
- zzMarkedPosL = zzMarkedPos;
- zzAction = -1;
- zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
- zzState = zzLexicalState;
- zzForAction: {
- while (true) {
- if (zzCurrentPosL < zzEndReadL)
- zzInput = zzBufferL[zzCurrentPosL++];
- else if (zzAtEOF) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- // store back cached positions
- zzCurrentPos = zzCurrentPosL;
- zzMarkedPos = zzMarkedPosL;
- boolean eof = zzRefill();
- // get translated positions and possibly new buffer
- zzCurrentPosL = zzCurrentPos;
- zzMarkedPosL = zzMarkedPos;
- zzBufferL = zzBuffer;
- zzEndReadL = zzEndRead;
- if (eof) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- zzInput = zzBufferL[zzCurrentPosL++];
- }
- }
- int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
- if (zzNext == -1)
- break zzForAction;
- zzState = zzNext;
- int zzAttributes = zzAttrL[zzState];
- if ((zzAttributes & 1) == 1) {
- zzAction = zzState;
- zzMarkedPosL = zzCurrentPosL;
- if ((zzAttributes & 8) == 8)
- break zzForAction;
- }
- }
- }
- // store back cached position
- zzMarkedPos = zzMarkedPosL;
- switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
- case 5: {
- addNullToken();
- return firstToken;
- }
- case 30:
- break;
- case 16: {
- addToken(Token.LITERAL_CHAR);
- }
- case 31:
- break;
- case 21: {
- yybegin(YYINITIAL);
- addToken(start, zzStartRead + 1, Token.COMMENT_MULTILINE);
- }
- case 32:
- break;
- case 25: {
- addToken(Token.COMMENT_MULTILINE);
- }
- case 33:
- break;
- case 20: {
- start = zzMarkedPos - 2;
- yybegin(MLC);
- }
- case 34:
- break;
- case 7: {
- addToken(Token.WHITESPACE);
- }
- case 35:
- break;
- case 15: {
- addToken(Token.LITERAL_NUMBER_HEXADECIMAL);
- }
- case 36:
- break;
- case 22: {
- addToken(Token.ERROR_STRING_DOUBLE);
- }
- case 37:
- break;
- case 14: {
- addToken(Token.LITERAL_NUMBER_FLOAT);
- }
- case 38:
- break;
- case 17: {
- addToken(Token.RESERVED_WORD);
- }
- case 39:
- break;
- case 9: {
- addToken(Token.SEPARATOR);
- }
- case 40:
- break;
- case 2: {
- addToken(Token.IDENTIFIER);
- }
- case 41:
- break;
- case 12: {
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- addNullToken();
- return firstToken;
- }
- case 42:
- break;
- case 19: {
- start = zzMarkedPos - 2;
- yybegin(EOL_COMMENT);
- }
- case 43:
- break;
- case 27: {
- addToken(Token.FUNCTION);
- }
- case 44:
- break;
- case 4: {
- addToken(Token.ERROR_CHAR);
- addNullToken();
- return firstToken;
- }
- case 45:
- break;
- case 6: {
- addToken(Token.ERROR_STRING_DOUBLE);
- addNullToken();
- return firstToken;
- }
- case 46:
- break;
- case 23: {
- addToken(Token.DATA_TYPE);
- }
- case 47:
- break;
- case 1: {
- addToken(Token.ERROR_IDENTIFIER);
- }
- case 48:
- break;
- case 24: {
- addToken(Token.ERROR_CHAR);
- }
- case 49:
- break;
- case 26: {
- addToken(Token.LITERAL_BOOLEAN);
- }
- case 50:
- break;
- case 18: {
- addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
- }
- case 51:
- break;
- case 29: {
- int temp = zzStartRead;
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_EOL);
- start = zzMarkedPos;
- }
- case 52:
- break;
- case 28: {
- int temp = zzStartRead;
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_MULTILINE);
- start = zzMarkedPos;
- }
- case 53:
- break;
- case 13: {
- addToken(Token.ERROR_NUMBER_FORMAT);
- }
- case 54:
- break;
- case 3: {
- addToken(Token.LITERAL_NUMBER_DECIMAL_INT);
- }
- case 55:
- break;
- case 8: {
- addToken(Token.OPERATOR);
- }
- case 56:
- break;
- case 10: {
- }
- case 57:
- break;
- case 11: {
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- return firstToken;
- }
- case 58:
- break;
- default:
- if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
- zzAtEOF = true;
- switch (zzLexicalState) {
- case EOL_COMMENT: {
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- addNullToken();
- return firstToken;
- }
- case 529:
- break;
- case YYINITIAL: {
- addNullToken();
- return firstToken;
- }
- case 530:
- break;
- case MLC: {
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- return firstToken;
- }
- case 531:
- break;
- default:
- return null;
- }
- } else {
- zzScanError(ZZ_NO_MATCH);
- }
- }
- }
- }
-}
diff --git a/src/org/fife/ui/rsyntaxtextarea/modes/AssemblerX86TokenMaker.flex b/src/org/fife/ui/rsyntaxtextarea/modes/AssemblerX86TokenMaker.flex
deleted file mode 100644
index cb28dd0..0000000
--- a/src/org/fife/ui/rsyntaxtextarea/modes/AssemblerX86TokenMaker.flex
+++ /dev/null
@@ -1,1032 +0,0 @@
-/*
- * 12/06/2004
- *
- * AssemblerX86TokenMaker.java - An object that can take a chunk of text and
- * return a linked list of tokens representing X86 assembler.
- *
- * This library is distributed under a modified BSD license. See the included
- * RSyntaxTextArea.License.txt file for details.
- */
-package org.fife.ui.rsyntaxtextarea.modes;
-
-import java.io.*;
-import javax.swing.text.Segment;
-
-import org.fife.ui.rsyntaxtextarea.*;
-
-
-/**
- * This class takes plain text and returns tokens representing x86
- * assembler.
- *
- * This implementation was created using
- * JFlex 1.4.1; however, the generated file
- * was modified for performance. Memory allocation needs to be almost
- * completely removed to be competitive with the handwritten lexers (subclasses
- * of AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around).
- * We can achieve this because RText always scans exactly 1 line of tokens at a
- * time, and hands the scanner this line as an array of characters (a Segment
- * really). Since tokens contain pointers to char arrays instead of Strings
- * holding their contents, there is no need for allocating new memory for
- * Strings.
- * - * The actual algorithm generated for scanning has, of course, not been - * modified.
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
AssemblerX86TokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
.
- * You should hand-delete the second of each definition (the ones
- * generated by the lexer), as these generated methods modify the input
- * buffer, which we'll never have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would
- * with any other TokenMaker
instance.text
. This method must be implemented by
- * subclasses so they can correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing
- * the syntax highlighted text.
- */
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
-
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
-
- // Start off in the proper state.
- int state = Token.NULL;
- switch (initialTokenType) {
- default:
- state = Token.NULL;
- }
-
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
-
- }
-
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise
- * false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos>=s.offset+s.count;
- }
-
-
- /**
- * Resets the scanner to read from a new input stream.
- * Does not close the old reader.
- *
- * All internal variables are reset, the old input stream
- * cannot be reused (internal buffer is discarded and lost).
- * Lexical state is set to YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill
- * no longer "refills" the buffer (since the way we do it, it's always
- * "full" the first time through, since it points to the segment's
- * array). So, we assign zzEndRead here.
- */
- //zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtBOL = true;
- zzAtEOF = false;
- }
-
-
-%}
-
-Letter = ([A-Za-z_])
-Digit = ([0-9])
-Number = ({Digit}+)
-
-Identifier = (({Letter}|{Digit})[^ \t\f\n\,\.\+\-\*\/\%\[\]]+)
-
-UnclosedStringLiteral = ([\"][^\"]*)
-StringLiteral = ({UnclosedStringLiteral}[\"])
-UnclosedCharLiteral = ([\'][^\']*)
-CharLiteral = ({UnclosedCharLiteral}[\'])
-
-CommentBegin = ([;])
-
-LineTerminator = (\n)
-WhiteSpace = ([ \t\f])
-
-Label = (({Letter}|{Digit})+[\:])
-
-Operator = ("+"|"-"|"*"|"/"|"%"|"^"|"|"|"&"|"~"|"!"|"="|"<"|">")
-
-%%
-
-
- *
- * This implementation was created using
- * JFlex 1.4.1; however, the generated file
- * was modified for performance. Memory allocation needs to be almost completely
- * removed to be competitive with the handwritten lexers (subclasses of
- * AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around). We can
- * achieve this because RText always scans exactly 1 line of tokens at a time,
- * and hands the scanner this line as an array of characters (a Segment really).
- * Since tokens contain pointers to char arrays instead of Strings holding their
- * contents, there is no need for allocating new memory for Strings.
- *
- * - * The actual algorithm generated for scanning has, of course, not been - * modified. - *
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
AssemblerX86TokenMaker.java
file will contain
- * two definitions of both zzRefill
and yyreset
. You
- * should hand-delete the second of each definition (the ones generated by the
- * lexer), as these generated methods modify the input buffer, which we'll never
- * have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would with
- * any other TokenMaker
instance.aState
- */
- private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
- private static final String ZZ_ATTRIBUTE_PACKED_0 = "\2\0\1\11\5\1\1\11\1\1\1\11\44\1\2\11"
- + "\25\0\225\1\31\0\1\11\11\0\245\1\1\0\1\1" + "\10\0\1\1\17\0\155\1\1\0\1\1\3\0\1\1"
- + "\5\0\1\1\5\0\61\1\7\0\22\1\1\0\1\1" + "\2\0\1\1\1\0\6\1\3\0\2\1\2\0\2\1" + "\2\0";
-
- private static int[] zzUnpackAttribute() {
- int[] result = new int[668];
- int offset = 0;
- offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
- return result;
- }
-
- private static int zzUnpackAttribute(String packed, int offset, int[] result) {
- int i = 0; /* index in packed string */
- int j = offset; /* index in unpacked array */
- int l = packed.length();
- while (i < l) {
- int count = packed.charAt(i++);
- int value = packed.charAt(i++);
- do
- result[j++] = value;
- while (--count > 0);
- }
- return j;
- }
-
- /** the input device */
- private java.io.Reader zzReader;
- /** the current state of the DFA */
- private int zzState;
- /** the current lexical state */
- private int zzLexicalState = YYINITIAL;
- /**
- * this buffer contains the current text to be matched and is the source of the
- * yytext() string
- */
- private char zzBuffer[];
- /** the textposition at the last accepting state */
- private int zzMarkedPos;
- /** the current text position in the buffer */
- private int zzCurrentPos;
- /** startRead marks the beginning of the yytext() string in the buffer */
- private int zzStartRead;
- /**
- * endRead marks the last character in the buffer, that has been read from input
- */
- private int zzEndRead;
- /**
- * zzAtBOL == true <=> the scanner is currently at the beginning of a line
- */
- private boolean zzAtBOL = true;
- /** zzAtEOF == true <=> the scanner is at the EOF */
- private boolean zzAtEOF;
- /* user code: */
-
- /**
- * Constructor. We must have this here as JFLex does not generate a no parameter
- * constructor.
- */
- public AssemblerX86TokenMaker() {
- super();
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int tokenType) {
- addToken(zzStartRead, zzMarkedPos - 1, tokenType);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param array The character array.
- * @param start The starting offset in the array.
- * @param end The ending offset in the array.
- * @param tokenType The token's type.
- * @param startOffset The offset in the document at which this token occurs.
- */
- @Override
- public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
- super.addToken(array, start, end, tokenType, startOffset);
- zzStartRead = zzMarkedPos;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String[] getLineCommentStartAndEnd(int languageIndex) {
- return new String[] { ";", null };
- }
-
- /**
- * Returns the first token in the linked list of tokens generated from
- * text
. This method must be implemented by subclasses so they can
- * correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing the syntax
- * highlighted text.
- */
- @Override
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
- // Start off in the proper state.
- int state = Token.NULL;
- switch (initialTokenType) {
- default:
- state = Token.NULL;
- }
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
- }
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos >= s.offset + s.count;
- }
-
- /**
- * Resets the scanner to read from a new input stream. Does not close the old
- * reader.
- *
- * All internal variables are reset, the old input stream cannot be
- * reused (internal buffer is discarded and lost). Lexical state is set to
- * YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill no longer
- * "refills" the buffer (since the way we do it, it's always "full" the first
- * time through, since it points to the segment's array). So, we assign
- * zzEndRead here.
- */
- // zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtBOL = true;
- zzAtEOF = false;
- }
-
- /**
- * Creates a new scanner There is also a java.io.InputStream version of this
- * constructor.
- *
- * @param in the java.io.Reader to read input from.
- */
- public AssemblerX86TokenMaker(java.io.Reader in) {
- this.zzReader = in;
- }
-
- /**
- * Creates a new scanner. There is also java.io.Reader version of this
- * constructor.
- *
- * @param in the java.io.Inputstream to read input from.
- */
- public AssemblerX86TokenMaker(java.io.InputStream in) {
- this(new java.io.InputStreamReader(in));
- }
-
- /**
- * Unpacks the compressed character translation table.
- *
- * @param packed the packed character translation table
- * @return the unpacked character translation table
- */
- private static char[] zzUnpackCMap(String packed) {
- char[] map = new char[0x10000];
- int i = 0; /* index in packed string */
- int j = 0; /* index in unpacked array */
- while (i < 200) {
- int count = packed.charAt(i++);
- char value = packed.charAt(i++);
- do
- map[j++] = value;
- while (--count > 0);
- }
- return map;
- }
-
- /**
- * Closes the input stream.
- */
- public final void yyclose() throws java.io.IOException {
- zzAtEOF = true; /* indicate end of file */
- zzEndRead = zzStartRead; /* invalidate buffer */
- if (zzReader != null)
- zzReader.close();
- }
-
- /**
- * Returns the current lexical state.
- */
- public final int yystate() {
- return zzLexicalState;
- }
-
- /**
- * Enters a new lexical state
- *
- * @param newState the new lexical state
- */
- @Override
- public final void yybegin(int newState) {
- zzLexicalState = newState;
- }
-
- /**
- * Returns the text matched by the current regular expression.
- */
- public final String yytext() {
- return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
- }
-
- /**
- * Returns the character at position pos from the matched text.
- *
- * It is equivalent to yytext().charAt(pos), but faster
- *
- * @param pos the position of the character to fetch. A value from 0 to
- * yylength()-1.
- *
- * @return the character at position pos
- */
- public final char yycharat(int pos) {
- return zzBuffer[zzStartRead + pos];
- }
-
- /**
- * Returns the length of the matched text region.
- */
- public final int yylength() {
- return zzMarkedPos - zzStartRead;
- }
-
- /**
- * Reports an error that occured while scanning.
- *
- * In a wellformed scanner (no or only correct usage of yypushback(int) and a
- * match-all fallback rule) this method will only be called with things that
- * "Can't Possibly Happen". If this method is called, something is seriously
- * wrong (e.g. a JFlex bug producing a faulty scanner etc.).
- *
- * Usual syntax/scanner level error handling should be done in error fallback
- * rules.
- *
- * @param errorCode the code of the errormessage to display
- */
- private void zzScanError(int errorCode) {
- String message;
- try {
- message = ZZ_ERROR_MSG[errorCode];
- } catch (ArrayIndexOutOfBoundsException e) {
- message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
- }
- throw new Error(message);
- }
-
- /**
- * Pushes the specified amount of characters back into the input stream.
- *
- * They will be read again by then next call of the scanning method
- *
- * @param number the number of characters to be read again. This number must not
- * be greater than yylength()!
- */
- public void yypushback(int number) {
- if (number > yylength())
- zzScanError(ZZ_PUSHBACK_2BIG);
- zzMarkedPos -= number;
- }
-
- /**
- * Resumes scanning until the next regular expression is matched, the end of
- * input is encountered or an I/O-Error occurs.
- *
- * @return the next token
- * @exception java.io.IOException if any I/O-Error occurs
- */
- public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
- int zzInput;
- int zzAction;
- // cached fields:
- int zzCurrentPosL;
- int zzMarkedPosL;
- int zzEndReadL = zzEndRead;
- char[] zzBufferL = zzBuffer;
- char[] zzCMapL = ZZ_CMAP;
- int[] zzTransL = ZZ_TRANS;
- int[] zzRowMapL = ZZ_ROWMAP;
- int[] zzAttrL = ZZ_ATTRIBUTE;
- while (true) {
- zzMarkedPosL = zzMarkedPos;
- if (zzMarkedPosL > zzStartRead) {
- switch (zzBufferL[zzMarkedPosL - 1]) {
- case '\n':
- case '\u000B':
- case '\u000C':
- case '\u0085':
- case '\u2028':
- case '\u2029':
- zzAtBOL = true;
- break;
- case '\r':
- if (zzMarkedPosL < zzEndReadL)
- zzAtBOL = zzBufferL[zzMarkedPosL] != '\n';
- else if (zzAtEOF)
- zzAtBOL = false;
- else {
- boolean eof = zzRefill();
- zzMarkedPosL = zzMarkedPos;
- zzEndReadL = zzEndRead;
- zzBufferL = zzBuffer;
- if (eof)
- zzAtBOL = false;
- else
- zzAtBOL = zzBufferL[zzMarkedPosL] != '\n';
- }
- break;
- default:
- zzAtBOL = false;
- }
- }
- zzAction = -1;
- zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
- if (zzAtBOL)
- zzState = ZZ_LEXSTATE[zzLexicalState + 1];
- else
- zzState = ZZ_LEXSTATE[zzLexicalState];
- zzForAction: {
- while (true) {
- if (zzCurrentPosL < zzEndReadL)
- zzInput = zzBufferL[zzCurrentPosL++];
- else if (zzAtEOF) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- // store back cached positions
- zzCurrentPos = zzCurrentPosL;
- zzMarkedPos = zzMarkedPosL;
- boolean eof = zzRefill();
- // get translated positions and possibly new buffer
- zzCurrentPosL = zzCurrentPos;
- zzMarkedPosL = zzMarkedPos;
- zzBufferL = zzBuffer;
- zzEndReadL = zzEndRead;
- if (eof) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- zzInput = zzBufferL[zzCurrentPosL++];
- }
- }
- int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
- if (zzNext == -1)
- break zzForAction;
- zzState = zzNext;
- int zzAttributes = zzAttrL[zzState];
- if ((zzAttributes & 1) == 1) {
- zzAction = zzState;
- zzMarkedPosL = zzCurrentPosL;
- if ((zzAttributes & 8) == 8)
- break zzForAction;
- }
- }
- }
- // store back cached position
- zzMarkedPos = zzMarkedPosL;
- switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
- case 11: {
- addToken(Token.RESERVED_WORD);
- }
- case 16:
- break;
- case 1: {
- addToken(Token.IDENTIFIER);
- }
- case 17:
- break;
- case 12: {
- addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
- }
- case 18:
- break;
- case 9: {
- addToken(Token.FUNCTION);
- }
- case 19:
- break;
- case 5: {
- addToken(Token.COMMENT_EOL);
- addNullToken();
- return firstToken;
- }
- case 20:
- break;
- case 14: {
- addToken(Token.VARIABLE);
- }
- case 21:
- break;
- case 7: {
- addToken(Token.WHITESPACE);
- }
- case 22:
- break;
- case 10: {
- addToken(Token.PREPROCESSOR);
- }
- case 23:
- break;
- case 15: {
- addToken(Token.DATA_TYPE);
- }
- case 24:
- break;
- case 4: {
- addToken(Token.ERROR_CHAR); /*
- * addNullToken(); return firstToken;
- */
- }
- case 25:
- break;
- case 8: {
- addToken(Token.OPERATOR);
- }
- case 26:
- break;
- case 2: {
- addToken(Token.LITERAL_NUMBER_DECIMAL_INT);
- }
- case 27:
- break;
- case 13: {
- addToken(Token.LITERAL_CHAR);
- }
- case 28:
- break;
- case 3: {
- addToken(Token.ERROR_STRING_DOUBLE);
- addNullToken();
- return firstToken;
- }
- case 29:
- break;
- case 6: {
- addNullToken();
- return firstToken;
- }
- case 30:
- break;
- default:
- if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
- zzAtEOF = true;
- switch (zzLexicalState) {
- case YYINITIAL: {
- addNullToken();
- return firstToken;
- }
- case 669:
- break;
- default:
- return null;
- }
- } else {
- zzScanError(ZZ_NO_MATCH);
- }
- }
- }
- }
-}
diff --git a/src/org/fife/ui/rsyntaxtextarea/modes/BBCodeTokenMaker.flex b/src/org/fife/ui/rsyntaxtextarea/modes/BBCodeTokenMaker.flex
deleted file mode 100644
index eb8ea08..0000000
--- a/src/org/fife/ui/rsyntaxtextarea/modes/BBCodeTokenMaker.flex
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * 11/18/2009
- *
- * BBCodeTokenMaker.java - Generates tokens for BBCode syntax highlighting.
- *
- * This library is distributed under a modified BSD license. See the included
- * RSyntaxTextArea.License.txt file for details.
- */
-package org.fife.ui.rsyntaxtextarea.modes;
-
-import java.io.*;
-import javax.swing.text.Segment;
-
-import org.fife.ui.rsyntaxtextarea.*;
-
-
-/**
- * Scanner for BBCode.
- *
- * This implementation was created using
- * JFlex 1.4.1; however, the generated file
- * was modified for performance. Memory allocation needs to be almost
- * completely removed to be competitive with the handwritten lexers (subclasses
- * of AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around).
- * We can achieve this because RText always scans exactly 1 line of tokens at a
- * time, and hands the scanner this line as an array of characters (a Segment
- * really). Since tokens contain pointers to char arrays instead of Strings
- * holding their contents, there is no need for allocating new memory for
- * Strings.- * - * The actual algorithm generated for scanning has, of course, not been - * modified.
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
BBCodeTokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
.
- * You should hand-delete the second of each definition (the ones
- * generated by the lexer), as these generated methods modify the input
- * buffer, which we'll never have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would
- * with any other TokenMaker
instance.true
.
- *
- * @return Whether closing markup tags are completed.
- * @see #setCompleteCloseTags(boolean)
- */
- @Override
- public boolean getCompleteCloseTags() {
- return completeCloseTags;
- }
-
-
- /**
- * Returns null
since BBCode has no comments.
- *
- * @return null
always.
- */
- @Override
- public String[] getLineCommentStartAndEnd(int languageIndex) {
- return null;
- }
-
-
- /**
- * Returns the first token in the linked list of tokens generated
- * from text
. This method must be implemented by
- * subclasses so they can correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing
- * the syntax highlighted text.
- */
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
-
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
-
- // Start off in the proper state.
- int state = Token.NULL;
- switch (initialTokenType) {
- case INTERNAL_INTAG:
- state = INTAG;
- start = text.offset;
- break;
- default:
- state = Token.NULL;
- }
-
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
-
- }
-
-
- /**
- * Sets whether markup close tags should be completed.
- *
- * @param complete Whether closing markup tags are completed.
- * @see #getCompleteCloseTags()
- */
- public static void setCompleteCloseTags(boolean complete) {
- completeCloseTags = complete;
- }
-
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise
- * false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos>=s.offset+s.count;
- }
-
-
- /**
- * Resets the scanner to read from a new input stream.
- * Does not close the old reader.
- *
- * All internal variables are reset, the old input stream
- * cannot be reused (internal buffer is discarded and lost).
- * Lexical state is set to YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(java.io.Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill
- * no longer "refills" the buffer (since the way we do it, it's always
- * "full" the first time through, since it points to the segment's
- * array). So, we assign zzEndRead here.
- */
- //zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtBOL = true;
- zzAtEOF = false;
- }
-
-
-%}
-
-Whitespace = ([ \t\f]+)
-LineTerminator = ([\n])
-Identifier = ([^ \t\f\n\[]+)
-InTagIdentifier = ([^ \t\f\n\[\]\/\=]+)
-Tag = ("b"|"i"|"u"|"s"|"size"|"color"|"center"|"quote"|"url"|"img"|"ul"|"li"|"ol"|"youtube"|"gvideo")
-
-%state INTAG
-
-%%
-
-AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around). We can
- * achieve this because RText always scans exactly 1 line of tokens at a time,
- * and hands the scanner this line as an array of characters (a Segment really).
- * Since tokens contain pointers to char arrays instead of Strings holding their
- * contents, there is no need for allocating new memory for Strings.
- * - * - * The actual algorithm generated for scanning has, of course, not been - * modified. - *
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
BBCodeTokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
. You
- * should hand-delete the second of each definition (the ones generated by the
- * lexer), as these generated methods modify the input buffer, which we'll never
- * have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would with
- * any other TokenMaker
instance.aState
- */
- private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
- private static final String ZZ_ATTRIBUTE_PACKED_0 = "\2\0\2\1\1\11\2\1\2\11\13\1\2\11\23\1";
-
- private static int[] zzUnpackAttribute() {
- int[] result = new int[41];
- int offset = 0;
- offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
- return result;
- }
-
- private static int zzUnpackAttribute(String packed, int offset, int[] result) {
- int i = 0; /* index in packed string */
- int j = offset; /* index in unpacked array */
- int l = packed.length();
- while (i < l) {
- int count = packed.charAt(i++);
- int value = packed.charAt(i++);
- do
- result[j++] = value;
- while (--count > 0);
- }
- return j;
- }
-
- /** the input device */
- private java.io.Reader zzReader;
- /** the current state of the DFA */
- private int zzState;
- /** the current lexical state */
- private int zzLexicalState = YYINITIAL;
- /**
- * this buffer contains the current text to be matched and is the source of the
- * yytext() string
- */
- private char zzBuffer[];
- /** the textposition at the last accepting state */
- private int zzMarkedPos;
- /** the current text position in the buffer */
- private int zzCurrentPos;
- /** startRead marks the beginning of the yytext() string in the buffer */
- private int zzStartRead;
- /**
- * endRead marks the last character in the buffer, that has been read from input
- */
- private int zzEndRead;
- /** zzAtEOF == true <=> the scanner is at the EOF */
- private boolean zzAtEOF;
- /* user code: */
- /**
- * Token type specific to BBCodeTokenMaker; this signals that the user has ended
- * a line with an unclosed tag; thus a new line is beginning still inside of the
- * tag.
- */
- public static final int INTERNAL_INTAG = -1;
- /**
- * Whether closing markup tags are automatically completed for BBCode.
- */
- private static boolean completeCloseTags = true;
-
- /**
- * Constructor. This must be here because JFlex does not generate a no-parameter
- * constructor.
- */
- public BBCodeTokenMaker() {
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int tokenType) {
- addToken(zzStartRead, zzMarkedPos - 1, tokenType);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param array The character array.
- * @param start The starting offset in the array.
- * @param end The ending offset in the array.
- * @param tokenType The token's type.
- * @param startOffset The offset in the document at which this token occurs.
- */
- @Override
- public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
- super.addToken(array, start, end, tokenType, startOffset);
- zzStartRead = zzMarkedPos;
- }
-
- /**
- * Sets whether markup close tags should be completed. The default value for
- * BBCode is true
.
- *
- * @return Whether closing markup tags are completed.
- * @see #setCompleteCloseTags(boolean)
- */
- @Override
- public boolean getCompleteCloseTags() {
- return completeCloseTags;
- }
-
- /**
- * Returns null
since BBCode has no comments.
- *
- * @return null
always.
- */
- @Override
- public String[] getLineCommentStartAndEnd(int languageIndex) {
- return null;
- }
-
- /**
- * Returns the first token in the linked list of tokens generated from
- * text
. This method must be implemented by subclasses so they can
- * correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing the syntax
- * highlighted text.
- */
- @Override
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
- // Start off in the proper state.
- int state = Token.NULL;
- switch (initialTokenType) {
- case INTERNAL_INTAG:
- state = INTAG;
- start = text.offset;
- break;
- default:
- state = Token.NULL;
- }
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
- }
-
- /**
- * Sets whether markup close tags should be completed.
- *
- * @param complete Whether closing markup tags are completed.
- * @see #getCompleteCloseTags()
- */
- public static void setCompleteCloseTags(boolean complete) {
- completeCloseTags = complete;
- }
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos >= s.offset + s.count;
- }
-
- /**
- * Resets the scanner to read from a new input stream. Does not close the old
- * reader.
- *
- * All internal variables are reset, the old input stream cannot be
- * reused (internal buffer is discarded and lost). Lexical state is set to
- * YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(java.io.Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill no longer
- * "refills" the buffer (since the way we do it, it's always "full" the first
- * time through, since it points to the segment's array). So, we assign
- * zzEndRead here.
- */
- // zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtEOF = false;
- }
-
- /**
- * Creates a new scanner There is also a java.io.InputStream version of this
- * constructor.
- *
- * @param in the java.io.Reader to read input from.
- */
- public BBCodeTokenMaker(java.io.Reader in) {
- this.zzReader = in;
- }
-
- /**
- * Creates a new scanner. There is also java.io.Reader version of this
- * constructor.
- *
- * @param in the java.io.Inputstream to read input from.
- */
- public BBCodeTokenMaker(java.io.InputStream in) {
- this(new java.io.InputStreamReader(in));
- }
-
- /**
- * Unpacks the compressed character translation table.
- *
- * @param packed the packed character translation table
- * @return the unpacked character translation table
- */
- private static char[] zzUnpackCMap(String packed) {
- char[] map = new char[0x10000];
- int i = 0; /* index in packed string */
- int j = 0; /* index in unpacked array */
- while (i < 80) {
- int count = packed.charAt(i++);
- char value = packed.charAt(i++);
- do
- map[j++] = value;
- while (--count > 0);
- }
- return map;
- }
-
- /**
- * Closes the input stream.
- */
- public final void yyclose() throws java.io.IOException {
- zzAtEOF = true; /* indicate end of file */
- zzEndRead = zzStartRead; /* invalidate buffer */
- if (zzReader != null)
- zzReader.close();
- }
-
- /**
- * Returns the current lexical state.
- */
- public final int yystate() {
- return zzLexicalState;
- }
-
- /**
- * Enters a new lexical state
- *
- * @param newState the new lexical state
- */
- @Override
- public final void yybegin(int newState) {
- zzLexicalState = newState;
- }
-
- /**
- * Returns the text matched by the current regular expression.
- */
- public final String yytext() {
- return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
- }
-
- /**
- * Returns the character at position pos from the matched text.
- *
- * It is equivalent to yytext().charAt(pos), but faster
- *
- * @param pos the position of the character to fetch. A value from 0 to
- * yylength()-1.
- *
- * @return the character at position pos
- */
- public final char yycharat(int pos) {
- return zzBuffer[zzStartRead + pos];
- }
-
- /**
- * Returns the length of the matched text region.
- */
- public final int yylength() {
- return zzMarkedPos - zzStartRead;
- }
-
- /**
- * Reports an error that occured while scanning.
- *
- * In a wellformed scanner (no or only correct usage of yypushback(int) and a
- * match-all fallback rule) this method will only be called with things that
- * "Can't Possibly Happen". If this method is called, something is seriously
- * wrong (e.g. a JFlex bug producing a faulty scanner etc.).
- *
- * Usual syntax/scanner level error handling should be done in error fallback
- * rules.
- *
- * @param errorCode the code of the errormessage to display
- */
- private void zzScanError(int errorCode) {
- String message;
- try {
- message = ZZ_ERROR_MSG[errorCode];
- } catch (ArrayIndexOutOfBoundsException e) {
- message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
- }
- throw new Error(message);
- }
-
- /**
- * Pushes the specified amount of characters back into the input stream.
- *
- * They will be read again by then next call of the scanning method
- *
- * @param number the number of characters to be read again. This number must not
- * be greater than yylength()!
- */
- public void yypushback(int number) {
- if (number > yylength())
- zzScanError(ZZ_PUSHBACK_2BIG);
- zzMarkedPos -= number;
- }
-
- /**
- * Resumes scanning until the next regular expression is matched, the end of
- * input is encountered or an I/O-Error occurs.
- *
- * @return the next token
- * @exception java.io.IOException if any I/O-Error occurs
- */
- public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
- int zzInput;
- int zzAction;
- // cached fields:
- int zzCurrentPosL;
- int zzMarkedPosL;
- int zzEndReadL = zzEndRead;
- char[] zzBufferL = zzBuffer;
- char[] zzCMapL = ZZ_CMAP;
- int[] zzTransL = ZZ_TRANS;
- int[] zzRowMapL = ZZ_ROWMAP;
- int[] zzAttrL = ZZ_ATTRIBUTE;
- while (true) {
- zzMarkedPosL = zzMarkedPos;
- zzAction = -1;
- zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
- zzState = zzLexicalState;
- zzForAction: {
- while (true) {
- if (zzCurrentPosL < zzEndReadL)
- zzInput = zzBufferL[zzCurrentPosL++];
- else if (zzAtEOF) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- // store back cached positions
- zzCurrentPos = zzCurrentPosL;
- zzMarkedPos = zzMarkedPosL;
- boolean eof = zzRefill();
- // get translated positions and possibly new buffer
- zzCurrentPosL = zzCurrentPos;
- zzMarkedPosL = zzMarkedPos;
- zzBufferL = zzBuffer;
- zzEndReadL = zzEndRead;
- if (eof) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- zzInput = zzBufferL[zzCurrentPosL++];
- }
- }
- int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
- if (zzNext == -1)
- break zzForAction;
- zzState = zzNext;
- int zzAttributes = zzAttrL[zzState];
- if ((zzAttributes & 1) == 1) {
- zzAction = zzState;
- zzMarkedPosL = zzCurrentPosL;
- if ((zzAttributes & 8) == 8)
- break zzForAction;
- }
- }
- }
- // store back cached position
- zzMarkedPos = zzMarkedPosL;
- switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
- case 1: {
- addToken(Token.IDENTIFIER);
- }
- case 11:
- break;
- case 9: {
- addToken(Token.MARKUP_TAG_DELIMITER);
- }
- case 12:
- break;
- case 2: {
- addToken(Token.WHITESPACE);
- }
- case 13:
- break;
- case 10: {
- addToken(Token.OPERATOR);
- }
- case 14:
- break;
- case 8: {
- addToken(Token.MARKUP_TAG_NAME);
- }
- case 15:
- break;
- case 4: {
- addToken(Token.MARKUP_TAG_DELIMITER);
- yybegin(INTAG);
- }
- case 16:
- break;
- case 6: {
- addToken(Token.IDENTIFIER); /* Unhandled chars, not likely */
- }
- case 17:
- break;
- case 5: {
- addToken(Token.MARKUP_TAG_ATTRIBUTE);
- }
- case 18:
- break;
- case 3: {
- addNullToken();
- return firstToken;
- }
- case 19:
- break;
- case 7: {
- yybegin(YYINITIAL);
- addToken(Token.MARKUP_TAG_DELIMITER);
- }
- case 20:
- break;
- default:
- if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
- zzAtEOF = true;
- switch (zzLexicalState) {
- case INTAG: {
- addToken(zzMarkedPos, zzMarkedPos, INTERNAL_INTAG);
- return firstToken;
- }
- case 42:
- break;
- case YYINITIAL: {
- addNullToken();
- return firstToken;
- }
- case 43:
- break;
- default:
- return null;
- }
- } else {
- zzScanError(ZZ_NO_MATCH);
- }
- }
- }
- }
-}
diff --git a/src/org/fife/ui/rsyntaxtextarea/modes/CPlusPlusTokenMaker.flex b/src/org/fife/ui/rsyntaxtextarea/modes/CPlusPlusTokenMaker.flex
deleted file mode 100644
index 12b0711..0000000
--- a/src/org/fife/ui/rsyntaxtextarea/modes/CPlusPlusTokenMaker.flex
+++ /dev/null
@@ -1,685 +0,0 @@
-/*
- * 11/19/2004
- *
- * CPlusPlusTokenMaker.java - An object that can take a chunk of text and
- * return a linked list of tokens representing it in C++.
- *
- * This library is distributed under a modified BSD license. See the included
- * RSyntaxTextArea.License.txt file for details.
- */
-package org.fife.ui.rsyntaxtextarea.modes;
-
-import java.io.*;
-import javax.swing.text.Segment;
-
-import org.fife.ui.rsyntaxtextarea.*;
-
-
-/**
- * A parser for the C++ programming language.
- *
- * This implementation was created using
- * JFlex 1.4.1; however, the generated file
- * was modified for performance. Memory allocation needs to be almost
- * completely removed to be competitive with the handwritten lexers (subclasses
- * of AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around).
- * We can achieve this because RText always scans exactly 1 line of tokens at a
- * time, and hands the scanner this line as an array of characters (a Segment
- * really). Since tokens contain pointers to char arrays instead of Strings
- * holding their contents, there is no need for allocating new memory for
- * Strings.- * - * The actual algorithm generated for scanning has, of course, not been - * modified.
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
CPlusPlusTokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
.
- * You should hand-delete the second of each definition (the ones
- * generated by the lexer), as these generated methods modify the input
- * buffer, which we'll never have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would
- * with any other TokenMaker
instance.text
. This method must be implemented by
- * subclasses so they can correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing
- * the syntax highlighted text.
- */
- @Override
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
-
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
-
- // Start off in the proper state.
- int state = YYINITIAL;
- switch (initialTokenType) {
- case Token.COMMENT_EOL:
- state = EOL_COMMENT;
- start = text.offset;
- break;
- case Token.COMMENT_MULTILINE:
- state = MLC;
- start = text.offset;
- break;
- default:
- state = YYINITIAL;
- }
-
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
-
- }
-
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise
- * false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos>=s.offset+s.count;
- }
-
-
- /**
- * Resets the scanner to read from a new input stream.
- * Does not close the old reader.
- *
- * All internal variables are reset, the old input stream
- * cannot be reused (internal buffer is discarded and lost).
- * Lexical state is set to YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill
- * no longer "refills" the buffer (since the way we do it, it's always
- * "full" the first time through, since it points to the segment's
- * array). So, we assign zzEndRead here.
- */
- //zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtBOL = true;
- zzAtEOF = false;
- }
-
-
-%}
-
-Letter = [A-Za-z]
-LetterOrUnderscore = ({Letter}|"_")
-Digit = [0-9]
-HexDigit = {Digit}|[A-Fa-f]
-OctalDigit = [0-7]
-Exponent = [eE][+-]?{Digit}+
-
-PreprocessorWord = define|elif|else|endif|error|if|ifdef|ifndef|include|line|pragma|undef
-
-Trigraph = ("??="|"??("|"??)"|"??/"|"??'"|"??<"|"??>"|"??!"|"??-")
-
-OctEscape1 = ([\\]{OctalDigit})
-OctEscape2 = ([\\]{OctalDigit}{OctalDigit})
-OctEscape3 = ([\\][0-3]{OctalDigit}{OctalDigit})
-OctEscape = ({OctEscape1}|{OctEscape2}|{OctEscape3})
-HexEscape = ([\\][xX]{HexDigit}{HexDigit})
-
-AnyChrChr = ([^\'\n\\])
-Escape = ([\\]([abfnrtv\'\"\?\\0e]))
-UnclosedCharLiteral = ([\']({Escape}|{OctEscape}|{HexEscape}|{Trigraph}|{AnyChrChr}))
-CharLiteral = ({UnclosedCharLiteral}[\'])
-ErrorUnclosedCharLiteral = ([\'][^\'\n]*)
-ErrorCharLiteral = (([\'][\'])|{ErrorUnclosedCharLiteral}[\'])
-AnyStrChr = ([^\"\n\\])
-FalseTrigraph = (("?"(("?")*)[^\=\(\)\/\'\<\>\!\-\\\?\"\n])|("?"[\=\(\)\/\'\<\>\!\-]))
-StringLiteral = ([\"]((((("?")*)({Escape}|{OctEscape}|{HexEscape}|{Trigraph}))|{FalseTrigraph}|{AnyStrChr})*)(("?")*)[\"])
-UnclosedStringLiteral = ([\"]([\\].|[^\\\"])*[^\"]?)
-ErrorStringLiteral = ({UnclosedStringLiteral}[\"])
-
-
-LineTerminator = \n
-WhiteSpace = [ \t\f]
-
-MLCBegin = "/*"
-MLCEnd = "*/"
-LineCommentBegin = "//"
-
-NonFloatSuffix = (([uU][lL]?)|([lL][uU]?))
-IntegerLiteral = ({Digit}+{Exponent}?{NonFloatSuffix}?)
-HexLiteral = ("0"[xX]{HexDigit}+{NonFloatSuffix}?)
-FloatLiteral = ((({Digit}*[\.]{Digit}+)|({Digit}+[\.]{Digit}*)){Exponent}?[fFlL]?)
-ErrorNumberFormat = (({IntegerLiteral}|{HexLiteral}|{FloatLiteral}){NonSeparator}+)
-
-NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\']|"#")
-Identifier = ({LetterOrUnderscore}({LetterOrUnderscore}|{Digit}|[$])*)
-ErrorIdentifier = ({NonSeparator}+)
-
-URLGenDelim = ([:\/\?#\[\]@])
-URLSubDelim = ([\!\$&'\(\)\*\+,;=])
-URLUnreserved = ({LetterOrUnderscore}|{Digit}|[\-\.\~])
-URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
-URLCharacters = ({URLCharacter}*)
-URLEndCharacter = ([\/\$]|{Letter}|{Digit})
-URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
-
-
-%state MLC
-%state EOL_COMMENT
-
-%%
-
-AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around). We can
- * achieve this because RText always scans exactly 1 line of tokens at a time,
- * and hands the scanner this line as an array of characters (a Segment really).
- * Since tokens contain pointers to char arrays instead of Strings holding their
- * contents, there is no need for allocating new memory for Strings.
- * - * - * The actual algorithm generated for scanning has, of course, not been - * modified. - *
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
CPlusPlusTokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
. You
- * should hand-delete the second of each definition (the ones generated by the
- * lexer), as these generated methods modify the input buffer, which we'll never
- * have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would with
- * any other TokenMaker
instance.aState
- */
- private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
- private static final String ZZ_ATTRIBUTE_PACKED_0 = "\3\0\26\1\1\11\6\1\1\11\6\1\1\11\1\1"
- + "\2\11\7\1\1\11\6\1\1\11\114\1\1\0\2\11" + "\2\1\1\11\3\1\1\11\17\1\1\0\14\1\2\0"
- + "\1\11\4\0\1\11\2\0\6\1\1\0\142\1\1\11" + "\7\1\1\11\21\1\6\0\14\1\10\0\6\1\1\0"
- + "\142\1\4\0\1\1\4\0\11\1\2\0\1\1\2\0" + "\67\1\7\0\10\1\4\0\25\1\1\11\3\0\12\1" + "\2\0\5\1";
-
- private static int[] zzUnpackAttribute() {
- int[] result = new int[583];
- int offset = 0;
- offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
- return result;
- }
-
- private static int zzUnpackAttribute(String packed, int offset, int[] result) {
- int i = 0; /* index in packed string */
- int j = offset; /* index in unpacked array */
- int l = packed.length();
- while (i < l) {
- int count = packed.charAt(i++);
- int value = packed.charAt(i++);
- do
- result[j++] = value;
- while (--count > 0);
- }
- return j;
- }
-
- /** the input device */
- private java.io.Reader zzReader;
- /** the current state of the DFA */
- private int zzState;
- /** the current lexical state */
- private int zzLexicalState = YYINITIAL;
- /**
- * this buffer contains the current text to be matched and is the source of the
- * yytext() string
- */
- private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
- /** the textposition at the last accepting state */
- private int zzMarkedPos;
- /** the current text position in the buffer */
- private int zzCurrentPos;
- /** startRead marks the beginning of the yytext() string in the buffer */
- private int zzStartRead;
- /**
- * endRead marks the last character in the buffer, that has been read from input
- */
- private int zzEndRead;
- /** zzAtEOF == true <=> the scanner is at the EOF */
- private boolean zzAtEOF;
- /* user code: */
-
- /**
- * Constructor. This must be here because JFlex does not generate a no-parameter
- * constructor.
- */
- public CPlusPlusTokenMaker() {
- super();
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- * @see #addToken(int, int, int)
- */
- private void addHyperlinkToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so, true);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int tokenType) {
- addToken(zzStartRead, zzMarkedPos - 1, tokenType);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param array The character array.
- * @param start The starting offset in the array.
- * @param end The ending offset in the array.
- * @param tokenType The token's type.
- * @param startOffset The offset in the document at which this token occurs.
- */
- @Override
- public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
- super.addToken(array, start, end, tokenType, startOffset);
- zzStartRead = zzMarkedPos;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String[] getLineCommentStartAndEnd(int languageIndex) {
- return new String[] { "//", null };
- }
-
- /**
- * Returns the first token in the linked list of tokens generated from
- * text
. This method must be implemented by subclasses so they can
- * correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing the syntax
- * highlighted text.
- */
- @Override
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
- // Start off in the proper state.
- int state = YYINITIAL;
- switch (initialTokenType) {
- case Token.COMMENT_EOL:
- state = EOL_COMMENT;
- start = text.offset;
- break;
- case Token.COMMENT_MULTILINE:
- state = MLC;
- start = text.offset;
- break;
- default:
- state = YYINITIAL;
- }
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
- }
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos >= s.offset + s.count;
- }
-
- /**
- * Resets the scanner to read from a new input stream. Does not close the old
- * reader.
- *
- * All internal variables are reset, the old input stream cannot be
- * reused (internal buffer is discarded and lost). Lexical state is set to
- * YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill no longer
- * "refills" the buffer (since the way we do it, it's always "full" the first
- * time through, since it points to the segment's array). So, we assign
- * zzEndRead here.
- */
- // zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtEOF = false;
- }
-
- /**
- * Creates a new scanner There is also a java.io.InputStream version of this
- * constructor.
- *
- * @param in the java.io.Reader to read input from.
- */
- public CPlusPlusTokenMaker(java.io.Reader in) {
- this.zzReader = in;
- }
-
- /**
- * Creates a new scanner. There is also java.io.Reader version of this
- * constructor.
- *
- * @param in the java.io.Inputstream to read input from.
- */
- public CPlusPlusTokenMaker(java.io.InputStream in) {
- this(new java.io.InputStreamReader(in));
- }
-
- /**
- * Unpacks the compressed character translation table.
- *
- * @param packed the packed character translation table
- * @return the unpacked character translation table
- */
- private static char[] zzUnpackCMap(String packed) {
- char[] map = new char[0x10000];
- int i = 0; /* index in packed string */
- int j = 0; /* index in unpacked array */
- while (i < 184) {
- int count = packed.charAt(i++);
- char value = packed.charAt(i++);
- do
- map[j++] = value;
- while (--count > 0);
- }
- return map;
- }
-
- /**
- * Closes the input stream.
- */
- public final void yyclose() throws java.io.IOException {
- zzAtEOF = true; /* indicate end of file */
- zzEndRead = zzStartRead; /* invalidate buffer */
- if (zzReader != null)
- zzReader.close();
- }
-
- /**
- * Returns the current lexical state.
- */
- public final int yystate() {
- return zzLexicalState;
- }
-
- /**
- * Enters a new lexical state
- *
- * @param newState the new lexical state
- */
- @Override
- public final void yybegin(int newState) {
- zzLexicalState = newState;
- }
-
- /**
- * Returns the text matched by the current regular expression.
- */
- public final String yytext() {
- return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
- }
-
- /**
- * Returns the character at position pos from the matched text.
- *
- * It is equivalent to yytext().charAt(pos), but faster
- *
- * @param pos the position of the character to fetch. A value from 0 to
- * yylength()-1.
- *
- * @return the character at position pos
- */
- public final char yycharat(int pos) {
- return zzBuffer[zzStartRead + pos];
- }
-
- /**
- * Returns the length of the matched text region.
- */
- public final int yylength() {
- return zzMarkedPos - zzStartRead;
- }
-
- /**
- * Reports an error that occured while scanning.
- *
- * In a wellformed scanner (no or only correct usage of yypushback(int) and a
- * match-all fallback rule) this method will only be called with things that
- * "Can't Possibly Happen". If this method is called, something is seriously
- * wrong (e.g. a JFlex bug producing a faulty scanner etc.).
- *
- * Usual syntax/scanner level error handling should be done in error fallback
- * rules.
- *
- * @param errorCode the code of the errormessage to display
- */
- private void zzScanError(int errorCode) {
- String message;
- try {
- message = ZZ_ERROR_MSG[errorCode];
- } catch (ArrayIndexOutOfBoundsException e) {
- message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
- }
- throw new Error(message);
- }
-
- /**
- * Pushes the specified amount of characters back into the input stream.
- *
- * They will be read again by then next call of the scanning method
- *
- * @param number the number of characters to be read again. This number must not
- * be greater than yylength()!
- */
- public void yypushback(int number) {
- if (number > yylength())
- zzScanError(ZZ_PUSHBACK_2BIG);
- zzMarkedPos -= number;
- }
-
- /**
- * Resumes scanning until the next regular expression is matched, the end of
- * input is encountered or an I/O-Error occurs.
- *
- * @return the next token
- * @exception java.io.IOException if any I/O-Error occurs
- */
- public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
- int zzInput;
- int zzAction;
- // cached fields:
- int zzCurrentPosL;
- int zzMarkedPosL;
- int zzEndReadL = zzEndRead;
- char[] zzBufferL = zzBuffer;
- char[] zzCMapL = ZZ_CMAP;
- int[] zzTransL = ZZ_TRANS;
- int[] zzRowMapL = ZZ_ROWMAP;
- int[] zzAttrL = ZZ_ATTRIBUTE;
- while (true) {
- zzMarkedPosL = zzMarkedPos;
- zzAction = -1;
- zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
- zzState = zzLexicalState;
- zzForAction: {
- while (true) {
- if (zzCurrentPosL < zzEndReadL)
- zzInput = zzBufferL[zzCurrentPosL++];
- else if (zzAtEOF) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- // store back cached positions
- zzCurrentPos = zzCurrentPosL;
- zzMarkedPos = zzMarkedPosL;
- boolean eof = zzRefill();
- // get translated positions and possibly new buffer
- zzCurrentPosL = zzCurrentPos;
- zzMarkedPosL = zzMarkedPos;
- zzBufferL = zzBuffer;
- zzEndReadL = zzEndRead;
- if (eof) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- zzInput = zzBufferL[zzCurrentPosL++];
- }
- }
- int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
- if (zzNext == -1)
- break zzForAction;
- zzState = zzNext;
- int zzAttributes = zzAttrL[zzState];
- if ((zzAttributes & 1) == 1) {
- zzAction = zzState;
- zzMarkedPosL = zzCurrentPosL;
- if ((zzAttributes & 8) == 8)
- break zzForAction;
- }
- }
- }
- // store back cached position
- zzMarkedPos = zzMarkedPosL;
- switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
- case 29: {
- addToken(Token.PREPROCESSOR);
- }
- case 33:
- break;
- case 7: {
- addNullToken();
- return firstToken;
- }
- case 34:
- break;
- case 26: {
- addToken(Token.LITERAL_CHAR);
- }
- case 35:
- break;
- case 22: {
- yybegin(YYINITIAL);
- addToken(start, zzStartRead + 1, Token.COMMENT_MULTILINE);
- }
- case 36:
- break;
- case 18: {
- start = zzMarkedPos - 2;
- yybegin(MLC);
- }
- case 37:
- break;
- case 9: {
- addToken(Token.WHITESPACE);
- }
- case 38:
- break;
- case 28: {
- addToken(Token.LITERAL_NUMBER_HEXADECIMAL);
- }
- case 39:
- break;
- case 19: {
- addToken(Token.ERROR_CHAR); /*
- * addNullToken(); return firstToken;
- */
- }
- case 40:
- break;
- case 27: {
- addToken(Token.ERROR_STRING_DOUBLE);
- }
- case 41:
- break;
- case 15: {
- addToken(Token.LITERAL_NUMBER_FLOAT);
- }
- case 42:
- break;
- case 16: {
- addToken(Token.RESERVED_WORD);
- }
- case 43:
- break;
- case 5: {
- addToken(Token.SEPARATOR);
- }
- case 44:
- break;
- case 2: {
- addToken(Token.IDENTIFIER);
- }
- case 45:
- break;
- case 12: { /* Line ending in '\' => continue to next line. */
- addToken(start, zzStartRead, Token.COMMENT_EOL);
- return firstToken;
- }
- case 46:
- break;
- case 13: {
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- addNullToken();
- return firstToken;
- }
- case 47:
- break;
- case 17: {
- start = zzMarkedPos - 2;
- yybegin(EOL_COMMENT);
- }
- case 48:
- break;
- case 24: {
- addToken(Token.FUNCTION);
- }
- case 49:
- break;
- case 6: {
- addToken(Token.ERROR_CHAR);
- addNullToken();
- return firstToken;
- }
- case 50:
- break;
- case 8: {
- addToken(Token.ERROR_STRING_DOUBLE);
- addNullToken();
- return firstToken;
- }
- case 51:
- break;
- case 25: {
- addToken(Token.DATA_TYPE);
- }
- case 52:
- break;
- case 1: {
- addToken(Token.ERROR_IDENTIFIER);
- }
- case 53:
- break;
- case 20: {
- addToken(Token.ERROR_CHAR);
- }
- case 54:
- break;
- case 23: { /* Skip all escaped chars. */
- }
- case 55:
- break;
- case 21: {
- addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
- }
- case 56:
- break;
- case 31: {
- int temp = zzStartRead;
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_EOL);
- start = zzMarkedPos;
- }
- case 57:
- break;
- case 30: {
- int temp = zzStartRead;
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_MULTILINE);
- start = zzMarkedPos;
- }
- case 58:
- break;
- case 32: {
- addToken(Token.RESERVED_WORD_2);
- }
- case 59:
- break;
- case 14: {
- addToken(Token.ERROR_NUMBER_FORMAT);
- }
- case 60:
- break;
- case 3: {
- addToken(Token.LITERAL_NUMBER_DECIMAL_INT);
- }
- case 61:
- break;
- case 4: {
- addToken(Token.OPERATOR);
- }
- case 62:
- break;
- case 10: {
- }
- case 63:
- break;
- case 11: {
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- return firstToken;
- }
- case 64:
- break;
- default:
- if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
- zzAtEOF = true;
- switch (zzLexicalState) {
- case EOL_COMMENT: {
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- addNullToken();
- return firstToken;
- }
- case 584:
- break;
- case YYINITIAL: {
- addNullToken();
- return firstToken;
- }
- case 585:
- break;
- case MLC: {
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- return firstToken;
- }
- case 586:
- break;
- default:
- return null;
- }
- } else {
- zzScanError(ZZ_NO_MATCH);
- }
- }
- }
- }
-}
diff --git a/src/org/fife/ui/rsyntaxtextarea/modes/CSSTokenMaker.flex b/src/org/fife/ui/rsyntaxtextarea/modes/CSSTokenMaker.flex
deleted file mode 100644
index 33ecc99..0000000
--- a/src/org/fife/ui/rsyntaxtextarea/modes/CSSTokenMaker.flex
+++ /dev/null
@@ -1,558 +0,0 @@
-/*
- * 09/03/2005
- *
- * CSSTokenMaker.java - Token maker for CSS 3 files.
- *
- * This library is distributed under a modified BSD license. See the included
- * RSyntaxTextArea.License.txt file for details.
- */
-package org.fife.ui.rsyntaxtextarea.modes;
-
-import java.io.*;
-import javax.swing.text.Segment;
-
-import org.fife.ui.rsyntaxtextarea.*;
-
-
-/**
- * This class splits up text into tokens representing a CSS 3 file. It's
- * written with a few extra internal states so that it can easily be copy
- * and pasted into HTML, PHP, and JSP TokenMakres when it is updated.
- *
- * This implementation was created using
- * JFlex 1.4.1; however, the generated file
- * was modified for performance. Memory allocation needs to be almost
- * completely removed to be competitive with the handwritten lexers (subclasses
- * of AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around).
- * We can achieve this because RText always scans exactly 1 line of tokens at a
- * time, and hands the scanner this line as an array of characters (a Segment
- * really). Since tokens contain pointers to char arrays instead of Strings
- * holding their contents, there is no need for allocating new memory for
- * Strings.
- * - * The actual algorithm generated for scanning has, of course, not been - * modified.
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
CSSTokenMaker.java
file will contain 2
- * definitions of both zzRefill
and yyreset
.
- * You should hand-delete the second of each definition (the ones
- * generated by the lexer), as these generated methods modify the input
- * buffer, which we'll never have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would
- * with any other TokenMaker
instance.zzMarkedPos
.
- *
- * @param tokenType The token's type.
- */
- private void addEndToken(int tokenType) {
- addToken(zzMarkedPos,zzMarkedPos, tokenType);
- }
-
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- * @see #addToken(int, int, int)
- */
- private void addHyperlinkToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start,end, tokenType, so, true);
- }
-
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int tokenType) {
- addToken(zzStartRead, zzMarkedPos-1, tokenType);
- }
-
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start,end, tokenType, so);
- }
-
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param array The character array.
- * @param start The starting offset in the array.
- * @param end The ending offset in the array.
- * @param tokenType The token's type.
- * @param startOffset The offset in the document at which this token
- * occurs.
- */
- @Override
- public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
- super.addToken(array, start,end, tokenType, startOffset);
- zzStartRead = zzMarkedPos;
- }
-
-
- /**
- * Returns the closest {@link TokenTypes "standard" token type} for a given
- * "internal" token type (e.g. one whose value is < 0
).
- */
- @Override
- public int getClosestStandardTokenTypeForInternalType(int type) {
- switch (type) {
- case INTERNAL_CSS_STRING:
- case INTERNAL_CSS_CHAR:
- return TokenTypes.LITERAL_STRING_DOUBLE_QUOTE;
- case INTERNAL_CSS_MLC:
- return TokenTypes.COMMENT_MULTILINE;
- }
- return type;
- }
-
-
- /**
- * Returns true
since CSS uses curly braces.
- *
- * @return true
always.
- */
- public boolean getCurlyBracesDenoteCodeBlocks() {
- return true;
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean getMarkOccurrencesOfTokenType(int type) {
- return type==Token.RESERVED_WORD; // Used for CSS keys
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean getShouldIndentNextLineAfter(Token t) {
- if (t!=null && t.length()==1) {
- char ch = t.charAt(0);
- return ch=='{' || ch=='(';
- }
- return false;
- }
-
-
- /**
- * Returns the first token in the linked list of tokens generated
- * from text
. This method must be implemented by
- * subclasses so they can correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing
- * the syntax highlighted text.
- */
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
-
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
- cssPrevState = YYINITIAL; // Shouldn't be necessary
-
- // Start off in the proper state.
- int state = YYINITIAL;
- switch (initialTokenType) {
- case Token.LITERAL_STRING_DOUBLE_QUOTE:
- state = CSS_STRING;
- break;
- case Token.LITERAL_CHAR:
- state = CSS_CHAR_LITERAL;
- break;
- case Token.COMMENT_MULTILINE:
- state = CSS_C_STYLE_COMMENT;
- break;
- case INTERNAL_CSS_PROPERTY:
- state = CSS_PROPERTY;
- break;
- case INTERNAL_CSS_VALUE:
- state = CSS_VALUE;
- break;
- default:
- if (initialTokenType<-1024) {
- int main = -(-initialTokenType & 0xffffff00);
- switch (main) {
- default: // Should never happen
- case INTERNAL_CSS_STRING:
- state = CSS_STRING;
- break;
- case INTERNAL_CSS_CHAR:
- state = CSS_CHAR_LITERAL;
- break;
- case INTERNAL_CSS_MLC:
- state = CSS_C_STYLE_COMMENT;
- break;
- }
- cssPrevState = -initialTokenType&0xff;
- }
- else {
- state = YYINITIAL;
- }
- }
-
- start = text.offset;
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
-
- }
-
-
- /**
- * Overridden to accept letters, digits, underscores, and hyphens.
- */
- @Override
- public boolean isIdentifierChar(int languageIndex, char ch) {
- return Character.isLetterOrDigit(ch) || ch=='-' || ch=='.' || ch=='_';
- }
-
-
- /**
- * Toggles whether we're highlighting less instead of just CSS.
- *
- * @param highlightingLess Whether we're highlighting less.
- */
- public void setHighlightingLess(boolean highlightingLess) {
- this.highlightingLess = highlightingLess;
- }
-
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise
- * false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos>=s.offset+s.count;
- }
-
-
- /**
- * Resets the scanner to read from a new input stream.
- * Does not close the old reader.
- *
- * All internal variables are reset, the old input stream
- * cannot be reused (internal buffer is discarded and lost).
- * Lexical state is set to YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(java.io.Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill
- * no longer "refills" the buffer (since the way we do it, it's always
- * "full" the first time through, since it points to the segment's
- * array). So, we assign zzEndRead here.
- */
- //zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtBOL = true;
- zzAtEOF = false;
- }
-
-
-%}
-
-Digit = ([0-9])
-Letter = ([A-Za-z])
-LetterOrUnderscore = ({Letter}|[_])
-LetterOrUnderscoreOrDash = ({LetterOrUnderscore}|[\-])
-
-CSS_SelectorPiece = (("*"|"."|{LetterOrUnderscoreOrDash})({LetterOrUnderscoreOrDash}|"."|{Digit})*)
-CSS_PseudoClass = (":"("root"|"nth-child"|"nth-last-child"|"nth-of-type"|"nth-last-of-type"|"first-child"|"last-child"|"first-of-type"|"last-of-type"|"only-child"|"only-of-type"|"empty"|"link"|"visited"|"active"|"hover"|"focus"|"target"|"lang"|"enabled"|"disabled"|"checked"|":first-line"|":first-letter"|":before"|":after"|"not"))
-CSS_AtRule = ("@"(charset|import|namespace|media|document|page|font-face|keyframes|viewport))
-CSS_Less_Var = ("@"({LetterOrUnderscoreOrDash})({LetterOrUnderscoreOrDash}|"."|{Digit})*)
-CSS_Id = ("#"{CSS_SelectorPiece})
-CSS_Separator = ([;\(\)\[\]])
-WhiteSpace = ([ \t]+)
-MlcStart = ("/*")
-MlcEnd = ("*/")
-
-CSS_Property = ([\*]?{LetterOrUnderscoreOrDash}({LetterOrUnderscoreOrDash}|{Digit})*(:[\w]+)?)
-CSS_ValueChar = ({LetterOrUnderscoreOrDash}|[\\/])
-CSS_Value = ({CSS_ValueChar}*)
-CSS_Function = ({CSS_Value}\()
-CSS_Digits = ([\-]?{Digit}+([0-9\.]+)?(pt|pc|in|mm|cm|em|ex|px|ms|s|%)?)
-CSS_Hex = ("#"[0-9a-fA-F]+)
-CSS_Number = ({CSS_Digits}|{CSS_Hex})
-
-// Less_Nested_Selector includes pseudo-classes for ease of highlighting, even
-// though it is not as detailed as standard CSS selector highlighting.
-Less_Nested_Selector_With_Pseudo = ({CSS_SelectorPiece}{CSS_PseudoClass}*)
-Less_Selector_ParentRef = ("&"{CSS_SelectorPiece})
-Less_LineCommentBegin = "//"
-
-URLGenDelim = ([:\/\?#\[\]@])
-URLSubDelim = ([\!\$&'\(\)\*\+,;=])
-URLUnreserved = ({LetterOrUnderscore}|{Digit}|[\-\.\~])
-URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
-URLCharacters = ({URLCharacter}*)
-URLEndCharacter = ([\/\$]|{Letter}|{Digit})
-URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
-
-
-%state CSS_PROPERTY
-%state CSS_VALUE
-%state CSS_STRING
-%state CSS_CHAR_LITERAL
-%state CSS_C_STYLE_COMMENT
-%state LESS_EOL_COMMENT
-
-%%
-
-
- *
- * This implementation was created using
- * JFlex 1.4.1; however, the generated file
- * was modified for performance. Memory allocation needs to be almost completely
- * removed to be competitive with the handwritten lexers (subclasses of
- * AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around). We can
- * achieve this because RText always scans exactly 1 line of tokens at a time,
- * and hands the scanner this line as an array of characters (a Segment really).
- * Since tokens contain pointers to char arrays instead of Strings holding their
- * contents, there is no need for allocating new memory for Strings.
- *
- * - * The actual algorithm generated for scanning has, of course, not been - * modified. - *
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
CSSTokenMaker.java
file will contain 2
- * definitions of both zzRefill
and yyreset
. You
- * should hand-delete the second of each definition (the ones generated by the
- * lexer), as these generated methods modify the input buffer, which we'll never
- * have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would with
- * any other TokenMaker
instance.aState
- */
- private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
- private static final String ZZ_ATTRIBUTE_PACKED_0 = "\2\0\1\1\4\0\1\11\6\1\1\11\2\1\10\11"
- + "\3\1\1\11\3\1\4\11\5\1\1\11\1\1\1\11" + "\1\1\2\11\2\1\2\11\1\1\2\11\5\1\1\11"
- + "\4\1\1\11\2\0\1\11\3\0\1\1\15\0\15\1" + "\2\11\2\0\1\1\1\11\1\1\2\0\1\11\3\0"
- + "\2\1\1\0\2\11\33\0\11\1\15\0\1\1\16\0" + "\1\11\14\0\11\1\26\0\1\1\2\0\1\1\14\0"
- + "\10\1\5\0\1\1\31\0\6\1\21\0\3\1\14\0" + "\2\1\7\0\1\1\11\0\1\11\3\0";
-
- private static int[] zzUnpackAttribute() {
- int[] result = new int[340];
- int offset = 0;
- offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
- return result;
- }
-
- private static int zzUnpackAttribute(String packed, int offset, int[] result) {
- int i = 0; /* index in packed string */
- int j = offset; /* index in unpacked array */
- int l = packed.length();
- while (i < l) {
- int count = packed.charAt(i++);
- int value = packed.charAt(i++);
- do
- result[j++] = value;
- while (--count > 0);
- }
- return j;
- }
-
- /** the input device */
- private java.io.Reader zzReader;
- /** the current state of the DFA */
- private int zzState;
- /** the current lexical state */
- private int zzLexicalState = YYINITIAL;
- /**
- * this buffer contains the current text to be matched and is the source of the
- * yytext() string
- */
- private char zzBuffer[];
- /** the textposition at the last accepting state */
- private int zzMarkedPos;
- /** the current text position in the buffer */
- private int zzCurrentPos;
- /** startRead marks the beginning of the yytext() string in the buffer */
- private int zzStartRead;
- /**
- * endRead marks the last character in the buffer, that has been read from input
- */
- private int zzEndRead;
- /** zzAtEOF == true <=> the scanner is at the EOF */
- private boolean zzAtEOF;
- /* user code: */
- /**
- * Internal type denoting a line ending in a CSS property.
- */
- public static final int INTERNAL_CSS_PROPERTY = -1;
- /**
- * Internal type denoting a line ending in a CSS property value.
- */
- public static final int INTERNAL_CSS_VALUE = -2;
- /**
- * Internal type denoting line ending in a CSS double-quote string. The state to
- * return to is embedded in the actual end token type.
- */
- public static final int INTERNAL_CSS_STRING = -(1 << 11);
- /**
- * Internal type denoting line ending in a CSS single-quote string. The state to
- * return to is embedded in the actual end token type.
- */
- public static final int INTERNAL_CSS_CHAR = -(2 << 11);
- /**
- * Internal type denoting line ending in a CSS multi-line comment. The state to
- * return to is embedded in the actual end token type.
- */
- public static final int INTERNAL_CSS_MLC = -(3 << 11);
- /**
- * The state previous CSS-related state we were in before going into a CSS
- * string, multi-line comment, etc.
- */
- private int cssPrevState;
- /**
- * Whether we are highlighting less instead of CSS.
- */
- private boolean highlightingLess;
-
- /**
- * Constructor. This must be here because JFlex does not generate a no-parameter
- * constructor.
- */
- public CSSTokenMaker() {
- super();
- }
-
- /**
- * Adds the token specified to the current linked list of tokens as an "end
- * token;" that is, at zzMarkedPos
.
- *
- * @param tokenType The token's type.
- */
- private void addEndToken(int tokenType) {
- addToken(zzMarkedPos, zzMarkedPos, tokenType);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- * @see #addToken(int, int, int)
- */
- private void addHyperlinkToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so, true);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int tokenType) {
- addToken(zzStartRead, zzMarkedPos - 1, tokenType);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param array The character array.
- * @param start The starting offset in the array.
- * @param end The ending offset in the array.
- * @param tokenType The token's type.
- * @param startOffset The offset in the document at which this token occurs.
- */
- @Override
- public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
- super.addToken(array, start, end, tokenType, startOffset);
- zzStartRead = zzMarkedPos;
- }
-
- /**
- * Returns the closest {@link TokenTypes "standard" token type} for a given
- * "internal" token type (e.g. one whose value is < 0
).
- */
- @Override
- public int getClosestStandardTokenTypeForInternalType(int type) {
- switch (type) {
- case INTERNAL_CSS_STRING:
- case INTERNAL_CSS_CHAR:
- return TokenTypes.LITERAL_STRING_DOUBLE_QUOTE;
- case INTERNAL_CSS_MLC:
- return TokenTypes.COMMENT_MULTILINE;
- }
- return type;
- }
-
- /**
- * Returns true
since CSS uses curly braces.
- *
- * @return true
always.
- */
- public boolean getCurlyBracesDenoteCodeBlocks() {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean getMarkOccurrencesOfTokenType(int type) {
- return type == Token.RESERVED_WORD; // Used for CSS keys
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean getShouldIndentNextLineAfter(Token t) {
- if (t != null && t.length() == 1) {
- char ch = t.charAt(0);
- return ch == '{' || ch == '(';
- }
- return false;
- }
-
- /**
- * Returns the first token in the linked list of tokens generated from
- * text
. This method must be implemented by subclasses so they can
- * correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing the syntax
- * highlighted text.
- */
- @Override
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
- cssPrevState = YYINITIAL; // Shouldn't be necessary
- // Start off in the proper state.
- int state = YYINITIAL;
- switch (initialTokenType) {
- case Token.LITERAL_STRING_DOUBLE_QUOTE:
- state = CSS_STRING;
- break;
- case Token.LITERAL_CHAR:
- state = CSS_CHAR_LITERAL;
- break;
- case Token.COMMENT_MULTILINE:
- state = CSS_C_STYLE_COMMENT;
- break;
- case INTERNAL_CSS_PROPERTY:
- state = CSS_PROPERTY;
- break;
- case INTERNAL_CSS_VALUE:
- state = CSS_VALUE;
- break;
- default:
- if (initialTokenType < -1024) {
- int main = -(-initialTokenType & 0xffffff00);
- switch (main) {
- default: // Should never happen
- case INTERNAL_CSS_STRING:
- state = CSS_STRING;
- break;
- case INTERNAL_CSS_CHAR:
- state = CSS_CHAR_LITERAL;
- break;
- case INTERNAL_CSS_MLC:
- state = CSS_C_STYLE_COMMENT;
- break;
- }
- cssPrevState = -initialTokenType & 0xff;
- } else {
- state = YYINITIAL;
- }
- }
- start = text.offset;
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
- }
-
- /**
- * Overridden to accept letters, digits, underscores, and hyphens.
- */
- @Override
- public boolean isIdentifierChar(int languageIndex, char ch) {
- return Character.isLetterOrDigit(ch) || ch == '-' || ch == '.' || ch == '_';
- }
-
- /**
- * Toggles whether we're highlighting less instead of just CSS.
- *
- * @param highlightingLess Whether we're highlighting less.
- */
- public void setHighlightingLess(boolean highlightingLess) {
- this.highlightingLess = highlightingLess;
- }
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos >= s.offset + s.count;
- }
-
- /**
- * Resets the scanner to read from a new input stream. Does not close the old
- * reader.
- *
- * All internal variables are reset, the old input stream cannot be
- * reused (internal buffer is discarded and lost). Lexical state is set to
- * YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(java.io.Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill no longer
- * "refills" the buffer (since the way we do it, it's always "full" the first
- * time through, since it points to the segment's array). So, we assign
- * zzEndRead here.
- */
- // zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtEOF = false;
- }
-
- /**
- * Creates a new scanner There is also a java.io.InputStream version of this
- * constructor.
- *
- * @param in the java.io.Reader to read input from.
- */
- public CSSTokenMaker(java.io.Reader in) {
- this.zzReader = in;
- }
-
- /**
- * Creates a new scanner. There is also java.io.Reader version of this
- * constructor.
- *
- * @param in the java.io.Inputstream to read input from.
- */
- public CSSTokenMaker(java.io.InputStream in) {
- this(new java.io.InputStreamReader(in));
- }
-
- /**
- * Unpacks the compressed character translation table.
- *
- * @param packed the packed character translation table
- * @return the unpacked character translation table
- */
- private static char[] zzUnpackCMap(String packed) {
- char[] map = new char[0x10000];
- int i = 0; /* index in packed string */
- int j = 0; /* index in unpacked array */
- while (i < 134) {
- int count = packed.charAt(i++);
- char value = packed.charAt(i++);
- do
- map[j++] = value;
- while (--count > 0);
- }
- return map;
- }
-
- /**
- * Closes the input stream.
- */
- public final void yyclose() throws java.io.IOException {
- zzAtEOF = true; /* indicate end of file */
- zzEndRead = zzStartRead; /* invalidate buffer */
- if (zzReader != null)
- zzReader.close();
- }
-
- /**
- * Returns the current lexical state.
- */
- public final int yystate() {
- return zzLexicalState;
- }
-
- /**
- * Enters a new lexical state
- *
- * @param newState the new lexical state
- */
- @Override
- public final void yybegin(int newState) {
- zzLexicalState = newState;
- }
-
- /**
- * Returns the text matched by the current regular expression.
- */
- public final String yytext() {
- return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
- }
-
- /**
- * Returns the character at position pos from the matched text.
- *
- * It is equivalent to yytext().charAt(pos), but faster
- *
- * @param pos the position of the character to fetch. A value from 0 to
- * yylength()-1.
- *
- * @return the character at position pos
- */
- public final char yycharat(int pos) {
- return zzBuffer[zzStartRead + pos];
- }
-
- /**
- * Returns the length of the matched text region.
- */
- public final int yylength() {
- return zzMarkedPos - zzStartRead;
- }
-
- /**
- * Reports an error that occured while scanning.
- *
- * In a wellformed scanner (no or only correct usage of yypushback(int) and a
- * match-all fallback rule) this method will only be called with things that
- * "Can't Possibly Happen". If this method is called, something is seriously
- * wrong (e.g. a JFlex bug producing a faulty scanner etc.).
- *
- * Usual syntax/scanner level error handling should be done in error fallback
- * rules.
- *
- * @param errorCode the code of the errormessage to display
- */
- private void zzScanError(int errorCode) {
- String message;
- try {
- message = ZZ_ERROR_MSG[errorCode];
- } catch (ArrayIndexOutOfBoundsException e) {
- message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
- }
- throw new Error(message);
- }
-
- /**
- * Pushes the specified amount of characters back into the input stream.
- *
- * They will be read again by then next call of the scanning method
- *
- * @param number the number of characters to be read again. This number must not
- * be greater than yylength()!
- */
- public void yypushback(int number) {
- if (number > yylength())
- zzScanError(ZZ_PUSHBACK_2BIG);
- zzMarkedPos -= number;
- }
-
- /**
- * Resumes scanning until the next regular expression is matched, the end of
- * input is encountered or an I/O-Error occurs.
- *
- * @return the next token
- * @exception java.io.IOException if any I/O-Error occurs
- */
- public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
- int zzInput;
- int zzAction;
- // cached fields:
- int zzCurrentPosL;
- int zzMarkedPosL;
- int zzEndReadL = zzEndRead;
- char[] zzBufferL = zzBuffer;
- char[] zzCMapL = ZZ_CMAP;
- int[] zzTransL = ZZ_TRANS;
- int[] zzRowMapL = ZZ_ROWMAP;
- int[] zzAttrL = ZZ_ATTRIBUTE;
- while (true) {
- zzMarkedPosL = zzMarkedPos;
- zzAction = -1;
- zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
- zzState = zzLexicalState;
- zzForAction: {
- while (true) {
- if (zzCurrentPosL < zzEndReadL)
- zzInput = zzBufferL[zzCurrentPosL++];
- else if (zzAtEOF) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- // store back cached positions
- zzCurrentPos = zzCurrentPosL;
- zzMarkedPos = zzMarkedPosL;
- boolean eof = zzRefill();
- // get translated positions and possibly new buffer
- zzCurrentPosL = zzCurrentPos;
- zzMarkedPosL = zzMarkedPos;
- zzBufferL = zzBuffer;
- zzEndReadL = zzEndRead;
- if (eof) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- zzInput = zzBufferL[zzCurrentPosL++];
- }
- }
- int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
- if (zzNext == -1)
- break zzForAction;
- zzState = zzNext;
- int zzAttributes = zzAttrL[zzState];
- if ((zzAttributes & 1) == 1) {
- zzAction = zzState;
- zzMarkedPosL = zzCurrentPosL;
- if ((zzAttributes & 8) == 8)
- break zzForAction;
- }
- }
- }
- // store back cached position
- zzMarkedPos = zzMarkedPosL;
- switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
- case 1: {
- addToken(Token.IDENTIFIER);
- }
- case 48:
- break;
- case 2: {
- /* System.out.println("yyinitial: " + yytext()); */ addToken(Token.IDENTIFIER);
- }
- case 49:
- break;
- case 25: {
- addEndToken(INTERNAL_CSS_VALUE);
- return firstToken;
- }
- case 50:
- break;
- case 16: {
- addToken(highlightingLess ? Token.RESERVED_WORD : Token.IDENTIFIER);
- }
- case 51:
- break;
- case 9: {
- addToken(Token.SEPARATOR);
- yybegin(CSS_PROPERTY);
- }
- case 52:
- break;
- case 29: {
- addToken(start, zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE);
- yybegin(cssPrevState);
- }
- case 53:
- break;
- case 32: {
- addToken(start, zzStartRead - 1, Token.LITERAL_CHAR);
- addEndToken(INTERNAL_CSS_CHAR - cssPrevState);
- return firstToken;
- }
- case 54:
- break;
- case 37: {
- start = zzMarkedPos - 2;
- cssPrevState = zzLexicalState;
- yybegin(CSS_C_STYLE_COMMENT);
- }
- case 55:
- break;
- case 31: {
- addToken(start, zzStartRead, Token.LITERAL_CHAR);
- yybegin(cssPrevState);
- }
- case 56:
- break;
- case 43: {
- addToken(start, zzStartRead + 1, Token.COMMENT_MULTILINE);
- yybegin(cssPrevState);
- }
- case 57:
- break;
- case 12: {
- addToken(highlightingLess ? Token.SEPARATOR : Token.IDENTIFIER);
- }
- case 58:
- break;
- case 10: {
- start = zzMarkedPos - 1;
- cssPrevState = zzLexicalState;
- yybegin(CSS_STRING);
- }
- case 59:
- break;
- case 17: {
- addToken(Token.OPERATOR);
- yybegin(CSS_VALUE);
- }
- case 60:
- break;
- case 38: {
- if (highlightingLess) {
- start = zzMarkedPos - 2;
- yybegin(LESS_EOL_COMMENT);
- } else { // Highlight the "//" as an identifier and continue
- // on
- int temp = zzStartRead + 2;
- addToken(zzStartRead, zzStartRead + 1, Token.IDENTIFIER);
- zzStartRead = temp;
- }
- }
- case 61:
- break;
- case 5: {
- /* Unknown pseudo class */ addToken(Token.DATA_TYPE);
- }
- case 62:
- break;
- case 23: {
- addToken(Token.OPERATOR);
- yybegin(CSS_PROPERTY);
- }
- case 63:
- break;
- case 28: { /* Skip escaped chars. */
- }
- case 64:
- break;
- case 46: {
- addToken(Token.REGEX);
- }
- case 65:
- break;
- case 36: {
- addToken(highlightingLess ? Token.ANNOTATION : Token.VARIABLE);
- }
- case 66:
- break;
- case 3: {
- addToken(highlightingLess ? Token.LITERAL_NUMBER_DECIMAL_INT : Token.IDENTIFIER);
- }
- case 67:
- break;
- case 20: {
- addEndToken(INTERNAL_CSS_PROPERTY);
- return firstToken;
- }
- case 68:
- break;
- case 7: {
- addToken(Token.WHITESPACE);
- }
- case 69:
- break;
- case 19: {
- addToken(Token.SEPARATOR);
- yybegin(YYINITIAL);
- }
- case 70:
- break;
- case 47: {
- addToken(Token.PREPROCESSOR);
- }
- case 71:
- break;
- case 4: {
- addToken(Token.DATA_TYPE);
- }
- case 72:
- break;
- case 24: {
- int temp = zzMarkedPos - 2;
- addToken(zzStartRead, temp, Token.FUNCTION);
- addToken(zzMarkedPos - 1, zzMarkedPos - 1, Token.SEPARATOR);
- zzStartRead = zzCurrentPos = zzMarkedPos;
- }
- case 73:
- break;
- case 35: {
- addToken(highlightingLess ? Token.VARIABLE : Token.REGEX);
- }
- case 74:
- break;
- case 18: {
- addToken(Token.SEPARATOR); /*
- * helps with auto-closing curlies when editing CSS
- */
- }
- case 75:
- break;
- case 34: {
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- switch (cssPrevState) {
- case CSS_PROPERTY:
- addEndToken(INTERNAL_CSS_PROPERTY);
- break;
- case CSS_VALUE:
- addEndToken(INTERNAL_CSS_VALUE);
- break;
- default: // Should be YYINITIAL
- addNullToken();
- break;
- }
- return firstToken;
- }
- case 76:
- break;
- case 22: {
- addToken(Token.LITERAL_NUMBER_DECIMAL_INT);
- }
- case 77:
- break;
- case 30: {
- addToken(start, zzStartRead - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
- addEndToken(INTERNAL_CSS_STRING - cssPrevState);
- return firstToken;
- }
- case 78:
- break;
- case 33: {
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- addEndToken(INTERNAL_CSS_MLC - cssPrevState);
- return firstToken;
- }
- case 79:
- break;
- case 26: {
- /* End of a function */ addToken(Token.SEPARATOR);
- }
- case 80:
- break;
- case 41: {
- if (highlightingLess) {
- // Unfortunately, as we're sharing the CSS and Less
- // syntax highlighting, we do not color nested selectors
- // properly. For uniformity, color this the same as
- // CSS_Property
- addToken(Token.RESERVED_WORD);
- } else {
- addToken(Token.IDENTIFIER);
- }
- }
- case 81:
- break;
- case 39: {
- addToken(highlightingLess ? Token.VARIABLE : Token.IDENTIFIER);
- }
- case 82:
- break;
- case 14: {
- /* System.out.println("css_property: " + yytext()); */ addToken(Token.IDENTIFIER);
- }
- case 83:
- break;
- case 15: {
- addToken(Token.RESERVED_WORD);
- }
- case 84:
- break;
- case 44: {
- int temp = zzStartRead;
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_MULTILINE);
- start = zzMarkedPos;
- }
- case 85:
- break;
- case 11: {
- start = zzMarkedPos - 1;
- cssPrevState = zzLexicalState;
- yybegin(CSS_CHAR_LITERAL);
- }
- case 86:
- break;
- case 6: {
- addToken(Token.SEPARATOR);
- }
- case 87:
- break;
- case 13: {
- addNullToken();
- return firstToken;
- }
- case 88:
- break;
- case 40: {
- if (highlightingLess) {
- cssPrevState = zzLexicalState;
- start = zzMarkedPos - 2;
- yybegin(LESS_EOL_COMMENT);
- } else { // Highlight the "//" as an identifier and continue
- // on
- int temp = zzStartRead + 2;
- addToken(zzStartRead, zzStartRead + 1, Token.IDENTIFIER);
- zzStartRead = temp;
- }
- }
- case 89:
- break;
- case 8: {
- addToken(Token.OPERATOR);
- }
- case 90:
- break;
- case 21: {
- /* System.out.println("css_value: " + yytext()); */ addToken(Token.IDENTIFIER);
- }
- case 91:
- break;
- case 45: {
- int temp = zzStartRead;
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_EOL);
- start = zzMarkedPos;
- }
- case 92:
- break;
- case 42: { // This must be before {CSS_Value} since "//" is a
- // valid CSS value
- if (highlightingLess) {
- cssPrevState = zzLexicalState;
- start = zzMarkedPos - 2;
- yybegin(LESS_EOL_COMMENT);
- } else { // Highlight the "//" as an identifier and continue
- // on
- int temp = zzStartRead + 2;
- addToken(zzStartRead, zzStartRead + 1, Token.IDENTIFIER);
- zzStartRead = temp;
- }
- }
- case 93:
- break;
- case 27: {
- }
- case 94:
- break;
- default:
- if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
- zzAtEOF = true;
- switch (zzLexicalState) {
- case CSS_C_STYLE_COMMENT: {
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- addEndToken(INTERNAL_CSS_MLC - cssPrevState);
- return firstToken;
- }
- case 341:
- break;
- case LESS_EOL_COMMENT: {
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- switch (cssPrevState) {
- case CSS_PROPERTY:
- addEndToken(INTERNAL_CSS_PROPERTY);
- break;
- case CSS_VALUE:
- addEndToken(INTERNAL_CSS_VALUE);
- break;
- default: // Should be YYINITIAL
- addNullToken();
- break;
- }
- return firstToken;
- }
- case 342:
- break;
- case YYINITIAL: {
- addNullToken();
- return firstToken;
- }
- case 343:
- break;
- case CSS_STRING: {
- addToken(start, zzStartRead - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
- addEndToken(INTERNAL_CSS_STRING - cssPrevState);
- return firstToken;
- }
- case 344:
- break;
- case CSS_VALUE: {
- addEndToken(INTERNAL_CSS_VALUE);
- return firstToken;
- }
- case 345:
- break;
- case CSS_PROPERTY: {
- addEndToken(INTERNAL_CSS_PROPERTY);
- return firstToken;
- }
- case 346:
- break;
- case CSS_CHAR_LITERAL: {
- addToken(start, zzStartRead - 1, Token.LITERAL_CHAR);
- addEndToken(INTERNAL_CSS_CHAR - cssPrevState);
- return firstToken;
- }
- case 347:
- break;
- default:
- return null;
- }
- } else {
- zzScanError(ZZ_NO_MATCH);
- }
- }
- }
- }
-}
diff --git a/src/org/fife/ui/rsyntaxtextarea/modes/CSharpTokenMaker.flex b/src/org/fife/ui/rsyntaxtextarea/modes/CSharpTokenMaker.flex
deleted file mode 100644
index ba203c0..0000000
--- a/src/org/fife/ui/rsyntaxtextarea/modes/CSharpTokenMaker.flex
+++ /dev/null
@@ -1,514 +0,0 @@
-/*
- * 11/13/2004
- *
- * CSharpTokenMaker.java - An object that can take a chunk of text and return
- * a linked list of tokens representing it in the C# programming language.
- *
- * This library is distributed under a modified BSD license. See the included
- * RSyntaxTextArea.License.txt file for details.
- */
-package org.fife.ui.rsyntaxtextarea.modes;
-
-import java.io.*;
-import javax.swing.text.Segment;
-
-import org.fife.ui.rsyntaxtextarea.*;
-
-
-/**
- * A lexer for the C# programming language.
- *
- * This implementation was created using
- * JFlex 1.4.1; however, the generated file
- * was modified for performance. Memory allocation needs to be almost
- * completely removed to be competitive with the handwritten lexers (subclasses
- * of AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around).
- * We can achieve this because RText always scans exactly 1 line of tokens at a
- * time, and hands the scanner this line as an array of characters (a Segment
- * really). Since tokens contain pointers to char arrays instead of Strings
- * holding their contents, there is no need for allocating new memory for
- * Strings.- * - * The actual algorithm generated for scanning has, of course, not been - * modified.
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
CSharpTokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
.
- * You should hand-delete the second of each definition (the ones
- * generated by the lexer), as these generated methods modify the input
- * buffer, which we'll never have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would
- * with any other TokenMaker
instance.text
. This method must be implemented by
- * subclasses so they can correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing
- * the syntax highlighted text.
- */
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
-
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
-
- // Start off in the proper state.
- int state = Token.NULL;
- switch (initialTokenType) {
- case Token.LITERAL_STRING_DOUBLE_QUOTE:
- state = VERBATIMSTRING;
- start = text.offset;
- break;
- case Token.COMMENT_MULTILINE:
- state = DELIMITEDCOMMENT;
- start = text.offset;
- break;
- default:
- state = Token.NULL;
- }
-
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
-
- }
-
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise
- * false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos>=s.offset+s.count;
- }
-
-
- /**
- * Resets the scanner to read from a new input stream.
- * Does not close the old reader.
- *
- * All internal variables are reset, the old input stream
- * cannot be reused (internal buffer is discarded and lost).
- * Lexical state is set to YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill
- * no longer "refills" the buffer (since the way we do it, it's always
- * "full" the first time through, since it points to the segment's
- * array). So, we assign zzEndRead here.
- */
- //zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtBOL = true;
- zzAtEOF = false;
- }
-
-
-%}
-
-/* C1.1 - Line terminators. */
-NewlineCharacter = ([\n])
-
-/* C.1.2 - Whitespace. */
-Whitespace = ([\t ]+)
-
-/* C.1.3 - Comments */
-InputCharacter = ([^\n])
-InputCharacters = ({InputCharacter}+)
-DocumentationCommentStart = ("///")
-SingleLineComment = ("//"([^/]{InputCharacters}?)?)
-DelimitedCommentStart = ("/*")
-DelimitedCommentEnd = ("*/")
-
-/* C.1.5 - Unicode character escape sequences. */
-UnicodeEscape1 = ("\\u"{HexDigit}{HexDigit}{HexDigit}{HexDigit})
-UnicodeEscape2 = ("\\U"{HexDigit}{HexDigit}{HexDigit}{HexDigit}{HexDigit}{HexDigit}{HexDigit}{HexDigit})
-UnicodeEscapeSequence = ({UnicodeEscape1}|{UnicodeEscape2})
-
-/* C1.6 - Identifiers. */
-LetterCharacter = ([A-Za-z]) /* Not accurate - many more Unicode letters, Unicode escapes */
-/*
-CombiningCharacter = ()
-*/
-DecimalDigitCharacter = ([0-9])
-ConnectingCharacter = ([_\-])
-/*
-FormattingCharacter = ()
-*/
-/*
-IdentifierPartCharacter = ({LetterCharacter}|{DecimalDigitCharacter}|{ConnectingCharacter}|{CombiningCharacter}|{FormattingCharacter})
-*/
-IdentifierPartCharacter = ({LetterCharacter}|{DecimalDigitCharacter}|{ConnectingCharacter})
-IdentifierPartCharacters = ({IdentifierPartCharacter}+)
-IdentifierStartCharacter = ({LetterCharacter}|[_])
-IdentifierOrKeyword = ({IdentifierStartCharacter}{IdentifierPartCharacters}?)
-Identifier = ("@"?{IdentifierOrKeyword})
-/* NOTE: The two below aren't from the C# spec, but we add them so we can */
-/* highlight errors. */
-NonSeparator = (([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\']|"#"|"\\"))
-ErrorIdentifier = ({NonSeparator}+)
-
-/* C1.8 - Literals. */
-BooleanLiteral = ("true"|"false")
-DecimalDigit = ([0-9])
-DecimalDigits = ({DecimalDigit}+)
-IntegerTypeSuffix = (([uU][lL]?)|([lL][uU]?))
-DecimalIntegerLiteral = ({DecimalDigits}{IntegerTypeSuffix}?)
-HexDigit = ([0-9A-Fa-f])
-HexDigits = ({HexDigit}+)
-HexadecimalIntegerLiteral = ("0"[xX]{HexDigits}{IntegerTypeSuffix}?)
-Sign = ([+\-])
-ExponentPart = ([eE]{Sign}?{DecimalDigits})
-RealTypeSuffix = ([fFdDmM])
-RealHelper1 = ({DecimalDigits}"."{DecimalDigits}{ExponentPart}?{RealTypeSuffix}?)
-RealHelper2 = ("."{DecimalDigits}{ExponentPart}?{RealTypeSuffix}?)
-RealHelper3 = ({DecimalDigits}{ExponentPart}{RealTypeSuffix}?)
-RealHelper4 = ({DecimalDigits}{RealTypeSuffix})
-RealLiteral = ({RealHelper1}|{RealHelper2}|{RealHelper3}|{RealHelper4})
-ErrorNumberFormat = (({DecimalIntegerLiteral}|{HexadecimalIntegerLiteral}|{RealLiteral}){NonSeparator}+)
-SingleCharacter = ([^\'\\\n])
-SimpleEscapeSequence = ("\\"[\'\"\\0abfnrtv])
-HexadecimalEscapeSequence = ("\\x"{HexDigit}{HexDigit}?{HexDigit}?{HexDigit}?)
-Character = ({SingleCharacter}|{SimpleEscapeSequence}|{HexadecimalEscapeSequence}|{UnicodeEscapeSequence})
-UnclosedCharacterLiteral = ("'"{Character})
-CharacterLiteral = ({UnclosedCharacterLiteral}"'")
-ErrorUnclosedCharacterLiteral = ("'"[^\'\n]*)
-ErrorCharacterLiteral = ("''"|{ErrorUnclosedCharacterLiteral}[\'])
-QuoteEscapeSequence = ("\"\"")
-SingleVerbatimStringLiteralCharacter = ([^\"])
-VerbatimStringLiteralStart = ("@\"")
-SingleRegularStringLiteralCharacter = ([^\"\\\n])
-RegularStringLiteralCharacter = ({SingleRegularStringLiteralCharacter}|{SimpleEscapeSequence}|{HexadecimalEscapeSequence}|{UnicodeEscapeSequence})
-RegularStringLiteralCharacters = ({RegularStringLiteralCharacter}+)
-RegularStringLiteral = ([\"]{RegularStringLiteralCharacters}?[\"])
-UnclosedRegularStringLiteral = ([\"]([\\].|[^\\\"])*[^\"]?)
-ErrorRegularStringLiteral = ({UnclosedRegularStringLiteral}[\"])
-
-/* C.1.9 - Operators and Punctuators. */
-OOPHelper1 = (":")
-OOPHelper2 = ("+"|"-"|"*"|"/"|"%"|"&"|"|"|"^"|"!"|"~")
-OOPHelper3 = ("="|"<"|">"|"?"|"++"|"--"|"&&"|"||"|"<<"|">>")
-OOPHelper4 = ("=="|"!="|"<="|">="|"+="|"-="|"*="|"/="|"%="|"&=")
-OOPHelper5 = ("|="|"^="|"<<="|">>="|"->")
-OperatorOrPunctuator = ({OOPHelper1}|{OOPHelper2}|{OOPHelper3}|{OOPHelper4}|{OOPHelper5})
-/* NOTE: We distinguish between operators and separators (punctuators), but */
-/* the C# spec doesn't, so the stuff below isn't in the spec. */
-Separator = ([\{\}\[\]\(\)])
-Separator2 = ([,;])
-
-/* C.1.10 - Pre-processing Directives. */
-/* NOTE: We don't do ALL of the PP stuff here as it's unnecessary */
-/* for us to know the difference between declarations, diagnostics, */
-/* regions, etc. */
-ConditionalSymbol = ({IdentifierOrKeyword}) /* Not correct - excludes "true" and "false". */
-PPNewLine = ({Whitespace}?{SingleLineComment}?{NewlineCharacter})
-PPPrimaryExpression = ({IdentifierOrKeyword}|({Whitespace}?{PPExpression}{Whitespace}?))
-PPUnaryExpression = ({PPPrimaryExpression}|("!"{Whitespace}?{PPUnaryExpression}))
-PPEqualityExpression = ({PPUnaryExpression}|({Whitespace}?"=="{Whitespace}?{PPUnaryExpression})|({Whitespace}?"!="{Whitespace}?{PPUnaryExpression}))
-PPAndExpression = ({PPEqualityExpression}|({Whitespace}?"&&"{Whitespace}?{PPEqualityExpression}))
-PPOrExpression = ({PPAndExpression}|({Whitespace}?"||"{Whitespace}?{PPAndExpression}))
-PPExpression = ({Whitespace}?{PPOrExpression}{Whitespace}?)
-PPWord = ("define"|"undef"|"if"|"elif"|"else"|"endif"|"line"|"error"|"warning"|"region"|"endregion")
-PPDirective = ({Whitespace}?"#"{Whitespace}?{PPWord}{InputCharacter}*)
-
-/* URL matching, for comments (not in C# spec) */
-URLGenDelim = ([:\/\?#\[\]@])
-URLSubDelim = ([\!\$&'\(\)\*\+,;=])
-URLUnreserved = ([A-Za-z_]|{DecimalDigitCharacter}|[\-\.\~])
-URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
-URLCharacters = ({URLCharacter}*)
-URLEndCharacter = ([\/\$]|[A-Za-z0-9])
-URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
-
-
-%state DELIMITEDCOMMENT
-%state DOCUMENTCOMMENT
-%state VERBATIMSTRING
-
-%%
-
-AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around). We can
- * achieve this because RText always scans exactly 1 line of tokens at a time,
- * and hands the scanner this line as an array of characters (a Segment really).
- * Since tokens contain pointers to char arrays instead of Strings holding their
- * contents, there is no need for allocating new memory for Strings.
- * - * - * The actual algorithm generated for scanning has, of course, not been - * modified. - *
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
CSharpTokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
. You
- * should hand-delete the second of each definition (the ones generated by the
- * lexer), as these generated methods modify the input buffer, which we'll never
- * have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would with
- * any other TokenMaker
instance.aState
- */
- private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
- private static final String ZZ_ATTRIBUTE_PACKED_0 = "\2\0\3\1\1\11\10\1\1\11\17\1\1\11\4\1"
- + "\2\11\11\1\1\11\5\1\1\11\5\1\1\11\1\1" + "\1\0\1\1\1\11\12\1\1\0\1\11\40\1\1\11"
- + "\4\1\1\11\27\1\1\11\7\0\1\11\2\0\1\11" + "\7\0\1\1\1\11\7\1\1\0\43\1\1\11\10\1"
- + "\1\11\33\1\20\0\54\1\1\0\1\1\2\0\1\1" + "\7\0\32\1\7\0\16\1\2\0\4\1\1\0\1\1";
-
- private static int[] zzUnpackAttribute() {
- int[] result = new int[364];
- int offset = 0;
- offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
- return result;
- }
-
- private static int zzUnpackAttribute(String packed, int offset, int[] result) {
- int i = 0; /* index in packed string */
- int j = offset; /* index in unpacked array */
- int l = packed.length();
- while (i < l) {
- int count = packed.charAt(i++);
- int value = packed.charAt(i++);
- do
- result[j++] = value;
- while (--count > 0);
- }
- return j;
- }
-
- /** the input device */
- private java.io.Reader zzReader;
- /** the current state of the DFA */
- private int zzState;
- /** the current lexical state */
- private int zzLexicalState = YYINITIAL;
- /**
- * this buffer contains the current text to be matched and is the source of the
- * yytext() string
- */
- private char zzBuffer[];
- /** the textposition at the last accepting state */
- private int zzMarkedPos;
- /** the current text position in the buffer */
- private int zzCurrentPos;
- /** startRead marks the beginning of the yytext() string in the buffer */
- private int zzStartRead;
- /**
- * endRead marks the last character in the buffer, that has been read from input
- */
- private int zzEndRead;
- /** zzAtEOF == true <=> the scanner is at the EOF */
- private boolean zzAtEOF;
- /* user code: */
-
- /**
- * Constructor. This must be here because JFlex does not generate a no-parameter
- * constructor.
- */
- public CSharpTokenMaker() {
- super();
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- * @see #addToken(int, int, int)
- */
- private void addHyperlinkToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so, true);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int tokenType) {
- addToken(zzStartRead, zzMarkedPos - 1, tokenType);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param array The character array.
- * @param start The starting offset in the array.
- * @param end The ending offset in the array.
- * @param tokenType The token's type.
- * @param startOffset The offset in the document at which this token occurs.
- */
- @Override
- public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
- super.addToken(array, start, end, tokenType, startOffset);
- zzStartRead = zzMarkedPos;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String[] getLineCommentStartAndEnd(int languageIndex) {
- return new String[] { "//", null };
- }
-
- /**
- * Returns the first token in the linked list of tokens generated from
- * text
. This method must be implemented by subclasses so they can
- * correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing the syntax
- * highlighted text.
- */
- @Override
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
- // Start off in the proper state.
- int state = Token.NULL;
- switch (initialTokenType) {
- case Token.LITERAL_STRING_DOUBLE_QUOTE:
- state = VERBATIMSTRING;
- start = text.offset;
- break;
- case Token.COMMENT_MULTILINE:
- state = DELIMITEDCOMMENT;
- start = text.offset;
- break;
- default:
- state = Token.NULL;
- }
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
- }
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos >= s.offset + s.count;
- }
-
- /**
- * Resets the scanner to read from a new input stream. Does not close the old
- * reader.
- *
- * All internal variables are reset, the old input stream cannot be
- * reused (internal buffer is discarded and lost). Lexical state is set to
- * YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(java.io.Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill no longer
- * "refills" the buffer (since the way we do it, it's always "full" the first
- * time through, since it points to the segment's array). So, we assign
- * zzEndRead here.
- */
- // zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtEOF = false;
- }
-
- /**
- * Creates a new scanner There is also a java.io.InputStream version of this
- * constructor.
- *
- * @param in the java.io.Reader to read input from.
- */
- public CSharpTokenMaker(java.io.Reader in) {
- this.zzReader = in;
- }
-
- /**
- * Creates a new scanner. There is also java.io.Reader version of this
- * constructor.
- *
- * @param in the java.io.Inputstream to read input from.
- */
- public CSharpTokenMaker(java.io.InputStream in) {
- this(new java.io.InputStreamReader(in));
- }
-
- /**
- * Unpacks the compressed character translation table.
- *
- * @param packed the packed character translation table
- * @return the unpacked character translation table
- */
- private static char[] zzUnpackCMap(String packed) {
- char[] map = new char[0x10000];
- int i = 0; /* index in packed string */
- int j = 0; /* index in unpacked array */
- while (i < 158) {
- int count = packed.charAt(i++);
- char value = packed.charAt(i++);
- do
- map[j++] = value;
- while (--count > 0);
- }
- return map;
- }
-
- /**
- * Closes the input stream.
- */
- public final void yyclose() throws java.io.IOException {
- zzAtEOF = true; /* indicate end of file */
- zzEndRead = zzStartRead; /* invalidate buffer */
- if (zzReader != null)
- zzReader.close();
- }
-
- /**
- * Returns the current lexical state.
- */
- public final int yystate() {
- return zzLexicalState;
- }
-
- /**
- * Enters a new lexical state
- *
- * @param newState the new lexical state
- */
- @Override
- public final void yybegin(int newState) {
- zzLexicalState = newState;
- }
-
- /**
- * Returns the text matched by the current regular expression.
- */
- public final String yytext() {
- return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
- }
-
- /**
- * Returns the character at position pos from the matched text.
- *
- * It is equivalent to yytext().charAt(pos), but faster
- *
- * @param pos the position of the character to fetch. A value from 0 to
- * yylength()-1.
- *
- * @return the character at position pos
- */
- public final char yycharat(int pos) {
- return zzBuffer[zzStartRead + pos];
- }
-
- /**
- * Returns the length of the matched text region.
- */
- public final int yylength() {
- return zzMarkedPos - zzStartRead;
- }
-
- /**
- * Reports an error that occured while scanning.
- *
- * In a wellformed scanner (no or only correct usage of yypushback(int) and a
- * match-all fallback rule) this method will only be called with things that
- * "Can't Possibly Happen". If this method is called, something is seriously
- * wrong (e.g. a JFlex bug producing a faulty scanner etc.).
- *
- * Usual syntax/scanner level error handling should be done in error fallback
- * rules.
- *
- * @param errorCode the code of the errormessage to display
- */
- private void zzScanError(int errorCode) {
- String message;
- try {
- message = ZZ_ERROR_MSG[errorCode];
- } catch (ArrayIndexOutOfBoundsException e) {
- message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
- }
- throw new Error(message);
- }
-
- /**
- * Pushes the specified amount of characters back into the input stream.
- *
- * They will be read again by then next call of the scanning method
- *
- * @param number the number of characters to be read again. This number must not
- * be greater than yylength()!
- */
- public void yypushback(int number) {
- if (number > yylength())
- zzScanError(ZZ_PUSHBACK_2BIG);
- zzMarkedPos -= number;
- }
-
- /**
- * Resumes scanning until the next regular expression is matched, the end of
- * input is encountered or an I/O-Error occurs.
- *
- * @return the next token
- * @exception java.io.IOException if any I/O-Error occurs
- */
- public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
- int zzInput;
- int zzAction;
- // cached fields:
- int zzCurrentPosL;
- int zzMarkedPosL;
- int zzEndReadL = zzEndRead;
- char[] zzBufferL = zzBuffer;
- char[] zzCMapL = ZZ_CMAP;
- int[] zzTransL = ZZ_TRANS;
- int[] zzRowMapL = ZZ_ROWMAP;
- int[] zzAttrL = ZZ_ATTRIBUTE;
- while (true) {
- zzMarkedPosL = zzMarkedPos;
- zzAction = -1;
- zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
- zzState = zzLexicalState;
- zzForAction: {
- while (true) {
- if (zzCurrentPosL < zzEndReadL)
- zzInput = zzBufferL[zzCurrentPosL++];
- else if (zzAtEOF) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- // store back cached positions
- zzCurrentPos = zzCurrentPosL;
- zzMarkedPos = zzMarkedPosL;
- boolean eof = zzRefill();
- // get translated positions and possibly new buffer
- zzCurrentPosL = zzCurrentPos;
- zzMarkedPosL = zzMarkedPos;
- zzBufferL = zzBuffer;
- zzEndReadL = zzEndRead;
- if (eof) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- zzInput = zzBufferL[zzCurrentPosL++];
- }
- }
- int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
- if (zzNext == -1)
- break zzForAction;
- zzState = zzNext;
- int zzAttributes = zzAttrL[zzState];
- if ((zzAttributes & 1) == 1) {
- zzAction = zzState;
- zzMarkedPosL = zzCurrentPosL;
- if ((zzAttributes & 8) == 8)
- break zzForAction;
- }
- }
- }
- // store back cached position
- zzMarkedPos = zzMarkedPosL;
- switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
- case 35: {
- int temp = zzStartRead;
- addToken(start, zzStartRead - 1, Token.COMMENT_DOCUMENTATION);
- addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_DOCUMENTATION);
- start = zzMarkedPos;
- }
- case 36:
- break;
- case 28: {
- addToken(Token.PREPROCESSOR);
- }
- case 37:
- break;
- case 3: {
- addNullToken();
- return firstToken;
- }
- case 38:
- break;
- case 30: {
- addToken(Token.LITERAL_CHAR);
- }
- case 39:
- break;
- case 25: {
- yybegin(YYINITIAL);
- addToken(start, zzStartRead + 1, Token.COMMENT_MULTILINE);
- }
- case 40:
- break;
- case 4: {
- addToken(Token.WHITESPACE);
- }
- case 41:
- break;
- case 29: {
- addToken(Token.LITERAL_NUMBER_HEXADECIMAL);
- }
- case 42:
- break;
- case 22: {
- addToken(Token.ERROR_CHAR); /*
- * addNullToken(); return firstToken;
- */
- }
- case 43:
- break;
- case 31: {
- addToken(Token.ERROR_STRING_DOUBLE);
- }
- case 44:
- break;
- case 19: {
- addToken(Token.LITERAL_NUMBER_FLOAT);
- }
- case 45:
- break;
- case 21: {
- addToken(Token.RESERVED_WORD);
- }
- case 46:
- break;
- case 10: {
- addToken(Token.SEPARATOR);
- }
- case 47:
- break;
- case 12: {
- addToken(start, zzStartRead - 1, Token.COMMENT_DOCUMENTATION);
- addNullToken();
- return firstToken;
- }
- case 48:
- break;
- case 6: {
- addToken(Token.IDENTIFIER);
- }
- case 49:
- break;
- case 13: {
- int temp = zzStartRead;
- addToken(start, zzStartRead - 1, Token.COMMENT_DOCUMENTATION);
- addToken(temp, zzEndRead, Token.PREPROCESSOR);
- addNullToken();
- return firstToken;
- }
- case 50:
- break;
- case 8: {
- addToken(Token.ERROR_CHAR);
- addNullToken();
- return firstToken;
- }
- case 51:
- break;
- case 9: {
- addToken(Token.ERROR_STRING_DOUBLE);
- addNullToken();
- return firstToken;
- }
- case 52:
- break;
- case 32: {
- addToken(Token.DATA_TYPE);
- }
- case 53:
- break;
- case 2: {
- addToken(Token.ERROR_IDENTIFIER);
- }
- case 54:
- break;
- case 23: {
- addToken(Token.ERROR_CHAR);
- }
- case 55:
- break;
- case 33: {
- addToken(Token.LITERAL_BOOLEAN);
- }
- case 56:
- break;
- case 20: {
- start = zzMarkedPos - 2;
- yybegin(VERBATIMSTRING);
- }
- case 57:
- break;
- case 24: {
- addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
- }
- case 58:
- break;
- case 14: {
- addToken(start, zzStartRead - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
- return firstToken;
- }
- case 59:
- break;
- case 34: {
- int temp = zzStartRead;
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_MULTILINE);
- start = zzMarkedPos;
- }
- case 60:
- break;
- case 16: {
- addToken(Token.COMMENT_EOL);
- addNullToken();
- return firstToken;
- }
- case 61:
- break;
- case 18: {
- addToken(Token.ERROR_NUMBER_FORMAT);
- }
- case 62:
- break;
- case 27: {
- start = zzMarkedPos - 3;
- yybegin(DOCUMENTCOMMENT);
- }
- case 63:
- break;
- case 17: {
- start = zzMarkedPos - 2;
- yybegin(DELIMITEDCOMMENT);
- }
- case 64:
- break;
- case 7: {
- addToken(Token.LITERAL_NUMBER_DECIMAL_INT);
- }
- case 65:
- break;
- case 5: {
- addToken(Token.OPERATOR);
- }
- case 66:
- break;
- case 26: {
- int temp = zzStartRead;
- addToken(start, zzStartRead - 1, Token.COMMENT_DOCUMENTATION);
- addToken(temp, zzMarkedPos - 1, Token.PREPROCESSOR);
- start = zzMarkedPos;
- }
- case 67:
- break;
- case 15: {
- yybegin(YYINITIAL);
- addToken(start, zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE);
- }
- case 68:
- break;
- case 1: {
- }
- case 69:
- break;
- case 11: {
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- return firstToken;
- }
- case 70:
- break;
- default:
- if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
- zzAtEOF = true;
- switch (zzLexicalState) {
- case VERBATIMSTRING: {
- addToken(start, zzStartRead - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
- return firstToken;
- }
- case 365:
- break;
- case DOCUMENTCOMMENT: {
- addToken(start, zzStartRead - 1, Token.COMMENT_DOCUMENTATION);
- addNullToken();
- return firstToken;
- }
- case 366:
- break;
- case YYINITIAL: {
- addNullToken();
- return firstToken;
- }
- case 367:
- break;
- case DELIMITEDCOMMENT: {
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- return firstToken;
- }
- case 368:
- break;
- default:
- return null;
- }
- } else {
- zzScanError(ZZ_NO_MATCH);
- }
- }
- }
- }
-}
diff --git a/src/org/fife/ui/rsyntaxtextarea/modes/CTokenMaker.flex b/src/org/fife/ui/rsyntaxtextarea/modes/CTokenMaker.flex
deleted file mode 100644
index 5a4ba1e..0000000
--- a/src/org/fife/ui/rsyntaxtextarea/modes/CTokenMaker.flex
+++ /dev/null
@@ -1,647 +0,0 @@
-/*
- * 11/13/2004
- *
- * CTokenMaker.java - An object that can take a chunk of text and
- * return a linked list of tokens representing it in the C programming
- * language.
- *
- * This library is distributed under a modified BSD license. See the included
- * RSyntaxTextArea.License.txt file for details.
- */
-package org.fife.ui.rsyntaxtextarea.modes;
-
-import java.io.*;
-import javax.swing.text.Segment;
-
-import org.fife.ui.rsyntaxtextarea.*;
-
-
-/**
- * Scanner for the C programming language.
- *
- * This implementation was created using
- * JFlex 1.4.1; however, the generated file
- * was modified for performance. Memory allocation needs to be almost
- * completely removed to be competitive with the handwritten lexers (subclasses
- * of AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around).
- * We can achieve this because RText always scans exactly 1 line of tokens at a
- * time, and hands the scanner this line as an array of characters (a Segment
- * really). Since tokens contain pointers to char arrays instead of Strings
- * holding their contents, there is no need for allocating new memory for
- * Strings.- * - * The actual algorithm generated for scanning has, of course, not been - * modified.
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
CTokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
.
- * You should hand-delete the second of each definition (the ones
- * generated by the lexer), as these generated methods modify the input
- * buffer, which we'll never have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would
- * with any other TokenMaker
instance.text
. This method must be implemented by
- * subclasses so they can correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing
- * the syntax highlighted text.
- */
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
-
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
-
- // Start off in the proper state.
- int state = Token.NULL;
- switch (initialTokenType) {
- case Token.COMMENT_MULTILINE:
- state = MLC;
- start = text.offset;
- break;
- default:
- state = Token.NULL;
- }
-
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
-
- }
-
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise
- * false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos>=s.offset+s.count;
- }
-
-
- /**
- * Resets the scanner to read from a new input stream.
- * Does not close the old reader.
- *
- * All internal variables are reset, the old input stream
- * cannot be reused (internal buffer is discarded and lost).
- * Lexical state is set to YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill
- * no longer "refills" the buffer (since the way we do it, it's always
- * "full" the first time through, since it points to the segment's
- * array). So, we assign zzEndRead here.
- */
- //zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtBOL = true;
- zzAtEOF = false;
- }
-
-
-%}
-
-Letter = [A-Za-z]
-LetterOrUnderscore = ({Letter}|[_])
-Digit = [0-9]
-HexDigit = {Digit}|[A-Fa-f]
-OctalDigit = [0-7]
-Exponent = [eE][+-]?{Digit}+
-
-PreprocessorWord = define|elif|else|endif|error|if|ifdef|ifndef|include|line|pragma|undef
-
-Trigraph = ("??="|"??("|"??)"|"??/"|"??'"|"??<"|"??>"|"??!"|"??-")
-
-OctEscape1 = ([\\]{OctalDigit})
-OctEscape2 = ([\\]{OctalDigit}{OctalDigit})
-OctEscape3 = ([\\][0-3]{OctalDigit}{OctalDigit})
-OctEscape = ({OctEscape1}|{OctEscape2}|{OctEscape3})
-HexEscape = ([\\][xX]{HexDigit}{HexDigit})
-
-AnyChrChr = ([^\'\n\\])
-Escape = ([\\]([abfnrtv\'\"\?\\0e]))
-UnclosedCharLiteral = ([\']({Escape}|{OctEscape}|{HexEscape}|{Trigraph}|{AnyChrChr}))
-CharLiteral = ({UnclosedCharLiteral}[\'])
-ErrorUnclosedCharLiteral = ([\'][^\'\n]*)
-ErrorCharLiteral = (([\'][\'])|{ErrorUnclosedCharLiteral}[\'])
-AnyStrChr = ([^\"\n\\])
-FalseTrigraph = (("?"(("?")*)[^\=\(\)\/\'\<\>\!\-\\\?\"\n])|("?"[\=\(\)\/\'\<\>\!\-]))
-StringLiteral = ([\"]((((("?")*)({Escape}|{OctEscape}|{HexEscape}|{Trigraph}))|{FalseTrigraph}|{AnyStrChr})*)(("?")*)[\"])
-UnclosedStringLiteral = ([\"]([\\].|[^\\\"])*[^\"]?)
-ErrorStringLiteral = ({UnclosedStringLiteral}[\"])
-
-
-LineTerminator = \n
-WhiteSpace = [ \t\f]
-
-MLCBegin = "/*"
-MLCEnd = "*/"
-LineCommentBegin = "//"
-
-NonFloatSuffix = (([uU][lL]?)|([lL][uU]?))
-IntegerLiteral = ({Digit}+{Exponent}?{NonFloatSuffix}?)
-HexLiteral = ("0"[xX]{HexDigit}+{NonFloatSuffix}?)
-FloatLiteral = ((({Digit}*[\.]{Digit}+)|({Digit}+[\.]{Digit}*)){Exponent}?[fFlL]?)
-ErrorNumberFormat = (({IntegerLiteral}|{HexLiteral}|{FloatLiteral}){NonSeparator}+)
-
-NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\']|"#")
-Identifier = ({LetterOrUnderscore}({LetterOrUnderscore}|{Digit}|[$])*)
-ErrorIdentifier = ({NonSeparator}+)
-
-
-URLGenDelim = ([:\/\?#\[\]@])
-URLSubDelim = ([\!\$&'\(\)\*\+,;=])
-URLUnreserved = ({LetterOrUnderscore}|{Digit}|[\-\.\~])
-URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
-URLCharacters = ({URLCharacter}*)
-URLEndCharacter = ([\/\$]|{Letter}|{Digit})
-URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
-
-%state MLC
-%state EOL_COMMENT
-
-%%
-
-AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around). We can
- * achieve this because RText always scans exactly 1 line of tokens at a time,
- * and hands the scanner this line as an array of characters (a Segment really).
- * Since tokens contain pointers to char arrays instead of Strings holding their
- * contents, there is no need for allocating new memory for Strings.
- * - * - * The actual algorithm generated for scanning has, of course, not been - * modified. - *
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
CTokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
. You
- * should hand-delete the second of each definition (the ones generated by the
- * lexer), as these generated methods modify the input buffer, which we'll never
- * have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would with
- * any other TokenMaker
instance.aState
- */
- private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
- private static final String ZZ_ATTRIBUTE_PACKED_0 = "\3\0\25\1\1\11\6\1\1\11\6\1\1\11\1\1"
- + "\2\11\7\1\1\11\5\1\1\11\105\1\1\0\2\11" + "\2\1\1\11\3\1\1\11\16\1\1\0\11\1\2\0"
- + "\1\11\6\0\6\1\1\0\122\1\1\11\7\1\1\11" + "\20\1\6\0\10\1\10\0\6\1\1\0\122\1\4\0"
- + "\1\1\4\0\10\1\2\0\1\1\2\0\56\1\7\0" + "\7\1\4\0\15\1\1\11\3\0\4\1\2\0\1\1";
-
- private static int[] zzUnpackAttribute() {
- int[] result = new int[503];
- int offset = 0;
- offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
- return result;
- }
-
- private static int zzUnpackAttribute(String packed, int offset, int[] result) {
- int i = 0; /* index in packed string */
- int j = offset; /* index in unpacked array */
- int l = packed.length();
- while (i < l) {
- int count = packed.charAt(i++);
- int value = packed.charAt(i++);
- do
- result[j++] = value;
- while (--count > 0);
- }
- return j;
- }
-
- /** the input device */
- private java.io.Reader zzReader;
- /** the current state of the DFA */
- private int zzState;
- /** the current lexical state */
- private int zzLexicalState = YYINITIAL;
- /**
- * this buffer contains the current text to be matched and is the source of the
- * yytext() string
- */
- private char zzBuffer[];
- /** the textposition at the last accepting state */
- private int zzMarkedPos;
- /** the current text position in the buffer */
- private int zzCurrentPos;
- /** startRead marks the beginning of the yytext() string in the buffer */
- private int zzStartRead;
- /**
- * endRead marks the last character in the buffer, that has been read from input
- */
- private int zzEndRead;
- /** zzAtEOF == true <=> the scanner is at the EOF */
- private boolean zzAtEOF;
- /* user code: */
-
- /**
- * Constructor. This must be here because JFlex does not generate a no-parameter
- * constructor.
- */
- public CTokenMaker() {
- super();
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- * @see #addToken(int, int, int)
- */
- private void addHyperlinkToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so, true);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int tokenType) {
- addToken(zzStartRead, zzMarkedPos - 1, tokenType);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param array The character array.
- * @param start The starting offset in the array.
- * @param end The ending offset in the array.
- * @param tokenType The token's type.
- * @param startOffset The offset in the document at which this token occurs.
- */
- @Override
- public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
- super.addToken(array, start, end, tokenType, startOffset);
- zzStartRead = zzMarkedPos;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String[] getLineCommentStartAndEnd(int languageIndex) {
- return new String[] { "//", null };
- }
-
- /**
- * Returns the first token in the linked list of tokens generated from
- * text
. This method must be implemented by subclasses so they can
- * correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing the syntax
- * highlighted text.
- */
- @Override
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
- // Start off in the proper state.
- int state = Token.NULL;
- switch (initialTokenType) {
- case Token.COMMENT_MULTILINE:
- state = MLC;
- start = text.offset;
- break;
- default:
- state = Token.NULL;
- }
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
- }
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos >= s.offset + s.count;
- }
-
- /**
- * Resets the scanner to read from a new input stream. Does not close the old
- * reader.
- *
- * All internal variables are reset, the old input stream cannot be
- * reused (internal buffer is discarded and lost). Lexical state is set to
- * YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill no longer
- * "refills" the buffer (since the way we do it, it's always "full" the first
- * time through, since it points to the segment's array). So, we assign
- * zzEndRead here.
- */
- // zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtEOF = false;
- }
-
- /**
- * Creates a new scanner There is also a java.io.InputStream version of this
- * constructor.
- *
- * @param in the java.io.Reader to read input from.
- */
- public CTokenMaker(java.io.Reader in) {
- this.zzReader = in;
- }
-
- /**
- * Creates a new scanner. There is also java.io.Reader version of this
- * constructor.
- *
- * @param in the java.io.Inputstream to read input from.
- */
- public CTokenMaker(java.io.InputStream in) {
- this(new java.io.InputStreamReader(in));
- }
-
- /**
- * Unpacks the compressed character translation table.
- *
- * @param packed the packed character translation table
- * @return the unpacked character translation table
- */
- private static char[] zzUnpackCMap(String packed) {
- char[] map = new char[0x10000];
- int i = 0; /* index in packed string */
- int j = 0; /* index in unpacked array */
- while (i < 184) {
- int count = packed.charAt(i++);
- char value = packed.charAt(i++);
- do
- map[j++] = value;
- while (--count > 0);
- }
- return map;
- }
-
- /**
- * Closes the input stream.
- */
- public final void yyclose() throws java.io.IOException {
- zzAtEOF = true; /* indicate end of file */
- zzEndRead = zzStartRead; /* invalidate buffer */
- if (zzReader != null)
- zzReader.close();
- }
-
- /**
- * Returns the current lexical state.
- */
- public final int yystate() {
- return zzLexicalState;
- }
-
- /**
- * Enters a new lexical state
- *
- * @param newState the new lexical state
- */
- @Override
- public final void yybegin(int newState) {
- zzLexicalState = newState;
- }
-
- /**
- * Returns the text matched by the current regular expression.
- */
- public final String yytext() {
- return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
- }
-
- /**
- * Returns the character at position pos from the matched text.
- *
- * It is equivalent to yytext().charAt(pos), but faster
- *
- * @param pos the position of the character to fetch. A value from 0 to
- * yylength()-1.
- *
- * @return the character at position pos
- */
- public final char yycharat(int pos) {
- return zzBuffer[zzStartRead + pos];
- }
-
- /**
- * Returns the length of the matched text region.
- */
- public final int yylength() {
- return zzMarkedPos - zzStartRead;
- }
-
- /**
- * Reports an error that occured while scanning.
- *
- * In a wellformed scanner (no or only correct usage of yypushback(int) and a
- * match-all fallback rule) this method will only be called with things that
- * "Can't Possibly Happen". If this method is called, something is seriously
- * wrong (e.g. a JFlex bug producing a faulty scanner etc.).
- *
- * Usual syntax/scanner level error handling should be done in error fallback
- * rules.
- *
- * @param errorCode the code of the errormessage to display
- */
- private void zzScanError(int errorCode) {
- String message;
- try {
- message = ZZ_ERROR_MSG[errorCode];
- } catch (ArrayIndexOutOfBoundsException e) {
- message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
- }
- throw new Error(message);
- }
-
- /**
- * Pushes the specified amount of characters back into the input stream.
- *
- * They will be read again by then next call of the scanning method
- *
- * @param number the number of characters to be read again. This number must not
- * be greater than yylength()!
- */
- public void yypushback(int number) {
- if (number > yylength())
- zzScanError(ZZ_PUSHBACK_2BIG);
- zzMarkedPos -= number;
- }
-
- /**
- * Resumes scanning until the next regular expression is matched, the end of
- * input is encountered or an I/O-Error occurs.
- *
- * @return the next token
- * @exception java.io.IOException if any I/O-Error occurs
- */
- public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
- int zzInput;
- int zzAction;
- // cached fields:
- int zzCurrentPosL;
- int zzMarkedPosL;
- int zzEndReadL = zzEndRead;
- char[] zzBufferL = zzBuffer;
- char[] zzCMapL = ZZ_CMAP;
- int[] zzTransL = ZZ_TRANS;
- int[] zzRowMapL = ZZ_ROWMAP;
- int[] zzAttrL = ZZ_ATTRIBUTE;
- while (true) {
- zzMarkedPosL = zzMarkedPos;
- zzAction = -1;
- zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
- zzState = zzLexicalState;
- zzForAction: {
- while (true) {
- if (zzCurrentPosL < zzEndReadL)
- zzInput = zzBufferL[zzCurrentPosL++];
- else if (zzAtEOF) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- // store back cached positions
- zzCurrentPos = zzCurrentPosL;
- zzMarkedPos = zzMarkedPosL;
- boolean eof = zzRefill();
- // get translated positions and possibly new buffer
- zzCurrentPosL = zzCurrentPos;
- zzMarkedPosL = zzMarkedPos;
- zzBufferL = zzBuffer;
- zzEndReadL = zzEndRead;
- if (eof) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- zzInput = zzBufferL[zzCurrentPosL++];
- }
- }
- int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
- if (zzNext == -1)
- break zzForAction;
- zzState = zzNext;
- int zzAttributes = zzAttrL[zzState];
- if ((zzAttributes & 1) == 1) {
- zzAction = zzState;
- zzMarkedPosL = zzCurrentPosL;
- if ((zzAttributes & 8) == 8)
- break zzForAction;
- }
- }
- }
- // store back cached position
- zzMarkedPos = zzMarkedPosL;
- switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
- case 27: {
- addToken(Token.PREPROCESSOR);
- }
- case 31:
- break;
- case 7: {
- addNullToken();
- return firstToken;
- }
- case 32:
- break;
- case 24: {
- addToken(Token.LITERAL_CHAR);
- }
- case 33:
- break;
- case 21: {
- yybegin(YYINITIAL);
- addToken(start, zzStartRead + 1, Token.COMMENT_MULTILINE);
- }
- case 34:
- break;
- case 17: {
- start = zzMarkedPos - 2;
- yybegin(MLC);
- }
- case 35:
- break;
- case 9: {
- addToken(Token.WHITESPACE);
- }
- case 36:
- break;
- case 26: {
- addToken(Token.LITERAL_NUMBER_HEXADECIMAL);
- }
- case 37:
- break;
- case 18: {
- addToken(Token.ERROR_CHAR); /*
- * addNullToken(); return firstToken;
- */
- }
- case 38:
- break;
- case 25: {
- addToken(Token.ERROR_STRING_DOUBLE);
- }
- case 39:
- break;
- case 14: {
- addToken(Token.LITERAL_NUMBER_FLOAT);
- }
- case 40:
- break;
- case 15: {
- addToken(Token.RESERVED_WORD);
- }
- case 41:
- break;
- case 5: {
- addToken(Token.SEPARATOR);
- }
- case 42:
- break;
- case 2: {
- addToken(Token.IDENTIFIER);
- }
- case 43:
- break;
- case 12: {
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- addNullToken();
- return firstToken;
- }
- case 44:
- break;
- case 16: {
- start = zzMarkedPos - 2;
- yybegin(EOL_COMMENT);
- }
- case 45:
- break;
- case 22: {
- addToken(Token.FUNCTION);
- }
- case 46:
- break;
- case 6: {
- addToken(Token.ERROR_CHAR);
- addNullToken();
- return firstToken;
- }
- case 47:
- break;
- case 8: {
- addToken(Token.ERROR_STRING_DOUBLE);
- addNullToken();
- return firstToken;
- }
- case 48:
- break;
- case 23: {
- addToken(Token.DATA_TYPE);
- }
- case 49:
- break;
- case 1: {
- addToken(Token.ERROR_IDENTIFIER);
- }
- case 50:
- break;
- case 19: {
- addToken(Token.ERROR_CHAR);
- }
- case 51:
- break;
- case 20: {
- addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
- }
- case 52:
- break;
- case 29: {
- int temp = zzStartRead;
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_EOL);
- start = zzMarkedPos;
- }
- case 53:
- break;
- case 28: {
- int temp = zzStartRead;
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_MULTILINE);
- start = zzMarkedPos;
- }
- case 54:
- break;
- case 30: {
- addToken(Token.RESERVED_WORD_2);
- }
- case 55:
- break;
- case 13: {
- addToken(Token.ERROR_NUMBER_FORMAT);
- }
- case 56:
- break;
- case 3: {
- addToken(Token.LITERAL_NUMBER_DECIMAL_INT);
- }
- case 57:
- break;
- case 4: {
- addToken(Token.OPERATOR);
- }
- case 58:
- break;
- case 10: {
- }
- case 59:
- break;
- case 11: {
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- return firstToken;
- }
- case 60:
- break;
- default:
- if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
- zzAtEOF = true;
- switch (zzLexicalState) {
- case EOL_COMMENT: {
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- addNullToken();
- return firstToken;
- }
- case 504:
- break;
- case YYINITIAL: {
- addNullToken();
- return firstToken;
- }
- case 505:
- break;
- case MLC: {
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- return firstToken;
- }
- case 506:
- break;
- default:
- return null;
- }
- } else {
- zzScanError(ZZ_NO_MATCH);
- }
- }
- }
- }
-}
diff --git a/src/org/fife/ui/rsyntaxtextarea/modes/ClojureTokenMaker.flex b/src/org/fife/ui/rsyntaxtextarea/modes/ClojureTokenMaker.flex
deleted file mode 100644
index 7125d87..0000000
--- a/src/org/fife/ui/rsyntaxtextarea/modes/ClojureTokenMaker.flex
+++ /dev/null
@@ -1,561 +0,0 @@
-/*
- * 12/23/2010
- *
- * ClojureTokenMaker.java - Scanner for Clojure.
- *
- * This library is distributed under a modified BSD license. See the included
- * RSyntaxTextArea.License.txt file for details.
- */
-package org.fife.ui.rsyntaxtextarea.modes;
-
-import java.io.*;
-import javax.swing.text.Segment;
-
-import org.fife.ui.rsyntaxtextarea.*;
-
-
-/**
- * Scanner for the Clojure programming language.- * - * The original version of this class was graciously donated by the folks at the - * Fiji project. - * This version has been modified to fix a few issues. - * Its original location was - * here. - *
- *
- * This implementation was created using
- * JFlex 1.4.1; however, the generated file
- * was modified for performance. Memory allocation needs to be almost
- * completely removed to be competitive with the handwritten lexers (subclasses
- * of AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around).
- * We can achieve this because RText always scans exactly 1 line of tokens at a
- * time, and hands the scanner this line as an array of characters (a Segment
- * really). Since tokens contain pointers to char arrays instead of Strings
- * holding their contents, there is no need for allocating new memory for
- * Strings.
- * - * The actual algorithm generated for scanning has, of course, not been - * modified.
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
ClojureTokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
.
- * You should hand-delete the second of each definition (the ones
- * generated by the lexer), as these generated methods modify the input
- * buffer, which we'll never have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would
- * with any other TokenMaker
instance.text
. This method must be implemented by
- * subclasses so they can correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing
- * the syntax highlighted text.
- */
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
-
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
-
- // Start off in the proper state.
- int state = Token.NULL;
- switch (initialTokenType) {
- /*case Token.COMMENT_MULTILINE:
- state = MLC;
- start = text.offset;
- break;
- case Token.COMMENT_DOCUMENTATION:
- state = DOCCOMMENT;
- start = text.offset;
- break;*/
- case Token.LITERAL_STRING_DOUBLE_QUOTE:
- state = STRING;
- start = text.offset;
- break;
- default:
- state = Token.NULL;
- }
-
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
-
- }
-
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise
- * false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos>=s.offset+s.count;
- }
-
-
- /**
- * Resets the scanner to read from a new input stream.
- * Does not close the old reader.
- *
- * All internal variables are reset, the old input stream
- * cannot be reused (internal buffer is discarded and lost).
- * Lexical state is set to YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill
- * no longer "refills" the buffer (since the way we do it, it's always
- * "full" the first time through, since it points to the segment's
- * array). So, we assign zzEndRead here.
- */
- //zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtBOL = true;
- zzAtEOF = false;
- }
-
-
-%}
-
-
-LineCommentBegin = (";")
-Keyword = ([:][a-zA-Z?!\-+*/][a-zA-Z0-9?!\-+*/]*)
-NonzeroDigit = [1-9]
-Digit = ("0"|{NonzeroDigit})
-HexDigit = ({Digit}|[A-Fa-f])
-OctalDigit = ([0-7])
-EscapedSourceCharacter = ("u"{HexDigit}{HexDigit}{HexDigit}{HexDigit})
-Escape = ("\\"(([btnfr\"'\\])|([0123]{OctalDigit}?{OctalDigit}?)|({OctalDigit}{OctalDigit}?)|{EscapedSourceCharacter}))
-AnyCharacterButDoubleQuoteOrBackSlash = ([^\\\"\n])
-StringLiteralStart = ([\"])
-CharLiteral = ("\\."|"\\space"|"\\tab"|"\\newline")
-AnyCharacter = ([.]*)
-Separator = ([\(\)\{\}\[\]])
-NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\'])
-
-BooleanLiteral =("true"|"false")
-
-LineTerminator = (\n)
-WhiteSpace = ([ \t\f])
-
-IntegerHelper1 = (({NonzeroDigit}{Digit}*)|"0")
-IntegerHelper2 = ("0"(([xX]{HexDigit}+)|({OctalDigit}*)))
-IntegerLiteral = ({IntegerHelper1}[lL]?)
-HexLiteral = ({IntegerHelper2}[lL]?)
-FloatHelper1 = ([fFdD]?)
-FloatHelper2 = ([eE][+-]?{Digit}+{FloatHelper1})
-FloatLiteral1 = ({Digit}+"."({FloatHelper1}|{FloatHelper2}|{Digit}+({FloatHelper1}|{FloatHelper2})))
-FloatLiteral2 = ("."{Digit}+({FloatHelper1}|{FloatHelper2}))
-FloatLiteral3 = ({Digit}+{FloatHelper2})
-FloatLiteral = ({FloatLiteral1}|{FloatLiteral2}|{FloatLiteral3}|({Digit}+[fFdD]))
-ErrorNumberFormat = (({IntegerLiteral}|{HexLiteral}|{FloatLiteral}){NonSeparator}+)
-
-
-Nil = ("nil")
-Quote = (\('\|`\))
-Unquote = (\(\~@\|\~\))
-DispatchStart = ("#^"|"#^{")
-Dispatch = ({DispatchStart}[^\s\t\n;\"}]*([ \t\n;\"]|"}"))
-VarQuote = ("#'"[.]*[ \t\n;(\"])
-DefName = ([a-zA-Z0-9?!\-+*\./<>_]*)
-
-NonAssignmentOperator = ("+"|"-"|"<="|"^"|"<"|"*"|">="|"%"|">"|"/"|"!="|"?"|">>"|"!"|"&"|"=="|":"|">>"|"~"|">>>")
-AssignmentOperator = ("=")
-Operator = ({NonAssignmentOperator}|{AssignmentOperator})
-
-Letter = [A-Za-z]
-LetterOrUnderscore = ({Letter}|[_])
-Digit = [0-9]
-URLGenDelim = ([:\/\?#\[\]@])
-URLSubDelim = ([\!\$&'\(\)\*\+,;=])
-URLUnreserved = ({LetterOrUnderscore}|{Digit}|[\-\.\~])
-URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
-URLCharacters = ({URLCharacter}*)
-URLEndCharacter = ([\/\$]|{Letter}|{Digit})
-URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
-
-
-%state STRING
-%state EOL_COMMENT
-
-%%
-
-- * - * The original version of this class was graciously donated by the folks at the - * Fiji project. - * This version has been modified to fix a few issues. Its original location was - * here. - *
- *
- * This implementation was created using
- * JFlex 1.4.1; however, the generated file
- * was modified for performance. Memory allocation needs to be almost completely
- * removed to be competitive with the handwritten lexers (subclasses of
- * AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around). We can
- * achieve this because RText always scans exactly 1 line of tokens at a time,
- * and hands the scanner this line as an array of characters (a Segment really).
- * Since tokens contain pointers to char arrays instead of Strings holding their
- * contents, there is no need for allocating new memory for Strings.
- *
- * - * The actual algorithm generated for scanning has, of course, not been - * modified. - *
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
ClojureTokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
. You
- * should hand-delete the second of each definition (the ones generated by the
- * lexer), as these generated methods modify the input buffer, which we'll never
- * have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would with
- * any other TokenMaker
instance.aState
- */
- private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
- private static final String ZZ_ATTRIBUTE_PACKED_0 = "\1\1\2\0\2\11\10\1\2\11\14\1\1\11\4\1"
- + "\1\11\20\1\1\11\3\1\1\11\15\1\1\11\3\0" + "\72\1\4\0\37\1\2\11\4\0\6\1\3\0\106\1"
- + "\2\0\1\11\45\1\4\0\3\1\2\0\51\1\2\0" + "\31\1\1\0\1\1\1\0\1\1\2\0\62\1\2\0" + "\1\1\1\0\311\1";
-
- private static int[] zzUnpackAttribute() {
- int[] result = new int[627];
- int offset = 0;
- offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
- return result;
- }
-
- private static int zzUnpackAttribute(String packed, int offset, int[] result) {
- int i = 0; /* index in packed string */
- int j = offset; /* index in unpacked array */
- int l = packed.length();
- while (i < l) {
- int count = packed.charAt(i++);
- int value = packed.charAt(i++);
- do
- result[j++] = value;
- while (--count > 0);
- }
- return j;
- }
-
- /** the input device */
- private java.io.Reader zzReader;
- /** the current state of the DFA */
- private int zzState;
- /** the current lexical state */
- private int zzLexicalState = YYINITIAL;
- /**
- * this buffer contains the current text to be matched and is the source of the
- * yytext() string
- */
- private char zzBuffer[];
- /** the textposition at the last accepting state */
- private int zzMarkedPos;
- /** the current text position in the buffer */
- private int zzCurrentPos;
- /** startRead marks the beginning of the yytext() string in the buffer */
- private int zzStartRead;
- /**
- * endRead marks the last character in the buffer, that has been read from input
- */
- private int zzEndRead;
- /** zzAtEOF == true <=> the scanner is at the EOF */
- private boolean zzAtEOF;
- /* user code: */
-
- /**
- * Constructor. This must be here because JFlex does not generate a no-parameter
- * constructor.
- */
- public ClojureTokenMaker() {
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- * @see #addToken(int, int, int)
- */
- private void addHyperlinkToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so, true);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int tokenType) {
- addToken(zzStartRead, zzMarkedPos - 1, tokenType);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- * @see #addHyperlinkToken(int, int, int)
- */
- private void addToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so, false);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param array The character array.
- * @param start The starting offset in the array.
- * @param end The ending offset in the array.
- * @param tokenType The token's type.
- * @param startOffset The offset in the document at which this token occurs.
- * @param hyperlink Whether this token is a hyperlink.
- */
- @Override
- public void addToken(char[] array, int start, int end, int tokenType, int startOffset, boolean hyperlink) {
- super.addToken(array, start, end, tokenType, startOffset, hyperlink);
- zzStartRead = zzMarkedPos;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String[] getLineCommentStartAndEnd(int languageIndex) {
- return new String[] { ";", null };
- }
-
- /**
- * Returns the first token in the linked list of tokens generated from
- * text
. This method must be implemented by subclasses so they can
- * correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing the syntax
- * highlighted text.
- */
- @Override
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
- // Start off in the proper state.
- int state = Token.NULL;
- switch (initialTokenType) {
- /*
- * case Token.COMMENT_MULTILINE: state = MLC; start = text.offset; break; case
- * Token.COMMENT_DOCUMENTATION: state = DOCCOMMENT; start = text.offset; break;
- */
- case Token.LITERAL_STRING_DOUBLE_QUOTE:
- state = STRING;
- start = text.offset;
- break;
- default:
- state = Token.NULL;
- }
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
- }
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos >= s.offset + s.count;
- }
-
- /**
- * Resets the scanner to read from a new input stream. Does not close the old
- * reader.
- *
- * All internal variables are reset, the old input stream cannot be
- * reused (internal buffer is discarded and lost). Lexical state is set to
- * YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill no longer
- * "refills" the buffer (since the way we do it, it's always "full" the first
- * time through, since it points to the segment's array). So, we assign
- * zzEndRead here.
- */
- // zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtEOF = false;
- }
-
- /**
- * Creates a new scanner There is also a java.io.InputStream version of this
- * constructor.
- *
- * @param in the java.io.Reader to read input from.
- */
- public ClojureTokenMaker(java.io.Reader in) {
- this.zzReader = in;
- }
-
- /**
- * Creates a new scanner. There is also java.io.Reader version of this
- * constructor.
- *
- * @param in the java.io.Inputstream to read input from.
- */
- public ClojureTokenMaker(java.io.InputStream in) {
- this(new java.io.InputStreamReader(in));
- }
-
- /**
- * Unpacks the compressed character translation table.
- *
- * @param packed the packed character translation table
- * @return the unpacked character translation table
- */
- private static char[] zzUnpackCMap(String packed) {
- char[] map = new char[0x10000];
- int i = 0; /* index in packed string */
- int j = 0; /* index in unpacked array */
- while (i < 164) {
- int count = packed.charAt(i++);
- char value = packed.charAt(i++);
- do
- map[j++] = value;
- while (--count > 0);
- }
- return map;
- }
-
- /**
- * Closes the input stream.
- */
- public final void yyclose() throws java.io.IOException {
- zzAtEOF = true; /* indicate end of file */
- zzEndRead = zzStartRead; /* invalidate buffer */
- if (zzReader != null)
- zzReader.close();
- }
-
- /**
- * Returns the current lexical state.
- */
- public final int yystate() {
- return zzLexicalState;
- }
-
- /**
- * Enters a new lexical state
- *
- * @param newState the new lexical state
- */
- @Override
- public final void yybegin(int newState) {
- zzLexicalState = newState;
- }
-
- /**
- * Returns the text matched by the current regular expression.
- */
- public final String yytext() {
- return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
- }
-
- /**
- * Returns the character at position pos from the matched text.
- *
- * It is equivalent to yytext().charAt(pos), but faster
- *
- * @param pos the position of the character to fetch. A value from 0 to
- * yylength()-1.
- *
- * @return the character at position pos
- */
- public final char yycharat(int pos) {
- return zzBuffer[zzStartRead + pos];
- }
-
- /**
- * Returns the length of the matched text region.
- */
- public final int yylength() {
- return zzMarkedPos - zzStartRead;
- }
-
- /**
- * Reports an error that occured while scanning.
- *
- * In a wellformed scanner (no or only correct usage of yypushback(int) and a
- * match-all fallback rule) this method will only be called with things that
- * "Can't Possibly Happen". If this method is called, something is seriously
- * wrong (e.g. a JFlex bug producing a faulty scanner etc.).
- *
- * Usual syntax/scanner level error handling should be done in error fallback
- * rules.
- *
- * @param errorCode the code of the errormessage to display
- */
- private void zzScanError(int errorCode) {
- String message;
- try {
- message = ZZ_ERROR_MSG[errorCode];
- } catch (ArrayIndexOutOfBoundsException e) {
- message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
- }
- throw new Error(message);
- }
-
- /**
- * Pushes the specified amount of characters back into the input stream.
- *
- * They will be read again by then next call of the scanning method
- *
- * @param number the number of characters to be read again. This number must not
- * be greater than yylength()!
- */
- public void yypushback(int number) {
- if (number > yylength())
- zzScanError(ZZ_PUSHBACK_2BIG);
- zzMarkedPos -= number;
- }
-
- /**
- * Resumes scanning until the next regular expression is matched, the end of
- * input is encountered or an I/O-Error occurs.
- *
- * @return the next token
- * @exception java.io.IOException if any I/O-Error occurs
- */
- public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
- int zzInput;
- int zzAction;
- // cached fields:
- int zzCurrentPosL;
- int zzMarkedPosL;
- int zzEndReadL = zzEndRead;
- char[] zzBufferL = zzBuffer;
- char[] zzCMapL = ZZ_CMAP;
- int[] zzTransL = ZZ_TRANS;
- int[] zzRowMapL = ZZ_ROWMAP;
- int[] zzAttrL = ZZ_ATTRIBUTE;
- while (true) {
- zzMarkedPosL = zzMarkedPos;
- zzAction = -1;
- zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
- zzState = zzLexicalState;
- zzForAction: {
- while (true) {
- if (zzCurrentPosL < zzEndReadL)
- zzInput = zzBufferL[zzCurrentPosL++];
- else if (zzAtEOF) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- // store back cached positions
- zzCurrentPos = zzCurrentPosL;
- zzMarkedPos = zzMarkedPosL;
- boolean eof = zzRefill();
- // get translated positions and possibly new buffer
- zzCurrentPosL = zzCurrentPos;
- zzMarkedPosL = zzMarkedPos;
- zzBufferL = zzBuffer;
- zzEndReadL = zzEndRead;
- if (eof) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- zzInput = zzBufferL[zzCurrentPosL++];
- }
- }
- int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
- if (zzNext == -1)
- break zzForAction;
- zzState = zzNext;
- int zzAttributes = zzAttrL[zzState];
- if ((zzAttributes & 1) == 1) {
- zzAction = zzState;
- zzMarkedPosL = zzCurrentPosL;
- if ((zzAttributes & 8) == 8)
- break zzForAction;
- }
- }
- }
- // store back cached position
- zzMarkedPos = zzMarkedPosL;
- switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
- case 15: {
- addToken(Token.PREPROCESSOR);
- }
- case 26:
- break;
- case 6: {
- addNullToken();
- return firstToken;
- }
- case 27:
- break;
- case 19: {
- addToken(Token.LITERAL_CHAR);
- }
- case 28:
- break;
- case 9: {
- addToken(Token.WHITESPACE);
- }
- case 29:
- break;
- case 17: {
- addToken(Token.LITERAL_NUMBER_HEXADECIMAL);
- }
- case 30:
- break;
- case 18: {
- addToken(Token.LITERAL_NUMBER_FLOAT);
- }
- case 31:
- break;
- case 20: {
- addToken(Token.RESERVED_WORD);
- }
- case 32:
- break;
- case 22: {
- addToken(Token.VARIABLE);
- }
- case 33:
- break;
- case 8: {
- addToken(Token.SEPARATOR);
- }
- case 34:
- break;
- case 1: {
- addToken(Token.IDENTIFIER);
- }
- case 35:
- break;
- case 14: {
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- addNullToken();
- return firstToken;
- }
- case 36:
- break;
- case 21: {
- addToken(Token.FUNCTION);
- }
- case 37:
- break;
- case 23: {
- addToken(Token.DATA_TYPE);
- }
- case 38:
- break;
- case 11: { /* Skip escaped chars. */
- }
- case 39:
- break;
- case 2: {
- addToken(Token.ERROR_IDENTIFIER);
- }
- case 40:
- break;
- case 24: {
- addToken(Token.LITERAL_BOOLEAN);
- }
- case 41:
- break;
- case 12: {
- addToken(start, zzStartRead - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
- return firstToken;
- }
- case 42:
- break;
- case 25: {
- int temp = zzStartRead;
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_EOL);
- start = zzMarkedPos;
- }
- case 43:
- break;
- case 16: {
- addToken(Token.ERROR_NUMBER_FORMAT);
- }
- case 44:
- break;
- case 7: {
- start = zzMarkedPos - 1;
- yybegin(STRING);
- }
- case 45:
- break;
- case 3: {
- start = zzMarkedPos - 1;
- yybegin(EOL_COMMENT);
- }
- case 46:
- break;
- case 5: {
- addToken(Token.LITERAL_NUMBER_DECIMAL_INT);
- }
- case 47:
- break;
- case 4: {
- addToken(Token.OPERATOR);
- }
- case 48:
- break;
- case 13: {
- yybegin(YYINITIAL);
- addToken(start, zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE);
- }
- case 49:
- break;
- case 10: {
- }
- case 50:
- break;
- default:
- if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
- zzAtEOF = true;
- switch (zzLexicalState) {
- case EOL_COMMENT: {
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- addNullToken();
- return firstToken;
- }
- case 628:
- break;
- case STRING: {
- addToken(start, zzStartRead - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
- return firstToken;
- }
- case 629:
- break;
- case YYINITIAL: {
- addNullToken();
- return firstToken;
- }
- case 630:
- break;
- default:
- return null;
- }
- } else {
- zzScanError(ZZ_NO_MATCH);
- }
- }
- }
- }
-}
diff --git a/src/org/fife/ui/rsyntaxtextarea/modes/DTokenMaker.flex b/src/org/fife/ui/rsyntaxtextarea/modes/DTokenMaker.flex
deleted file mode 100644
index c23934d..0000000
--- a/src/org/fife/ui/rsyntaxtextarea/modes/DTokenMaker.flex
+++ /dev/null
@@ -1,663 +0,0 @@
-/*
- * 09/08/2014
- *
- * DTokenMaker.java - Scanner for the D programming language.
- *
- * This library is distributed under a modified BSD license. See the included
- * RSyntaxTextArea.License.txt file for details.
- */
-package org.fife.ui.rsyntaxtextarea.modes;
-
-import java.io.*;
-import javax.swing.text.Segment;
-
-import org.fife.ui.rsyntaxtextarea.*;
-
-
-/**
- * Scanner for the D programming language.
- *
- * This implementation was created using
- * JFlex 1.4.1; however, the generated file
- * was modified for performance. Memory allocation needs to be almost
- * completely removed to be competitive with the handwritten lexers (subclasses
- * of AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around).
- * We can achieve this because RText always scans exactly 1 line of tokens at a
- * time, and hands the scanner this line as an array of characters (a Segment
- * really). Since tokens contain pointers to char arrays instead of Strings
- * holding their contents, there is no need for allocating new memory for
- * Strings.
- * - * The actual algorithm generated for scanning has, of course, not been - * modified.
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
DTokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
.
- * You should hand-delete the second of each definition (the ones
- * generated by the lexer), as these generated methods modify the input
- * buffer, which we'll never have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would
- * with any other TokenMaker
instance.zzMarkedPos
.
- *
- * @param tokenType The token's type.
- */
- private void addEndToken(int tokenType) {
- addToken(zzMarkedPos,zzMarkedPos, tokenType);
- }
-
-
- private void addNestedMlcEndToken() {
- addEndToken(INTERNAL_IN_NESTABLE_MLC - nestedMlcDepth);
- }
-
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- * @see #addToken(int, int, int)
- */
- private void addHyperlinkToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start,end, tokenType, so, true);
- }
-
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int tokenType) {
- addToken(zzStartRead, zzMarkedPos-1, tokenType);
- }
-
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- * @see #addHyperlinkToken(int, int, int)
- */
- private void addToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start,end, tokenType, so, false);
- }
-
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param array The character array.
- * @param start The starting offset in the array.
- * @param end The ending offset in the array.
- * @param tokenType The token's type.
- * @param startOffset The offset in the document at which this token
- * occurs.
- * @param hyperlink Whether this token is a hyperlink.
- */
- @Override
- public void addToken(char[] array, int start, int end, int tokenType,
- int startOffset, boolean hyperlink) {
- super.addToken(array, start,end, tokenType, startOffset, hyperlink);
- zzStartRead = zzMarkedPos;
- }
-
-
- @Override
- public int getClosestStandardTokenTypeForInternalType(int type) {
- switch (type) {
- case INTERNAL_IN_NESTABLE_MLC:
- return TokenTypes.COMMENT_MULTILINE;
- }
- return type;
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String[] getLineCommentStartAndEnd(int languageIndex) {
- return new String[] { "//", null };
- }
-
-
- /**
- * Returns the first token in the linked list of tokens generated
- * from text
. This method must be implemented by
- * subclasses so they can correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing
- * the syntax highlighted text.
- */
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
-
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
- nestedMlcDepth = 0;
-
- // Start off in the proper state.
- int state = YYINITIAL;
- switch (initialTokenType) {
- case Token.LITERAL_BACKQUOTE:
- state = WYSIWYG_STRING_2;
- break;
- case Token.LITERAL_STRING_DOUBLE_QUOTE:
- state = WYSIWYG_STRING_1;
- break;
- case Token.COMMENT_MULTILINE:
- state = MLC;
- break;
- case Token.COMMENT_DOCUMENTATION:
- state = DOCCOMMENT;
- break;
- case INTERNAL_IN_NESTABLE_MLC:
- state = NESTABLE_MLC;
- break;
- default:
- if (initialTokenType<-1024) {
- int main = -(-initialTokenType & 0xffffff00);
- switch (main) {
- default: // Should never happen
- case INTERNAL_IN_NESTABLE_MLC:
- state = NESTABLE_MLC;
- break;
- }
- nestedMlcDepth = -initialTokenType&0xff;
- }
- else {
- state = YYINITIAL;
- }
- }
-
- start = text.offset;
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
-
- }
-
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise
- * false
.
- * @exception IOException if any I/O-Error occurs.
- */
- private boolean zzRefill() {
- return zzCurrentPos>=s.offset+s.count;
- }
-
-
- /**
- * Resets the scanner to read from a new input stream.
- * Does not close the old reader.
- *
- * All internal variables are reset, the old input stream
- * cannot be reused (internal buffer is discarded and lost).
- * Lexical state is set to YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill
- * no longer "refills" the buffer (since the way we do it, it's always
- * "full" the first time through, since it points to the segment's
- * array). So, we assign zzEndRead here.
- */
- //zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtBOL = true;
- zzAtEOF = false;
- }
-
-
-%}
-
-Letter = ([A-Za-z])
-LetterOrUnderscore = ({Letter}|"_")
-NonzeroDigit = ([1-9])
-BinaryDigit = ([0-1])
-Digit = ("0"|{NonzeroDigit})
-HexDigit = ({Digit}|[A-Fa-f])
-OctalDigit = ([0-7])
-AnyCharacterButApostropheOrBackSlash = ([^\\'])
-AnyCharacterButDoubleQuoteOrBackSlash = ([^\\\"\n])
-EscapedSourceCharacter = ("u"{HexDigit}{HexDigit}{HexDigit}{HexDigit})
-Escape = ("\\"(([btnfr\"'\\])|([0123]{OctalDigit}?{OctalDigit}?)|({OctalDigit}{OctalDigit}?)|{EscapedSourceCharacter}))
-NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\'\`]|"#"|"\\")
-IdentifierStart = ({LetterOrUnderscore}|"$")
-IdentifierPart = ({IdentifierStart}|{Digit}|("\\"{EscapedSourceCharacter}))
-
-LineTerminator = (\n)
-WhiteSpace = ([ \t\f])
-
-StringPostfix = ([cwd])
-CharLiteral = ([\']({AnyCharacterButApostropheOrBackSlash}|{Escape})[\']{StringPostfix}?)
-UnclosedCharLiteral = ([\'][^\'\n]*)
-ErrorCharLiteral = ({UnclosedCharLiteral}[\']{StringPostfix}?)
-StringLiteral = ([\"]({AnyCharacterButDoubleQuoteOrBackSlash}|{Escape})*[\"]{StringPostfix}?)
-UnclosedStringLiteral = ([\"]([\\].|[^\\\"])*[^\"]?)
-HexStringLiteral = ([x]{StringLiteral})
-UnclosedHexStringLiteral = ([x]{UnclosedStringLiteral})
-ErrorStringLiteral = ({UnclosedStringLiteral}[\"]{StringPostfix}?)
-WysiwygStringLiteralStart = ("r"[\"])
-WysiwygStringLiteralStart2 = ("`")
-
-MLCBegin = "/*"
-MLCEnd = "*/"
-DocCommentBegin = "/**"
-NestableMLCBegin = "/+"
-LineCommentBegin = "//"
-LineDocCommentBegin = "///"
-
-DigitOrUnderscore = ({Digit}|[_])
-DigitsAndUnderscoresEnd = ({DigitOrUnderscore}*{Digit})
-IntegerHelper = (({NonzeroDigit}{DigitsAndUnderscoresEnd}?)|"0")
-IntegerLiteral = ({IntegerHelper}[lL]?)
-
-BinaryDigitOrUnderscore = ({BinaryDigit}|[_])
-BinaryDigitsAndUnderscores = ({BinaryDigit}({BinaryDigitOrUnderscore}*{BinaryDigit})?)
-BinaryLiteral = ("0"[bB]{BinaryDigitsAndUnderscores})
-
-HexDigitOrUnderscore = ({HexDigit}|[_])
-HexDigitsAndUnderscores = ({HexDigit}({HexDigitOrUnderscore}*{HexDigit})?)
-OctalDigitOrUnderscore = ({OctalDigit}|[_])
-OctalDigitsAndUnderscoresEnd= ({OctalDigitOrUnderscore}*{OctalDigit})
-HexHelper = ("0"(([xX]{HexDigitsAndUnderscores})|({OctalDigitsAndUnderscoresEnd})))
-NonFloatSuffix = (([uU][lL]?)|([lL][uU]?))
-HexLiteral = ({HexHelper}{NonFloatSuffix}?)
-
-FloatHelper1 = ([fFdD]?)
-FloatHelper2 = ([eE][+-]?{Digit}+{FloatHelper1})
-FloatLiteral1 = ({Digit}+"."({FloatHelper1}|{FloatHelper2}|{Digit}+({FloatHelper1}|{FloatHelper2})))
-FloatLiteral2 = ("."{Digit}+({FloatHelper1}|{FloatHelper2}))
-FloatLiteral3 = ({Digit}+{FloatHelper2})
-FloatLiteral = ({FloatLiteral1}|{FloatLiteral2}|{FloatLiteral3}|({Digit}+[fFdD]))
-
-ErrorNumberFormat = (({IntegerLiteral}|{HexLiteral}|{FloatLiteral}){NonSeparator}+)
-BooleanLiteral = ("true"|"false")
-
-Separator = ([\(\)\{\}\[\]])
-Separator2 = ([\;,.])
-
-NonAssignmentOperator = ("+"|"-"|"<="|"^"|"++"|"<"|"*"|">="|"%"|"--"|">"|"/"|"!="|"?"|">>"|"!"|"&"|"=="|":"|">>"|"~"|"|"|"&&"|">>>")
-AssignmentOperator = ("="|"-="|"*="|"/="|"|="|"&="|"^="|"+="|"%="|"<<="|">>="|">>>=")
-Operator = ({NonAssignmentOperator}|{AssignmentOperator})
-
-Identifier = ({IdentifierStart}{IdentifierPart}*)
-ErrorIdentifier = ({NonSeparator}+)
-
-Annotation = ("@"{Identifier}?)
-
-URLGenDelim = ([:\/\?#\[\]@])
-URLSubDelim = ([\!\$&'\(\)\*\+,;=])
-URLUnreserved = ({LetterOrUnderscore}|{Digit}|[\-\.\~])
-URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
-URLCharacters = ({URLCharacter}*)
-URLEndCharacter = ([\/\$]|{Letter}|{Digit})
-URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
-
-
-%state MLC
-%state DOCCOMMENT
-%state NESTABLE_MLC
-%state EOL_COMMENT
-%state EOL_DOCCOMMENT
-%state WYSIWYG_STRING_1
-%state WYSIWYG_STRING_2
-
-%%
-
-
- *
- * This implementation was created using
- * JFlex 1.4.1; however, the generated file
- * was modified for performance. Memory allocation needs to be almost completely
- * removed to be competitive with the handwritten lexers (subclasses of
- * AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around). We can
- * achieve this because RText always scans exactly 1 line of tokens at a time,
- * and hands the scanner this line as an array of characters (a Segment really).
- * Since tokens contain pointers to char arrays instead of Strings holding their
- * contents, there is no need for allocating new memory for Strings.
- *
- * - * The actual algorithm generated for scanning has, of course, not been - * modified. - *
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
DTokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
. You
- * should hand-delete the second of each definition (the ones generated by the
- * lexer), as these generated methods modify the input buffer, which we'll never
- * have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would with
- * any other TokenMaker
instance.aState
- */
- private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
- private static final String ZZ_ATTRIBUTE_PACKED_0 = "\10\0\6\1\1\11\4\1\1\11\5\1\1\11\14\1"
- + "\2\11\2\1\1\11\11\1\1\11\4\1\1\11\5\1" + "\1\11\3\1\1\11\3\1\1\11\1\1\1\11\1\1"
- + "\1\11\17\1\1\0\36\1\1\11\3\1\1\11\31\1" + "\1\0\21\1\3\0\1\11\4\0\1\11\1\0\2\11"
- + "\4\0\13\1\1\0\7\1\1\11\21\1\1\11\16\1" + "\1\11\62\1\14\0\15\1\1\11\10\1\1\11\6\1"
- + "\1\11\36\1\1\0\1\1\2\0\1\1\2\0\1\1" + "\1\0\43\1\6\0\60\1";
-
- private static int[] zzUnpackAttribute() {
- int[] result = new int[459];
- int offset = 0;
- offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
- return result;
- }
-
- private static int zzUnpackAttribute(String packed, int offset, int[] result) {
- int i = 0; /* index in packed string */
- int j = offset; /* index in unpacked array */
- int l = packed.length();
- while (i < l) {
- int count = packed.charAt(i++);
- int value = packed.charAt(i++);
- do
- result[j++] = value;
- while (--count > 0);
- }
- return j;
- }
-
- /** the input device */
- private java.io.Reader zzReader;
- /** the current state of the DFA */
- private int zzState;
- /** the current lexical state */
- private int zzLexicalState = YYINITIAL;
- /**
- * this buffer contains the current text to be matched and is the source of the
- * yytext() string
- */
- private char zzBuffer[];
- /** the textposition at the last accepting state */
- private int zzMarkedPos;
- /** the current text position in the buffer */
- private int zzCurrentPos;
- /** startRead marks the beginning of the yytext() string in the buffer */
- private int zzStartRead;
- /**
- * endRead marks the last character in the buffer, that has been read from input
- */
- private int zzEndRead;
- /** zzAtEOF == true <=> the scanner is at the EOF */
- private boolean zzAtEOF;
- /* user code: */
- /**
- * Token type specific to DTokenMaker; this signals that the user is in a
- * nestable multi-line comment. The nested depth is embedded in the actual end
- * token type.
- */
- private static final int INTERNAL_IN_NESTABLE_MLC = -(1 << 11);
- /**
- * When in a (possibly) nested MLC, this is the current nested depth.
- */
- private int nestedMlcDepth;
-
- /**
- * Constructor. This must be here because JFlex does not generate a no-parameter
- * constructor.
- */
- public DTokenMaker() {
- }
-
- /**
- * Adds the token specified to the current linked list of tokens as an "end
- * token;" that is, at zzMarkedPos
.
- *
- * @param tokenType The token's type.
- */
- private void addEndToken(int tokenType) {
- addToken(zzMarkedPos, zzMarkedPos, tokenType);
- }
-
- private void addNestedMlcEndToken() {
- addEndToken(INTERNAL_IN_NESTABLE_MLC - nestedMlcDepth);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- * @see #addToken(int, int, int)
- */
- private void addHyperlinkToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so, true);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int tokenType) {
- addToken(zzStartRead, zzMarkedPos - 1, tokenType);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- * @see #addHyperlinkToken(int, int, int)
- */
- private void addToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so, false);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param array The character array.
- * @param start The starting offset in the array.
- * @param end The ending offset in the array.
- * @param tokenType The token's type.
- * @param startOffset The offset in the document at which this token occurs.
- * @param hyperlink Whether this token is a hyperlink.
- */
- @Override
- public void addToken(char[] array, int start, int end, int tokenType, int startOffset, boolean hyperlink) {
- super.addToken(array, start, end, tokenType, startOffset, hyperlink);
- zzStartRead = zzMarkedPos;
- }
-
- @Override
- public int getClosestStandardTokenTypeForInternalType(int type) {
- switch (type) {
- case INTERNAL_IN_NESTABLE_MLC:
- return TokenTypes.COMMENT_MULTILINE;
- }
- return type;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String[] getLineCommentStartAndEnd(int languageIndex) {
- return new String[] { "//", null };
- }
-
- /**
- * Returns the first token in the linked list of tokens generated from
- * text
. This method must be implemented by subclasses so they can
- * correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing the syntax
- * highlighted text.
- */
- @Override
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
- nestedMlcDepth = 0;
- // Start off in the proper state.
- int state = YYINITIAL;
- switch (initialTokenType) {
- case Token.LITERAL_BACKQUOTE:
- state = WYSIWYG_STRING_2;
- break;
- case Token.LITERAL_STRING_DOUBLE_QUOTE:
- state = WYSIWYG_STRING_1;
- break;
- case Token.COMMENT_MULTILINE:
- state = MLC;
- break;
- case Token.COMMENT_DOCUMENTATION:
- state = DOCCOMMENT;
- break;
- case INTERNAL_IN_NESTABLE_MLC:
- state = NESTABLE_MLC;
- break;
- default:
- if (initialTokenType < -1024) {
- int main = -(-initialTokenType & 0xffffff00);
- switch (main) {
- default: // Should never happen
- case INTERNAL_IN_NESTABLE_MLC:
- state = NESTABLE_MLC;
- break;
- }
- nestedMlcDepth = -initialTokenType & 0xff;
- } else {
- state = YYINITIAL;
- }
- }
- start = text.offset;
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
- }
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise false
.
- * @exception IOException if any I/O-Error occurs.
- */
- private boolean zzRefill() {
- return zzCurrentPos >= s.offset + s.count;
- }
-
- /**
- * Resets the scanner to read from a new input stream. Does not close the old
- * reader.
- *
- * All internal variables are reset, the old input stream cannot be
- * reused (internal buffer is discarded and lost). Lexical state is set to
- * YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill no longer
- * "refills" the buffer (since the way we do it, it's always "full" the first
- * time through, since it points to the segment's array). So, we assign
- * zzEndRead here.
- */
- // zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtEOF = false;
- }
-
- /**
- * Creates a new scanner There is also a java.io.InputStream version of this
- * constructor.
- *
- * @param in the java.io.Reader to read input from.
- */
- public DTokenMaker(java.io.Reader in) {
- this.zzReader = in;
- }
-
- /**
- * Creates a new scanner. There is also java.io.Reader version of this
- * constructor.
- *
- * @param in the java.io.Inputstream to read input from.
- */
- public DTokenMaker(java.io.InputStream in) {
- this(new java.io.InputStreamReader(in));
- }
-
- /**
- * Unpacks the compressed character translation table.
- *
- * @param packed the packed character translation table
- * @return the unpacked character translation table
- */
- private static char[] zzUnpackCMap(String packed) {
- char[] map = new char[0x10000];
- int i = 0; /* index in packed string */
- int j = 0; /* index in unpacked array */
- while (i < 188) {
- int count = packed.charAt(i++);
- char value = packed.charAt(i++);
- do
- map[j++] = value;
- while (--count > 0);
- }
- return map;
- }
-
- /**
- * Closes the input stream.
- */
- public final void yyclose() throws java.io.IOException {
- zzAtEOF = true; /* indicate end of file */
- zzEndRead = zzStartRead; /* invalidate buffer */
- if (zzReader != null)
- zzReader.close();
- }
-
- /**
- * Returns the current lexical state.
- */
- public final int yystate() {
- return zzLexicalState;
- }
-
- /**
- * Enters a new lexical state
- *
- * @param newState the new lexical state
- */
- @Override
- public final void yybegin(int newState) {
- zzLexicalState = newState;
- }
-
- /**
- * Returns the text matched by the current regular expression.
- */
- public final String yytext() {
- return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
- }
-
- /**
- * Returns the character at position pos from the matched text.
- *
- * It is equivalent to yytext().charAt(pos), but faster
- *
- * @param pos the position of the character to fetch. A value from 0 to
- * yylength()-1.
- *
- * @return the character at position pos
- */
- public final char yycharat(int pos) {
- return zzBuffer[zzStartRead + pos];
- }
-
- /**
- * Returns the length of the matched text region.
- */
- public final int yylength() {
- return zzMarkedPos - zzStartRead;
- }
-
- /**
- * Reports an error that occured while scanning.
- *
- * In a wellformed scanner (no or only correct usage of yypushback(int) and a
- * match-all fallback rule) this method will only be called with things that
- * "Can't Possibly Happen". If this method is called, something is seriously
- * wrong (e.g. a JFlex bug producing a faulty scanner etc.).
- *
- * Usual syntax/scanner level error handling should be done in error fallback
- * rules.
- *
- * @param errorCode the code of the errormessage to display
- */
- private void zzScanError(int errorCode) {
- String message;
- try {
- message = ZZ_ERROR_MSG[errorCode];
- } catch (ArrayIndexOutOfBoundsException e) {
- message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
- }
- throw new Error(message);
- }
-
- /**
- * Pushes the specified amount of characters back into the input stream.
- *
- * They will be read again by then next call of the scanning method
- *
- * @param number the number of characters to be read again. This number must not
- * be greater than yylength()!
- */
- public void yypushback(int number) {
- if (number > yylength())
- zzScanError(ZZ_PUSHBACK_2BIG);
- zzMarkedPos -= number;
- }
-
- /**
- * Resumes scanning until the next regular expression is matched, the end of
- * input is encountered or an I/O-Error occurs.
- *
- * @return the next token
- * @exception java.io.IOException if any I/O-Error occurs
- */
- public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
- int zzInput;
- int zzAction;
- // cached fields:
- int zzCurrentPosL;
- int zzMarkedPosL;
- int zzEndReadL = zzEndRead;
- char[] zzBufferL = zzBuffer;
- char[] zzCMapL = ZZ_CMAP;
- int[] zzTransL = ZZ_TRANS;
- int[] zzRowMapL = ZZ_ROWMAP;
- int[] zzAttrL = ZZ_ATTRIBUTE;
- while (true) {
- zzMarkedPosL = zzMarkedPos;
- zzAction = -1;
- zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
- zzState = zzLexicalState;
- zzForAction: {
- while (true) {
- if (zzCurrentPosL < zzEndReadL)
- zzInput = zzBufferL[zzCurrentPosL++];
- else if (zzAtEOF) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- // store back cached positions
- zzCurrentPos = zzCurrentPosL;
- zzMarkedPos = zzMarkedPosL;
- boolean eof = zzRefill();
- // get translated positions and possibly new buffer
- zzCurrentPosL = zzCurrentPos;
- zzMarkedPosL = zzMarkedPos;
- zzBufferL = zzBuffer;
- zzEndReadL = zzEndRead;
- if (eof) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- zzInput = zzBufferL[zzCurrentPosL++];
- }
- }
- int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
- if (zzNext == -1)
- break zzForAction;
- zzState = zzNext;
- int zzAttributes = zzAttrL[zzState];
- if ((zzAttributes & 1) == 1) {
- zzAction = zzState;
- zzMarkedPosL = zzCurrentPosL;
- if ((zzAttributes & 8) == 8)
- break zzForAction;
- }
- }
- }
- // store back cached position
- zzMarkedPos = zzMarkedPosL;
- switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
- case 14: {
- yybegin(YYINITIAL);
- addToken(start, zzEndRead, Token.COMMENT_DOCUMENTATION);
- return firstToken;
- }
- case 46:
- break;
- case 2: {
- addToken(Token.IDENTIFIER);
- }
- case 47:
- break;
- case 41: {
- addToken(Token.LITERAL_BOOLEAN);
- }
- case 48:
- break;
- case 25: {
- addToken(Token.ERROR_CHAR);
- }
- case 49:
- break;
- case 22: {
- addToken(Token.ERROR_NUMBER_FORMAT);
- }
- case 50:
- break;
- case 4: {
- addToken(Token.ERROR_CHAR);
- addNullToken();
- return firstToken;
- }
- case 51:
- break;
- case 18: {
- addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
- }
- case 52:
- break;
- case 11: {
- addToken(Token.ANNOTATION);
- }
- case 53:
- break;
- case 6: {
- addToken(Token.ERROR_STRING_DOUBLE);
- addNullToken();
- return firstToken;
- }
- case 54:
- break;
- case 1: {
- addToken(Token.ERROR_IDENTIFIER);
- }
- case 55:
- break;
- case 20: {
- addToken(Token.LITERAL_BACKQUOTE);
- }
- case 56:
- break;
- case 33: {
- nestedMlcDepth++;
- }
- case 57:
- break;
- case 37: {
- start = zzMarkedPos - 3;
- yybegin(EOL_DOCCOMMENT);
- }
- case 58:
- break;
- case 43: {
- int temp = zzStartRead;
- addToken(start, zzStartRead - 1, Token.COMMENT_DOCUMENTATION);
- addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_DOCUMENTATION);
- start = zzMarkedPos;
- }
- case 59:
- break;
- case 35: {
- addToken(Token.LITERAL_CHAR);
- }
- case 60:
- break;
- case 24: {
- addToken(Token.LITERAL_NUMBER_HEXADECIMAL);
- }
- case 61:
- break;
- case 28: {
- start = zzMarkedPos - 2;
- yybegin(MLC);
- }
- case 62:
- break;
- case 17: {
- addToken(start, zzStartRead - 1, Token.COMMENT_DOCUMENTATION);
- addNullToken();
- return firstToken;
- }
- case 63:
- break;
- case 7: {
- addToken(Token.WHITESPACE);
- }
- case 64:
- break;
- case 32: {
- yybegin(YYINITIAL);
- addToken(start, zzStartRead + 1, Token.COMMENT_DOCUMENTATION);
- }
- case 65:
- break;
- case 39: {
- addToken(Token.DATA_TYPE);
- }
- case 66:
- break;
- case 34: {
- System.out.println("... " + nestedMlcDepth);
- if (--nestedMlcDepth == 0) {
- addToken(start, zzStartRead + 1, Token.COMMENT_MULTILINE);
- yybegin(YYINITIAL);
- }
- }
- case 67:
- break;
- case 31: {
- yybegin(YYINITIAL);
- addToken(start, zzStartRead + 1, Token.COMMENT_MULTILINE);
- }
- case 68:
- break;
- case 21: {
- addToken(Token.LITERAL_BACKQUOTE);
- yybegin(YYINITIAL);
- }
- case 69:
- break;
- case 3: {
- addToken(Token.LITERAL_NUMBER_DECIMAL_INT);
- }
- case 70:
- break;
- case 19: {
- addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
- yybegin(YYINITIAL);
- }
- case 71:
- break;
- case 38: {
- start = zzMarkedPos - 3;
- yybegin(DOCCOMMENT);
- }
- case 72:
- break;
- case 15: {
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- addNestedMlcEndToken();
- return firstToken;
- }
- case 73:
- break;
- case 30: {
- addToken(Token.RESERVED_WORD);
- }
- case 74:
- break;
- case 42: {
- int temp = zzStartRead;
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_MULTILINE);
- start = zzMarkedPos;
- }
- case 75:
- break;
- case 29: {
- start = zzMarkedPos - 2;
- nestedMlcDepth = 1;
- yybegin(NESTABLE_MLC);
- }
- case 76:
- break;
- case 45: {
- addToken(Token.RESERVED_WORD_2);
- }
- case 77:
- break;
- case 16: {
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- addNullToken();
- return firstToken;
- }
- case 78:
- break;
- case 10: {
- addToken(Token.SEPARATOR);
- }
- case 79:
- break;
- case 5: {
- addNullToken();
- return firstToken;
- }
- case 80:
- break;
- case 13: {
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- return firstToken;
- }
- case 81:
- break;
- case 8: {
- addToken(Token.LITERAL_BACKQUOTE);
- yybegin(WYSIWYG_STRING_2);
- }
- case 82:
- break;
- case 9: {
- addToken(Token.OPERATOR);
- }
- case 83:
- break;
- case 23: {
- addToken(Token.LITERAL_NUMBER_FLOAT);
- }
- case 84:
- break;
- case 26: {
- addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
- yybegin(WYSIWYG_STRING_1);
- }
- case 85:
- break;
- case 44: {
- int temp = zzStartRead;
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_EOL);
- start = zzMarkedPos;
- }
- case 86:
- break;
- case 40: {
- addToken(Token.COMMENT_MULTILINE);
- }
- case 87:
- break;
- case 27: {
- start = zzMarkedPos - 2;
- yybegin(EOL_COMMENT);
- }
- case 88:
- break;
- case 36: {
- addToken(Token.ERROR_STRING_DOUBLE);
- }
- case 89:
- break;
- case 12: {
- }
- case 90:
- break;
- default:
- if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
- zzAtEOF = true;
- switch (zzLexicalState) {
- case WYSIWYG_STRING_1: {
- if (firstToken == null) {
- addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
- }
- return firstToken;
- }
- case 460:
- break;
- case EOL_COMMENT: {
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- addNullToken();
- return firstToken;
- }
- case 461:
- break;
- case NESTABLE_MLC: {
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- addNestedMlcEndToken();
- return firstToken;
- }
- case 462:
- break;
- case DOCCOMMENT: {
- yybegin(YYINITIAL);
- addToken(start, zzEndRead, Token.COMMENT_DOCUMENTATION);
- return firstToken;
- }
- case 463:
- break;
- case YYINITIAL: {
- addNullToken();
- return firstToken;
- }
- case 464:
- break;
- case MLC: {
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- return firstToken;
- }
- case 465:
- break;
- case WYSIWYG_STRING_2: {
- if (firstToken == null) {
- addToken(Token.LITERAL_BACKQUOTE);
- }
- return firstToken;
- }
- case 466:
- break;
- case EOL_DOCCOMMENT: {
- addToken(start, zzStartRead - 1, Token.COMMENT_DOCUMENTATION);
- addNullToken();
- return firstToken;
- }
- case 467:
- break;
- default:
- return null;
- }
- } else {
- zzScanError(ZZ_NO_MATCH);
- }
- }
- }
- }
-}
diff --git a/src/org/fife/ui/rsyntaxtextarea/modes/DartTokenMaker.flex b/src/org/fife/ui/rsyntaxtextarea/modes/DartTokenMaker.flex
deleted file mode 100644
index 5c5143c..0000000
--- a/src/org/fife/ui/rsyntaxtextarea/modes/DartTokenMaker.flex
+++ /dev/null
@@ -1,660 +0,0 @@
-/*
- * 09/01/2014
- *
- * DartTokenMaker.java - Token parser for Dart.
- *
- * This library is distributed under a modified BSD license. See the included
- * RSyntaxTextArea.License.txt file for details.
- */
-package org.fife.ui.rsyntaxtextarea.modes;
-
-import java.io.*;
-import javax.swing.text.Segment;
-
-import org.fife.ui.rsyntaxtextarea.*;
-
-
-/**
- * Scanner for Dart files. Its states could be simplified, but are
- * kept the way they are to keep a degree of similarity (i.e. copy/paste)
- * between it and HTML/JSP/PHPTokenMaker. This should cause no difference in
- * performance.
- *
- * This implementation was created using
- * JFlex 1.4.1; however, the generated file
- * was modified for performance. Memory allocation needs to be almost
- * completely removed to be competitive with the handwritten lexers (subclasses
- * of AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around).
- * We can achieve this because RText always scans exactly 1 line of tokens at a
- * time, and hands the scanner this line as an array of characters (a Segment
- * really). Since tokens contain pointers to char arrays instead of Strings
- * holding their contents, there is no need for allocating new memory for
- * Strings.
- * - * The actual algorithm generated for scanning has, of course, not been - * modified.
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
DartTokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
.
- * You should hand-delete the second of each definition (the ones
- * generated by the lexer), as these generated methods modify the input
- * buffer, which we'll never have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would
- * with any other TokenMaker
instance.zzMarkedPos
.
- *
- * @param tokenType The token's type.
- */
- private void addEndToken(int tokenType) {
- addToken(zzMarkedPos,zzMarkedPos, tokenType);
- }
-
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- * @see #addToken(int, int, int)
- */
- private void addHyperlinkToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start,end, tokenType, so, true);
- }
-
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int tokenType) {
- addToken(zzStartRead, zzMarkedPos-1, tokenType);
- }
-
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start,end, tokenType, so);
- }
-
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param array The character array.
- * @param start The starting offset in the array.
- * @param end The ending offset in the array.
- * @param tokenType The token's type.
- * @param startOffset The offset in the document at which this token
- * occurs.
- */
- @Override
- public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
- super.addToken(array, start,end, tokenType, startOffset);
- zzStartRead = zzMarkedPos;
- }
-
-
- /**
- * Returns the closest {@link TokenTypes "standard" token type} for a given
- * "internal" token type (e.g. one whose value is < 0
).
- */
- @Override
- public int getClosestStandardTokenTypeForInternalType(int type) {
- switch (type) {
- case INTERNAL_IN_JS_MLC:
- return TokenTypes.COMMENT_MULTILINE;
- case INTERNAL_IN_JS_STRING_INVALID:
- case INTERNAL_IN_JS_STRING_VALID:
- case INTERNAL_IN_JS_CHAR_INVALID:
- case INTERNAL_IN_JS_CHAR_VALID:
- return TokenTypes.LITERAL_STRING_DOUBLE_QUOTE;
- }
- return type;
- }
-
-
- /**
- * Returns the JavaScript version being highlighted.
- *
- * @return Supported JavaScript version.
- * @see #isJavaScriptCompatible(String)
- */
- public static String getJavaScriptVersion() {
- return jsVersion;
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String[] getLineCommentStartAndEnd(int languageIndex) {
- return new String[] { "//", null };
- }
-
-
- /**
- * Returns the first token in the linked list of tokens generated
- * from text
. This method must be implemented by
- * subclasses so they can correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing
- * the syntax highlighted text.
- */
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
-
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
- validJSString = true;
- int languageIndex = LANG_INDEX_DEFAULT;
-
- // Start off in the proper state.
- int state = YYINITIAL;
- switch (initialTokenType) {
- case Token.LITERAL_STRING_DOUBLE_QUOTE:
- state = DART_MULTILINE_STRING_DOUBLE;
- break;
- case Token.LITERAL_CHAR:
- state = DART_MULTILINE_STRING_SINGLE;
- break;
- case INTERNAL_IN_JS_MLC:
- state = JS_MLC;
- break;
- case INTERNAL_IN_JS_STRING_INVALID:
- state = JS_STRING;
- validJSString = false;
- break;
- case INTERNAL_IN_JS_STRING_VALID:
- state = JS_STRING;
- break;
- case INTERNAL_IN_JS_CHAR_INVALID:
- state = JS_CHAR;
- validJSString = false;
- break;
- case INTERNAL_IN_JS_CHAR_VALID:
- state = JS_CHAR;
- break;
- default:
- state = YYINITIAL; // ???
- break;
- }
-
- setLanguageIndex(languageIndex);
- start = text.offset;
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
-
- }
-
-
- /**
- * Returns whether features for a specific JS version should be honored
- * while highlighting.
- *
- * @param version JavaScript version required
- * @return Whether the JavaScript version is the same or greater than
- * version required.
- */
- public static boolean isJavaScriptCompatible(String version) {
- return jsVersion.compareTo(version) >= 0;
- }
-
-
- /**
- * Set the supported JavaScript version because some keywords were
- * introduced on or after this version.
- *
- * @param javaScriptVersion The version of JavaScript to support, such as
- * "1.5
" or "1.6
".
- * @see #isJavaScriptCompatible(String)
- * @see #getJavaScriptVersion()
- */
- public static void setJavaScriptVersion(String javaScriptVersion) {
- jsVersion = javaScriptVersion;
- }
-
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise
- * false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos>=s.offset+s.count;
- }
-
-
- /**
- * Resets the scanner to read from a new input stream.
- * Does not close the old reader.
- *
- * All internal variables are reset, the old input stream
- * cannot be reused (internal buffer is discarded and lost).
- * Lexical state is set to YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill
- * no longer "refills" the buffer (since the way we do it, it's always
- * "full" the first time through, since it points to the segment's
- * array). So, we assign zzEndRead here.
- */
- //zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtBOL = true;
- zzAtEOF = false;
- }
-
-
-%}
-
-Whitespace = ([ \t\f]+)
-LineTerminator = ([\n])
-
-Letter = [A-Za-z]
-NonzeroDigit = [1-9]
-Digit = ("0"|{NonzeroDigit})
-HexDigit = ({Digit}|[A-Fa-f])
-OctalDigit = ([0-7])
-LetterOrDigit = ({Letter}|{Digit})
-EscapedSourceCharacter = ("u"{HexDigit}{HexDigit}{HexDigit}{HexDigit})
-NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\']|"#"|"\\")
-IdentifierStart = ({Letter}|"_"|"$")
-IdentifierPart = ({IdentifierStart}|{Digit}|("\\"{EscapedSourceCharacter}))
-JS_MLCBegin = "/*"
-JS_MLCEnd = "*/"
-JS_LineCommentBegin = "//"
-JS_IntegerHelper1 = (({NonzeroDigit}{Digit}*)|"0")
-JS_IntegerHelper2 = ("0"(([xX]{HexDigit}+)|({OctalDigit}*)))
-JS_IntegerLiteral = ({JS_IntegerHelper1}[lL]?)
-JS_HexLiteral = ({JS_IntegerHelper2}[lL]?)
-JS_FloatHelper1 = ([fFdD]?)
-JS_FloatHelper2 = ([eE][+-]?{Digit}+{JS_FloatHelper1})
-JS_FloatLiteral1 = ({Digit}+"."({JS_FloatHelper1}|{JS_FloatHelper2}|{Digit}+({JS_FloatHelper1}|{JS_FloatHelper2})))
-JS_FloatLiteral2 = ("."{Digit}+({JS_FloatHelper1}|{JS_FloatHelper2}))
-JS_FloatLiteral3 = ({Digit}+{JS_FloatHelper2})
-JS_FloatLiteral = ({JS_FloatLiteral1}|{JS_FloatLiteral2}|{JS_FloatLiteral3}|({Digit}+[fFdD]))
-JS_ErrorNumberFormat = (({JS_IntegerLiteral}|{JS_HexLiteral}|{JS_FloatLiteral}){NonSeparator}+)
-JS_Separator = ([\(\)\{\}\[\]\]])
-JS_Separator2 = ([\;,.])
-JS_NonAssignmentOperator = ("+"|"-"|"<="|"^"|"++"|"<"|"*"|">="|"%"|"--"|">"|"/"|"!="|"?"|">>"|"!"|"&"|"=="|":"|">>"|"~"|"||"|"&&"|">>>")
-JS_AssignmentOperator = ("="|"-="|"*="|"/="|"|="|"&="|"^="|"+="|"%="|"<<="|">>="|">>>=")
-JS_Operator = ({JS_NonAssignmentOperator}|{JS_AssignmentOperator})
-JS_Identifier = ({IdentifierStart}{IdentifierPart}*)
-JS_ErrorIdentifier = ({NonSeparator}+)
-
-DART_Annotation = ("@"{Letter}{LetterOrDigit}*)
-
-URLGenDelim = ([:\/\?#\[\]@])
-URLSubDelim = ([\!\$&'\(\)\*\+,;=])
-URLUnreserved = ({LetterOrDigit}|"_"|[\-\.\~])
-URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
-URLCharacters = ({URLCharacter}*)
-URLEndCharacter = ([\/\$]|{LetterOrDigit})
-URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
-
-
-%state JS_STRING
-%state JS_CHAR
-%state JS_MLC
-%state JS_EOL_COMMENT
-%state DART_MULTILINE_STRING_DOUBLE
-%state DART_MULTILINE_STRING_SINGLE
-
-
-%%
-
-
- *
- * This implementation was created using
- * JFlex 1.4.1; however, the generated file
- * was modified for performance. Memory allocation needs to be almost completely
- * removed to be competitive with the handwritten lexers (subclasses of
- * AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around). We can
- * achieve this because RText always scans exactly 1 line of tokens at a time,
- * and hands the scanner this line as an array of characters (a Segment really).
- * Since tokens contain pointers to char arrays instead of Strings holding their
- * contents, there is no need for allocating new memory for Strings.
- *
- * - * The actual algorithm generated for scanning has, of course, not been - * modified. - *
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
DartTokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
. You
- * should hand-delete the second of each definition (the ones generated by the
- * lexer), as these generated methods modify the input buffer, which we'll never
- * have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would with
- * any other TokenMaker
instance.aState
- */
- private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
- private static final String ZZ_ATTRIBUTE_PACKED_0 = "\5\0\4\1\1\11\4\1\1\11\10\1\2\11\3\1"
- + "\1\11\45\1\1\11\1\1\1\11\1\1\1\11\1\1" + "\1\11\1\1\1\11\5\1\1\11\3\1\1\11\2\1"
- + "\1\11\20\1\1\11\6\1\1\0\2\1\1\0\73\1" + "\1\0\1\11\2\1\1\11\10\0\1\11\1\0\1\11"
- + "\1\0\2\1\1\0\7\1\1\0\7\1\1\11\103\1" + "\1\11\12\0\2\11\5\1\1\11\74\1\1\0\1\11"
- + "\2\0\1\1\2\0\66\1\4\0\303\1";
-
- private static int[] zzUnpackAttribute() {
- int[] result = new int[616];
- int offset = 0;
- offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
- return result;
- }
-
- private static int zzUnpackAttribute(String packed, int offset, int[] result) {
- int i = 0; /* index in packed string */
- int j = offset; /* index in unpacked array */
- int l = packed.length();
- while (i < l) {
- int count = packed.charAt(i++);
- int value = packed.charAt(i++);
- do
- result[j++] = value;
- while (--count > 0);
- }
- return j;
- }
-
- /** the input device */
- private java.io.Reader zzReader;
- /** the current state of the DFA */
- private int zzState;
- /** the current lexical state */
- private int zzLexicalState = YYINITIAL;
- /**
- * this buffer contains the current text to be matched and is the source of the
- * yytext() string
- */
- private char zzBuffer[];
- /** the textposition at the last accepting state */
- private int zzMarkedPos;
- /** the current text position in the buffer */
- private int zzCurrentPos;
- /** startRead marks the beginning of the yytext() string in the buffer */
- private int zzStartRead;
- /**
- * endRead marks the last character in the buffer, that has been read from input
- */
- private int zzEndRead;
- /** zzAtEOF == true <=> the scanner is at the EOF */
- private boolean zzAtEOF;
- /* user code: */
- /**
- * Token type specifying we're in a JavaScript multi-line comment.
- */
- private static final int INTERNAL_IN_JS_MLC = -8;
- /**
- * Token type specifying we're in an invalid multi-line JS string.
- */
- private static final int INTERNAL_IN_JS_STRING_INVALID = -10;
- /**
- * Token type specifying we're in a valid multi-line JS string.
- */
- private static final int INTERNAL_IN_JS_STRING_VALID = -11;
- /**
- * Token type specifying we're in an invalid multi-line JS single-quoted string.
- */
- private static final int INTERNAL_IN_JS_CHAR_INVALID = -12;
- /**
- * Token type specifying we're in a valid multi-line JS single-quoted string.
- */
- private static final int INTERNAL_IN_JS_CHAR_VALID = -13;
- /**
- * When in the JS_STRING state, whether the current string is valid.
- */
- private boolean validJSString;
- /**
- * The version of JavaScript being highlighted.
- */
- private static String jsVersion;
- /**
- * Language state set on JS tokens. Must be 0.
- */
- private static final int LANG_INDEX_DEFAULT = 0;
-
- /**
- * Constructor. This must be here because JFlex does not generate a no-parameter
- * constructor.
- */
- public DartTokenMaker() {
- super();
- }
-
- static {
- jsVersion = "1.0";
- }
-
- /**
- * Adds the token specified to the current linked list of tokens as an "end
- * token;" that is, at zzMarkedPos
.
- *
- * @param tokenType The token's type.
- */
- private void addEndToken(int tokenType) {
- addToken(zzMarkedPos, zzMarkedPos, tokenType);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- * @see #addToken(int, int, int)
- */
- private void addHyperlinkToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so, true);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int tokenType) {
- addToken(zzStartRead, zzMarkedPos - 1, tokenType);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param array The character array.
- * @param start The starting offset in the array.
- * @param end The ending offset in the array.
- * @param tokenType The token's type.
- * @param startOffset The offset in the document at which this token occurs.
- */
- @Override
- public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
- super.addToken(array, start, end, tokenType, startOffset);
- zzStartRead = zzMarkedPos;
- }
-
- /**
- * Returns the closest {@link TokenTypes "standard" token type} for a given
- * "internal" token type (e.g. one whose value is < 0
).
- */
- @Override
- public int getClosestStandardTokenTypeForInternalType(int type) {
- switch (type) {
- case INTERNAL_IN_JS_MLC:
- return TokenTypes.COMMENT_MULTILINE;
- case INTERNAL_IN_JS_STRING_INVALID:
- case INTERNAL_IN_JS_STRING_VALID:
- case INTERNAL_IN_JS_CHAR_INVALID:
- case INTERNAL_IN_JS_CHAR_VALID:
- return TokenTypes.LITERAL_STRING_DOUBLE_QUOTE;
- }
- return type;
- }
-
- /**
- * Returns the JavaScript version being highlighted.
- *
- * @return Supported JavaScript version.
- * @see #isJavaScriptCompatible(String)
- */
- public static String getJavaScriptVersion() {
- return jsVersion;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String[] getLineCommentStartAndEnd(int languageIndex) {
- return new String[] { "//", null };
- }
-
- /**
- * Returns the first token in the linked list of tokens generated from
- * text
. This method must be implemented by subclasses so they can
- * correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing the syntax
- * highlighted text.
- */
- @Override
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
- validJSString = true;
- int languageIndex = LANG_INDEX_DEFAULT;
- // Start off in the proper state.
- int state = YYINITIAL;
- switch (initialTokenType) {
- case Token.LITERAL_STRING_DOUBLE_QUOTE:
- state = DART_MULTILINE_STRING_DOUBLE;
- break;
- case Token.LITERAL_CHAR:
- state = DART_MULTILINE_STRING_SINGLE;
- break;
- case INTERNAL_IN_JS_MLC:
- state = JS_MLC;
- break;
- case INTERNAL_IN_JS_STRING_INVALID:
- state = JS_STRING;
- validJSString = false;
- break;
- case INTERNAL_IN_JS_STRING_VALID:
- state = JS_STRING;
- break;
- case INTERNAL_IN_JS_CHAR_INVALID:
- state = JS_CHAR;
- validJSString = false;
- break;
- case INTERNAL_IN_JS_CHAR_VALID:
- state = JS_CHAR;
- break;
- default:
- state = YYINITIAL; // ???
- break;
- }
- setLanguageIndex(languageIndex);
- start = text.offset;
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
- }
-
- /**
- * Returns whether features for a specific JS version should be honored while
- * highlighting.
- *
- * @param version JavaScript version required
- * @return Whether the JavaScript version is the same or greater than version
- * required.
- */
- public static boolean isJavaScriptCompatible(String version) {
- return jsVersion.compareTo(version) >= 0;
- }
-
- /**
- * Set the supported JavaScript version because some keywords were introduced on
- * or after this version.
- *
- * @param javaScriptVersion The version of JavaScript to support, such as
- * "1.5
" or "1.6
".
- * @see #isJavaScriptCompatible(String)
- * @see #getJavaScriptVersion()
- */
- public static void setJavaScriptVersion(String javaScriptVersion) {
- jsVersion = javaScriptVersion;
- }
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos >= s.offset + s.count;
- }
-
- /**
- * Resets the scanner to read from a new input stream. Does not close the old
- * reader.
- *
- * All internal variables are reset, the old input stream cannot be
- * reused (internal buffer is discarded and lost). Lexical state is set to
- * YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill no longer
- * "refills" the buffer (since the way we do it, it's always "full" the first
- * time through, since it points to the segment's array). So, we assign
- * zzEndRead here.
- */
- // zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtEOF = false;
- }
-
- /**
- * Creates a new scanner There is also a java.io.InputStream version of this
- * constructor.
- *
- * @param in the java.io.Reader to read input from.
- */
- public DartTokenMaker(java.io.Reader in) {
- this.zzReader = in;
- }
-
- /**
- * Creates a new scanner. There is also java.io.Reader version of this
- * constructor.
- *
- * @param in the java.io.Inputstream to read input from.
- */
- public DartTokenMaker(java.io.InputStream in) {
- this(new java.io.InputStreamReader(in));
- }
-
- /**
- * Unpacks the compressed character translation table.
- *
- * @param packed the packed character translation table
- * @return the unpacked character translation table
- */
- private static char[] zzUnpackCMap(String packed) {
- char[] map = new char[0x10000];
- int i = 0; /* index in packed string */
- int j = 0; /* index in unpacked array */
- while (i < 190) {
- int count = packed.charAt(i++);
- char value = packed.charAt(i++);
- do
- map[j++] = value;
- while (--count > 0);
- }
- return map;
- }
-
- /**
- * Closes the input stream.
- */
- public final void yyclose() throws java.io.IOException {
- zzAtEOF = true; /* indicate end of file */
- zzEndRead = zzStartRead; /* invalidate buffer */
- if (zzReader != null)
- zzReader.close();
- }
-
- /**
- * Returns the current lexical state.
- */
- public final int yystate() {
- return zzLexicalState;
- }
-
- /**
- * Enters a new lexical state
- *
- * @param newState the new lexical state
- */
- @Override
- public final void yybegin(int newState) {
- zzLexicalState = newState;
- }
-
- /**
- * Returns the text matched by the current regular expression.
- */
- public final String yytext() {
- return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
- }
-
- /**
- * Returns the character at position pos from the matched text.
- *
- * It is equivalent to yytext().charAt(pos), but faster
- *
- * @param pos the position of the character to fetch. A value from 0 to
- * yylength()-1.
- *
- * @return the character at position pos
- */
- public final char yycharat(int pos) {
- return zzBuffer[zzStartRead + pos];
- }
-
- /**
- * Returns the length of the matched text region.
- */
- public final int yylength() {
- return zzMarkedPos - zzStartRead;
- }
-
- /**
- * Reports an error that occured while scanning.
- *
- * In a wellformed scanner (no or only correct usage of yypushback(int) and a
- * match-all fallback rule) this method will only be called with things that
- * "Can't Possibly Happen". If this method is called, something is seriously
- * wrong (e.g. a JFlex bug producing a faulty scanner etc.).
- *
- * Usual syntax/scanner level error handling should be done in error fallback
- * rules.
- *
- * @param errorCode the code of the errormessage to display
- */
- private void zzScanError(int errorCode) {
- String message;
- try {
- message = ZZ_ERROR_MSG[errorCode];
- } catch (ArrayIndexOutOfBoundsException e) {
- message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
- }
- throw new Error(message);
- }
-
- /**
- * Pushes the specified amount of characters back into the input stream.
- *
- * They will be read again by then next call of the scanning method
- *
- * @param number the number of characters to be read again. This number must not
- * be greater than yylength()!
- */
- public void yypushback(int number) {
- if (number > yylength())
- zzScanError(ZZ_PUSHBACK_2BIG);
- zzMarkedPos -= number;
- }
-
- /**
- * Resumes scanning until the next regular expression is matched, the end of
- * input is encountered or an I/O-Error occurs.
- *
- * @return the next token
- * @exception java.io.IOException if any I/O-Error occurs
- */
- public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
- int zzInput;
- int zzAction;
- // cached fields:
- int zzCurrentPosL;
- int zzMarkedPosL;
- int zzEndReadL = zzEndRead;
- char[] zzBufferL = zzBuffer;
- char[] zzCMapL = ZZ_CMAP;
- int[] zzTransL = ZZ_TRANS;
- int[] zzRowMapL = ZZ_ROWMAP;
- int[] zzAttrL = ZZ_ATTRIBUTE;
- while (true) {
- zzMarkedPosL = zzMarkedPos;
- zzAction = -1;
- zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
- zzState = zzLexicalState;
- zzForAction: {
- while (true) {
- if (zzCurrentPosL < zzEndReadL)
- zzInput = zzBufferL[zzCurrentPosL++];
- else if (zzAtEOF) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- // store back cached positions
- zzCurrentPos = zzCurrentPosL;
- zzMarkedPos = zzMarkedPosL;
- boolean eof = zzRefill();
- // get translated positions and possibly new buffer
- zzCurrentPosL = zzCurrentPos;
- zzMarkedPosL = zzMarkedPos;
- zzBufferL = zzBuffer;
- zzEndReadL = zzEndRead;
- if (eof) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- zzInput = zzBufferL[zzCurrentPosL++];
- }
- }
- int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
- if (zzNext == -1)
- break zzForAction;
- zzState = zzNext;
- int zzAttributes = zzAttrL[zzState];
- if ((zzAttributes & 1) == 1) {
- zzAction = zzState;
- zzMarkedPosL = zzCurrentPosL;
- if ((zzAttributes & 8) == 8)
- break zzForAction;
- }
- }
- }
- // store back cached position
- zzMarkedPos = zzMarkedPosL;
- switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
- case 11: {
- addToken(start, zzStartRead - 1, Token.ERROR_STRING_DOUBLE);
- addNullToken();
- return firstToken;
- }
- case 45:
- break;
- case 5: {
- addToken(Token.IDENTIFIER);
- }
- case 46:
- break;
- case 41: {
- addToken(Token.LITERAL_BOOLEAN);
- }
- case 47:
- break;
- case 39: {
- addToken(start, zzStartRead + 2, Token.LITERAL_CHAR);
- yybegin(YYINITIAL);
- }
- case 48:
- break;
- case 30: { /* Skip all escaped chars. */
- }
- case 49:
- break;
- case 32: {
- /* Invalid latin-1 character \xXX */ validJSString = false;
- }
- case 50:
- break;
- case 38: {
- addToken(start, zzStartRead + 2, Token.LITERAL_STRING_DOUBLE_QUOTE);
- yybegin(YYINITIAL);
- }
- case 51:
- break;
- case 23: {
- addToken(Token.ERROR_NUMBER_FORMAT);
- }
- case 52:
- break;
- case 17: {
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- addEndToken(INTERNAL_IN_JS_MLC);
- return firstToken;
- }
- case 53:
- break;
- case 36: {
- addToken(Token.FUNCTION);
- }
- case 54:
- break;
- case 28: {
- addToken(Token.ANNOTATION);
- }
- case 55:
- break;
- case 2: {
- addToken(Token.ERROR_IDENTIFIER);
- }
- case 56:
- break;
- case 27: {
- start = zzMarkedPos - 2;
- yybegin(JS_MLC);
- }
- case 57:
- break;
- case 13: {
- int type = validJSString ? Token.LITERAL_STRING_DOUBLE_QUOTE : Token.ERROR_STRING_DOUBLE;
- addToken(start, zzStartRead, type);
- yybegin(YYINITIAL);
- }
- case 58:
- break;
- case 37: {
- start = zzMarkedPos - 3;
- yybegin(DART_MULTILINE_STRING_DOUBLE);
- }
- case 59:
- break;
- case 16: {
- int type = validJSString ? Token.LITERAL_CHAR : Token.ERROR_CHAR;
- addToken(start, zzStartRead, type);
- yybegin(YYINITIAL);
- }
- case 60:
- break;
- case 14: {
- addToken(start, zzStartRead - 1, Token.ERROR_CHAR);
- addNullToken();
- return firstToken;
- }
- case 61:
- break;
- case 26: {
- start = zzMarkedPos - 2;
- yybegin(JS_EOL_COMMENT);
- }
- case 62:
- break;
- case 20: { /* Skip escaped chars, handles case: '\"""'. */
- }
- case 63:
- break;
- case 34: {
- start = zzMarkedPos - 3;
- yybegin(DART_MULTILINE_STRING_SINGLE);
- }
- case 64:
- break;
- case 25: {
- addToken(Token.LITERAL_NUMBER_HEXADECIMAL);
- }
- case 65:
- break;
- case 12: { /* Line ending in '\' => continue to next line. */
- if (validJSString) {
- addToken(start, zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE);
- addEndToken(INTERNAL_IN_JS_STRING_VALID);
- } else {
- addToken(start, zzStartRead, Token.ERROR_STRING_DOUBLE);
- addEndToken(INTERNAL_IN_JS_STRING_INVALID);
- }
- return firstToken;
- }
- case 66:
- break;
- case 3: {
- addToken(Token.WHITESPACE);
- }
- case 67:
- break;
- case 35: {
- addToken(Token.DATA_TYPE);
- }
- case 68:
- break;
- case 33: {
- yybegin(YYINITIAL);
- addToken(start, zzStartRead + 1, Token.COMMENT_MULTILINE);
- }
- case 69:
- break;
- case 15: { /* Line ending in '\' => continue to next line. */
- if (validJSString) {
- addToken(start, zzStartRead, Token.LITERAL_CHAR);
- addEndToken(INTERNAL_IN_JS_CHAR_VALID);
- } else {
- addToken(start, zzStartRead, Token.ERROR_CHAR);
- addEndToken(INTERNAL_IN_JS_CHAR_INVALID);
- }
- return firstToken;
- }
- case 70:
- break;
- case 6: {
- addToken(Token.LITERAL_NUMBER_DECIMAL_INT);
- }
- case 71:
- break;
- case 10: {
- start = zzMarkedPos - 1;
- validJSString = true;
- yybegin(JS_STRING);
- }
- case 72:
- break;
- case 31: {
- /* Invalid Unicode character \\uXXXX */ validJSString = false;
- }
- case 73:
- break;
- case 22: { /* Skip escaped chars, handles case: "\'''". */
- }
- case 74:
- break;
- case 9: {
- start = zzMarkedPos - 1;
- validJSString = true;
- yybegin(JS_CHAR);
- }
- case 75:
- break;
- case 29: {
- addToken(Token.RESERVED_WORD);
- }
- case 76:
- break;
- case 42: {
- int temp = zzStartRead;
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_MULTILINE);
- start = zzMarkedPos;
- }
- case 77:
- break;
- case 44: {
- addToken(Token.RESERVED_WORD_2);
- }
- case 78:
- break;
- case 18: {
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- addNullToken();
- return firstToken;
- }
- case 79:
- break;
- case 8: {
- addToken(Token.SEPARATOR);
- }
- case 80:
- break;
- case 4: {
- addNullToken();
- return firstToken;
- }
- case 81:
- break;
- case 7: {
- addToken(Token.OPERATOR);
- }
- case 82:
- break;
- case 21: {
- addToken(start, zzStartRead - 1, Token.LITERAL_CHAR);
- return firstToken;
- }
- case 83:
- break;
- case 24: {
- addToken(Token.LITERAL_NUMBER_FLOAT);
- }
- case 84:
- break;
- case 43: {
- int temp = zzStartRead;
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_EOL);
- start = zzMarkedPos;
- }
- case 85:
- break;
- case 40: {
- addToken(Token.COMMENT_MULTILINE);
- }
- case 86:
- break;
- case 1: {
- }
- case 87:
- break;
- case 19: {
- addToken(start, zzStartRead - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
- return firstToken;
- }
- case 88:
- break;
- default:
- if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
- zzAtEOF = true;
- switch (zzLexicalState) {
- case JS_STRING: {
- addToken(start, zzStartRead - 1, Token.ERROR_STRING_DOUBLE);
- addNullToken();
- return firstToken;
- }
- case 617:
- break;
- case JS_CHAR: {
- addToken(start, zzStartRead - 1, Token.ERROR_CHAR);
- addNullToken();
- return firstToken;
- }
- case 618:
- break;
- case DART_MULTILINE_STRING_DOUBLE: {
- addToken(start, zzStartRead - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
- return firstToken;
- }
- case 619:
- break;
- case JS_EOL_COMMENT: {
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- addNullToken();
- return firstToken;
- }
- case 620:
- break;
- case YYINITIAL: {
- addNullToken();
- return firstToken;
- }
- case 621:
- break;
- case JS_MLC: {
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- addEndToken(INTERNAL_IN_JS_MLC);
- return firstToken;
- }
- case 622:
- break;
- case DART_MULTILINE_STRING_SINGLE: {
- addToken(start, zzStartRead - 1, Token.LITERAL_CHAR);
- return firstToken;
- }
- case 623:
- break;
- default:
- return null;
- }
- } else {
- zzScanError(ZZ_NO_MATCH);
- }
- }
- }
- }
-}
diff --git a/src/org/fife/ui/rsyntaxtextarea/modes/DelphiTokenMaker.flex b/src/org/fife/ui/rsyntaxtextarea/modes/DelphiTokenMaker.flex
deleted file mode 100644
index 4e69d45..0000000
--- a/src/org/fife/ui/rsyntaxtextarea/modes/DelphiTokenMaker.flex
+++ /dev/null
@@ -1,559 +0,0 @@
-/*
- * 7/28/2009
- *
- * DelphiTokenMaker.java - Scanner for the Delphi programming language.
- *
- * This library is distributed under a modified BSD license. See the included
- * RSyntaxTextArea.License.txt file for details.
- */
-package org.fife.ui.rsyntaxtextarea.modes;
-
-import java.io.*;
-import javax.swing.text.Segment;
-
-import org.fife.ui.rsyntaxtextarea.*;
-
-
-/**
- * Scanner for the Delphi programming language.
- *
- * This implementation was created using
- * JFlex 1.4.1; however, the generated file
- * was modified for performance. Memory allocation needs to be almost
- * completely removed to be competitive with the handwritten lexers (subclasses
- * of AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around).
- * We can achieve this because RText always scans exactly 1 line of tokens at a
- * time, and hands the scanner this line as an array of characters (a Segment
- * really). Since tokens contain pointers to char arrays instead of Strings
- * holding their contents, there is no need for allocating new memory for
- * Strings.
- * - * The actual algorithm generated for scanning has, of course, not been - * modified.
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
DelphiTokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
.
- * You should hand-delete the second of each definition (the ones
- * generated by the lexer), as these generated methods modify the input
- * buffer, which we'll never have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would
- * with any other TokenMaker
instance.zzMarkedPos
.
- *
- * @param tokenType The token's type.
- */
- private void addEndToken(int tokenType) {
- addToken(zzMarkedPos,zzMarkedPos, tokenType);
- }
-
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- * @see #addToken(int, int, int)
- */
- private void addHyperlinkToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start,end, tokenType, so, true);
- }
-
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int tokenType) {
- addToken(zzStartRead, zzMarkedPos-1, tokenType);
- }
-
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- * @see #addHyperlinkToken(int, int, int)
- */
- private void addToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start,end, tokenType, so, false);
- }
-
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param array The character array.
- * @param start The starting offset in the array.
- * @param end The ending offset in the array.
- * @param tokenType The token's type.
- * @param startOffset The offset in the document at which this token
- * occurs.
- * @param hyperlink Whether this token is a hyperlink.
- */
- @Override
- public void addToken(char[] array, int start, int end, int tokenType,
- int startOffset, boolean hyperlink) {
- super.addToken(array, start,end, tokenType, startOffset, hyperlink);
- zzStartRead = zzMarkedPos;
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String[] getLineCommentStartAndEnd(int languageIndex) {
- return new String[] { "//", null };
- }
-
-
- /**
- * Returns the first token in the linked list of tokens generated
- * from text
. This method must be implemented by
- * subclasses so they can correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing
- * the syntax highlighted text.
- */
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
-
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
-
- // Start off in the proper state.
- int state = Token.NULL;
- switch (initialTokenType) {
- case Token.COMMENT_MULTILINE:
- state = MLC;
- start = text.offset;
- break;
- case INTERNAL_MLC2:
- state = MLC2;
- start = text.offset;
- break;
- case INTERNAL_COMPILER_DIRECTIVE:
- state = COMPILER_DIRECTIVE;
- start = text.offset;
- break;
- case INTERNAL_COMPILER_DIRECTIVE2:
- state = COMPILER_DIRECTIVE2;
- start = text.offset;
- break;
- default:
- state = Token.NULL;
- }
-
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
-
- }
-
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise
- * false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos>=s.offset+s.count;
- }
-
-
- /**
- * Resets the scanner to read from a new input stream.
- * Does not close the old reader.
- *
- * All internal variables are reset, the old input stream
- * cannot be reused (internal buffer is discarded and lost).
- * Lexical state is set to YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill
- * no longer "refills" the buffer (since the way we do it, it's always
- * "full" the first time through, since it points to the segment's
- * array). So, we assign zzEndRead here.
- */
- //zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtBOL = true;
- zzAtEOF = false;
- }
-
-
-%}
-
-Letter = [A-Za-z]
-LetterOrUnderscore = ({Letter}|"_")
-NonzeroDigit = [1-9]
-Digit = ("0"|{NonzeroDigit})
-HexDigit = ({Digit}|[A-Fa-f])
-OctalDigit = ([0-7])
-NonSeparator = ([^\t\f\r\n\ \(\)\{\}\[\]\;\,\.\=\>\<\!\~\?\:\+\-\*\/\&\|\^\%\"\']|"#"|"\\")
-IdentifierStart = ({LetterOrUnderscore}|"$")
-IdentifierPart = ({IdentifierStart}|{Digit})
-
-LineTerminator = (\n)
-WhiteSpace = ([ \t\f])
-
-UnclosedStringLiteral = ([\'][^\']*)
-StringLiteral = ({UnclosedStringLiteral}[\'])
-EscapeSequence = ("#"{Digit}*)
-
-MLCBegin = "{"
-MLCEnd = "}"
-MLC2Begin = "(*"
-MLC2End = "*)"
-CompilerDirective1Begin = ({MLCBegin}"$")
-CompilerDirective2Begin = ({MLC2Begin}"$")
-LineCommentBegin = "//"
-
-IntegerHelper1 = (({NonzeroDigit}{Digit}*)|"0")
-IntegerHelper2 = ("0"(([xX]{HexDigit}+)|({OctalDigit}*)))
-IntegerLiteral = ({IntegerHelper1}[lL]?)
-HexLiteral = ({IntegerHelper2}[lL]?)
-FloatHelper1 = ([fFdD]?)
-FloatHelper2 = ([eE][+-]?{Digit}+{FloatHelper1})
-FloatLiteral1 = ({Digit}+"."({FloatHelper1}|{FloatHelper2}|{Digit}+({FloatHelper1}|{FloatHelper2})))
-FloatLiteral2 = ("."{Digit}+({FloatHelper1}|{FloatHelper2}))
-FloatLiteral3 = ({Digit}+{FloatHelper2})
-FloatLiteral = ({FloatLiteral1}|{FloatLiteral2}|{FloatLiteral3}|({Digit}+[fFdD]))
-ErrorNumberFormat = (({IntegerLiteral}|{HexLiteral}|{FloatLiteral}){NonSeparator}+)
-BooleanLiteral = ("true"|"false")
-
-Separator = ([\(\)\[\]])
-Separator2 = ([\;,.])
-
-Operator = ([\^\@\:\=\<\>\+\-\/\*])
-
-Identifier = ({IdentifierStart}{IdentifierPart}*)
-ErrorIdentifier = ({NonSeparator}+)
-
-URLGenDelim = ([:\/\?#\[\]@])
-URLSubDelim = ([\!\$&'\(\)\*\+,;=])
-URLUnreserved = ({LetterOrUnderscore}|{Digit}|[\-\.\~])
-URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
-URLCharacters = ({URLCharacter}*)
-URLEndCharacter = ([\/\$]|{Letter}|{Digit})
-URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
-
-
-%state MLC
-%state MLC2
-%state COMPILER_DIRECTIVE
-%state COMPILER_DIRECTIVE2
-%state EOL_COMMENT
-
-%%
-
-
- *
- * This implementation was created using
- * JFlex 1.4.1; however, the generated file
- * was modified for performance. Memory allocation needs to be almost completely
- * removed to be competitive with the handwritten lexers (subclasses of
- * AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around). We can
- * achieve this because RText always scans exactly 1 line of tokens at a time,
- * and hands the scanner this line as an array of characters (a Segment really).
- * Since tokens contain pointers to char arrays instead of Strings holding their
- * contents, there is no need for allocating new memory for Strings.
- *
- * - * The actual algorithm generated for scanning has, of course, not been - * modified. - *
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
DelphiTokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
. You
- * should hand-delete the second of each definition (the ones generated by the
- * lexer), as these generated methods modify the input buffer, which we'll never
- * have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would with
- * any other TokenMaker
instance.aState
- */
- private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
- private static final String ZZ_ATTRIBUTE_PACKED_0 = "\6\0\4\1\1\11\1\1\1\11\4\1\2\11\30\1"
- + "\2\11\4\1\1\11\2\1\2\11\1\1\1\11\2\1" + "\1\11\13\1\2\11\1\1\1\11\100\1\4\0\2\11"
- + "\4\0\1\1\1\0\2\1\1\11\123\1\10\0\104\1" + "\2\0\1\1\2\0\66\1\4\0\76\1";
-
- private static int[] zzUnpackAttribute() {
- int[] result = new int[437];
- int offset = 0;
- offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
- return result;
- }
-
- private static int zzUnpackAttribute(String packed, int offset, int[] result) {
- int i = 0; /* index in packed string */
- int j = offset; /* index in unpacked array */
- int l = packed.length();
- while (i < l) {
- int count = packed.charAt(i++);
- int value = packed.charAt(i++);
- do
- result[j++] = value;
- while (--count > 0);
- }
- return j;
- }
-
- /** the input device */
- private java.io.Reader zzReader;
- /** the current state of the DFA */
- private int zzState;
- /** the current lexical state */
- private int zzLexicalState = YYINITIAL;
- /**
- * this buffer contains the current text to be matched and is the source of the
- * yytext() string
- */
- private char zzBuffer[];
- /** the textposition at the last accepting state */
- private int zzMarkedPos;
- /** the current text position in the buffer */
- private int zzCurrentPos;
- /** startRead marks the beginning of the yytext() string in the buffer */
- private int zzStartRead;
- /**
- * endRead marks the last character in the buffer, that has been read from input
- */
- private int zzEndRead;
- /** zzAtEOF == true <=> the scanner is at the EOF */
- private boolean zzAtEOF;
- /* user code: */
- /**
- * Token type specific to DelphiTokenMaker; denotes a line ending with an
- * unterminated "(*" comment.
- */
- public static final int INTERNAL_MLC2 = -1;
- /**
- * Token type specific to DelphiTokenMaker; denotes a line ending with an
- * unterminated "{$" compiler directive.
- */
- public static final int INTERNAL_COMPILER_DIRECTIVE = -2;
- /**
- * Token type specific to DelphiTokenMaker; denotes a line ending with an
- * unterminated "(*$" compiler directive.
- */
- public static final int INTERNAL_COMPILER_DIRECTIVE2 = -3;
-
- /**
- * Constructor. This must be here because JFlex does not generate a no-parameter
- * constructor.
- */
- public DelphiTokenMaker() {
- }
-
- /**
- * Adds the token specified to the current linked list of tokens as an "end
- * token;" that is, at zzMarkedPos
.
- *
- * @param tokenType The token's type.
- */
- private void addEndToken(int tokenType) {
- addToken(zzMarkedPos, zzMarkedPos, tokenType);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- * @see #addToken(int, int, int)
- */
- private void addHyperlinkToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so, true);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int tokenType) {
- addToken(zzStartRead, zzMarkedPos - 1, tokenType);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- * @see #addHyperlinkToken(int, int, int)
- */
- private void addToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so, false);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param array The character array.
- * @param start The starting offset in the array.
- * @param end The ending offset in the array.
- * @param tokenType The token's type.
- * @param startOffset The offset in the document at which this token occurs.
- * @param hyperlink Whether this token is a hyperlink.
- */
- @Override
- public void addToken(char[] array, int start, int end, int tokenType, int startOffset, boolean hyperlink) {
- super.addToken(array, start, end, tokenType, startOffset, hyperlink);
- zzStartRead = zzMarkedPos;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String[] getLineCommentStartAndEnd(int languageIndex) {
- return new String[] { "//", null };
- }
-
- /**
- * Returns the first token in the linked list of tokens generated from
- * text
. This method must be implemented by subclasses so they can
- * correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing the syntax
- * highlighted text.
- */
- @Override
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
- // Start off in the proper state.
- int state = Token.NULL;
- switch (initialTokenType) {
- case Token.COMMENT_MULTILINE:
- state = MLC;
- start = text.offset;
- break;
- case INTERNAL_MLC2:
- state = MLC2;
- start = text.offset;
- break;
- case INTERNAL_COMPILER_DIRECTIVE:
- state = COMPILER_DIRECTIVE;
- start = text.offset;
- break;
- case INTERNAL_COMPILER_DIRECTIVE2:
- state = COMPILER_DIRECTIVE2;
- start = text.offset;
- break;
- default:
- state = Token.NULL;
- }
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
- }
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos >= s.offset + s.count;
- }
-
- /**
- * Resets the scanner to read from a new input stream. Does not close the old
- * reader.
- *
- * All internal variables are reset, the old input stream cannot be
- * reused (internal buffer is discarded and lost). Lexical state is set to
- * YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill no longer
- * "refills" the buffer (since the way we do it, it's always "full" the first
- * time through, since it points to the segment's array). So, we assign
- * zzEndRead here.
- */
- // zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtEOF = false;
- }
-
- /**
- * Creates a new scanner There is also a java.io.InputStream version of this
- * constructor.
- *
- * @param in the java.io.Reader to read input from.
- */
- public DelphiTokenMaker(java.io.Reader in) {
- this.zzReader = in;
- }
-
- /**
- * Creates a new scanner. There is also java.io.Reader version of this
- * constructor.
- *
- * @param in the java.io.Inputstream to read input from.
- */
- public DelphiTokenMaker(java.io.InputStream in) {
- this(new java.io.InputStreamReader(in));
- }
-
- /**
- * Unpacks the compressed character translation table.
- *
- * @param packed the packed character translation table
- * @return the unpacked character translation table
- */
- private static char[] zzUnpackCMap(String packed) {
- char[] map = new char[0x10000];
- int i = 0; /* index in packed string */
- int j = 0; /* index in unpacked array */
- while (i < 158) {
- int count = packed.charAt(i++);
- char value = packed.charAt(i++);
- do
- map[j++] = value;
- while (--count > 0);
- }
- return map;
- }
-
- /**
- * Closes the input stream.
- */
- public final void yyclose() throws java.io.IOException {
- zzAtEOF = true; /* indicate end of file */
- zzEndRead = zzStartRead; /* invalidate buffer */
- if (zzReader != null)
- zzReader.close();
- }
-
- /**
- * Returns the current lexical state.
- */
- public final int yystate() {
- return zzLexicalState;
- }
-
- /**
- * Enters a new lexical state
- *
- * @param newState the new lexical state
- */
- @Override
- public final void yybegin(int newState) {
- zzLexicalState = newState;
- }
-
- /**
- * Returns the text matched by the current regular expression.
- */
- public final String yytext() {
- return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
- }
-
- /**
- * Returns the character at position pos from the matched text.
- *
- * It is equivalent to yytext().charAt(pos), but faster
- *
- * @param pos the position of the character to fetch. A value from 0 to
- * yylength()-1.
- *
- * @return the character at position pos
- */
- public final char yycharat(int pos) {
- return zzBuffer[zzStartRead + pos];
- }
-
- /**
- * Returns the length of the matched text region.
- */
- public final int yylength() {
- return zzMarkedPos - zzStartRead;
- }
-
- /**
- * Reports an error that occured while scanning.
- *
- * In a wellformed scanner (no or only correct usage of yypushback(int) and a
- * match-all fallback rule) this method will only be called with things that
- * "Can't Possibly Happen". If this method is called, something is seriously
- * wrong (e.g. a JFlex bug producing a faulty scanner etc.).
- *
- * Usual syntax/scanner level error handling should be done in error fallback
- * rules.
- *
- * @param errorCode the code of the errormessage to display
- */
- private void zzScanError(int errorCode) {
- String message;
- try {
- message = ZZ_ERROR_MSG[errorCode];
- } catch (ArrayIndexOutOfBoundsException e) {
- message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
- }
- throw new Error(message);
- }
-
- /**
- * Pushes the specified amount of characters back into the input stream.
- *
- * They will be read again by then next call of the scanning method
- *
- * @param number the number of characters to be read again. This number must not
- * be greater than yylength()!
- */
- public void yypushback(int number) {
- if (number > yylength())
- zzScanError(ZZ_PUSHBACK_2BIG);
- zzMarkedPos -= number;
- }
-
- /**
- * Resumes scanning until the next regular expression is matched, the end of
- * input is encountered or an I/O-Error occurs.
- *
- * @return the next token
- * @exception java.io.IOException if any I/O-Error occurs
- */
- public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
- int zzInput;
- int zzAction;
- // cached fields:
- int zzCurrentPosL;
- int zzMarkedPosL;
- int zzEndReadL = zzEndRead;
- char[] zzBufferL = zzBuffer;
- char[] zzCMapL = ZZ_CMAP;
- int[] zzTransL = ZZ_TRANS;
- int[] zzRowMapL = ZZ_ROWMAP;
- int[] zzAttrL = ZZ_ATTRIBUTE;
- while (true) {
- zzMarkedPosL = zzMarkedPos;
- zzAction = -1;
- zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
- zzState = zzLexicalState;
- zzForAction: {
- while (true) {
- if (zzCurrentPosL < zzEndReadL)
- zzInput = zzBufferL[zzCurrentPosL++];
- else if (zzAtEOF) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- // store back cached positions
- zzCurrentPos = zzCurrentPosL;
- zzMarkedPos = zzMarkedPosL;
- boolean eof = zzRefill();
- // get translated positions and possibly new buffer
- zzCurrentPosL = zzCurrentPos;
- zzMarkedPosL = zzMarkedPos;
- zzBufferL = zzBuffer;
- zzEndReadL = zzEndRead;
- if (eof) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- zzInput = zzBufferL[zzCurrentPosL++];
- }
- }
- int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
- if (zzNext == -1)
- break zzForAction;
- zzState = zzNext;
- int zzAttributes = zzAttrL[zzState];
- if ((zzAttributes & 1) == 1) {
- zzAction = zzState;
- zzMarkedPosL = zzCurrentPosL;
- if ((zzAttributes & 8) == 8)
- break zzForAction;
- }
- }
- }
- // store back cached position
- zzMarkedPos = zzMarkedPosL;
- switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
- case 15: {
- addToken(start, zzStartRead - 1, Token.PREPROCESSOR);
- addEndToken(INTERNAL_COMPILER_DIRECTIVE);
- return firstToken;
- }
- case 35:
- break;
- case 4: {
- addToken(Token.PREPROCESSOR);
- }
- case 36:
- break;
- case 5: {
- addNullToken();
- return firstToken;
- }
- case 37:
- break;
- case 27: {
- yybegin(YYINITIAL);
- addToken(start, zzStartRead + 1, Token.COMMENT_MULTILINE);
- }
- case 38:
- break;
- case 6: {
- addToken(Token.WHITESPACE);
- }
- case 39:
- break;
- case 21: {
- addToken(Token.LITERAL_NUMBER_HEXADECIMAL);
- }
- case 40:
- break;
- case 20: {
- addToken(Token.LITERAL_NUMBER_FLOAT);
- }
- case 41:
- break;
- case 26: {
- addToken(Token.RESERVED_WORD);
- }
- case 42:
- break;
- case 16: {
- yybegin(YYINITIAL);
- addToken(start, zzStartRead, Token.PREPROCESSOR);
- }
- case 43:
- break;
- case 9: {
- addToken(Token.SEPARATOR);
- }
- case 44:
- break;
- case 17: {
- addToken(start, zzStartRead - 1, Token.PREPROCESSOR);
- addEndToken(INTERNAL_COMPILER_DIRECTIVE2);
- return firstToken;
- }
- case 45:
- break;
- case 2: {
- addToken(Token.IDENTIFIER);
- }
- case 46:
- break;
- case 18: {
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- addNullToken();
- return firstToken;
- }
- case 47:
- break;
- case 25: {
- start = zzMarkedPos - 2;
- yybegin(EOL_COMMENT);
- }
- case 48:
- break;
- case 30: {
- addToken(Token.FUNCTION);
- }
- case 49:
- break;
- case 7: {
- addToken(Token.ERROR_STRING_DOUBLE);
- addNullToken();
- return firstToken;
- }
- case 50:
- break;
- case 14: {
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- addEndToken(INTERNAL_MLC2);
- return firstToken;
- }
- case 51:
- break;
- case 32: {
- addToken(Token.DATA_TYPE);
- }
- case 52:
- break;
- case 1: {
- addToken(Token.ERROR_IDENTIFIER);
- }
- case 53:
- break;
- case 31: {
- addToken(Token.LITERAL_BOOLEAN);
- }
- case 54:
- break;
- case 22: {
- addToken(Token.LITERAL_STRING_DOUBLE_QUOTE);
- }
- case 55:
- break;
- case 34: {
- int temp = zzStartRead;
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_EOL);
- start = zzMarkedPos;
- }
- case 56:
- break;
- case 29: {
- start = zzMarkedPos - 3;
- yybegin(COMPILER_DIRECTIVE2);
- }
- case 57:
- break;
- case 24: {
- start = zzMarkedPos - 2;
- yybegin(MLC2);
- }
- case 58:
- break;
- case 33: {
- int temp = zzStartRead;
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- addHyperlinkToken(temp, zzMarkedPos - 1, Token.COMMENT_MULTILINE);
- start = zzMarkedPos;
- }
- case 59:
- break;
- case 19: {
- addToken(Token.ERROR_NUMBER_FORMAT);
- }
- case 60:
- break;
- case 28: {
- yybegin(YYINITIAL);
- addToken(start, zzStartRead + 1, Token.PREPROCESSOR);
- }
- case 61:
- break;
- case 13: {
- yybegin(YYINITIAL);
- addToken(start, zzStartRead, Token.COMMENT_MULTILINE);
- }
- case 62:
- break;
- case 3: {
- addToken(Token.LITERAL_NUMBER_DECIMAL_INT);
- }
- case 63:
- break;
- case 10: {
- addToken(Token.OPERATOR);
- }
- case 64:
- break;
- case 8: {
- start = zzMarkedPos - 1;
- yybegin(MLC);
- }
- case 65:
- break;
- case 23: {
- start = zzMarkedPos - 2;
- yybegin(COMPILER_DIRECTIVE);
- }
- case 66:
- break;
- case 11: {
- }
- case 67:
- break;
- case 12: {
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- return firstToken;
- }
- case 68:
- break;
- default:
- if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
- zzAtEOF = true;
- switch (zzLexicalState) {
- case COMPILER_DIRECTIVE: {
- addToken(start, zzStartRead - 1, Token.PREPROCESSOR);
- addEndToken(INTERNAL_COMPILER_DIRECTIVE);
- return firstToken;
- }
- case 438:
- break;
- case EOL_COMMENT: {
- addToken(start, zzStartRead - 1, Token.COMMENT_EOL);
- addNullToken();
- return firstToken;
- }
- case 439:
- break;
- case YYINITIAL: {
- addNullToken();
- return firstToken;
- }
- case 440:
- break;
- case COMPILER_DIRECTIVE2: {
- addToken(start, zzStartRead - 1, Token.PREPROCESSOR);
- addEndToken(INTERNAL_COMPILER_DIRECTIVE2);
- return firstToken;
- }
- case 441:
- break;
- case MLC: {
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- return firstToken;
- }
- case 442:
- break;
- case MLC2: {
- addToken(start, zzStartRead - 1, Token.COMMENT_MULTILINE);
- addEndToken(INTERNAL_MLC2);
- return firstToken;
- }
- case 443:
- break;
- default:
- return null;
- }
- } else {
- zzScanError(ZZ_NO_MATCH);
- }
- }
- }
- }
-}
diff --git a/src/org/fife/ui/rsyntaxtextarea/modes/DockerTokenMaker.flex b/src/org/fife/ui/rsyntaxtextarea/modes/DockerTokenMaker.flex
deleted file mode 100644
index 042efde..0000000
--- a/src/org/fife/ui/rsyntaxtextarea/modes/DockerTokenMaker.flex
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * 11/24/2015
- *
- * This library is distributed under a modified BSD license. See the included
- * RSyntaxTextArea.License.txt file for details.
- */
-package org.fife.ui.rsyntaxtextarea.modes;
-
-import java.io.*;
-import javax.swing.text.Segment;
-
-import org.fife.ui.rsyntaxtextarea.*;
-
-
-/**
- * Scanner for Dockerfiles.
- *
- * This implementation was created using
- * JFlex 1.4.1; however, the generated file
- * was modified for performance. Memory allocation needs to be almost
- * completely removed to be competitive with the handwritten lexers (subclasses
- * of AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around).
- * We can achieve this because RText always scans exactly 1 line of tokens at a
- * time, and hands the scanner this line as an array of characters (a Segment
- * really). Since tokens contain pointers to char arrays instead of Strings
- * holding their contents, there is no need for allocating new memory for
- * Strings.
- * - * The actual algorithm generated for scanning has, of course, not been - * modified.
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
DockerTokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
.
- * You should hand-delete the second of each definition (the ones
- * generated by the lexer), as these generated methods modify the input
- * buffer, which we'll never have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would
- * with any other TokenMaker
instance.text
. This method must be implemented by
- * subclasses so they can correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing
- * the syntax highlighted text.
- */
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
-
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
-
- // Start off in the proper state.
- int state = TokenTypes.NULL;
-
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
-
- }
-
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise
- * false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos>=s.offset+s.count;
- }
-
-
- /**
- * Resets the scanner to read from a new input stream.
- * Does not close the old reader.
- *
- * All internal variables are reset, the old input stream
- * cannot be reused (internal buffer is discarded and lost).
- * Lexical state is set to YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill
- * no longer "refills" the buffer (since the way we do it, it's always
- * "full" the first time through, since it points to the segment's
- * array). So, we assign zzEndRead here.
- */
- //zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtBOL = true;
- zzAtEOF = false;
- }
-
-
-%}
-
-Letter = [A-Za-z]
-Digit = [0-9]
-IdentifierPart = ({Letter}|{Digit}|[_\-\.])
-Identifier = ({IdentifierPart}|{IdentifierPart}*)
-WhiteSpace = ([ \t\f])
-
-%state STRING
-%state CHAR_LITERAL
-
-%%
-
-
- *
- * This implementation was created using
- * JFlex 1.4.1; however, the generated file
- * was modified for performance. Memory allocation needs to be almost completely
- * removed to be competitive with the handwritten lexers (subclasses of
- * AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around). We can
- * achieve this because RText always scans exactly 1 line of tokens at a time,
- * and hands the scanner this line as an array of characters (a Segment really).
- * Since tokens contain pointers to char arrays instead of Strings holding their
- * contents, there is no need for allocating new memory for Strings.
- *
- * - * The actual algorithm generated for scanning has, of course, not been - * modified. - *
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
DockerTokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
. You
- * should hand-delete the second of each definition (the ones generated by the
- * lexer), as these generated methods modify the input buffer, which we'll never
- * have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would with
- * any other TokenMaker
instance.aState
- */
- private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
- private static final String ZZ_ATTRIBUTE_PACKED_0 = "\1\1\2\0\1\11\16\1\2\11\1\1\2\11\1\1"
- + "\1\11\1\1\2\11\2\1\2\11\17\1\2\11\43\1";
-
- private static int[] zzUnpackAttribute() {
- int[] result = new int[84];
- int offset = 0;
- offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
- return result;
- }
-
- private static int zzUnpackAttribute(String packed, int offset, int[] result) {
- int i = 0; /* index in packed string */
- int j = offset; /* index in unpacked array */
- int l = packed.length();
- while (i < l) {
- int count = packed.charAt(i++);
- int value = packed.charAt(i++);
- do
- result[j++] = value;
- while (--count > 0);
- }
- return j;
- }
-
- /** the input device */
- private java.io.Reader zzReader;
- /** the current state of the DFA */
- private int zzState;
- /** the current lexical state */
- private int zzLexicalState = YYINITIAL;
- /**
- * this buffer contains the current text to be matched and is the source of the
- * yytext() string
- */
- private char zzBuffer[];
- /** the textposition at the last accepting state */
- private int zzMarkedPos;
- /** the current text position in the buffer */
- private int zzCurrentPos;
- /** startRead marks the beginning of the yytext() string in the buffer */
- private int zzStartRead;
- /**
- * endRead marks the last character in the buffer, that has been read from input
- */
- private int zzEndRead;
- /** zzAtEOF == true <=> the scanner is at the EOF */
- private boolean zzAtEOF;
- /* user code: */
-
- /**
- * Constructor. This must be here because JFlex does not generate a no-parameter
- * constructor.
- */
- public DockerTokenMaker() {
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int tokenType) {
- addToken(zzStartRead, zzMarkedPos - 1, tokenType);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param array The character array.
- * @param start The starting offset in the array.
- * @param end The ending offset in the array.
- * @param tokenType The token's type.
- * @param startOffset The offset in the document at which this token occurs.
- */
- @Override
- public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
- super.addToken(array, start, end, tokenType, startOffset);
- zzStartRead = zzMarkedPos;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String[] getLineCommentStartAndEnd(int languageIndex) {
- return new String[] { "#", null };
- }
-
- /**
- * Returns whether tokens of the specified type should have "mark occurrences"
- * enabled for the current programming language.
- *
- * @param type The token type.
- * @return Whether tokens of this type should have "mark occurrences" enabled.
- */
- @Override
- public boolean getMarkOccurrencesOfTokenType(int type) {
- return type == Token.IDENTIFIER || type == Token.RESERVED_WORD;
- }
-
- /**
- * Returns the first token in the linked list of tokens generated from
- * text
. This method must be implemented by subclasses so they can
- * correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing the syntax
- * highlighted text.
- */
- @Override
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
- // Start off in the proper state.
- int state = TokenTypes.NULL;
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
- }
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos >= s.offset + s.count;
- }
-
- /**
- * Resets the scanner to read from a new input stream. Does not close the old
- * reader.
- *
- * All internal variables are reset, the old input stream cannot be
- * reused (internal buffer is discarded and lost). Lexical state is set to
- * YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill no longer
- * "refills" the buffer (since the way we do it, it's always "full" the first
- * time through, since it points to the segment's array). So, we assign
- * zzEndRead here.
- */
- // zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtEOF = false;
- }
-
- /**
- * Creates a new scanner There is also a java.io.InputStream version of this
- * constructor.
- *
- * @param in the java.io.Reader to read input from.
- */
- public DockerTokenMaker(java.io.Reader in) {
- this.zzReader = in;
- }
-
- /**
- * Creates a new scanner. There is also java.io.Reader version of this
- * constructor.
- *
- * @param in the java.io.Inputstream to read input from.
- */
- public DockerTokenMaker(java.io.InputStream in) {
- this(new java.io.InputStreamReader(in));
- }
-
- /**
- * Unpacks the compressed character translation table.
- *
- * @param packed the packed character translation table
- * @return the unpacked character translation table
- */
- private static char[] zzUnpackCMap(String packed) {
- char[] map = new char[0x10000];
- int i = 0; /* index in packed string */
- int j = 0; /* index in unpacked array */
- while (i < 160) {
- int count = packed.charAt(i++);
- char value = packed.charAt(i++);
- do
- map[j++] = value;
- while (--count > 0);
- }
- return map;
- }
-
- /**
- * Closes the input stream.
- */
- public final void yyclose() throws java.io.IOException {
- zzAtEOF = true; /* indicate end of file */
- zzEndRead = zzStartRead; /* invalidate buffer */
- if (zzReader != null)
- zzReader.close();
- }
-
- /**
- * Returns the current lexical state.
- */
- public final int yystate() {
- return zzLexicalState;
- }
-
- /**
- * Enters a new lexical state
- *
- * @param newState the new lexical state
- */
- @Override
- public final void yybegin(int newState) {
- zzLexicalState = newState;
- }
-
- /**
- * Returns the text matched by the current regular expression.
- */
- public final String yytext() {
- return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
- }
-
- /**
- * Returns the character at position pos from the matched text.
- *
- * It is equivalent to yytext().charAt(pos), but faster
- *
- * @param pos the position of the character to fetch. A value from 0 to
- * yylength()-1.
- *
- * @return the character at position pos
- */
- public final char yycharat(int pos) {
- return zzBuffer[zzStartRead + pos];
- }
-
- /**
- * Returns the length of the matched text region.
- */
- public final int yylength() {
- return zzMarkedPos - zzStartRead;
- }
-
- /**
- * Reports an error that occured while scanning.
- *
- * In a wellformed scanner (no or only correct usage of yypushback(int) and a
- * match-all fallback rule) this method will only be called with things that
- * "Can't Possibly Happen". If this method is called, something is seriously
- * wrong (e.g. a JFlex bug producing a faulty scanner etc.).
- *
- * Usual syntax/scanner level error handling should be done in error fallback
- * rules.
- *
- * @param errorCode the code of the errormessage to display
- */
- private void zzScanError(int errorCode) {
- String message;
- try {
- message = ZZ_ERROR_MSG[errorCode];
- } catch (ArrayIndexOutOfBoundsException e) {
- message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
- }
- throw new Error(message);
- }
-
- /**
- * Pushes the specified amount of characters back into the input stream.
- *
- * They will be read again by then next call of the scanning method
- *
- * @param number the number of characters to be read again. This number must not
- * be greater than yylength()!
- */
- public void yypushback(int number) {
- if (number > yylength())
- zzScanError(ZZ_PUSHBACK_2BIG);
- zzMarkedPos -= number;
- }
-
- /**
- * Resumes scanning until the next regular expression is matched, the end of
- * input is encountered or an I/O-Error occurs.
- *
- * @return the next token
- * @exception java.io.IOException if any I/O-Error occurs
- */
- public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
- int zzInput;
- int zzAction;
- // cached fields:
- int zzCurrentPosL;
- int zzMarkedPosL;
- int zzEndReadL = zzEndRead;
- char[] zzBufferL = zzBuffer;
- char[] zzCMapL = ZZ_CMAP;
- int[] zzTransL = ZZ_TRANS;
- int[] zzRowMapL = ZZ_ROWMAP;
- int[] zzAttrL = ZZ_ATTRIBUTE;
- while (true) {
- zzMarkedPosL = zzMarkedPos;
- zzAction = -1;
- zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
- zzState = zzLexicalState;
- zzForAction: {
- while (true) {
- if (zzCurrentPosL < zzEndReadL)
- zzInput = zzBufferL[zzCurrentPosL++];
- else if (zzAtEOF) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- // store back cached positions
- zzCurrentPos = zzCurrentPosL;
- zzMarkedPos = zzMarkedPosL;
- boolean eof = zzRefill();
- // get translated positions and possibly new buffer
- zzCurrentPosL = zzCurrentPos;
- zzMarkedPosL = zzMarkedPos;
- zzBufferL = zzBuffer;
- zzEndReadL = zzEndRead;
- if (eof) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- zzInput = zzBufferL[zzCurrentPosL++];
- }
- }
- int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
- if (zzNext == -1)
- break zzForAction;
- zzState = zzNext;
- int zzAttributes = zzAttrL[zzState];
- if ((zzAttributes & 1) == 1) {
- zzAction = zzState;
- zzMarkedPosL = zzCurrentPosL;
- if ((zzAttributes & 8) == 8)
- break zzForAction;
- }
- }
- }
- // store back cached position
- zzMarkedPos = zzMarkedPosL;
- switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
- case 16: {
- addToken(Token.RESERVED_WORD);
- }
- case 17:
- break;
- case 1: {
- addToken(Token.IDENTIFIER);
- }
- case 18:
- break;
- case 7: {
- addToken(Token.COMMENT_EOL);
- addNullToken();
- return firstToken;
- }
- case 19:
- break;
- case 2: {
- addToken(Token.WHITESPACE);
- }
- case 20:
- break;
- case 11: {
- addToken(start, zzStartRead - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
- return firstToken;
- }
- case 21:
- break;
- case 14: {
- addToken(start, zzStartRead - 1, Token.LITERAL_CHAR);
- return firstToken;
- }
- case 22:
- break;
- case 12: { /* Skip escaped chars. */
- }
- case 23:
- break;
- case 4: {
- addToken(Token.OPERATOR);
- }
- case 24:
- break;
- case 15: { /*
- * Skip escaped single quotes only, but this should still work.
- */
- }
- case 25:
- break;
- case 5: {
- start = zzMarkedPos - 1;
- yybegin(STRING);
- }
- case 26:
- break;
- case 13: {
- yybegin(YYINITIAL);
- addToken(start, zzStartRead, Token.LITERAL_CHAR);
- }
- case 27:
- break;
- case 10: {
- yybegin(YYINITIAL);
- addToken(start, zzStartRead, Token.LITERAL_STRING_DOUBLE_QUOTE);
- }
- case 28:
- break;
- case 8: {
- addNullToken();
- return firstToken;
- }
- case 29:
- break;
- case 9: {
- }
- case 30:
- break;
- case 3: {
- addToken(Token.SEPARATOR);
- }
- case 31:
- break;
- case 6: {
- start = zzMarkedPos - 1;
- yybegin(CHAR_LITERAL);
- }
- case 32:
- break;
- default:
- if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
- zzAtEOF = true;
- switch (zzLexicalState) {
- case STRING: {
- addToken(start, zzStartRead - 1, Token.LITERAL_STRING_DOUBLE_QUOTE);
- return firstToken;
- }
- case 85:
- break;
- case CHAR_LITERAL: {
- addToken(start, zzStartRead - 1, Token.LITERAL_CHAR);
- return firstToken;
- }
- case 86:
- break;
- case YYINITIAL: {
- addNullToken();
- return firstToken;
- }
- case 87:
- break;
- default:
- return null;
- }
- } else {
- zzScanError(ZZ_NO_MATCH);
- }
- }
- }
- }
-}
diff --git a/src/org/fife/ui/rsyntaxtextarea/modes/DtdTokenMaker.flex b/src/org/fife/ui/rsyntaxtextarea/modes/DtdTokenMaker.flex
deleted file mode 100644
index 8a2f8f3..0000000
--- a/src/org/fife/ui/rsyntaxtextarea/modes/DtdTokenMaker.flex
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * 04/12/2012
- *
- * DtdTokenMaker.java - Generates tokens for DTD syntax highlighting.
- *
- * This library is distributed under a modified BSD license. See the included
- * RSyntaxTextArea.License.txt file for details.
- */
-package org.fife.ui.rsyntaxtextarea.modes;
-
-import java.io.*;
-import javax.swing.text.Segment;
-
-import org.fife.ui.rsyntaxtextarea.*;
-
-
-/**
- * Scanner for DTD files.
- *
- * This implementation was created using
- * JFlex 1.4.1; however, the generated file
- * was modified for performance. Memory allocation needs to be almost
- * completely removed to be competitive with the handwritten lexers (subclasses
- * of AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around).
- * We can achieve this because RText always scans exactly 1 line of tokens at a
- * time, and hands the scanner this line as an array of characters (a Segment
- * really). Since tokens contain pointers to char arrays instead of Strings
- * holding their contents, there is no need for allocating new memory for
- * Strings.- * - * The actual algorithm generated for scanning has, of course, not been - * modified.
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
XMLTokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
.
- * You should hand-delete the second of each definition (the ones
- * generated by the lexer), as these generated methods modify the input
- * buffer, which we'll never have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would
- * with any other TokenMaker
instance.zzMarkedPos
.
- *
- * @param tokenType The token's type.
- */
- private void addEndToken(int tokenType) {
- addToken(zzMarkedPos,zzMarkedPos, tokenType);
- }
-
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- * @see #addToken(int, int, int)
- */
- private void addHyperlinkToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start,end, tokenType, so, true);
- }
-
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int tokenType) {
- addToken(zzStartRead, zzMarkedPos-1, tokenType);
- }
-
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start,end, tokenType, so);
- }
-
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param array The character array.
- * @param start The starting offset in the array.
- * @param end The ending offset in the array.
- * @param tokenType The token's type.
- * @param startOffset The offset in the document at which this token
- * occurs.
- */
- @Override
- public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
- super.addToken(array, start,end, tokenType, startOffset);
- zzStartRead = zzMarkedPos;
- }
-
-
- /**
- * Always returns false, as you never want "mark occurrences"
- * working in XML files.
- *
- * @param type The token type.
- * @return Whether tokens of this type should have "mark occurrences"
- * enabled.
- */
- @Override
- public boolean getMarkOccurrencesOfTokenType(int type) {
- return false;
- }
-
-
- /**
- * Returns the first token in the linked list of tokens generated
- * from text
. This method must be implemented by
- * subclasses so they can correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing
- * the syntax highlighted text.
- */
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
-
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
- prevState = YYINITIAL;
-
- // Start off in the proper state.
- int state = YYINITIAL;
- switch (initialTokenType) {
- case INTERNAL_INTAG_START:
- state = INTAG_START;
- break;
- case INTERNAL_INTAG_ELEMENT:
- state = INTAG_ELEMENT;
- break;
- case INTERNAL_INTAG_ATTLIST:
- state = INTAG_ATTLIST;
- break;
- default:
- if (initialTokenType<-1024) { // INTERNAL_IN_COMMENT - prevState
- int main = -(-initialTokenType & 0xffffff00);
- switch (main) {
- default: // Should never happen
- case INTERNAL_IN_COMMENT:
- state = COMMENT;
- break;
- }
- prevState = -initialTokenType&0xff;
- }
- else { // Shouldn't happen
- state = YYINITIAL;
- }
- }
-
- start = text.offset;
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
-
- }
-
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise
- * false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos>=s.offset+s.count;
- }
-
-
- /**
- * Resets the scanner to read from a new input stream.
- * Does not close the old reader.
- *
- * All internal variables are reset, the old input stream
- * cannot be reused (internal buffer is discarded and lost).
- * Lexical state is set to YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(java.io.Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill
- * no longer "refills" the buffer (since the way we do it, it's always
- * "full" the first time through, since it points to the segment's
- * array). So, we assign zzEndRead here.
- */
- //zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtBOL = true;
- zzAtEOF = false;
- }
-
-
-%}
-
-Whitespace = ([ \t\f])
-LineTerminator = ([\n])
-UnclosedString = ([\"][^\"]*)
-UnclosedChar = ([\'][^\']*)
-
-URLGenDelim = ([:\/\?#\[\]@])
-URLSubDelim = ([\!\$&'\(\)\*\+,;=])
-URLUnreserved = ([A-Za-z_0-9\-\.\~])
-URLCharacter = ({URLGenDelim}|{URLSubDelim}|{URLUnreserved}|[%])
-URLCharacters = ({URLCharacter}*)
-URLEndCharacter = ([\/\$A-Za-z0-9])
-URL = (((https?|f(tp|ile))"://"|"www.")({URLCharacters}{URLEndCharacter})?)
-
-%state COMMENT
-%state INTAG_START
-%state INTAG_ELEMENT
-%state INTAG_ATTLIST
-
-%%
-
-AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around). We can
- * achieve this because RText always scans exactly 1 line of tokens at a time,
- * and hands the scanner this line as an array of characters (a Segment really).
- * Since tokens contain pointers to char arrays instead of Strings holding their
- * contents, there is no need for allocating new memory for Strings.
- * - * - * The actual algorithm generated for scanning has, of course, not been - * modified. - *
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
XMLTokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
. You
- * should hand-delete the second of each definition (the ones generated by the
- * lexer), as these generated methods modify the input buffer, which we'll never
- * have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would with
- * any other TokenMaker
instance.aState
- */
- private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
- private static final String ZZ_ATTRIBUTE_PACKED_0 = "\5\0\4\1\1\11\5\1\1\11\11\1\5\0\2\1"
- + "\1\11\3\1\5\0\1\11\5\1\1\11\2\0\6\1" + "\2\0\14\1";
-
- private static int[] zzUnpackAttribute() {
- int[] result = new int[70];
- int offset = 0;
- offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
- return result;
- }
-
- private static int zzUnpackAttribute(String packed, int offset, int[] result) {
- int i = 0; /* index in packed string */
- int j = offset; /* index in unpacked array */
- int l = packed.length();
- while (i < l) {
- int count = packed.charAt(i++);
- int value = packed.charAt(i++);
- do
- result[j++] = value;
- while (--count > 0);
- }
- return j;
- }
-
- /** the input device */
- private java.io.Reader zzReader;
- /** the current state of the DFA */
- private int zzState;
- /** the current lexical state */
- private int zzLexicalState = YYINITIAL;
- /**
- * this buffer contains the current text to be matched and is the source of the
- * yytext() string
- */
- private char zzBuffer[];
- /** the textposition at the last accepting state */
- private int zzMarkedPos;
- /** the current text position in the buffer */
- private int zzCurrentPos;
- /** startRead marks the beginning of the yytext() string in the buffer */
- private int zzStartRead;
- /**
- * endRead marks the last character in the buffer, that has been read from input
- */
- private int zzEndRead;
- /** zzAtEOF == true <=> the scanner is at the EOF */
- private boolean zzAtEOF;
- /* user code: */
- /**
- * Token type specific to XMLTokenMaker denoting a line ending with an unclosed
- * XML tag; thus a new line is beginning still inside of the tag.
- */
- public static final int INTERNAL_INTAG_START = -1;
- /**
- * Token type specific to XMLTokenMaker denoting a line ending with an unclosed
- * DOCTYPE element.
- */
- public static final int INTERNAL_INTAG_ELEMENT = -2;
- /**
- * Token type specific to XMLTokenMaker denoting a line ending with an unclosed,
- * locally-defined DTD in a DOCTYPE element.
- */
- public static final int INTERNAL_INTAG_ATTLIST = -3;
- /**
- * Token type specific to XMLTokenMaker denoting a line ending with an unclosed
- * comment. The state to return to when this comment ends is embedded in the
- * token type as well.
- */
- public static final int INTERNAL_IN_COMMENT = -(1 << 11);
- /**
- * The state we were in prior to the current one. This is used to know what
- * state to resume after an MLC ends.
- */
- private int prevState;
-
- /**
- * Constructor. This must be here because JFlex does not generate a no-parameter
- * constructor.
- */
- public DtdTokenMaker() {
- }
-
- /**
- * Adds the token specified to the current linked list of tokens as an "end
- * token;" that is, at zzMarkedPos
.
- *
- * @param tokenType The token's type.
- */
- private void addEndToken(int tokenType) {
- addToken(zzMarkedPos, zzMarkedPos, tokenType);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- * @see #addToken(int, int, int)
- */
- private void addHyperlinkToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so, true);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int tokenType) {
- addToken(zzStartRead, zzMarkedPos - 1, tokenType);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param tokenType The token's type.
- */
- private void addToken(int start, int end, int tokenType) {
- int so = start + offsetShift;
- addToken(zzBuffer, start, end, tokenType, so);
- }
-
- /**
- * Adds the token specified to the current linked list of tokens.
- *
- * @param array The character array.
- * @param start The starting offset in the array.
- * @param end The ending offset in the array.
- * @param tokenType The token's type.
- * @param startOffset The offset in the document at which this token occurs.
- */
- @Override
- public void addToken(char[] array, int start, int end, int tokenType, int startOffset) {
- super.addToken(array, start, end, tokenType, startOffset);
- zzStartRead = zzMarkedPos;
- }
-
- /**
- * Always returns false, as you never want "mark occurrences" working
- * in XML files.
- *
- * @param type The token type.
- * @return Whether tokens of this type should have "mark occurrences" enabled.
- */
- @Override
- public boolean getMarkOccurrencesOfTokenType(int type) {
- return false;
- }
-
- /**
- * Returns the first token in the linked list of tokens generated from
- * text
. This method must be implemented by subclasses so they can
- * correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing the syntax
- * highlighted text.
- */
- @Override
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
- prevState = YYINITIAL;
- // Start off in the proper state.
- int state = YYINITIAL;
- switch (initialTokenType) {
- case INTERNAL_INTAG_START:
- state = INTAG_START;
- break;
- case INTERNAL_INTAG_ELEMENT:
- state = INTAG_ELEMENT;
- break;
- case INTERNAL_INTAG_ATTLIST:
- state = INTAG_ATTLIST;
- break;
- default:
- if (initialTokenType < -1024) { // INTERNAL_IN_COMMENT -
- // prevState
- int main = -(-initialTokenType & 0xffffff00);
- switch (main) {
- default: // Should never happen
- case INTERNAL_IN_COMMENT:
- state = COMMENT;
- break;
- }
- prevState = -initialTokenType & 0xff;
- } else { // Shouldn't happen
- state = YYINITIAL;
- }
- }
- start = text.offset;
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
- }
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos >= s.offset + s.count;
- }
-
- /**
- * Resets the scanner to read from a new input stream. Does not close the old
- * reader.
- *
- * All internal variables are reset, the old input stream cannot be
- * reused (internal buffer is discarded and lost). Lexical state is set to
- * YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(java.io.Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill no longer
- * "refills" the buffer (since the way we do it, it's always "full" the first
- * time through, since it points to the segment's array). So, we assign
- * zzEndRead here.
- */
- // zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtEOF = false;
- }
-
- /**
- * Creates a new scanner There is also a java.io.InputStream version of this
- * constructor.
- *
- * @param in the java.io.Reader to read input from.
- */
- public DtdTokenMaker(java.io.Reader in) {
- this.zzReader = in;
- }
-
- /**
- * Creates a new scanner. There is also java.io.Reader version of this
- * constructor.
- *
- * @param in the java.io.Inputstream to read input from.
- */
- public DtdTokenMaker(java.io.InputStream in) {
- this(new java.io.InputStreamReader(in));
- }
-
- /**
- * Unpacks the compressed character translation table.
- *
- * @param packed the packed character translation table
- * @return the unpacked character translation table
- */
- private static char[] zzUnpackCMap(String packed) {
- char[] map = new char[0x10000];
- int i = 0; /* index in packed string */
- int j = 0; /* index in unpacked array */
- while (i < 138) {
- int count = packed.charAt(i++);
- char value = packed.charAt(i++);
- do
- map[j++] = value;
- while (--count > 0);
- }
- return map;
- }
-
- /**
- * Closes the input stream.
- */
- public final void yyclose() throws java.io.IOException {
- zzAtEOF = true; /* indicate end of file */
- zzEndRead = zzStartRead; /* invalidate buffer */
- if (zzReader != null)
- zzReader.close();
- }
-
- /**
- * Returns the current lexical state.
- */
- public final int yystate() {
- return zzLexicalState;
- }
-
- /**
- * Enters a new lexical state
- *
- * @param newState the new lexical state
- */
- @Override
- public final void yybegin(int newState) {
- zzLexicalState = newState;
- }
-
- /**
- * Returns the text matched by the current regular expression.
- */
- public final String yytext() {
- return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
- }
-
- /**
- * Returns the character at position pos from the matched text.
- *
- * It is equivalent to yytext().charAt(pos), but faster
- *
- * @param pos the position of the character to fetch. A value from 0 to
- * yylength()-1.
- *
- * @return the character at position pos
- */
- public final char yycharat(int pos) {
- return zzBuffer[zzStartRead + pos];
- }
-
- /**
- * Returns the length of the matched text region.
- */
- public final int yylength() {
- return zzMarkedPos - zzStartRead;
- }
-
- /**
- * Reports an error that occured while scanning.
- *
- * In a wellformed scanner (no or only correct usage of yypushback(int) and a
- * match-all fallback rule) this method will only be called with things that
- * "Can't Possibly Happen". If this method is called, something is seriously
- * wrong (e.g. a JFlex bug producing a faulty scanner etc.).
- *
- * Usual syntax/scanner level error handling should be done in error fallback
- * rules.
- *
- * @param errorCode the code of the errormessage to display
- */
- private void zzScanError(int errorCode) {
- String message;
- try {
- message = ZZ_ERROR_MSG[errorCode];
- } catch (ArrayIndexOutOfBoundsException e) {
- message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
- }
- throw new Error(message);
- }
-
- /**
- * Pushes the specified amount of characters back into the input stream.
- *
- * They will be read again by then next call of the scanning method
- *
- * @param number the number of characters to be read again. This number must not
- * be greater than yylength()!
- */
- public void yypushback(int number) {
- if (number > yylength())
- zzScanError(ZZ_PUSHBACK_2BIG);
- zzMarkedPos -= number;
- }
-
- /**
- * Resumes scanning until the next regular expression is matched, the end of
- * input is encountered or an I/O-Error occurs.
- *
- * @return the next token
- * @exception java.io.IOException if any I/O-Error occurs
- */
- public org.fife.ui.rsyntaxtextarea.Token yylex() throws java.io.IOException {
- int zzInput;
- int zzAction;
- // cached fields:
- int zzCurrentPosL;
- int zzMarkedPosL;
- int zzEndReadL = zzEndRead;
- char[] zzBufferL = zzBuffer;
- char[] zzCMapL = ZZ_CMAP;
- int[] zzTransL = ZZ_TRANS;
- int[] zzRowMapL = ZZ_ROWMAP;
- int[] zzAttrL = ZZ_ATTRIBUTE;
- while (true) {
- zzMarkedPosL = zzMarkedPos;
- zzAction = -1;
- zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
- zzState = zzLexicalState;
- zzForAction: {
- while (true) {
- if (zzCurrentPosL < zzEndReadL)
- zzInput = zzBufferL[zzCurrentPosL++];
- else if (zzAtEOF) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- // store back cached positions
- zzCurrentPos = zzCurrentPosL;
- zzMarkedPos = zzMarkedPosL;
- boolean eof = zzRefill();
- // get translated positions and possibly new buffer
- zzCurrentPosL = zzCurrentPos;
- zzMarkedPosL = zzMarkedPos;
- zzBufferL = zzBuffer;
- zzEndReadL = zzEndRead;
- if (eof) {
- zzInput = YYEOF;
- break zzForAction;
- } else {
- zzInput = zzBufferL[zzCurrentPosL++];
- }
- }
- int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
- if (zzNext == -1)
- break zzForAction;
- zzState = zzNext;
- int zzAttributes = zzAttrL[zzState];
- if ((zzAttributes & 1) == 1) {
- zzAction = zzState;
- zzMarkedPosL = zzCurrentPosL;
- if ((zzAttributes & 8) == 8)
- break zzForAction;
- }
- }
- }
- // store back cached position
- zzMarkedPos = zzMarkedPosL;
- switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
- case 3: {
- addToken(Token.IDENTIFIER);
- }
- case 16:
- break;
- case 2: {
- addToken(Token.WHITESPACE);
- }
- case 17:
- break;
- case 1: {
- /* Not really valid */ addToken(Token.IDENTIFIER);
- }
- case 18:
- break;
- case 12: {
- int temp = zzStartRead;
- addToken(start, zzStartRead - 1, Token.MARKUP_COMMENT);
- addHyperlinkToken(temp, zzMarkedPos - 1, Token.MARKUP_COMMENT);
- start = zzMarkedPos;
- }
- case 19:
- break;
- case 9: {
- addToken(Token.MARKUP_TAG_DELIMITER);
- yybegin(INTAG_START);
- }
- case 20:
- break;
- case 6: {
- addToken(Token.MARKUP_TAG_DELIMITER);
- yybegin(YYINITIAL);
- }
- case 21:
- break;
- case 10: {
- int temp = zzMarkedPos;
- addToken(start, zzStartRead + 2, Token.MARKUP_COMMENT);
- start = temp;
- yybegin(prevState);
- }
- case 22:
- break;
- case 11: {
- start = zzStartRead;
- prevState = zzLexicalState;
- yybegin(COMMENT);
- }
- case 23:
- break;
- case 7: {
- addToken(Token.MARKUP_TAG_ATTRIBUTE);
- }
- case 24:
- break;
- case 15: {
- addToken(Token.MARKUP_TAG_NAME);
- yybegin(INTAG_ATTLIST);
- }
- case 25:
- break;
- case 14: {
- addToken(Token.MARKUP_TAG_NAME);
- yybegin(INTAG_ELEMENT);
- }
- case 26:
- break;
- case 13: {
- addToken(Token.MARKUP_PROCESSING_INSTRUCTION);
- }
- case 27:
- break;
- case 4: {
- }
- case 28:
- break;
- case 5: {
- addToken(start, zzStartRead - 1, Token.MARKUP_COMMENT);
- addEndToken(INTERNAL_IN_COMMENT - prevState);
- return firstToken;
- }
- case 29:
- break;
- case 8: {
- addToken(Token.MARKUP_TAG_ATTRIBUTE_VALUE);
- }
- case 30:
- break;
- default:
- if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
- zzAtEOF = true;
- switch (zzLexicalState) {
- case INTAG_START: {
- addEndToken(INTERNAL_INTAG_START);
- return firstToken;
- }
- case 71:
- break;
- case INTAG_ELEMENT: {
- addEndToken(INTERNAL_INTAG_ELEMENT);
- return firstToken;
- }
- case 72:
- break;
- case YYINITIAL: {
- addNullToken();
- return firstToken;
- }
- case 73:
- break;
- case INTAG_ATTLIST: {
- addEndToken(INTERNAL_INTAG_ATTLIST);
- return firstToken;
- }
- case 74:
- break;
- case COMMENT: {
- addToken(start, zzStartRead - 1, Token.MARKUP_COMMENT);
- addEndToken(INTERNAL_IN_COMMENT - prevState);
- return firstToken;
- }
- case 75:
- break;
- default:
- return null;
- }
- } else {
- zzScanError(ZZ_NO_MATCH);
- }
- }
- }
- }
-}
diff --git a/src/org/fife/ui/rsyntaxtextarea/modes/FortranTokenMaker.flex b/src/org/fife/ui/rsyntaxtextarea/modes/FortranTokenMaker.flex
deleted file mode 100644
index a119b88..0000000
--- a/src/org/fife/ui/rsyntaxtextarea/modes/FortranTokenMaker.flex
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
- * 03/23/2005
- *
- * FortranTokenMaker.java - Scanner for the Fortran programming language.
- *
- * This library is distributed under a modified BSD license. See the included
- * RSyntaxTextArea.License.txt file for details.
- */
-package org.fife.ui.rsyntaxtextarea.modes;
-
-import java.io.*;
-import javax.swing.text.Segment;
-
-import org.fife.ui.rsyntaxtextarea.*;
-
-
-/**
- * Scanner for the Fortran programming language.
- *
- * This implementation was created using
- * JFlex 1.4.1; however, the generated file
- * was modified for performance. Memory allocation needs to be almost
- * completely removed to be competitive with the handwritten lexers (subclasses
- * of AbstractTokenMaker
, so this class has been modified so that
- * Strings are never allocated (via yytext()), and the scanner never has to
- * worry about refilling its buffer (needlessly copying chars around).
- * We can achieve this because RText always scans exactly 1 line of tokens at a
- * time, and hands the scanner this line as an array of characters (a Segment
- * really). Since tokens contain pointers to char arrays instead of Strings
- * holding their contents, there is no need for allocating new memory for
- * Strings.- * - * The actual algorithm generated for scanning has, of course, not been - * modified.
- * - * If you wish to regenerate this file yourself, keep in mind the following: - *
FortranTokenMaker.java
file will contain two
- * definitions of both zzRefill
and yyreset
.
- * You should hand-delete the second of each definition (the ones
- * generated by the lexer), as these generated methods modify the input
- * buffer, which we'll never have to do.yylex()
on the generated scanner
- * directly; rather, you should use getTokenList
as you would
- * with any other TokenMaker
instance.text
. This method must be implemented by
- * subclasses so they can correctly implement syntax highlighting.
- *
- * @param text The text from which to get tokens.
- * @param initialTokenType The token type we should start with.
- * @param startOffset The offset into the document at which
- * text
starts.
- * @return The first Token
in a linked list representing
- * the syntax highlighted text.
- */
- public Token getTokenList(Segment text, int initialTokenType, int startOffset) {
-
- resetTokenList();
- this.offsetShift = -text.offset + startOffset;
-
- // Start off in the proper state.
- int state = Token.NULL;
- switch (initialTokenType) {
- case Token.LITERAL_STRING_DOUBLE_QUOTE:
- state = STRING;
- start = text.offset;
- break;
- case Token.LITERAL_CHAR:
- state = CHAR;
- start = text.offset;
- break;
- default:
- state = Token.NULL;
- }
-
- s = text;
- try {
- yyreset(zzReader);
- yybegin(state);
- return yylex();
- } catch (IOException ioe) {
- ioe.printStackTrace();
- return new TokenImpl();
- }
-
- }
-
-
- /**
- * Refills the input buffer.
- *
- * @return true
if EOF was reached, otherwise
- * false
.
- */
- private boolean zzRefill() {
- return zzCurrentPos>=s.offset+s.count;
- }
-
-
- /**
- * Resets the scanner to read from a new input stream.
- * Does not close the old reader.
- *
- * All internal variables are reset, the old input stream
- * cannot be reused (internal buffer is discarded and lost).
- * Lexical state is set to YY_INITIAL.
- *
- * @param reader the new input stream
- */
- public final void yyreset(Reader reader) {
- // 's' has been updated.
- zzBuffer = s.array;
- /*
- * We replaced the line below with the two below it because zzRefill
- * no longer "refills" the buffer (since the way we do it, it's always
- * "full" the first time through, since it points to the segment's
- * array). So, we assign zzEndRead here.
- */
- //zzStartRead = zzEndRead = s.offset;
- zzStartRead = s.offset;
- zzEndRead = zzStartRead + s.count - 1;
- zzCurrentPos = zzMarkedPos = zzPushbackPos = s.offset;
- zzLexicalState = YYINITIAL;
- zzReader = reader;
- zzAtBOL = true;
- zzAtEOF = false;
- }
-
-
-%}
-
-LineTerminator = (\n)
-WhiteSpace = ([ \t\f])
-
-Column1CommentBegin = ([C\*])
-Column1Comment2Begin = (D)
-AnywhereCommentBegin = (\!)
-
-Identifier = ([A-Za-z0-9_$]+)
-
-StringDelimiter = (\")
-CharDelimiter = (\')
-
-Operators1 = ("<"|">"|"<="|">="|"&"|"/="|"==")
-Operators2 = (\.(lt|gt|eq|ne|le|ge|and|or)\.)
-Operator = ({Operators1}|{Operators2})
-
-Boolean = (\.(true|false)\.)
-
-%state STRING
-%state CHAR
-
-%%
-
-/* Keywords */
-