JFlex

Class LexScan

public final class LexScan extends Object implements sym, Scanner

The lexer of JFlex. Generated by JFlex.
Field Summary
static intCHARCLASS
static intCOMMENT
static intCOPY
static intEATWSPNL
static intJAVA_CODE
static intMACROS
static intREGEXP
lexical states
static intREGEXPSTART
static intREPEATEXP
static intSTATELIST
static intSTATES
static intSTRING_CONTENT
static intYYEOF
This character denotes the end of file
static intYYINITIAL
Constructor Summary
LexScan(Reader in)
Creates a new scanner There is also a java.io.InputStream version of this constructor.
LexScan(InputStream in)
Creates a new scanner.
Method Summary
static Stringconc(Object a, Object b)
static StringconcExc(Object a, Object b)
intcurrentLine()
Symboldebug_next_token()
Same as next_token but also prints the token to standard out for debugging.
static voidmain(String[] argv)
Runs the scanner on input files.
Symbolnext_token()
Resumes scanning until the next regular expression is matched, the end of input is encountered or an I/O-Error occurs.
voidsetFile(File file)
voidyybegin(int newState)
Enters a new lexical state
charyycharat(int pos)
Returns the character at position pos from the matched text.
voidyyclose()
Closes the input stream.
intyylength()
Returns the length of the matched text region.
booleanyymoreStreams()
Returns true iff there are still streams left to read from on the stream stack.
voidyypopStream()
Closes the current input stream and continues to read from the one on top of the stream stack.
voidyypushback(int number)
Pushes the specified amount of characters back into the input stream.
voidyypushStream(Reader reader)
Stores the current input stream on a stack, and reads from a new stream.
voidyyreset(Reader reader)
Resets the scanner to read from a new input stream.
intyystate()
Returns the current lexical state.
Stringyytext()
Returns the text matched by the current regular expression.

Field Detail

CHARCLASS

public static final int CHARCLASS

COMMENT

public static final int COMMENT

COPY

public static final int COPY

EATWSPNL

public static final int EATWSPNL

JAVA_CODE

public static final int JAVA_CODE

MACROS

public static final int MACROS

REGEXP

public static final int REGEXP
lexical states

REGEXPSTART

public static final int REGEXPSTART

REPEATEXP

public static final int REPEATEXP

STATELIST

public static final int STATELIST

STATES

public static final int STATES

STRING_CONTENT

public static final int STRING_CONTENT

YYEOF

public static final int YYEOF
This character denotes the end of file

YYINITIAL

public static final int YYINITIAL

Constructor Detail

LexScan

public LexScan(Reader in)
Creates a new scanner There is also a java.io.InputStream version of this constructor.

Parameters: in the java.io.Reader to read input from.

LexScan

public LexScan(InputStream in)
Creates a new scanner. There is also java.io.Reader version of this constructor.

Parameters: in the java.io.Inputstream to read input from.

Method Detail

conc

public static String conc(Object a, Object b)

concExc

public static String concExc(Object a, Object b)

currentLine

public int currentLine()

debug_next_token

public Symbol debug_next_token()
Same as next_token but also prints the token to standard out for debugging. This code was contributed by Karl Meissner

main

public static void main(String[] argv)
Runs the scanner on input files. This main method is the debugging routine for the scanner. It prints debugging information about each returned token to System.out until the end of file is reached, or an error occured.

Parameters: argv the command line, contains the filenames to run the scanner on.

next_token

public Symbol next_token()
Resumes scanning until the next regular expression is matched, the end of input is encountered or an I/O-Error occurs.

Returns: the next token

Throws: java.io.IOException if any I/O-Error occurs

setFile

public void setFile(File file)

yybegin

public final void yybegin(int newState)
Enters a new lexical state

Parameters: newState the new lexical state

yycharat

public final char yycharat(int pos)
Returns the character at position pos from the matched text. It is equivalent to yytext().charAt(pos), but faster

Parameters: pos the position of the character to fetch. A value from 0 to yylength()-1.

Returns: the character at position pos

yyclose

public final void yyclose()
Closes the input stream.

yylength

public final int yylength()
Returns the length of the matched text region.

yymoreStreams

public final boolean yymoreStreams()
Returns true iff there are still streams left to read from on the stream stack.

yypopStream

public final void yypopStream()
Closes the current input stream and continues to read from the one on top of the stream stack.

Throws: java.util.EmptyStackException if there is no further stream to read from. java.io.IOException if there was an error in closing the stream.

See Also: yypushStream

yypushback

public void yypushback(int number)
Pushes the specified amount of characters back into the input stream. They will be read again by then next call of the scanning method

Parameters: number the number of characters to be read again. This number must not be greater than yylength()!

yypushStream

public final void yypushStream(Reader reader)
Stores the current input stream on a stack, and reads from a new stream. Lexical state, line, char, and column counting remain untouched. The current input stream can be restored with yypopstream (usually in an <> action).

Parameters: reader the new input stream to read from

See Also: yypopStream

yyreset

public final void yyreset(Reader reader)
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 ZZ_INITIAL.

Parameters: reader the new input stream

See Also: yypushStream yypopStream

yystate

public final int yystate()
Returns the current lexical state.

yytext

public final String yytext()
Returns the text matched by the current regular expression.