Class AbstractUtilityParser
- java.lang.Object
-
- ca.cgjennings.apps.arkham.plugins.engine.AbstractUtilityParser
-
- Direct Known Subclasses:
SyntaxChecker
public abstract class AbstractUtilityParser extends java.lang.ObjectThis 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 voidparse(java.lang.String script)Parses the specified script.protected abstract voidprocessTree(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 voidsetErrorReporter(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.
-
-
-
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 newNoOpErrorReporterwill be set automatically the first time that a script is parsed.- Parameters:
reporter- the reporter to use; instances ofErrorCollectorwill 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 benull.- Parameters:
rootNode- the root of the parse tree
-
-