kmy.jint.parser
Class Parser

java.lang.Object
  |
  +--kmy.jint.parser.Parser

public class Parser
extends java.lang.Object
implements ErrorStorage, DefinitionConst, TokenConst, ErrorCodes

This class can parse Jint (or Java) token stream and produce a parsing tree. It also calls ClassConsumer methods as it encounters corresponding constructions. Generally, one should create this class (giving it a token stream), set some properties (like errorStorage) and call parseStatement in a loop till the end of token stream.


Inner Class Summary
(package private) static class Parser.LabelExpression
          This is bogus expression node that expression parser returns when it encounters labeled statement.
(package private) static class Parser.LocalMethodExpression
          This is bogus expression node that expression parser returns when it encounters method definition.
(package private) static class Parser.LocalVariableExpression
          This is bogus expression node that expression parser returns when it encounters variable/member definition.
 
Field Summary
private  ClassConsumer classConsumer
           
private  IdentifierNode[] commonImports
           
private  java.lang.Object currentClassHandle
           
private  Identifier currentClassName
           
private  ErrorStorage errorStorage
           
(package private) static java.lang.Boolean FALSE
           
private  boolean fresh
           
private  AbstractTokenizer in
           
private  boolean inInterface
           
private  boolean looseExceptionCheck
           
private  int nextInlineClassName
           
private  boolean processed
           
private  java.lang.Object publicScope
           
(package private) static java.lang.Boolean TRUE
           
private  java.lang.Object upperLevelClassHandle
           
 
Fields inherited from interface kmy.jint.constants.DefinitionConst
ABSTRACT_FLAG, ACC_ABSTRACT, ACC_FINAL, ACC_INTERFACE, ACC_MASK, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_SUPER, ACC_SYNCHRONIZED, ACC_TRANSIENT, ACC_VOLATILE, CONST_FLAG, EXPLICIT_FLAG, FINAL_FLAG, INTERFACE_FLAG, METHOD_SCOPE_FLAG, MUST_BE_CLASS_FLAG, NATIVE_FLAG, PACKAGE_PRIVATE_FLAG, PRIVATE_FLAG, PROTECTED_FLAG, PUBLIC_FLAG, SCRIPT_STYLE_FLAG, SELF_USED_FLAG, STATIC_FLAG, STRICT_FLAG, SYNCHRONIZED_FLAG, TRANSIENT_FLAG, VOLATILE_FLAG, WHERE_FLAG, WORLD_FLAG
 
