2019-01-08 13:33:49 -05:00
|
|
|
|
2021-11-19 09:24:27 -05:00
|
|
|
/** This character denotes the end of file. */
|
2019-01-08 13:33:49 -05:00
|
|
|
public static final int YYEOF = -1;
|
|
|
|
|
2021-11-19 09:24:27 -05:00
|
|
|
/** Initial size of the lookahead buffer. */
|
2019-01-08 13:33:49 -05:00
|
|
|
--- private static final int ZZ_BUFFERSIZE = ...;
|
|
|
|
|
2021-11-19 09:24:27 -05:00
|
|
|
/** Lexical states. */
|
2019-01-08 13:33:49 -05:00
|
|
|
--- lexical states, charmap
|
|
|
|
|
2021-11-19 09:24:27 -05:00
|
|
|
/** Error code for "Unknown internal scanner error". */
|
2019-01-08 13:33:49 -05:00
|
|
|
private static final int ZZ_UNKNOWN_ERROR = 0;
|
2021-11-19 09:24:27 -05:00
|
|
|
/** Error code for "could not match input". */
|
2019-01-08 13:33:49 -05:00
|
|
|
private static final int ZZ_NO_MATCH = 1;
|
2021-11-19 09:24:27 -05:00
|
|
|
/** Error code for "pushback value was too large". */
|
2019-01-08 13:33:49 -05:00
|
|
|
private static final int ZZ_PUSHBACK_2BIG = 2;
|
|
|
|
|
2021-11-19 09:24:27 -05:00
|
|
|
/**
|
|
|
|
* Error messages for {@link #ZZ_UNKNOWN_ERROR}, {@link #ZZ_NO_MATCH}, and
|
|
|
|
* {@link #ZZ_PUSHBACK_2BIG} respectively.
|
|
|
|
*/
|
|
|
|
private static final String ZZ_ERROR_MSG[] = {
|
2019-01-08 13:33:49 -05:00
|
|
|
"Unknown internal scanner error",
|
|
|
|
"Error: could not match input",
|
|
|
|
"Error: pushback value was too large"
|
|
|
|
};
|
|
|
|
|
|
|
|
--- isFinal list
|
2021-11-19 09:24:27 -05:00
|
|
|
/** Input device. */
|
2019-01-08 13:33:49 -05:00
|
|
|
private java.io.Reader zzReader;
|
|
|
|
|
2021-11-19 09:24:27 -05:00
|
|
|
/** Current state of the DFA. */
|
2019-01-08 13:33:49 -05:00
|
|
|
private int zzState;
|
|
|
|
|
2021-11-19 09:24:27 -05:00
|
|
|
/** Current lexical state. */
|
2019-01-08 13:33:49 -05:00
|
|
|
private int zzLexicalState = YYINITIAL;
|
|
|
|
|
2021-11-19 09:24:27 -05:00
|
|
|
/**
|
|
|
|
* This buffer contains the current text to be matched and is the source of the {@link #yytext()}
|
|
|
|
* string.
|
|
|
|
*/
|
|
|
|
private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
|
2019-01-08 13:33:49 -05:00
|
|
|
|
2021-11-19 09:24:27 -05:00
|
|
|
/** Text position at the last accepting state. */
|
2019-01-08 13:33:49 -05:00
|
|
|
private int zzMarkedPos;
|
|
|
|
|
2021-11-19 09:24:27 -05:00
|
|
|
/** Current text position in the buffer. */
|
2019-01-08 13:33:49 -05:00
|
|
|
private int zzCurrentPos;
|
|
|
|
|
2021-11-19 09:24:27 -05:00
|
|
|
/** Marks the beginning of the {@link #yytext()} string in the buffer. */
|
2019-01-08 13:33:49 -05:00
|
|
|
private int zzStartRead;
|
|
|
|
|
2021-11-19 09:24:27 -05:00
|
|
|
/** Marks the last character in the buffer, that has been read from input. */
|
2019-01-08 13:33:49 -05:00
|
|
|
private int zzEndRead;
|
|
|
|
|
|
|
|
/**
|
2021-11-19 09:24:27 -05:00
|
|
|
* Whether the scanner is at the end of file.
|
|
|
|
* @see #yyatEOF
|
2019-01-08 13:33:49 -05:00
|
|
|
*/
|
|
|
|
private boolean zzAtEOF;
|
|
|
|
|
2021-11-19 09:24:27 -05:00
|
|
|
/**
|
|
|
|
* The number of occupied positions in {@link #zzBuffer} beyond {@link #zzEndRead}.
|
|
|
|
*
|
|
|
|
* <p>When a lead/high surrogate has been read from the input stream into the final
|
|
|
|
* {@link #zzBuffer} position, this will have a value of 1; otherwise, it will have a value of 0.
|
2019-01-08 13:33:49 -05:00
|
|
|
*/
|
|
|
|
private int zzFinalHighSurrogate = 0;
|
|
|
|
|
|
|
|
--- user class code
|
|
|
|
|
|
|
|
--- constructor declaration
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Refills the input buffer.
|
|
|
|
*
|
2021-11-19 09:24:27 -05:00
|
|
|
* @return {@code false} iff there was new input.
|
|
|
|
* @exception java.io.IOException if any I/O-Error occurs
|
2019-01-08 13:33:49 -05:00
|
|
|
*/
|
|
|
|
private boolean zzRefill() throws java.io.IOException {
|
|
|
|
|
|
|
|
/* first: make room (if you can) */
|
|
|
|
if (zzStartRead > 0) {
|
|
|
|
zzEndRead += zzFinalHighSurrogate;
|
|
|
|
zzFinalHighSurrogate = 0;
|
|
|
|
System.arraycopy(zzBuffer, zzStartRead,
|
|
|
|
zzBuffer, 0,
|
2021-11-19 09:24:27 -05:00
|
|
|
zzEndRead - zzStartRead);
|
2019-01-08 13:33:49 -05:00
|
|
|
|
|
|
|
/* translate stored positions */
|
2021-11-19 09:24:27 -05:00
|
|
|
zzEndRead -= zzStartRead;
|
|
|
|
zzCurrentPos -= zzStartRead;
|
|
|
|
zzMarkedPos -= zzStartRead;
|
2019-01-08 13:33:49 -05:00
|
|
|
zzStartRead = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* is the buffer big enough? */
|
|
|
|
if (zzCurrentPos >= zzBuffer.length - zzFinalHighSurrogate) {
|
|
|
|
/* if not: blow it up */
|
2021-11-19 09:24:27 -05:00
|
|
|
char newBuffer[] = new char[zzBuffer.length * 2];
|
2019-01-08 13:33:49 -05:00
|
|
|
System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
|
|
|
|
zzBuffer = newBuffer;
|
|
|
|
zzEndRead += zzFinalHighSurrogate;
|
|
|
|
zzFinalHighSurrogate = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* fill the buffer with new input */
|
|
|
|
int requested = zzBuffer.length - zzEndRead;
|
|
|
|
int numRead = zzReader.read(zzBuffer, zzEndRead, requested);
|
|
|
|
|
|
|
|
/* not supposed to occur according to specification of java.io.Reader */
|
|
|
|
if (numRead == 0) {
|
2021-11-19 09:24:27 -05:00
|
|
|
throw new java.io.IOException(
|
|
|
|
"Reader returned 0 characters. See JFlex examples/zero-reader for a workaround.");
|
2019-01-08 13:33:49 -05:00
|
|
|
}
|
|
|
|
if (numRead > 0) {
|
|
|
|
zzEndRead += numRead;
|
2021-11-19 09:24:27 -05:00
|
|
|
if (Character.isHighSurrogate(zzBuffer[zzEndRead - 1])) {
|
|
|
|
if (numRead == requested) { // We requested too few chars to encode a full Unicode character
|
2019-01-08 13:33:49 -05:00
|
|
|
--zzEndRead;
|
|
|
|
zzFinalHighSurrogate = 1;
|
2021-11-19 09:24:27 -05:00
|
|
|
} else { // There is room in the buffer for at least one more char
|
|
|
|
int c = zzReader.read(); // Expecting to read a paired low surrogate char
|
|
|
|
if (c == -1) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
zzBuffer[zzEndRead++] = (char)c;
|
|
|
|
}
|
2019-01-08 13:33:49 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* potentially more input available */
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* numRead < 0 ==> end of stream */
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2021-11-19 09:24:27 -05:00
|
|
|
|
2019-01-08 13:33:49 -05:00
|
|
|
/**
|
2021-11-19 09:24:27 -05:00
|
|
|
* Closes the input reader.
|
|
|
|
*
|
|
|
|
* @throws java.io.IOException if the reader could not be closed.
|
2019-01-08 13:33:49 -05:00
|
|
|
*/
|
|
|
|
public final void yyclose() throws java.io.IOException {
|
2021-11-19 09:24:27 -05:00
|
|
|
zzAtEOF = true; // indicate end of file
|
|
|
|
zzEndRead = zzStartRead; // invalidate buffer
|
2019-01-08 13:33:49 -05:00
|
|
|
|
2021-11-19 09:24:27 -05:00
|
|
|
if (zzReader != null) {
|
2019-01-08 13:33:49 -05:00
|
|
|
zzReader.close();
|
2021-11-19 09:24:27 -05:00
|
|
|
}
|
2019-01-08 13:33:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Resets the scanner to read from a new input stream.
|
|
|
|
*
|
2021-11-19 09:24:27 -05:00
|
|
|
* <p>Does not close the old reader.
|
2019-01-08 13:33:49 -05:00
|
|
|
*
|
2021-11-19 09:24:27 -05:00
|
|
|
* <p>All internal variables are reset, the old input stream <b>cannot</b> be reused (internal
|
|
|
|
* buffer is discarded and lost). Lexical state is set to {@code ZZ_INITIAL}.
|
2019-01-08 13:33:49 -05:00
|
|
|
*
|
2021-11-19 09:24:27 -05:00
|
|
|
* <p>Internal scan buffer is resized down to its initial length, if it has grown.
|
|
|
|
*
|
|
|
|
* @param reader The new input stream.
|
2019-01-08 13:33:49 -05:00
|
|
|
*/
|
|
|
|
public final void yyreset(java.io.Reader reader) {
|
|
|
|
zzReader = reader;
|
|
|
|
zzEOFDone = false;
|
2021-11-19 09:24:27 -05:00
|
|
|
yyResetPosition();
|
2019-01-08 13:33:49 -05:00
|
|
|
zzLexicalState = YYINITIAL;
|
2021-11-19 09:24:27 -05:00
|
|
|
if (zzBuffer.length > ZZ_BUFFERSIZE) {
|
2019-01-08 13:33:49 -05:00
|
|
|
zzBuffer = new char[ZZ_BUFFERSIZE];
|
2021-11-19 09:24:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Resets the input position.
|
|
|
|
*/
|
|
|
|
private final void yyResetPosition() {
|
|
|
|
zzAtBOL = true;
|
|
|
|
zzAtEOF = false;
|
|
|
|
zzCurrentPos = 0;
|
|
|
|
zzMarkedPos = 0;
|
|
|
|
zzStartRead = 0;
|
|
|
|
zzEndRead = 0;
|
|
|
|
zzFinalHighSurrogate = 0;
|
|
|
|
yyline = 0;
|
|
|
|
yycolumn = 0;
|
|
|
|
yychar = 0L;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether the scanner has reached the end of the reader it reads from.
|
|
|
|
*
|
|
|
|
* @return whether the scanner has reached EOF.
|
|
|
|
*/
|
|
|
|
public final boolean yyatEOF() {
|
|
|
|
return zzAtEOF;
|
2019-01-08 13:33:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the current lexical state.
|
2021-11-19 09:24:27 -05:00
|
|
|
*
|
|
|
|
* @return the current lexical state.
|
2019-01-08 13:33:49 -05:00
|
|
|
*/
|
|
|
|
public final int yystate() {
|
|
|
|
return zzLexicalState;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2021-11-19 09:24:27 -05:00
|
|
|
* Enters a new lexical state.
|
2019-01-08 13:33:49 -05:00
|
|
|
*
|
|
|
|
* @param newState the new lexical state
|
|
|
|
*/
|
|
|
|
public final void yybegin(int newState) {
|
|
|
|
zzLexicalState = newState;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the text matched by the current regular expression.
|
2021-11-19 09:24:27 -05:00
|
|
|
*
|
|
|
|
* @return the matched text.
|
2019-01-08 13:33:49 -05:00
|
|
|
*/
|
|
|
|
public final String yytext() {
|
2021-11-19 09:24:27 -05:00
|
|
|
return new String(zzBuffer, zzStartRead, zzMarkedPos-zzStartRead);
|
2019-01-08 13:33:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2021-11-19 09:24:27 -05:00
|
|
|
* Returns the character at the given position from the matched text.
|
|
|
|
*
|
|
|
|
* <p>It is equivalent to {@code yytext().charAt(pos)}, but faster.
|
2019-01-08 13:33:49 -05:00
|
|
|
*
|
2021-11-19 09:24:27 -05:00
|
|
|
* @param position the position of the character to fetch. A value from 0 to {@code yylength()-1}.
|
2019-01-08 13:33:49 -05:00
|
|
|
*
|
2021-11-19 09:24:27 -05:00
|
|
|
* @return the character at {@code position}.
|
2019-01-08 13:33:49 -05:00
|
|
|
*/
|
2021-11-19 09:24:27 -05:00
|
|
|
public final char yycharat(int position) {
|
|
|
|
return zzBuffer[zzStartRead + position];
|
2019-01-08 13:33:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2021-11-19 09:24:27 -05:00
|
|
|
* How many characters were matched.
|
|
|
|
*
|
|
|
|
* @return the length of the matched text region.
|
2019-01-08 13:33:49 -05:00
|
|
|
*/
|
|
|
|
public final int yylength() {
|
|
|
|
return zzMarkedPos-zzStartRead;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2021-11-19 09:24:27 -05:00
|
|
|
* Reports an error that occurred while scanning.
|
2019-01-08 13:33:49 -05:00
|
|
|
*
|
2021-11-19 09:24:27 -05:00
|
|
|
* <p>In a well-formed scanner (no or only correct usage of {@code yypushback(int)} and a
|
|
|
|
* match-all fallback rule) this method will only be called with things that
|
|
|
|
* "Can't Possibly Happen".
|
2019-01-08 13:33:49 -05:00
|
|
|
*
|
2021-11-19 09:24:27 -05:00
|
|
|
* <p>If this method is called, something is seriously wrong (e.g. a JFlex bug producing a faulty
|
|
|
|
* scanner etc.).
|
2019-01-08 13:33:49 -05:00
|
|
|
*
|
2021-11-19 09:24:27 -05:00
|
|
|
* <p>Usual syntax/scanner level error handling should be done in error fallback rules.
|
|
|
|
*
|
|
|
|
* @param errorCode the code of the error message to display.
|
2019-01-08 13:33:49 -05:00
|
|
|
*/
|
|
|
|
--- zzScanError declaration
|
|
|
|
String message;
|
|
|
|
try {
|
|
|
|
message = ZZ_ERROR_MSG[errorCode];
|
2021-11-19 09:24:27 -05:00
|
|
|
} catch (ArrayIndexOutOfBoundsException e) {
|
2019-01-08 13:33:49 -05:00
|
|
|
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
|
|
|
|
}
|
|
|
|
|
|
|
|
--- throws clause
|
2021-11-19 09:24:27 -05:00
|
|
|
}
|
2019-01-08 13:33:49 -05:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Pushes the specified amount of characters back into the input stream.
|
|
|
|
*
|
2021-11-19 09:24:27 -05:00
|
|
|
* <p>They will be read again by then next call of the scanning method.
|
2019-01-08 13:33:49 -05:00
|
|
|
*
|
2021-11-19 09:24:27 -05:00
|
|
|
* @param number the number of characters to be read again. This number must not be greater than
|
|
|
|
* {@link #yylength()}.
|
2019-01-08 13:33:49 -05:00
|
|
|
*/
|
|
|
|
--- yypushback decl (contains zzScanError exception)
|
|
|
|
if ( number > yylength() )
|
|
|
|
zzScanError(ZZ_PUSHBACK_2BIG);
|
|
|
|
|
|
|
|
zzMarkedPos -= number;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
--- zzDoEOF
|
2021-11-19 09:24:27 -05:00
|
|
|
|
|
|
|
|
2019-01-08 13:33:49 -05:00
|
|
|
/**
|
2021-11-19 09:24:27 -05:00
|
|
|
* Resumes scanning until the next regular expression is matched, the end of input is encountered
|
|
|
|
* or an I/O-Error occurs.
|
2019-01-08 13:33:49 -05:00
|
|
|
*
|
2021-11-19 09:24:27 -05:00
|
|
|
* @return the next token.
|
|
|
|
* @exception java.io.IOException if any I/O-Error occurs.
|
2019-01-08 13:33:49 -05:00
|
|
|
*/
|
|
|
|
--- yylex declaration
|
|
|
|
int zzInput;
|
|
|
|
int zzAction;
|
|
|
|
|
|
|
|
// cached fields:
|
|
|
|
int zzCurrentPosL;
|
|
|
|
int zzMarkedPosL;
|
|
|
|
int zzEndReadL = zzEndRead;
|
2021-11-19 09:24:27 -05:00
|
|
|
char[] zzBufferL = zzBuffer;
|
2019-01-08 13:33:49 -05:00
|
|
|
|
|
|
|
--- local declarations
|
|
|
|
|
|
|
|
while (true) {
|
|
|
|
zzMarkedPosL = zzMarkedPos;
|
|
|
|
|
|
|
|
--- start admin (line, char, col count)
|
|
|
|
zzAction = -1;
|
|
|
|
|
|
|
|
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
|
2021-11-19 09:24:27 -05:00
|
|
|
|
2019-01-08 13:33:49 -05:00
|
|
|
--- start admin (lexstate etc)
|
|
|
|
|
|
|
|
zzForAction: {
|
|
|
|
while (true) {
|
2021-11-19 09:24:27 -05:00
|
|
|
|
2019-01-08 13:33:49 -05:00
|
|
|
--- next input, line, col, char count, next transition, isFinal action
|
|
|
|
zzAction = zzState;
|
|
|
|
zzMarkedPosL = zzCurrentPosL;
|
|
|
|
--- line count update
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// store back cached position
|
|
|
|
zzMarkedPos = zzMarkedPosL;
|
|
|
|
--- char count update
|
|
|
|
|
|
|
|
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
|
|
|
|
zzAtEOF = true;
|
|
|
|
--- eofvalue
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
--- actions
|
|
|
|
default:
|
|
|
|
--- no match
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
--- main
|
|
|
|
|
|
|
|
}
|