|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.teatrove.tea.compiler.Scanner
public class Scanner
A Scanner breaks up a source file into its basic elements, called
Tokens. Add an ErrorListener to capture any syntax
errors detected by the Scanner.
| Constructor Summary | |
|---|---|
Scanner(SourceReader in)
|
|
Scanner(SourceReader in,
CompilationUnit unit)
|
|
| Method Summary | |
|---|---|
void |
addErrorListener(ErrorListener listener)
|
void |
close()
|
void |
emitSpecialTokens(boolean enable)
Passing true causes Scanner to emit additional tokens that should not be bassed into a Parser. |
int |
getErrorCount()
|
static void |
main(String[] arg)
Simple test program |
Token |
peekToken()
Returns EOF as the last token. |
Token |
readToken()
Returns EOF as the last token. |
void |
removeErrorListener(ErrorListener listener)
|
void |
unreadToken(Token token)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Scanner(SourceReader in)
public Scanner(SourceReader in,
CompilationUnit unit)
| Method Detail |
|---|
public void addErrorListener(ErrorListener listener)
public void removeErrorListener(ErrorListener listener)
public void emitSpecialTokens(boolean enable)
Token.COMMENT,
Token.ENTER_CODE, and Token.ENTER_TEXT. By default,
these special tokens are not emitted.
public Token readToken()
throws IOException
IOException
public Token peekToken()
throws IOException
IOException
public void unreadToken(Token token)
throws IOException
IOException
public void close()
throws IOException
IOExceptionpublic int getErrorCount()
public static void main(String[] arg)
throws Exception
Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||