primaryExpr
- Throws:
IOException
IRFactoryIt is based on the SpiderMonkey C source files jsparse.c and jsparse.h in the jsref package.
The parser generates an AstRoot parse tree representing the source code. No tree
rewriting is permitted at this stage, so that the parse tree is a faithful representation of the
source for frontend processing tools and IDEs.
This parser implementation is not intended to be reused after a parse finishes, and will throw an IllegalStateException() if invoked again.
private static class private static class protected class static final int(package private) boolean(package private) static final int(package private) CompilerEnvironsprivate intprivate Commentprivate LabeledStatement(package private) Scope(package private) ScriptNodeprivate intprivate booleanprivate intprivate IdeErrorReporterprivate ErrorReporterprivate static final intprivate booleanprivate booleanprotected booleanprivate Map<String,LabeledStatement> private static final intprotected intprivate booleanprivate intprivate intprivate Stringprivate static final intprivate static final intprivate char[]private Stringprivate int(package private) static final int(package private) static final intprivate TokenStreamParser()Parser(CompilerEnvirons compilerEnv) Parser(CompilerEnvirons compilerEnv,
ErrorReporter errorReporter) (package private) void(package private) void(package private) void(package private) void(package private) voidprivate voidaddError(String messageId,
String messageArg,
int position,
int length,
int line,
String lineSource,
int lineOffset) private AstNodeaddExpr()(package private) voidaddStrictWarning(String messageId,
String messageArg) (package private) voidaddStrictWarning(String messageId,
String messageArg,
int position,
int length) private voidaddStrictWarning(String messageId,
String messageArg,
int position,
int length,
int line,
String lineSource,
int lineOffset) (package private) voidaddWarning(String messageId,
int position,
int length) (package private) voidaddWarning(String messageId,
String messageArg) (package private) voidaddWarning(String messageId,
String messageArg,
int position,
int length) private voidaddWarning(String messageId,
String messageArg,
int position,
int length,
int line,
String lineSource,
int lineOffset) private AstNodeandExpr()private AstNodearrayComprehension(AstNode result,
int pos) private ArrayComprehensionLoopprivate AstNodeArrayLiteral or ArrayComprehension.private AstNodearrowFunction(AstNode params) private voidarrowFunctionParams(FunctionNode fnNode,
AstNode params,
Map<String,Node> destructuring,
Set<String> paramNames) private AstNodeprivate AstNodeprivate voidprivate AstNodeprivate AstNodeprivate AstNodeprivate AstNodeblock()private BreakStatementprotected voidcheckActivationName(String name,
int token) private voidprivate voidprotected voidprivate RuntimeExceptioncodeBug()private AstNodecondExpr()private Parser.ConditionDataprivate voidprivate ContinueStatement(package private) NodecreateDestructuringAssignment(int type,
Node left,
Node right) protected NodecreateName(int type,
String name,
Node child) protected NodecreateName(String name) private Nameprivate NamecreateNameNode(boolean checkActivation,
int token) Name node using the token info from the last scanned name.protected NodecreateNumber(double number) private AstNodecreateNumericLiteral(int tt,
boolean isProperty) protected ScopecreateScopeNode(int token,
int lineno) private StringLiteralprivate TemplateCharacterscreateTemplateLiteralCharacters(int pos) private AstNode(package private) voiddefineSymbol(int declType,
String name) (package private) voiddefineSymbol(int declType,
String name,
boolean ignoreNotInBlock) (package private) booleandestructuringArray(ArrayLiteral array,
int variableType,
String tempName,
Node parent,
List<String> destructuringNames) (package private) NodedestructuringAssignmentHelper(int variableType,
Node left,
Node right,
String tempName) (package private) booleandestructuringObject(ObjectLiteral node,
int variableType,
String tempName,
Node parent,
List<String> destructuringNames) private AstNodeprivate DoLoopdoLoop()private voidprivate voidenterSwitch(SwitchStatement node) booleaneof()private AstNodeeqExpr()private voidexitLoop()private voidprivate AstNodeexpExpr()private AstNodeexpr()private LoopforLoop()private AstNodeforLoopInit(int tt) private FunctionNodefunction(int type) private FunctionNodefunction(int type,
boolean isGenerator) private AstNodegeneratorExpression(AstNode result,
int pos) private AstNodegeneratorExpression(AstNode result,
int pos,
boolean inFunctionParams) private GeneratorExpressionLoopprivate Commentprivate static Stringprivate AstNodeprivate static intprivate IfStatement(package private) booleanbooleanprivate AstNodelet(boolean isStatement,
int pos) private AstNodeprivate intlineBeginningFor(int pos) (package private) StringlookupMessage(String messageId) (package private) StringlookupMessage(String messageId,
String messageArg) private ErrorNode(package private) voidmarkDestructuring(AstNode node) private LabeledStatementprivate booleanmatchToken(int toMatch,
boolean ignoreComment) private AstNodememberExpr(boolean allowCallSyntax) Token.NEW, a primary expression.private AstNodememberExprTail(boolean allowCallSyntax,
AstNode pn) private ObjectPropertymethodDefinition(int pos,
AstNode propName,
int entryKind) private AstNodemulExpr()private voidprivate booleanmustMatchToken(int toMatch,
String messageId,
boolean ignoreComment) private booleanmustMatchToken(int toMatch,
String msgId,
int pos,
int len,
boolean ignoreComment) private AstNodename(int ttFlagged,
int tt) private AstNodeprivate intprivate static intprivate static final booleannowAllSet(int before,
int after,
int mask) private ObjectLiteralprivate AstNodeprivate AstNodeorExpr()private AstNodeprivate AstRootparse()private AstNodeparseFunctionBody(int type,
FunctionNode fnNode) private voidparseFunctionParams(FunctionNode fnNode) private intprivate intprivate intprivate intpeekUntilNonComment(int tt) private ObjectPropertyplainProperty(AstNode property,
int ptt) (package private) voidpopScope()private AstNodeprivate AstNodepropertyAccess(int tt,
AstNode pn) private AstNodepropertyName(int atPos,
int memberTypeFlags) (package private) voidprivate voidrecordComment(int lineno,
String comment) private voidrecordLabel(Label label,
LabeledStatement bundle) private AstNoderelExpr()protected AstNoderemoveParens(AstNode node) (package private) voidreportError(String messageId) (package private) voidreportError(String messageId,
int position,
int length) (package private) voidreportError(String messageId,
String messageArg) (package private) voidreportError(String messageId,
String messageArg,
int position,
int length) private voidprivate AstNodereturnOrYield(int tt,
boolean exprContext) private voidsaveNameTokenData(int pos,
String name,
int lineno) voidsetDefaultUseStrictDirective(boolean useStrict) protected voidprotected voidprivate AstNodeprotected NodesimpleAssignment(Node left,
Node right) private AstNodeprivate AstNodeprivate AstNodeprivate AstNodestatements(AstNode parent) private SwitchStatementprivate AstNodeprivate AstNodetemplateLiteral(boolean isTaggedLiteral) private ThrowStatementprivate TryStatementprivate AstNodeprivate VariableDeclarationvariables(int declType,
int pos,
boolean isStatement) private voidwarnMissingSemi(int pos,
int end) private voidwarnTrailingComma(int pos,
List<?> elems,
int commaPos) private WhileLoopprivate WithStatementprivate XmlElemRefxmlElemRef(int atPos,
Name namespace,
int colonPos) private AstNodeIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionAstRoot object representing the parsed program. If the parse fails,
null will be returned. (The parse failure will result in a call to the ErrorReporter from CompilerEnvirons.)IOException - if the Reader encounters an errorIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionbefore - bits before changeafter - bits after changemask - mask for bitstrue if all the bits in the mask are set in "after" but not in "before"IOExceptionIOExceptionIOExceptionIOExceptionLabeledStatement "bundle" and return that.
Otherwise we parse an expression and return it wrapped in an ExpressionStatement.IOExceptiondeclType - A token value: either VAR, CONST, or LET depending on context.pos - the position where the node should start. It's sometimes the var/const/let
keyword, and other times the beginning of the first token in the first variable
declaration.IOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionToken.NEW, a primary expression.allowCallSyntax - passed down to memberExprTail(boolean, org.mozilla.javascript.ast.AstNode)IOExceptionpn - the non-null parent nodeIOExceptionIOExceptionpn - the left-hand side (target) of the operator. Never null.IOException@attr, @ns::attr, @ns::*, @ns::*, @*,
@*::attr, @*::*, @ns::[expr], @*::[expr], @[expr]
Called if we peeked an '@' token.
IOExceptionatPos - a natural number if we just read an '@' token, else -1memberTypeFlags - flags tracking whether we're a '.' or '..' childs - the name or string that was matched (an identifier, "throw" or "*").IOExceptionIOExceptionIOExceptionParser.ParserExceptionIOExceptionIOExceptionIOExceptionArrayLiteral or ArrayComprehension.IOExceptionresult - the first expression after the opening left-bracketpos - start of LB token that begins the array comprehensionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionIOExceptionName node using the token info from the last scanned name. In some cases we
need to either synthesize a name node, or we lost the name token information by peeking. If
the token parameter is not Token.NAME, then we use token info saved in
instance vars.IOExceptionpos - an offset into the input source stream. If the offset is negative, it's converted
to 0, and if it's beyond the end of the source buffer, the last source position is used.CompilerEnvirons is not set to
ide-mode, and parse(java.io.Reader,String,int) was used.type - declaration type: Token.VAR or Token.LET or -1left - array or object literal containing NAME nodes for variables to assignright - expression to assign fromtoken - the token of the node to createlineno - line number of sourceRuntimeException