Package edu.stanford.nlp.io
Interface Lexer
-
public interface LexerA Lexer interface to be used withLexerTokenizer. You can put aReaderinside a Lexer with theyyreset(java.io.Reader)method. An easy way to build classes implementing this interface is with JFlex (http://jflex.de). Just make sure to include the following in the JFlex source file In the Options and Macros section of the source file, include %class JFlexDummyLexer
%standalone
%unicode
%int
%implements edu.stanford.nlp.io.Lexer
%{
public void pushBack(int n) {
yypushback(n);
}
public int getYYEOF() {
return YYEOF;
}
%}
Alternatively, you can customize your own lexer and get lots of flexibility out.- Author:
- Roger Levy
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetYYEOF()returns value for YYEOFvoidpushBack(int length)Pushes backlengthcharacter positions in the lexer.intyylex()Gets the next token from input and returns an integer value signalling what to do with the token.voidyyreset(Reader r)put aReaderinside the Lexer.Stringyytext()returns the matched input text region
-
-
-
Field Detail
-
ACCEPT
static final int ACCEPT
- See Also:
- Constant Field Values
-
IGNORE
static final int IGNORE
- See Also:
- Constant Field Values
-
-
Method Detail
-
yylex
int yylex() throws IOException
Gets the next token from input and returns an integer value signalling what to do with the token.- Throws:
IOException
-
yytext
String yytext()
returns the matched input text region
-
pushBack
void pushBack(int length)
Pushes backlengthcharacter positions in the lexer. Conventionally used to push back exactly one token.
-
getYYEOF
int getYYEOF()
returns value for YYEOF
-
yyreset
void yyreset(Reader r) throws IOException
put aReaderinside the Lexer.- Throws:
IOException
-
-