com.go.tea.compiler
Class Scanner
java.lang.Object
|
+--com.go.tea.compiler.Scanner
- public class Scanner
- extends java.lang.Object
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.
- Version:
- 45 , 00/12/13
- Author:
- Brian S O'Neill
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Scanner
public Scanner(SourceReader in)
Scanner
public Scanner(SourceReader in,
CompilationUnit unit)
addErrorListener
public void addErrorListener(ErrorListener listener)
removeErrorListener
public void removeErrorListener(ErrorListener listener)
emitSpecialTokens
public void emitSpecialTokens(boolean enable)
- Passing true causes Scanner to emit additional tokens that should not
be bassed into a Parser. These are
Token.COMMENT,
Token.ENTER_CODE, and Token.ENTER_TEXT. By default,
these special tokens are not emitted.
readToken
public Token readToken()
throws java.io.IOException
- Returns EOF as the last token.
peekToken
public Token peekToken()
throws java.io.IOException
- Returns EOF as the last token.
unreadToken
public void unreadToken(Token token)
throws java.io.IOException
close
public void close()
throws java.io.IOException
getErrorCount
public int getErrorCount()
main
public static void main(java.lang.String[] arg)
throws java.lang.Exception
- Simple test program