Fields inherited from interface kmy.jint.constants.TokenConst
TOK_OPT_BUFFERONLY, TOK_OPT_DECLARE, TOK_OPT_GLOBAL, TOK_OPT_IGNORE, TOK_OPT_MULTILINE, TOK_OPT_OFFLINE, TOK_OPT_RETAINALL, TOK_OPT_SINGLELINE, TOK_OPT_STANDALONE, TOKEN_ABSTRACT, TOKEN_AE, TOKEN_AND, TOKEN_ANDE, TOKEN_BOOLEAN, TOKEN_BREAK, TOKEN_BYTE, TOKEN_BYVALUE, TOKEN_CASE, TOKEN_CATCH, TOKEN_CHAR, TOKEN_CLASS, TOKEN_CONST, TOKEN_CONTINUE, TOKEN_DEFAULT, TOKEN_DO, TOKEN_DOUBLE, TOKEN_EE, TOKEN_ELSE, TOKEN_EOF, TOKEN_EXTENDS, TOKEN_FALSE, TOKEN_FINAL, TOKEN_FINALLY, TOKEN_FLOAT, TOKEN_FOR, TOKEN_GE, TOKEN_GG, TOKEN_GGE, TOKEN_GGG, TOKEN_GGGE, TOKEN_GOTO, TOKEN_IF, TOKEN_IMPLEMENTS, TOKEN_IMPORT, TOKEN_INSTANCEOF, TOKEN_INT, TOKEN_INTERFACE, TOKEN_LE, TOKEN_LL, TOKEN_LLE, TOKEN_LONG, TOKEN_ME, TOKEN_MM, TOKEN_NATIVE, TOKEN_NE, TOKEN_NEW, TOKEN_NONE, TOKEN_NULL, TOKEN_OR, TOKEN_ORE, TOKEN_PACKAGE, TOKEN_PCE, TOKEN_PE, TOKEN_PP, TOKEN_PRIVATE, TOKEN_PROTECTED, TOKEN_PUBLIC, TOKEN_RETURN, TOKEN_SE, TOKEN_SHORT, TOKEN_SS, TOKEN_STATIC, TOKEN_SUPER, TOKEN_SWITCH, TOKEN_SYNCHRONIZED, TOKEN_TE, TOKEN_THIS, TOKEN_THREADSAFE, TOKEN_THROW, TOKEN_THROWS, TOKEN_TRANSIENT, TOKEN_TRUE, TOKEN_TRY, TOKEN_V_BOUND, TOKEN_V_CHAR, TOKEN_V_DOUBLE, TOKEN_V_FLOAT, TOKEN_V_FORM, TOKEN_V_INT, TOKEN_V_LONG, TOKEN_V_PATT, TOKEN_V_REGEX, TOKEN_V_STRING, TOKEN_V_SUBST, TOKEN_V_TRANS, TOKEN_VOID, TOKEN_VOLATILE, TOKEN_WHERE, TOKEN_WHILE, TOKEN_WORD, TOKEN_XE, UNARY_MINUS
 
Fields inherited from interface kmy.jint.constants.ErrorCodes
ERR_A_ARREMPTY, ERR_A_ARRNOTEMPTY, ERR_A_BADDCL, ERR_A_BADMETHODNAME, ERR_A_BADOP, ERR_A_BADSWITCHTYPE, ERR_A_BOOLCAST, ERR_A_CANTACCLABEL, ERR_A_CANTCAST, ERR_A_CANTMAKEARR, ERR_A_CANTRESOLVE, ERR_A_CONSTERROR, ERR_A_EXPLCONTEXT, ERR_A_FIELDNOTIDENT, ERR_A_FIELDNOTSTAT, ERR_A_IMPLICITDCL, ERR_A_INSTOFPRIM1, ERR_A_INSTOFPRIM2, ERR_A_INTERNAL, ERR_A_LABELREDEF, ERR_A_MATCHARG1, ERR_A_MATCHARG2, ERR_A_MUSTBEBOOL, ERR_A_NEVER, ERR_A_NEWARRARGS, ERR_A_NOBESTMATCH, ERR_A_NOCONSTRUCTOR, ERR_A_NOFIELD, ERR_A_NOMETHOD, ERR_A_NONSTATICACC, ERR_A_NOOUTERCLASS, ERR_A_NOTCAUGHT, ERR_A_NOTINDEXABLE, ERR_A_NOTINTARGS, ERR_A_NOTINTEGER, ERR_A_NOTLVALUE, ERR_A_NOTNUMBER, ERR_A_NOTSIMPLEID, ERR_A_NOTTHROWABLE, ERR_A_NOTTHROWN, ERR_A_NOVAR, ERR_A_OBJTOPRIMCAST, ERR_A_PARAMUNRES, ERR_A_PRIMSYNC, ERR_A_PRIMTOOBJCAST, ERR_A_REGEXTE, ERR_A_STATICTHIS, ERR_A_TOBOOLCAST, ERR_A_TOVOIDCAST, ERR_A_TYPEMISMATCH, ERR_A_TYPENOTFOUND, ERR_A_VARREDECL, ERR_A_VOIDCAST, ERR_C_BADOP, ERR_C_CANTASSIGN, ERR_C_CASEMISMATCH, ERR_C_CVTNULLTOPRIM, ERR_C_DUPCASE, ERR_C_GENERIC, ERR_C_INTERFCONSTR, ERR_C_INTERNAL, ERR_C_MATCHARG1, ERR_C_NESTING, ERR_C_NEVER, ERR_C_NOCNSTRWOPRM, ERR_C_NOENCLOSING, ERR_C_NONSTATINIT, ERR_C_NOTBOOL, ERR_C_PICKEDNONSTR, ERR_C_PRIMELEM, ERR_C_RETURNREQ, ERR_C_THISASSIGN, ERR_C_TWODEFAULT, ERR_L_BACKSLASHEOF, ERR_L_CHAREND, ERR_L_COMMENTEND, ERR_L_EMPTYCHAR, ERR_L_EOFINCHAR, ERR_L_EOFINREGEX, ERR_L_EOFINSTRING, ERR_L_ILLEGALCHAR, ERR_L_IOERROR, ERR_L_NEVER, ERR_L_NUMFORMAT, ERR_L_REGEXEND, ERR_L_STRINGEND, ERR_P_ARRNOTEMPTY, ERR_P_CASEEXPECTED, ERR_P_CATCHEXPECTED, ERR_P_CLASSKEYWORD, ERR_P_DUPEXTENDS, ERR_P_DUPIMPLEMENTS, ERR_P_IDENTEXPECTED, ERR_P_NOTIMPL, ERR_P_NOTSTANDALONE, ERR_P_OPEXPECTED, ERR_P_REGEXEXPECTED, ERR_P_TOKENEXPECTED, ERR_P_TOKENINSERTED, ERR_P_TYPEEXPECTED, ERR_P_UNEXPECTED, ERR_P_VALUEEXPECTED, ERR_P_VAREXPECTED, ERR_T_ARRNOTEMPTY, ERR_T_CANTRESOLVE, ERR_T_IDEXPECTED, ERR_T_INTERNAL, ERR_T_MULTIINHERIT, ERR_T_NOTLIST, ERR_T_NOTSIMPLEID, ERR_T_ONFINISH
 
