2 /** This character denotes the end of file */
3 public static final int YYEOF = -1;
5 /** initial size of the lookahead buffer */
6 --- private static final int ZZ_BUFFERSIZE = ...;
9 --- lexical states, charmap
12 private static final int ZZ_UNKNOWN_ERROR = 0;
13 private static final int ZZ_NO_MATCH = 1;
14 private static final int ZZ_PUSHBACK_2BIG = 2;
16 /* error messages for the codes above */
17 private static final String[] ZZ_ERROR_MSG = {
18 "Unknown internal scanner error",
19 "Error: could not match input",
20 "Error: pushback value was too large"
24 /** the input device */
25 private java.io.Reader zzReader;
27 /** the current state of the DFA */
30 /** the current lexical state */
31 private int zzLexicalState = YYINITIAL;
33 /** this buffer contains the current text to be matched and is
34 the source of the yytext() string */
35 private CharSequence zzBuffer = "";
37 /** the textposition at the last accepting state */
38 private int zzMarkedPos;
40 /** the current text position in the buffer */
41 private int zzCurrentPos;
43 /** startRead marks the beginning of the yytext() string in the buffer */
44 private int zzStartRead;
46 /** endRead marks the last character in the buffer, that has been read
48 private int zzEndRead;
51 * zzAtBOL == true <=> the scanner is currently at the beginning of a line
53 private boolean zzAtBOL = true;
55 /** zzAtEOF == true <=> the scanner is at the EOF */
56 private boolean zzAtEOF;
58 /** denotes if the user-EOF-code has already been executed */
59 private boolean zzEOFDone;
63 --- constructor declaration
65 public final int getTokenStart() {
69 public final int getTokenEnd() {
70 return getTokenStart() + yylength();
73 public void reset(CharSequence buffer, int start, int end, int initialState) {
75 zzCurrentPos = zzMarkedPos = zzStartRead = start;
79 yybegin(initialState);
83 * Refills the input buffer.
85 * @return <code>false</code>, iff there was new input.
87 * @exception java.io.IOException if any I/O-Error occurs
89 private boolean zzRefill() throws java.io.IOException {
95 * Returns the current lexical state.
97 public final int yystate() {
98 return zzLexicalState;
103 * Enters a new lexical state
105 * @param newState the new lexical state
107 public final void yybegin(int newState) {
108 zzLexicalState = newState;
113 * Returns the text matched by the current regular expression.
115 public final CharSequence yytext() {
116 return zzBuffer.subSequence(zzStartRead, zzMarkedPos);
121 * Returns the character at position <tt>pos</tt> from the
124 * It is equivalent to yytext().charAt(pos), but faster
126 * @param pos the position of the character to fetch.
127 * A value from 0 to yylength()-1.
129 * @return the character at position pos
131 public final char yycharat(int pos) {
132 return zzBuffer.charAt(zzStartRead+pos);
137 * Returns the length of the matched text region.
139 public final int yylength() {
140 return zzMarkedPos-zzStartRead;
145 * Reports an error that occured while scanning.
147 * In a wellformed scanner (no or only correct usage of
148 * yypushback(int) and a match-all fallback rule) this method
149 * will only be called with things that "Can't Possibly Happen".
150 * If this method is called, something is seriously wrong
151 * (e.g. a JFlex bug producing a faulty scanner etc.).
153 * Usual syntax/scanner level error handling should be done
154 * in error fallback rules.
156 * @param errorCode the code of the errormessage to display
158 --- zzScanError declaration
161 message = ZZ_ERROR_MSG[errorCode];
163 catch (ArrayIndexOutOfBoundsException e) {
164 message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
172 * Pushes the specified amount of characters back into the input stream.
174 * They will be read again by then next call of the scanning method
176 * @param number the number of characters to be read again.
177 * This number must not be greater than yylength()!
179 --- yypushback decl (contains zzScanError exception)
180 if ( number > yylength() )
181 zzScanError(ZZ_PUSHBACK_2BIG);
183 zzMarkedPos -= number;
189 * Resumes scanning until the next regular expression is matched,
190 * the end of input is encountered or an I/O-Error occurs.
192 * @return the next token
193 * @exception java.io.IOException if any I/O-Error occurs
195 --- yylex declaration
202 int zzEndReadL = zzEndRead;
203 CharSequence zzBufferL = zzBuffer;
205 --- local declarations
208 zzMarkedPosL = zzMarkedPos;
210 --- start admin (line, char, col count)
213 zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
215 --- start admin (lexstate etc)
220 --- next input, line, col, char count, next transition, isFinal action
222 zzMarkedPosL = zzCurrentPosL;
223 --- line count update
229 // store back cached position
230 zzMarkedPos = zzMarkedPosL;
231 --- char count update
233 if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {