|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.groovy.syntax.parser.Parser
Reads the source text and produces a hierarchy of Concrete Syntax Trees
(CSTs). Exceptions are collected during processing, and parsing will
continue for while possible, in order to report as many problems as
possible. compilationUnit()
is the primary entry point.
Field Summary | |
protected static int[] |
ARRAY_ITEM_TERMINATORS
|
protected static int[] |
EXTENDS_CLAUSE_TERMINATORS
End markers for use by classDeclaration(), interfaceDeclaration(), and methodDeclaration(). |
protected static int[] |
GENERAL_CLAUSE_TERMINATOR
|
protected static int[] |
IMPLEMENTS_CLAUSE_TERMINATORS
|
static int[] |
OPTIONAL_DATATYPE_FOLLOWER
|
protected static int[] |
PARAMETER_TERMINATORS
|
protected static int[] |
STATEMENT_TERMINATORS
|
static int[] |
SWITCH_STATEMENT_BLOCK_TERMINATORS
|
protected static int[] |
THROWS_CLAUSE_TERMINATORS
|
protected static int[] |
TYPE_DEFINERS
Various generally useful type sets. |
Constructor Summary | |
Parser(TokenStream tokenStream)
Sets the Parser to process a TokenStream . |
|
Parser(TokenStream tokenStream,
ExceptionCollector collector)
Sets the Parser to process a TokenStream . |
Method Summary | |
protected CSTNode |
additiveExpression()
|
protected CSTNode |
argumentList()
|
protected CSTNode |
assertStatement()
|
protected CSTNode |
assignmentExpression()
|
CSTNode |
bodyStatement()
A synonym for typeBodyStatement( true, true, false ) . |
protected CSTNode |
breakStatement()
Processes a break statement. |
CSTNode |
classDeclaration(CSTNode modifiers)
Processes a class declaration. |
protected CSTNode |
closureExpression()
|
protected CSTNode |
closureExpression(boolean pipeRequired)
|
CSTNode |
compilationUnit()
The primary file-level parsing entry point. |
protected void |
consume_bare(CSTNode root,
int type)
Analogous to consume(root, type) , exception consumes with
consume_bare . |
protected Token |
consume_bare(int type)
Consumes (and returns) the next token if it is of the specified type, or throws UnexpectedTokenException . |
protected void |
consume(CSTNode root,
int type)
Adds a CSTNode of the result of consume(type)
as a child of root . |
protected Token |
consume(int type)
Consumes (and returns) the next token if it is of the specified type, or throws an UnexpectedTokenException . |
protected void |
consumeUntil_bare(int type)
Consumes tokens until one of the specified type is consumed. |
protected void |
consumeUntil(int type)
Consumes tokens until one of the specified type is consumed. |
protected CSTNode |
continueStatement()
Processes a continue statement. |
static Parser |
create(java.lang.String text,
int errorTolerance)
Convenience routine to wrap a String in a Parser . |
protected CSTNode |
datatype()
A synonym for datatype( true ) . |
protected CSTNode |
datatype(boolean allowVoid)
Processes a datatype specification. |
protected CSTNode |
doubleQuotedString()
|
protected CSTNode |
doWhileStatement()
Processes a do ... |
void |
endOfStatement()
A synonym for endOfStatement( true ) . |
void |
endOfStatement(boolean allowRightCurlyBrace)
Eats a required end-of-statement (semicolon or newline) from the stream. |
protected CSTNode |
equalityExpression()
|
protected CSTNode |
expression()
|
protected CSTNode |
forStatement()
Processes a for statement. |
TokenStream |
getTokenStream()
Returns the TokenStream being parsed. |
protected CSTNode |
ifStatement()
Processes an if statement. |
CSTNode |
importStatement()
Processes an import statement. |
CSTNode |
interfaceDeclaration(CSTNode modifiers)
Processes a interface declaration. |
protected Token |
la_bare()
Returns (without consuming) the next token in the underlying token stream (newlines included). |
protected Token |
la_bare(int k)
Returns (without consuming any tokens) the next k th
token from the underlying token stream (newlines included). |
protected Token |
la()
Returns (without consuming) the next non-newline token in the underlying token stream. |
protected Token |
la(int k)
Returns (without consuming any tokens) the next k th
non-newline token from the underlying token stream. |
protected CSTNode |
listExpression(CSTNode entry)
|
protected CSTNode |
listOrMapExpression()
|
protected CSTNode |
logicalAndExpression()
|
protected CSTNode |
logicalOrExpression()
|
protected boolean |
lookAheadForMethodCall()
|
protected int |
lt_bare()
Returns the type of the la_bare() token, or -1. |
protected int |
lt_bare(int k)
Returns the type of the la_bare(k) token, or -1. |
protected int |
lt()
Returns the type of the la() token, or -1. |
protected int |
lt(int k)
Returns the type of the la(k) token, or -1. |
protected CSTNode |
mapExpression(CSTNode key)
|
protected CSTNode |
methodCallOrPropertyExpression(CSTNode expr)
|
protected CSTNode |
methodCallWithoutParenthesis(CSTNode expr,
CSTNode identifier)
|
CSTNode |
methodDeclaration(CSTNode modifiers,
CSTNode type,
CSTNode identifier,
boolean emptyOnly)
Processes a class/interface method. |
CSTNode |
modifierList(boolean allowStatic,
boolean allowAbstract)
Processes the modifiers list that can appear on top- and class-level method and class-level variable names (public, private, abstract, etc.). |
protected CSTNode |
multiplicativeExpression()
|
protected CSTNode |
nameDeclaration(boolean useBare)
Processes a name that is valid for declarations. |
protected CSTNode |
namedParameterList(int endOfListDemarc)
|
protected CSTNode |
nameReference(boolean useBare)
Processes a reference to a declared name. |
protected CSTNode |
newExpression()
|
protected CSTNode |
optionalDatatype(boolean useBare,
boolean allowVoid)
Processes an optional data type marker (for a parameter, method return type, etc.). |
void |
optionalNewlines()
Eats any optional newlines. |
CSTNode |
packageDeclaration()
Processes a package declaration. |
protected CSTNode |
parameterDeclaration()
Processes a single parameter declaration, which can occur on methods and closures. |
protected CSTNode |
parameterDeclarationList()
Processes a parameter declaration list, which can occur on methods and closures. |
protected CSTNode |
parameterList(int endOfListDemarc)
|
protected CSTNode |
parentheticalExpression()
|
protected CSTNode |
postfixExpression()
|
protected CSTNode |
primaryExpression()
|
CSTNode |
propertyDeclaration(CSTNode modifiers,
CSTNode type,
CSTNode identifier)
Processes a class/interface property, including the optional initialization clause. |
protected CSTNode |
rangeExpression()
|
void |
recover()
A synonym for recover( STATEMENT_TERMNINATORS, true ) . |
void |
recover(int[] safe)
A synonym for recover( safe, false ) . |
void |
recover(int[] safe,
boolean useBare)
Attempts to recover from an error by discarding input until a known token is found. |
protected CSTNode |
regexPattern()
|
protected CSTNode |
relationalExpression()
|
protected Token |
require(Token token)
Ensures that a Token is not null. |
protected CSTNode |
returnStatement()
Processes a return statement. |
protected CSTNode |
rootNode_bare(int type)
Analagous to rootNode(type) , except consumes with
consume_bare . |
protected CSTNode |
rootNode_bare(int type,
CSTNode child)
Analagous to rootNode(type, child) , except consumes with
consume_bare() . |
protected CSTNode |
rootNode(int type)
Returns a new CSTNode that holds the result of
consume(type) . |
protected CSTNode |
rootNode(int type,
CSTNode child)
Identical to rootNode(type) , but adds child as
a child of the newly created node. |
protected CSTNode |
scalarDatatype(boolean allowVoid)
Processes a scalar datatype specification. |
protected CSTNode |
statement()
Synonym for statement( false ) . |
protected CSTNode |
statement(boolean allowUnlabelledBlocks)
Processes a single statement. |
protected CSTNode |
statementBody(boolean requireBraces)
Processes the body of a complex statement (like "if", "for", etc.). |
protected CSTNode |
statementsUntilRightCurly(CSTNode root)
Reads statements until a "}" is met. |
protected CSTNode |
subscriptExpression(CSTNode expr)
|
protected CSTNode |
sugaryMethodCallExpression(CSTNode expr,
CSTNode identifier,
CSTNode dotExpr)
|
protected CSTNode |
switchStatement()
Processes a switch statement. |
protected CSTNode |
synchronizedStatement()
Processes a synchronized statement. |
protected CSTNode |
ternaryExpression()
|
protected CSTNode |
thisExpression()
|
protected void |
throwExpected(int[] expectedTypes)
Throws an UnexpectedTokenException . |
protected CSTNode |
throwStatement()
Processes a throw statement. |
CSTNode |
topLevelStatement()
Processes a top level statement (classes, interfaces, unattached methods, and unattached code). |
protected CSTNode |
tryParseMethodCallWithoutParenthesis(CSTNode expr,
CSTNode identifier)
|
protected CSTNode |
tryStatement()
Processes an try statement. |
CSTNode |
typeBody(boolean allowStatic,
boolean allowAbstract,
boolean requireAbstract)
Processes the body of an interface or class. |
CSTNode |
typeBodyStatement(boolean allowStatic,
boolean allowAbstract,
boolean requireAbstract)
Processes a single entry in the the body of an interface or class. |
CSTNode |
typeDeclaration()
A synomym for topLevelStatement() . |
CSTNode |
typeList(int declarator,
int[] until,
boolean optional,
int limit)
Processes a type list, like the ones that occur after "extends" or implements. |
protected CSTNode |
unaryExpression()
|
protected CSTNode |
whileStatement()
Processes a while statement. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final int[] TYPE_DEFINERS
protected static final int[] STATEMENT_TERMINATORS
protected static final int[] GENERAL_CLAUSE_TERMINATOR
protected static final int[] PARAMETER_TERMINATORS
protected static final int[] ARRAY_ITEM_TERMINATORS
protected static final int[] EXTENDS_CLAUSE_TERMINATORS
protected static final int[] IMPLEMENTS_CLAUSE_TERMINATORS
protected static final int[] THROWS_CLAUSE_TERMINATORS
public static final int[] OPTIONAL_DATATYPE_FOLLOWER
public static final int[] SWITCH_STATEMENT_BLOCK_TERMINATORS
Constructor Detail |
public Parser(TokenStream tokenStream)
Parser
to process a TokenStream
.
public Parser(TokenStream tokenStream, ExceptionCollector collector)
Parser
to process a TokenStream
.
Exceptions will be collected in the specified collector.
Method Detail |
public static Parser create(java.lang.String text, int errorTolerance)
String
in a Parser
.
public TokenStream getTokenStream()
TokenStream
being parsed.
public void optionalNewlines() throws ReadException, SyntaxException
ReadException
SyntaxException
public void endOfStatement(boolean allowRightCurlyBrace) throws ReadException, SyntaxException
UnexpectedTokenException
if anything else is found.
ReadException
SyntaxException
public void endOfStatement() throws ReadException, SyntaxException
endOfStatement( true )
.
ReadException
SyntaxException
public void recover(int[] safe, boolean useBare) throws ReadException, SyntaxException
ReadException
SyntaxException
public void recover(int[] safe) throws ReadException, SyntaxException
recover( safe, false )
.
ReadException
SyntaxException
public void recover() throws ReadException, SyntaxException
recover( STATEMENT_TERMNINATORS, true )
.
ReadException
SyntaxException
public CSTNode compilationUnit() throws ReadException, SyntaxException, ExceptionCollector, ExceptionCollector
Grammar:
compilationUnit = [packageStatement] (usingStatement)* (topLevelStatement)*
CST:
compilationUnit = {package imports (topLevelStatement)* } package see packageDeclaration() imports see importStatement() topLevelStatement see topLevelStatement()
ReadException
SyntaxException
ExceptionCollector
public CSTNode packageDeclaration() throws ReadException, SyntaxException, ExceptionCollector
compilationUnit()
.
Grammar:
packageDeclaration = "package"("." )*
CST:
package = { "package" classes } classes = { "." classes class } | class class = {}
ReadException
SyntaxException
ExceptionCollector
public CSTNode importStatement() throws ReadException, SyntaxException, ExceptionCollector
compilationUnit()
.
Grammar:
importStatement = "import" (all|specific)all = package "." (package ".")* "*" specific = (package "." (package ".")*)? classes classes = class ["as" alias] ("," class ["as" alias])* package = class = alias =
CST:
import = { "import" (package|{}) ({"*"} | clause*) } package = { "." package element } | element element = {} clause = { alias } alias = { } | {}
ReadException
SyntaxException
ExceptionCollector
public CSTNode topLevelStatement() throws ReadException, SyntaxException, ExceptionCollector
compilationUnit()
.
Grammar:
topLevelStatement = methodDeclaration | typeDeclaration | statement typeDeclaration = classDefinition | interfaceDeclaration
Recognition:
"def" => methodDeclaration modifierList "class" => classDeclaration modifierList "interface" => interfaceDeclaration modifierList =>* => statement
CST:
see methodDeclaration() see classDeclaration() see interfaceDeclaration() see statement()
ReadException
SyntaxException
ExceptionCollector
public CSTNode typeDeclaration() throws ReadException, SyntaxException, ExceptionCollector
topLevelStatement()
.
ReadException
SyntaxException
ExceptionCollector
public CSTNode modifierList(boolean allowStatic, boolean allowAbstract) throws ReadException, SyntaxException, ExceptionCollector
Grammar:
modifierList =*
CST:
modifiers = {{ }* }
ReadException
SyntaxException
ExceptionCollector
public CSTNode classDeclaration(CSTNode modifiers) throws ReadException, SyntaxException, ExceptionCollector
Grammar:
classDeclaration =* "class" ["extends" datatype] ["implements" datatype (, datatype)*] typeBody
CST:
class = { "class" modifiers {} extends implements body } extends = { "extends" datatype } | {} implements = { "implements" datatype* } | {} modifiers see modifierList() datatype see datatype() body see typeBody()
ReadException
SyntaxException
ExceptionCollector
public CSTNode interfaceDeclaration(CSTNode modifiers) throws ReadException, SyntaxException, ExceptionCollector
Grammar:
interfaceDeclaration =* "interface" ["extends" typeList] typeBody
CST:
class = { "interface" modifiers {} {} extends body } extends = { "extends" datatype* } | {} modifiers see modifierList() datatype see datatype() body see typeBody()
ReadException
SyntaxException
ExceptionCollector
public CSTNode typeList(int declarator, int[] until, boolean optional, int limit) throws ReadException, SyntaxException, ExceptionCollector
Grammar:
typeList = datatype (, datatype)*
CST:
typeList = {datatype+ } | {} datatype see datatype()
ReadException
SyntaxException
ExceptionCollector
public CSTNode typeBody(boolean allowStatic, boolean allowAbstract, boolean requireAbstract) throws ReadException, SyntaxException, ExceptionCollector
Grammar:
typeBody = "{" typeBodyStatement* "}"
CST:
body = {typeBodyStatement* } typeBodyStatement see typeBodyStatement()
ReadException
SyntaxException
ExceptionCollector
public CSTNode typeBodyStatement(boolean allowStatic, boolean allowAbstract, boolean requireAbstract) throws ReadException, SyntaxException, ExceptionCollector
Grammar:
typeBodyStatement = staticInitializer | classDeclaration | interfaceDeclaration | propertyDeclaration | methodDeclaration staticInitializer = ("static" "{" statement* "}")
Recognition:
"static" "{" => staticInitializer modifierList "class" => classDeclaration modifierList "interface" => interfaceDeclaration modifierList ["property"] optionalDatatype identifier "(" => methodDeclaration modifierList ["property"] optionalDatatype identifier ("="|";"|"\n"|"}" => propertyDeclaration * =>
CST:
see classDeclaration() see interfaceDeclaration() see methodDeclaration() see propertyDeclaration()
ReadException
SyntaxException
ExceptionCollector
public CSTNode bodyStatement() throws ReadException, SyntaxException, ExceptionCollector
typeBodyStatement( true, true, false )
.
ReadException
SyntaxException
ExceptionCollector
protected CSTNode nameDeclaration(boolean useBare) throws ReadException, SyntaxException
Grammar:
nameDeclaration =
CST:
name = {}
ReadException
SyntaxException
protected CSTNode nameReference(boolean useBare) throws ReadException, SyntaxException
Grammar:
nameReference =|
CST:
name = {}
ReadException
SyntaxException
protected CSTNode optionalDatatype(boolean useBare, boolean allowVoid) throws ReadException, SyntaxException, ExceptionCollector
Grammar:
optionalDatatype = datatype? (?=)
CST:
result = datatype | {} see datatype()
ReadException
SyntaxException
ExceptionCollector
public CSTNode propertyDeclaration(CSTNode modifiers, CSTNode type, CSTNode identifier) throws ReadException, SyntaxException, ExceptionCollector
Grammar:
propertyDeclaration = (modifierList optionalDatatype identifier ["=" expression])
CST:
property = { "property" modifierList methodIdentifier methodReturnType expression? } see modifierList() see methodIdentifier() see methodReturnType() see expression()
ReadException
SyntaxException
ExceptionCollector
public CSTNode methodDeclaration(CSTNode modifiers, CSTNode type, CSTNode identifier, boolean emptyOnly) throws ReadException, SyntaxException, ExceptionCollector
emptyOnly
is set, no method body will be allowed.
Grammar:
methodDeclaration = modifierList optionalDatatype identifier "(" parameterDeclarationList ")" [ "throws" typeList ] ( statementBody |)?
CST:
property = { "method" modifierList methodIdentifier methodReturnType parameterDeclarationList statementBody throwsClause } throwsClause = { "throws" datatype+ } | {} see modifierList() see methodIdentifier() see methodReturnType() see parameterDeclarationList() see statementBody()
ReadException
SyntaxException
ExceptionCollector
protected CSTNode parameterDeclarationList() throws ReadException, SyntaxException, ExceptionCollector
Grammar:
parameterDeclarationList = (parameterDeclaration ("," parameterDeclaration)* ("," parameterDeclaration "=" expression)* )? | (parameterDeclaration "=" expression ("," parameterDeclaration "=" expression)* )?
CST:
parameters = {parameter* } parameter = { datatype nameDeclaration default } default = { } | expression
ReadException
SyntaxException
ExceptionCollector
protected CSTNode parameterDeclaration() throws ReadException, SyntaxException, ExceptionCollector
Grammar:
parameterDeclaration = optionalDatatype nameDeclaration
CST:
parameter = {datatype nameDeclaration } see datatype() see nameDeclaration()
ReadException
SyntaxException
ExceptionCollector
protected CSTNode datatype(boolean allowVoid) throws ReadException, SyntaxException, ExceptionCollector
Grammar:
datatype = scalarDatatype ( "[" "]" )* scalarDatatype = (("." )*) | "void" | "int" | ...
CST:
datatype = { "[" datatype } | scalar scalar = typename | primitive typename = { "." typename name } | name name = {} primitive = { "void" } | { "int" } | ...
ReadException
SyntaxException
ExceptionCollector
protected CSTNode datatype() throws ReadException, SyntaxException, ExceptionCollector
datatype( true )
.
ReadException
SyntaxException
ExceptionCollector
protected CSTNode scalarDatatype(boolean allowVoid) throws ReadException, SyntaxException, ExceptionCollector
Grammar:
scalarDatatype = (("." )*) | "void" | "int" | ...
CST:
scalar = typename | primitive typename = { "." typename name } | name name = {} primitive = { "void" } | { "int" } | ...
ReadException
SyntaxException
ExceptionCollector
protected CSTNode statementBody(boolean requireBraces) throws ReadException, SyntaxException, ExceptionCollector
requireBraces
if the body must not be just a single
statement.
Grammar:
statementBody = ("{" statement* "}") | statement
CST:
complex = { "{" statement* } simple = statement see statement()
ReadException
SyntaxException
ExceptionCollector
protected CSTNode statementsUntilRightCurly(CSTNode root) throws ReadException, SyntaxException, ExceptionCollector
Grammar:
statementsUntilRightCurly = statement* (?= "}")
CST:
statements added as children of supplied root node
ReadException
SyntaxException
ExceptionCollector
protected CSTNode statement(boolean allowUnlabelledBlocks) throws ReadException, SyntaxException, ExceptionCollector
Grammar:
statement = (label ":")? bareStatement bareStatement = (emptyStatement|pureStatement|blockStatement) pureStatement = forStatement | whileStatement | doStatement | continueStatement | breakStatement | ifStatement | tryStatement | throwStatement | synchronizedStatement | switchStatement | returnStatement | assertStatement | expressionlabel = blockStatement = "{" statement* "}" emptyStatement = ";"
Recognition:
";" => emptyStatement=> Statement "{" => expression, then: if it is a closureExpression and has no parameters => blockStatement * => expression
CST:
labelled = { ":"bareStatement } bareStatement = emptyStatement | blockStatement | pureStatement emptyStatement = { "{" } blockStatement = { "{" statement* } see forStatement() see whileStatement() see doStatement() see continueStatement() see breakStatement() see ifStatement() see tryStatement() see throwStatement() see synchronizedStatement() see switchStatement() see returnStatement() see assertStatement() see expression()
ReadException
SyntaxException
ExceptionCollector
protected CSTNode statement() throws ReadException, SyntaxException, ExceptionCollector
statement( false )
.
ReadException
SyntaxException
ExceptionCollector
protected CSTNode switchStatement() throws ReadException, SyntaxException, ExceptionCollector
Grammar:
switchStatment = "switch" "(" expression ")" "{" switchBody "}" switchBody = caseSet* caseSet = (("case" expression ":")+ | ("default" ":")) statement+
CST:
switch = { "switch" expression case* } case = { "case" expression statement* } | { "default" statement* } see expression() see statement()
ReadException
SyntaxException
ExceptionCollector
protected CSTNode breakStatement() throws ReadException, SyntaxException, ExceptionCollector
Grammar:
breakStatement = "break" label?label =
CST:
statement = { "break" label? } label = {}
ReadException
SyntaxException
ExceptionCollector
protected CSTNode continueStatement() throws ReadException, SyntaxException, ExceptionCollector
Grammar:
continueStatement = "continue" label?label =
CST:
statement = { "continue" label? } label = {}
ReadException
SyntaxException
ExceptionCollector
protected CSTNode throwStatement() throws ReadException, SyntaxException, ExceptionCollector
Grammar:
throwStatement = "throw" expression
CST:
statement = { "throw" expression } see expression()
ReadException
SyntaxException
ExceptionCollector
protected CSTNode synchronizedStatement() throws ReadException, SyntaxException, ExceptionCollector
Grammar:
synchronizedStatement = "synchronized" "(" expression ")" statementBody
CST:
statement = { "synchronized" expression statementBody } see expression() see statementBody()
ReadException
SyntaxException
ExceptionCollector
protected CSTNode ifStatement() throws ReadException, SyntaxException, ExceptionCollector
Grammar:
ifStatement = ifClause elseIfClause* elseClause? ifClause = "if" "(" expression ")" statementBody elseIfClause = "else" "if" "(" expression ")" statementBody elseClause = "else" statementBody
CST:
if = { "if" expression statementBody else? } else = if | { "else" statementBody } see expression() see statementBody()
ReadException
SyntaxException
ExceptionCollector
protected CSTNode tryStatement() throws ReadException, SyntaxException, ExceptionCollector
Grammar:
tryStatement = "try" statementBody catchClause* finallyClause? catchClause = "catch" "(" datatype identifier ")" statementBody finallyClause = "finally" statementBody
CST:
try = { "try" statementBody finally catches } catches = {catch* } catch = { "catch" datatype identifier statementBody } finally = {} | statementBody see datatype() see identifier() see statementBody()
ReadException
SyntaxException
ExceptionCollector
protected CSTNode returnStatement() throws ReadException, SyntaxException, ExceptionCollector
Grammar:
returnStatement = "return" expression?
CST:
statement = { "return" expression? } see expression()
ReadException
SyntaxException
ExceptionCollector
protected CSTNode whileStatement() throws ReadException, SyntaxException, ExceptionCollector
Grammar:
whileStatement = "while" "(" expression ")" statementBody
CST:
while = { "while" expression statementBody } see expression() see statementBody()
ReadException
SyntaxException
ExceptionCollector
protected CSTNode doWhileStatement() throws ReadException, SyntaxException, ExceptionCollector
Grammar:
doWhileStatement = "do" statementBody "while" "(" expression ")"
CST:
do = { "do" statementBody expression } see expression() see statementBody()
ReadException
SyntaxException
ExceptionCollector
protected CSTNode forStatement() throws ReadException, SyntaxException, ExceptionCollector
Grammar:
forStatement = "for" statementBody "while" "(" expression ")"
CST:
do = { "do" statementBody expression } see expression() see statementBody()
ReadException
SyntaxException
ExceptionCollector
protected CSTNode assertStatement() throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode expression() throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode assignmentExpression() throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode ternaryExpression() throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode logicalOrExpression() throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode logicalAndExpression() throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode equalityExpression() throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode relationalExpression() throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode rangeExpression() throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode additiveExpression() throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode multiplicativeExpression() throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode unaryExpression() throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode postfixExpression() throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode primaryExpression() throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode thisExpression()
protected CSTNode subscriptExpression(CSTNode expr) throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode methodCallOrPropertyExpression(CSTNode expr) throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode sugaryMethodCallExpression(CSTNode expr, CSTNode identifier, CSTNode dotExpr) throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode tryParseMethodCallWithoutParenthesis(CSTNode expr, CSTNode identifier) throws SyntaxException, ReadException
SyntaxException
ReadException
protected CSTNode methodCallWithoutParenthesis(CSTNode expr, CSTNode identifier) throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected boolean lookAheadForMethodCall() throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode regexPattern() throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode doubleQuotedString() throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode parentheticalExpression() throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode parameterList(int endOfListDemarc) throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode namedParameterList(int endOfListDemarc) throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode newExpression() throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode closureExpression() throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode closureExpression(boolean pipeRequired) throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode listOrMapExpression() throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode mapExpression(CSTNode key) throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode listExpression(CSTNode entry) throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected CSTNode argumentList() throws ReadException, SyntaxException, ExceptionCollector
ReadException
SyntaxException
ExceptionCollector
protected void throwExpected(int[] expectedTypes) throws ReadException, SyntaxException
UnexpectedTokenException
.
ReadException
SyntaxException
protected Token require(Token token) throws ReadException, SyntaxException
Token
is not null. Throws a
ParserException
on error.
ReadException
SyntaxException
protected Token la() throws ReadException, SyntaxException
ReadException
SyntaxException
protected Token la(int k) throws ReadException, SyntaxException
k
th
non-newline token from the underlying token stream.
ReadException
SyntaxException
protected int lt() throws ReadException, SyntaxException
la()
token, or -1.
ReadException
SyntaxException
protected int lt(int k) throws ReadException, SyntaxException
la(k)
token, or -1.
ReadException
SyntaxException
protected void consumeUntil(int type) throws ReadException, SyntaxException
ReadException
SyntaxException
protected Token consume(int type) throws ReadException, SyntaxException
UnexpectedTokenException
. If the specified type
is Token.NEWLINE, eats all available newlines, and consumes (and returns)
the next (non-newline) token.
ReadException
SyntaxException
protected void consume(CSTNode root, int type) throws ReadException, SyntaxException
CSTNode
of the result of consume(type)
as a child of root
. Throws UnexpectedTokenException
if the next token is not of the correct type.
ReadException
SyntaxException
protected CSTNode rootNode(int type) throws ReadException, SyntaxException
CSTNode
that holds the result of
consume(type)
. Throws UnexpectedTokenException
if the next token is not of the correct type.
ReadException
SyntaxException
protected CSTNode rootNode(int type, CSTNode child) throws ReadException, SyntaxException
rootNode(type)
, but adds child as
a child of the newly created node.
- Throws:
ReadException
SyntaxException
protected Token la_bare() throws ReadException, SyntaxException
ReadException
SyntaxException
protected Token la_bare(int k) throws ReadException, SyntaxException
k
th
token from the underlying token stream (newlines included).
ReadException
SyntaxException
protected int lt_bare() throws ReadException, SyntaxException
la_bare()
token, or -1.
ReadException
SyntaxException
protected int lt_bare(int k) throws ReadException, SyntaxException
la_bare(k)
token, or -1.
ReadException
SyntaxException
protected void consumeUntil_bare(int type) throws ReadException, SyntaxException
ReadException
SyntaxException
protected Token consume_bare(int type) throws ReadException, SyntaxException
UnexpectedTokenException
.
ReadException
SyntaxException
protected void consume_bare(CSTNode root, int type) throws ReadException, SyntaxException
consume(root, type)
, exception consumes with
consume_bare
.
ReadException
SyntaxException
protected CSTNode rootNode_bare(int type) throws ReadException, SyntaxException
rootNode(type)
, except consumes with
consume_bare
.
ReadException
SyntaxException
protected CSTNode rootNode_bare(int type, CSTNode child) throws ReadException, SyntaxException
rootNode(type, child)
, except consumes with
consume_bare()
.
ReadException
SyntaxException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |