Class JsonMLAst
java.lang.Object
com.google.javascript.jscomp.jsonml.JsonMLAst
- All Implemented Interfaces:
SourceAst,Serializable
Generates an AST from a JsonML source file.
JsonML format for representation of JavaScript is specified
here.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclearAst()Removes any references to root node of the AST.getAstRoot(AbstractCompiler compiler) Generates AST based on AST representationgetElementPreOrder(int n) Returns a JsonML element with the specified number from the tree in pre-order walk.Returns the source file the generated AST represents.voidsetSourceFile(SourceFile file) Sets the source file the generated AST represents.
-
Constructor Details
-
JsonMLAst
-
-
Method Details
-
clearAst
public void clearAst()Description copied from interface:SourceAstRemoves any references to root node of the AST. If it is requested again, another parse will be performed. This method is needed to allow the ASTs to be garbage collected if the inputs are still around after compilation. -
getAstRoot
Generates AST based on AST representation- Specified by:
getAstRootin interfaceSourceAst- See Also:
-
getSourceFile
Description copied from interface:SourceAstReturns the source file the generated AST represents.- Specified by:
getSourceFilein interfaceSourceAst
-
setSourceFile
Description copied from interface:SourceAstSets the source file the generated AST represents. This can be called after deserializing if access to the source file is needed. If a different file is provided than that with which this was created, an IllegalStateException will be thrown.- Specified by:
setSourceFilein interfaceSourceAst
-
getSourceName
-
convertToJsonML
-
getElementPreOrder
Returns a JsonML element with the specified number from the tree in pre-order walk.- Returns:
- nth node or null if the node does not exists
-
getInputId
- Specified by:
getInputIdin interfaceSourceAst- Returns:
- The input id associated with this AST
-