public class StmtParser extends LeolaParser
Stmt
.Modifier and Type | Field and Description |
---|---|
protected static EnumSet<LeolaTokenType> |
STMT_FOLLOW_SET |
protected static EnumSet<LeolaTokenType> |
STMT_START_SET |
Constructor and Description |
---|
StmtParser(LeolaParser parser) |
Modifier and Type | Method and Description |
---|---|
protected Token |
eatOptionalStmtEnd(Token token)
Eats the optional line end
|
Token |
expectedTokens(EnumSet<LeolaTokenType> expectedSet)
Determines if the current token is within the supplied expected set, if it isn't
and error is thrown.
|
ASTNode |
parse(Token token)
Parse a statement.
|
protected void |
parseList(Token tok,
ASTNode parentNode,
LeolaTokenType terminator,
LeolaErrorCode errorCode)
Parse a statement list.
|
Stmt |
parseStmt(Token token)
Parses the next
Stmt |
expectToken, expectTokenNext, getErrorCount, parse, setLineNumber, throwParseError
currentToken, getEventDispatcher, getExceptionHandler, getScanner, getSource, nextToken, previousToken
protected static final EnumSet<LeolaTokenType> STMT_START_SET
protected static final EnumSet<LeolaTokenType> STMT_FOLLOW_SET
public StmtParser(LeolaParser parser)
parser
- public ASTNode parse(Token token) throws Exception
token
- the initial token.Exception
- if an error occurred.protected Token eatOptionalStmtEnd(Token token) throws Exception
token
- Exception
protected void parseList(Token tok, ASTNode parentNode, LeolaTokenType terminator, LeolaErrorCode errorCode) throws Exception
tok
- the current token.parentNode
- the parent node of the statement list.terminator
- the token type of the node that terminates the list.errorCode
- the error code if the terminator token is missing.Exception
- if an error occurred.public Token expectedTokens(EnumSet<LeolaTokenType> expectedSet)
expectedSet
- the set of tokens the parser expectsLeolaParser.throwParseError(Token, LeolaErrorCode)
Copyright © 2010–2015. All rights reserved.