Package jminusminus
Class JAST
java.lang.Object
jminusminus.JAST
- Direct Known Subclasses:
JClassDeclaration,JCompilationUnit,JFieldDeclaration,JFormalParameter,JInterfaceDeclaration,JMethodDeclaration,JStatement,JVariableDeclarator
JAST is the abstract superclass of all nodes in the abstract syntax tree (AST).
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic JCompilationUnitCurrent compilation unit (set in JCompilationUnit()).protected intLine in which the source for the AST was found. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJAST(int line) Constructs an AST node the given its line number in the source file. -
Method Summary
Modifier and TypeMethodDescriptionabstract JASTPerforms semantic analysis on this AST and returns the (possibly modified) AST.abstract voidPerforms code generation for this AST.intline()Returns the line in which the source for the AST was found.voidpartialCodegen(Context context, CLEmitter partial) Generates a partial class for a type, reflecting only the member information required to do analysis.voidtoJSON(JSONElement json) Stores information about this AST in JSON format.static StringUnescapes the escaped characters in the specified string and returns the unescaped string.
-
Field Details
-
compilationUnit
Current compilation unit (set in JCompilationUnit()). -
line
protected int lineLine in which the source for the AST was found.
-
-
Constructor Details
-
JAST
protected JAST(int line) Constructs an AST node the given its line number in the source file.- Parameters:
line- line in which the source for the AST was found.
-
-
Method Details
-
line
public int line()Returns the line in which the source for the AST was found.- Returns:
- the line in which the source for the AST was found.
-
analyze
Performs semantic analysis on this AST and returns the (possibly modified) AST.- Parameters:
context- the environment (scope) in which code is analyzed.- Returns:
- the (possibly modified) AST.
-
partialCodegen
Generates a partial class for a type, reflecting only the member information required to do analysis.- Parameters:
context- the parent (class) context.partial- the code emitter.
-
codegen
Performs code generation for this AST.- Parameters:
output- the code emitter.
-
toJSON
Stores information about this AST in JSON format.- Parameters:
json- the JSON emitter.
-
unescape
Unescapes the escaped characters in the specified string and returns the unescaped string.- Parameters:
s- string to unescape.- Returns:
- the unescaped string.
-