Fields inherited from interface kmy.jint.constants.MiniErrorCodes
ERR_F_BADEND, ERR_F_BADFORMATCHAR, ERR_F_GENERIC, ERR_F_INCOMPLETE, ERR_F_NOCURLBRACKET, ERR_F_NOTWITHJAVA, ERR_F_NOVARNAME, ERR_MASK_CLASSTABLE, ERR_MASK_COMPILER, ERR_MASK_ERROR, ERR_MASK_FATAL, ERR_MASK_FORMAT, ERR_MASK_GENERATOR, ERR_MASK_INFO, ERR_MASK_INTERNAL, ERR_MASK_LEXER, ERR_MASK_MODULE, ERR_MASK_PARSER, ERR_MASK_REGEX, ERR_MASK_SEVERITY, ERR_MASK_TYPER, ERR_MASK_VERBOSE, ERR_MASK_WARNING, ERR_R_BADBACKREF, ERR_R_BADSTART, ERR_R_BQBAD, ERR_R_BQUNFINISHED, ERR_R_CTLINVALID, ERR_R_CTLUNFINISHED, ERR_R_EXTRABRACKET, ERR_R_GENERIC, ERR_R_HEXBADNUMBER, ERR_R_HEXUNFINISHED, ERR_R_INTERNAL, ERR_R_NOBRACKET, ERR_R_NOCURLBRACKET, ERR_R_NOSQBRACKET, ERR_R_NOVAREXPR, ERR_R_NOVARNAME, ERR_R_STRAYBSLASH
 
Constructor Summary
Parser(AbstractTokenizer t)
          Creates a new parser that will parse the given token stream.
Parser(AbstractTokenizer t, ClassConsumer cc)
          Creates a new parser that will parse the given token stream and call the given ClassConsumer as it parses.
 
Method Summary
(package private)  void assertToken(char tType)
          Asserts that next token is of type tType.
(package private)  void assertToken(int tType, java.lang.String vis)
          Asserts that next token is of type tType.
