|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fife.rsta.ac.java.rjc.lexer.Scanner
public class Scanner
A scanner that allows the user to "push back" tokens. This scanner allows arbitrary lookahead.
| Constructor Summary | |
|---|---|
Scanner()
Constructor. |
|
Scanner(List tokens)
Constructor. |
|
Scanner(Reader r)
Constructor. |
|
| Method Summary | |
|---|---|
void |
clearResetPosition()
|
Offset |
createOffset(int offs)
Returns an offset into the source being parsed. |
void |
decreaseTypeArgumentsLevel()
Decreases the depth in which we're in TypeArguments or TypeParameters. |
void |
eatParenPairs()
Eats through (possibly nested) paren pairs, e.g.: |
void |
eatThroughNext(int tokenType)
Eats all tokens up to (and including) the next token of the specified type. |
void |
eatThroughNextSkippingBlocks(int tokenType)
Eats all tokens up to (and including) the next token of the specified type. |
void |
eatUntilNext(int type1,
int type2)
|
void |
eatUntilNext(int type1,
int type2,
int type3)
|
int |
getColumn()
Returns the current column into the current line. |
String |
getLastDocComment()
Returns the last documentation comment parsed. |
int |
getLine()
Returns the current line into the document. |
Token |
getMostRecentToken()
Returns the most recently-lexed token. |
int |
getOffset()
Returns the current offset into the document. |
int |
getTypeArgumentsLevel()
Returns the current TypeArgument/TypeParameter level. |
void |
increaseTypeArgumentsLevel()
Increases the depth in which we're in TypeArguments or TypeParameters. |
void |
markResetPosition()
|
void |
resetToLastMarkedPosition()
|
void |
setDocument(Document doc)
Sets the Swing Document whose content is being parsed. |
int |
skipBracketPairs()
Skips all bracket pairs ('[' followed by ']') in the stream. |
Token |
yylex()
Returns the next token from the input stream. |
Token |
yylexNonNull(int type1,
int type2,
int type3,
String error)
Returns the next token from the input stream, or throws an exception if the end of stream is reached or if the token is not of three given types. |
Token |
yylexNonNull(int type1,
int type2,
String error)
Returns the next token from the input stream, or throws an exception if the end of stream is reached or if the token is not of two given types. |
Token |
yylexNonNull(int type,
String error)
Returns the next token from the input stream, or throws an exception if the end of stream is reached or if the token is not of a given type. |
Token |
yylexNonNull(String error)
Returns the next token from the input stream, or throws an exception if the end of stream is reached. |
Token |
yyPeek()
Returns the next token, but does not take it off of the stream. |
Token |
yyPeek(int depth)
Returns the depth-th token, but does not anything off of the stream. |
int |
yyPeekCheckType()
Peeks at and returns the type of the next token on the stream. |
int |
yyPeekCheckType(int index)
Peeks at and returns the type of the specified token on the stream. |
Token |
yyPeekNonNull(int type1,
int type2,
int type3,
String error)
Returns the next token, but does not take it off of the stream. |
Token |
yyPeekNonNull(int type1,
int type2,
String error)
Returns the next token, but does not take it off of the stream. |
Token |
yyPeekNonNull(int type,
String error)
Returns the next token, but does not take it off of the stream. |
Token |
yyPeekNonNull(String error)
Returns the next token, but does not take it off of the stream. |
void |
yyPushback(Token t)
Pushes a token back onto the stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Scanner()
yyPushback(Token).
public Scanner(List tokens)
tokens - Tokens to return.public Scanner(Reader r)
r - The stream to read from.| Method Detail |
|---|
public void decreaseTypeArgumentsLevel()
increaseTypeArgumentsLevel(),
getTypeArgumentsLevel()public Offset createOffset(int offs)
JTextComponent.
offs - The offset.
setDocument(Document)public int getColumn()
getLine()public String getLastDocComment()
null
if there was none.public int getLine()
getColumn()public Token getMostRecentToken()
null if EOS was reached.public int getOffset()
public void eatParenPairs()
throws IOException
(int i=0; i<getFoo(getParam()); i++). Blocks nested inside the paren pairs are also skipped.
IOException - If an IO error occurs.
InternalError - If the next token is not a '('.
public void eatThroughNext(int tokenType)
throws IOException
tokenType - The type of token to eat through.
IOException - If an IO error occurs.
public void eatThroughNextSkippingBlocks(int tokenType)
throws IOException
tokenType - The type of token to eat through.
IOException - If an IO error occurs.
public void eatUntilNext(int type1,
int type2)
throws IOException
IOException
public void eatUntilNext(int type1,
int type2,
int type3)
throws IOException
IOExceptionpublic int getTypeArgumentsLevel()
increaseTypeArgumentsLevel(),
decreaseTypeArgumentsLevel()public void increaseTypeArgumentsLevel()
decreaseTypeArgumentsLevel(),
getTypeArgumentsLevel()public void markResetPosition()
public void resetToLastMarkedPosition()
public void clearResetPosition()
public void setDocument(Document doc)
Document whose content is being parsed.
This method should be called if we are parsing code inside a
JTextComponent, as it will help our parsed code to track
changes when the document is modified. If we are parsing source from a
flat file, this method shouldn't be called.
doc - The document being parsed.
public int skipBracketPairs()
throws IOException
IOException - If an IO error occurs.
public Token yylex()
throws IOException
IOException - If an IO error occurs.
public Token yylexNonNull(String error)
throws IOException
error - The error description for the exception if the end of
stream is reached.
IOException - If an IO error occurs or the end of stream is
reached.
public Token yylexNonNull(int type,
String error)
throws IOException
type - The type the token must be.error - The error description for the exception if the end of
stream is reached, or if the token is of an unexpected type.
IOException - If an IO error occurs or the end of stream is
reached, or if the token is of the wrong type.
public Token yylexNonNull(int type1,
int type2,
String error)
throws IOException
type1 - One type the token can be.type2 - Another type the token can be, or -1 if we
should only check against type1.error - The error description for the exception if the end of
stream is reached, or if the token is of an unexpected type.
IOException - If an IO error occurs or the end of stream is
reached, or if the token is of a wrong type.
public Token yylexNonNull(int type1,
int type2,
int type3,
String error)
throws IOException
type1 - One type the token can be.type2 - Another type the token can be, or -1 if we
should only check against type1.type3 - Another type the token can be, or -1 if we
should only check against type1 and type2.error - The error description for the exception if the end of
stream is reached, or if the token is of an unexpected type.
IOException - If an IO error occurs or the end of stream is
reached, or if the token is of a wrong type.
public Token yyPeek()
throws IOException
IOException - If an IO error occurs.
public Token yyPeek(int depth)
throws IOException
depth - The token to peek at, from 1 forward.
null if that token index is past the
end of the stream.
IOException - If an IO error occurs.
public int yyPeekCheckType()
throws IOException
IOException - If an IO error occurs.
public int yyPeekCheckType(int index)
throws IOException
index - The index of the token to retrieve.
IOException - If an IO error occurs.
public Token yyPeekNonNull(String error)
throws IOException
IOException - If an IO error occurs.
public Token yyPeekNonNull(int type,
String error)
throws IOException
type - The type the token must be.
IOException - If an IO error occurs, or if EOS is reached, or
if the token is not of the specified type.
public Token yyPeekNonNull(int type1,
int type2,
String error)
throws IOException
type - The type the token must be.
IOException - If an IO error occurs, or if EOS is reached, or
if the token is not of the specified type.
public Token yyPeekNonNull(int type1,
int type2,
int type3,
String error)
throws IOException
type - The type the token must be.
IOException - If an IO error occurs, or if EOS is reached, or
if the token is not of the specified type.public void yyPushback(Token t)
t - The token.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||