Class AbstractUtilityParser

  • Direct Known Subclasses:
    SyntaxChecker

    public abstract class AbstractUtilityParser
    extends java.lang.Object
    This abstract base class is used to build tools that aid script code developers. It parses script files into an abstract syntax tree and then null provides the tree root to the concrete subclass.
    Since:
    3.0
    Author:
    Chris Jennings
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractUtilityParser()
      Creates a new utility parser.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void parse​(java.lang.String script)
      Parses the specified script.
      protected abstract void processTree​(org.mozilla.javascript.ast.AstRoot rootNode)
      This is called after each script is parsed to allow the utility access to the resulting abstract syntax tree.
      protected void setErrorReporter​(org.mozilla.javascript.ErrorReporter reporter)
      Sets an error reporter that will be used to collect information about any syntax errors and warnings that are found during parsing.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractUtilityParser

        public AbstractUtilityParser()
        Creates a new utility parser.
    • Method Detail

      • parse

        public void parse​(java.lang.String script)
        Parses the specified script.
        Parameters:
        script - the script to process
      • setErrorReporter

        protected void setErrorReporter​(org.mozilla.javascript.ErrorReporter reporter)
        Sets an error reporter that will be used to collect information about any syntax errors and warnings that are found during parsing. If no error reporter is set explicitly, then a new NoOpErrorReporter will be set automatically the first time that a script is parsed.
        Parameters:
        reporter - the reporter to use; instances of ErrorCollector will have the IDE versions of the error methods called
      • processTree

        protected abstract void processTree​(org.mozilla.javascript.ast.AstRoot rootNode)
        This is called after each script is parsed to allow the utility access to the resulting abstract syntax tree. In the event of a serious parser error that prevents the tree from being generated, the root node will be null.
        Parameters:
        rootNode - the root of the parse tree