private  void consumeToken()
          Marks token as consumed, so next call to nextToken() will read a new one.
 void forcePublic(boolean force)
          Report all future subscopes of outermost scope as public.
 java.lang.Object getClassHandle()
          Returns current class handle.
 boolean getLooseExceptionCheck()
           
private  int getPriority(int token)
          Returns infix operator priority.
private  Identifier nextInnerClassIdentifier()
          Generates a new name for inner class.
private  Identifier nextInnerClassIdentifier(java.lang.String patt)
          The same as nextInnerClassIdentifier() without args, but appends "m_" + given string to the newly generated name; also uses ___F_ instead of ___C_.
private  Identifier nextRegexClassIdentifier()
          The same as nextInnerClassIdentifier() without args, but appends "r" to the newly generated name; also uses ___R_ instead of ___C_.
private  void nextToken()
          Reads new token from the stream if needed.
(package private)  ExpressionNode opCall(int filePos, ExpressionNode expr, ExpressionNode[] args)
           
(package private)  ExpressionNode opCast(int filePos, IdentifierNode type, ExpressionNode arg)
           
(package private)  ExpressionNode opCond(int filePos, ExpressionNode head, ExpressionNode arg1, ExpressionNode arg2)
           
(package private)  ExpressionNode opInfix(int filePos, int op, ExpressionNode head, ExpressionNode arg)
           
(package private)  ExpressionNode opPostfix(int filePos, int op, ExpressionNode arg)
           
(package private)  ExpressionNode opPrefix(int filePos, int op, ExpressionNode arg)
           
private  ExpressionNode[] parseArgs()
          Parses comma-separated list of expressions.
private  ArrayValueNode parseArrayValue(IdentifierNode type)
          Parses array expression (comma-separated expression list inside '{ }').
private  ExpressionNode parseBlock()
          Parses Jint block (statement list inside '[ ]').
(package private)  ClassNode parseClass(int flags)
          Parses class or interface.
(package private)  ClassNode parseClassBody(IdentifierNode className, IdentifierNode[] parentArray, IdentifierNode[] interfaceArray, ClassNode[] whereArray, int flags)
          Parses class body starting with '{'.
(package private)  DefinitionNode parseDefinition(int flags)
          Parses method, field or class definition, starting with modifiers (if any).
(package private)  ExpressionNode parseExpression()
          Parses an expression.
(package private)  ExpressionNode parseExpression(int finPriority)
          Parses a subexpression that contains operators of priority less or equal to finPriority.
(package private)  StatementNode parseExpressionStatement()
          Parses expression statement and certain other types of statements.
private  IdentifierNode parseIdentifier()
          Parses qualified identifier.
private  IdentifierNode parseIdentifier(boolean starAllowed)
          Parses qualified identifier.
private  IdentifierNode parseIdentifier(boolean starAllowed, boolean indexAllowed)
          Parses qualified identifier.
(package private)  IdentifierNode[] parseIdentifierList()
          Parses comma-separated identifier list.
(package private)  MethodNode parseMethodBody(IdentifierNode type, IdentifierNode name, ParameterNode[] paramArray, int flags)
          Parses method body starting with token that follows ')' that closes formal parameter list.
(package private)  BodyNode parseOpenBody()
          Parses startement list inside '{...}' (but not brackets themselves).
(package private)  BreakNode parseOpenBreak()
          Parses break statement (not including 'break' keyword).
(package private)  ContinueNode parseOpenContinue()
          Parses continue statement (not including 'continue' keyword).
(package private)  DoNode parseOpenDo()
          Parses do statement (not including 'do' keyword).
(package private)  ForNode parseOpenFor()
          Parses for statement (not including 'for' keyword).
(package private)  IfNode parseOpenIf()
          Parses if statement (not including 'if' keyword).
(package private)  ImportStatementNode parseOpenImport()
          Parses import statement (not including 'import' keyword).
