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
"Unkown 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 char zzBuffer[] = new char[ZZ_BUFFERSIZE];
37
/** the textposition at the last accepting state */
38
private int zzMarkedPos;
40
/** the textposition at the last state to be included in yytext */
41
private int zzPushbackPos;
43
/** the current text position in the buffer */
44
private int zzCurrentPos;
46
/** startRead marks the beginning of the yytext() string in the buffer */
47
private int zzStartRead;
49
/** endRead marks the last character in the buffer, that has been read
51
private int zzEndRead;
53
/** number of newlines encountered up to the start of the matched text */
56
/** the number of characters up to the start of the matched text */
60
* the number of characters from the last newline up to the start of the
66
* zzAtBOL == true <=> the scanner is currently at the beginning of a line
68
private boolean zzAtBOL = true;
70
/** zzAtEOF == true <=> the scanner is at the EOF */
71
private boolean zzAtEOF;
76
* Creates a new scanner
77
* There is also a java.io.InputStream version of this constructor.
79
* @param in the java.io.Reader to read input from.
81
--- constructor declaration
85
* Refills the input buffer.
87
* @return <code>false</code>, iff there was new input.
89
* @exception java.io.IOException if any I/O-Error occurs
91
private boolean zzRefill() throws java.io.IOException {
93
/* first: make room (if you can) */
94
if (zzStartRead > 0) {
95
System.arraycopy(zzBuffer, zzStartRead,
97
zzEndRead-zzStartRead);
99
/* translate stored positions */
100
zzEndRead-= zzStartRead;
101
zzCurrentPos-= zzStartRead;
102
zzMarkedPos-= zzStartRead;
103
zzPushbackPos-= zzStartRead;
107
/* is the buffer big enough? */
108
if (zzCurrentPos >= zzBuffer.length) {
109
/* if not: blow it up */
110
char newBuffer[] = new char[zzCurrentPos*2];
111
System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
112
zzBuffer = newBuffer;
115
/* finally: fill the buffer with new input */
116
int numRead = zzReader.read(zzBuffer, zzEndRead,
117
zzBuffer.length-zzEndRead);
130
* Closes the input stream.
132
public final void yyclose() throws java.io.IOException {
133
zzAtEOF = true; /* indicate end of file */
134
zzEndRead = zzStartRead; /* invalidate buffer */
136
if (zzReader != null)
142
* Resets the scanner to read from a new input stream.
143
* Does not close the old reader.
145
* All internal variables are reset, the old input stream
146
* <b>cannot</b> be reused (internal buffer is discarded and lost).
147
* Lexical state is set to <tt>ZZ_INITIAL</tt>.
149
* @param reader the new input stream
151
public final void yyreset(java.io.Reader reader) {
155
zzEndRead = zzStartRead = 0;
156
zzCurrentPos = zzMarkedPos = zzPushbackPos = 0;
157
yyline = yychar = yycolumn = 0;
158
zzLexicalState = YYINITIAL;
163
* Returns the current lexical state.
165
public final int yystate() {
166
return zzLexicalState;
171
* Enters a new lexical state
173
* @param newState the new lexical state
175
public final void yybegin(int newState) {
176
zzLexicalState = newState;
181
* Returns the text matched by the current regular expression.
183
public final String yytext() {
184
return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
189
* Returns the character at position <tt>pos</tt> from the
192
* It is equivalent to yytext().charAt(pos), but faster
194
* @param pos the position of the character to fetch.
195
* A value from 0 to yylength()-1.
197
* @return the character at position pos
199
public final char yycharat(int pos) {
200
return zzBuffer[zzStartRead+pos];
205
* Returns the length of the matched text region.
207
public final int yylength() {
208
return zzMarkedPos-zzStartRead;
213
* Reports an error that occured while scanning.
215
* In a wellformed scanner (no or only correct usage of
216
* yypushback(int) and a match-all fallback rule) this method
217
* will only be called with things that "Can't Possibly Happen".
218
* If this method is called, something is seriously wrong
219
* (e.g. a JFlex bug producing a faulty scanner etc.).
221
* Usual syntax/scanner level error handling should be done
222
* in error fallback rules.
224
* @param errorCode the code of the errormessage to display
226
--- zzScanError declaration
229
message = ZZ_ERROR_MSG[errorCode];
231
catch (ArrayIndexOutOfBoundsException e) {
232
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
240
* Pushes the specified amount of characters back into the input stream.
242
* They will be read again by then next call of the scanning method
244
* @param number the number of characters to be read again.
245
* This number must not be greater than yylength()!
247
--- yypushback decl (contains zzScanError exception)
248
if ( number > yylength() )
249
zzScanError(ZZ_PUSHBACK_2BIG);
251
zzMarkedPos -= number;
257
* Resumes scanning until the next regular expression is matched,
258
* the end of input is encountered or an I/O-Error occurs.
260
* @return the next token
261
* @exception java.io.IOException if any I/O-Error occurs
263
--- yylex declaration
270
int zzEndReadL = zzEndRead;
271
char [] zzBufferL = zzBuffer;
272
char [] zzCMapL = ZZ_CMAP;
274
--- local declarations
277
zzMarkedPosL = zzMarkedPos;
279
--- start admin (line, char, col count)
282
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
284
--- start admin (lexstate etc)
289
--- next input, line, col, char count, next transition, isFinal action
291
zzMarkedPosL = zzCurrentPosL;
292
--- line count update
298
// store back cached position
299
zzMarkedPos = zzMarkedPosL;
300
--- char count update
304
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {