Class Parser

java.lang.Object
org.htmlunit.corejs.javascript.Parser

public class Parser extends Object
This class implements the JavaScript parser.

It 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.

See Also:
  • Field Details

    • ARGC_LIMIT

      public static final int ARGC_LIMIT
      Maximum number of allowed function or constructor arguments, to follow SpiderMonkey.
      See Also:
    • CLEAR_TI_MASK

      static final int CLEAR_TI_MASK
      See Also:
    • TI_AFTER_EOL

      static final int TI_AFTER_EOL
      See Also:
    • TI_CHECK_LABEL

      static final int TI_CHECK_LABEL
      See Also:
    • compilerEnv

      CompilerEnvirons compilerEnv
    • errorReporter

      private ErrorReporter errorReporter
    • errorCollector

      private IdeErrorReporter errorCollector
    • sourceURI

      private String sourceURI
    • sourceChars

      private char[] sourceChars
    • calledByCompileFunction

      boolean calledByCompileFunction
    • parseFinished

      private boolean parseFinished
    • ts

      private TokenStream ts
    • currentFlaggedToken

      private int currentFlaggedToken
    • currentToken

      private int currentToken
    • syntaxErrorCount

      private int syntaxErrorCount
    • scannedComments

      private List<Comment> scannedComments
    • currentJsDocComment

      private Comment currentJsDocComment
    • nestingOfFunction

      protected int nestingOfFunction
    • currentLabel

      private LabeledStatement currentLabel
    • inDestructuringAssignment

      private boolean inDestructuringAssignment
    • inUseStrictDirective

      protected boolean inUseStrictDirective
    • currentScriptOrFn

      ScriptNode currentScriptOrFn
    • currentScope

      Scope currentScope
    • endFlags

      private int endFlags
    • inForInit

      private boolean inForInit
    • labelSet

      private Map<String,LabeledStatement> labelSet
    • loopSet

      private List<Loop> loopSet
    • loopAndSwitchSet

      private List<Jump> loopAndSwitchSet
    • prevNameTokenStart

      private int prevNameTokenStart
    • prevNameTokenString

      private String prevNameTokenString
    • prevNameTokenLineno

      private int prevNameTokenLineno
    • defaultUseStrictDirective

      private boolean defaultUseStrictDirective
    • PROP_ENTRY

      private static final int PROP_ENTRY
      See Also:
    • GET_ENTRY

      private static final int GET_ENTRY
      See Also:
    • SET_ENTRY

      private static final int SET_ENTRY
      See Also:
    • METHOD_ENTRY

      private static final int METHOD_ENTRY
      See Also:
  • Constructor Details

  • Method Details