(package private)  MemberNode parseOpenMember(IdentifierNode type, IdentifierNode name)
          Parses field (or variable) definition starting with token that follows variable name.
(package private)  MethodNode parseOpenMethod(IdentifierNode type, IdentifierNode name, int flags)
          Parses method definition starting with '(' that follows method name.
(package private)  PackageStatementNode parseOpenPackage()
          Parses package statement (not including 'package' keyword).
(package private)  ReturnNode parseOpenReturn()
          Parses return statement (not including 'return' keyword).
(package private)  SwitchNode parseOpenSwitch()
          Parses switch statement (not including 'switch' keyword).
(package private)  SynchronizedNode parseOpenSynchronized()
          Parses synchronized statement (not including 'synchronized' keyword).
(package private)  ThrowNode parseOpenThrow()
          Parses throw statement (not including 'throw' keyword).
(package private)  TryNode parseOpenTry()
          Parses try statement (not including 'try' keyword).
(package private)  ExpressionNode[] parseOpenVariableList(IdentifierNode name)
          Parses comma-separated variable name or initialization list starting with the first name.
(package private)  WhileNode parseOpenWhile()
          Parses while statement (not including 'while' keyword).
(package private)  ParameterNode parseParameter()
          Parses single formal parameter.
 StatementNode parseStatement()
          Parses a single statement.
(package private)  StatementNode[] parseStatementList()
          Parsers a list of statements.
 void setClassHandle(java.lang.Object handle)
          This method initializes outermost scope handle, so the code parser gets is treated in the context of the given scope.
 void setErrorStorage(ErrorStorage errorStorage)
          Assigns an ErrorStorage that this parser will use to report errors.
 void setLooseExceptionCheck(boolean t)
          Exceptions should be treated loosely.
 void storeError(CompilerException e)
           
private  void storeError(int code, int filePos)
           
private  void storeError(int code, int filePos, java.lang.Object info)
           
private  IdentifierNode toType(ExpressionNode t)
          Converts indexed expression with empty indexes (array type name) to identifier node.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

in

private AbstractTokenizer in

processed

private boolean processed

fresh

private boolean fresh

classConsumer

private ClassConsumer classConsumer

nextInlineClassName

private int nextInlineClassName

upperLevelClassHandle

private java.lang.Object upperLevelClassHandle

currentClassHandle

private java.lang.Object currentClassHandle

currentClassName

private Identifier currentClassName

commonImports

private IdentifierNode[] commonImports

errorStorage

private ErrorStorage errorStorage

inInterface

private boolean inInterface

publicScope

private java.lang.Object publicScope

looseExceptionCheck

private boolean looseExceptionCheck

TRUE

static final java.lang.Boolean TRUE

FALSE

static final java.lang.Boolean FALSE
Constructor Detail

Parser

public Parser(AbstractTokenizer t)
Creates a new parser that will parse the given token stream.

Parser

public Parser(AbstractTokenizer t,
              ClassConsumer cc)
Creates a new parser that will parse the given token stream and call the given ClassConsumer as it parses.
Method Detail

setLooseExceptionCheck

public void setLooseExceptionCheck(boolean t)
Exceptions should be treated loosely.

getLooseExceptionCheck

public boolean getLooseExceptionCheck()

setErrorStorage

public void setErrorStorage(ErrorStorage errorStorage)
Assigns an ErrorStorage that this parser will use to report errors. Both parsing and lexer errors are caught and sent to the given ErrorStorage.

setClassHandle

public void setClassHandle(java.lang.Object handle)
This method initializes outermost scope handle, so the code parser gets is treated in the context of the given scope. This scope handle will be passed to the first ClassConsumer.startScope method call as outerHandle parameter.

getClassHandle

public java.lang.Object getClassHandle()
Returns current class handle. Class handle is an object that corresponds to current scope (method or class); it is used by ClassConsumer.

forcePublic

public void forcePublic(boolean force)
Report all future subscopes of outermost scope as public.

nextInnerClassIdentifier

private Identifier nextInnerClassIdentifier()
Generates a new name for inner class. Normally it just increments an internal name counter and converts it into Identifier. Number by itself is not a valid name, but full (JVM) inner class name is parent$inner, so there is no problem. So for upper-level inner classes (which are nested in "anonymous" class), it adds ___C_ prefix, so we still have a valid name (although now we can only hope it's unique).

nextInnerClassIdentifier

private Identifier nextInnerClassIdentifier(java.lang.String patt)
The same as nextInnerClassIdentifier() without args, but appends "m_" + given string to the newly generated name; also uses ___F_ instead of ___C_. Such class names are used for (hidden) method scopes.

nextRegexClassIdentifier

private Identifier nextRegexClassIdentifier()
The same as nextInnerClassIdentifier() without args, but appends "r" to the newly generated name; also uses ___R_ instead of ___C_. Such class names are used for (hidden) regex classes.

nextToken

private final void nextToken()
Reads new token from the stream if needed. This method won't read the new token until it is consumed by calling consumeToken(), so it is safe to call it many times in a row.

consumeToken

private final void consumeToken()
Marks token as consumed, so next call to nextToken() will read a new one.

storeError

private void storeError(int code,
                        int filePos)

storeError

private void storeError(int code,
                        int filePos,
                        java.lang.Object info)

storeError

public void storeError(CompilerException e)
Specified by:
storeError in interface ErrorStorage

assertToken

void assertToken(int tType,
                 java.lang.String vis)
Asserts that next token is of type tType.
Parameters:
tType - expected token type
vis - string representation of expected token type for error reporting

assertToken

void assertToken(char tType)
Asserts that next token is of type tType.
Parameters:
tType - expected token type

parseClass

ClassNode parseClass(int flags)
Parses class or interface. This method expects to see either keyword 'class' or 'interface' as the first token, so things like 'public' or 'abstract' should be taken care of by caller.
Parameters:
flags - modifiers (parsed by caller and passed as flags)

parseIdentifierList

IdentifierNode[] parseIdentifierList()
Parses comma-separated identifier list.

parseClassBody

ClassNode parseClassBody(IdentifierNode className,
                         IdentifierNode[] parentArray,
                         IdentifierNode[] interfaceArray,
                         ClassNode[] whereArray,
                         int flags)
Parses class body starting with '{'.

parseDefinition

DefinitionNode parseDefinition(int flags)
Parses method, field or class definition, starting with modifiers (if any).

parseOpenMethod

MethodNode parseOpenMethod(IdentifierNode type,
                           IdentifierNode name,
                           int flags)
Parses method definition starting with '(' that follows method name.

parseMethodBody

MethodNode parseMethodBody(IdentifierNode type,
                           IdentifierNode name,
                           ParameterNode[] paramArray,
                           int flags)
Parses method body starting with token that follows ')' that closes formal parameter list. It can handle the case of abstract or native methods (that do not have body) as well.

parseParameter

ParameterNode parseParameter()
Parses single formal parameter.

parseOpenMember

MemberNode parseOpenMember(IdentifierNode type,
                           IdentifierNode name)
Parses field (or variable) definition starting with token that follows variable name.

parseOpenVariableList

ExpressionNode[] parseOpenVariableList(IdentifierNode name)
Parses comma-separated variable name or initialization list starting with the first name.

parseOpenBody

BodyNode parseOpenBody()
Parses startement list inside '{...}' (but not brackets themselves).

parseStatementList

StatementNode[] parseStatementList()
Parsers a list of statements. Reads as much statements as it can. The following tokens cause it to stop: '}', ']', 'case', 'default', EOF.

parseStatement

public StatementNode parseStatement()
Parses a single statement. Jint statements include package declarations, imports, and class/interface definitions as well as regular Java statements.

parseOpenImport

ImportStatementNode parseOpenImport()
Parses import statement (not including 'import' keyword).

parseOpenPackage

PackageStatementNode parseOpenPackage()
Parses package statement (not including 'package' keyword).

parseOpenReturn

ReturnNode parseOpenReturn()
Parses return statement (not including 'return' keyword).

parseOpenThrow

ThrowNode parseOpenThrow()
Parses throw statement (not including 'throw' keyword).

parseOpenBreak

BreakNode parseOpenBreak()
Parses break statement (not including 'break' keyword).

parseOpenContinue

ContinueNode parseOpenContinue()
Parses continue statement (not including 'continue' keyword).

parseOpenIf

IfNode parseOpenIf()
Parses if statement (not including 'if' keyword).

parseOpenWhile

WhileNode parseOpenWhile()
Parses while statement (not including 'while' keyword).

parseOpenDo

DoNode parseOpenDo()
Parses do statement (not including 'do' keyword).

parseOpenSynchronized

SynchronizedNode parseOpenSynchronized()
Parses synchronized statement (not including 'synchronized' keyword).

parseOpenSwitch

SwitchNode parseOpenSwitch()
Parses switch statement (not including 'switch' keyword).

parseOpenTry

TryNode parseOpenTry()
Parses try statement (not including 'try' keyword).

parseOpenFor

ForNode parseOpenFor()
Parses for statement (not including 'for' keyword).

parseExpressionStatement

StatementNode parseExpressionStatement()
Parses expression statement and certain other types of statements. In addition to expressions it can recognize labeled statement, variable and method definitions that do not start with a keyword.

getPriority

private final int getPriority(int token)
Returns infix operator priority. Higher priority means tighter binding, so priopity of '*' is higher then '+'. Brackets also treated somewhat like operators, so they also have a priopity.

parseExpression

ExpressionNode parseExpression()
Parses an expression. Expression can be delimited by either closing bracket, ';' or EOF.

parseExpression

ExpressionNode parseExpression(int finPriority)
Parses a subexpression that contains operators of priority less or equal to finPriority.

parseArgs

private ExpressionNode[] parseArgs()
Parses comma-separated list of expressions.

toType

private IdentifierNode toType(ExpressionNode t)
Converts indexed expression with empty indexes (array type name) to identifier node.

parseBlock

private ExpressionNode parseBlock()
Parses Jint block (statement list inside '[ ]').

parseArrayValue

private ArrayValueNode parseArrayValue(IdentifierNode type)
Parses array expression (comma-separated expression list inside '{ }').

parseIdentifier

private IdentifierNode parseIdentifier()
Parses qualified identifier.

parseIdentifier

private IdentifierNode parseIdentifier(boolean starAllowed)
Parses qualified identifier. If starAllowed is true, in addition, '*' can be a part of it (as in import statement). If starAllowed is false, in addition, a list of '[...]' (either empty or not) is allowed at the end.

parseIdentifier

private IdentifierNode parseIdentifier(boolean starAllowed,
                                       boolean indexAllowed)
Parses qualified identifier. If starAllowed is true, in addition, '*' can be a part of it (as in import statement). If indexAllowed is true, in addition, a list of '[...]' (either empty or not) is allowed at the end.

opCall

ExpressionNode opCall(int filePos,
                      ExpressionNode expr,
                      ExpressionNode[] args)

opInfix

ExpressionNode opInfix(int filePos,
                       int op,
                       ExpressionNode head,
                       ExpressionNode arg)

opPrefix

ExpressionNode opPrefix(int filePos,
                        int op,
                        ExpressionNode arg)

opPostfix

ExpressionNode opPostfix(int filePos,
                         int op,
                         ExpressionNode arg)

opCond

ExpressionNode opCond(int filePos,
                      ExpressionNode head,
                      ExpressionNode arg1,
                      ExpressionNode arg2)

opCast

ExpressionNode opCast(int filePos,
                      IdentifierNode type,
                      ExpressionNode arg)