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
Modifier and TypeFieldDescriptionstatic JCompilationUnit
Current compilation unit (set in JCompilationUnit()).protected int
Line in which the source for the AST was found. -
Constructor Summary
ModifierConstructorDescriptionprotected
JAST
(int line) Constructs an AST node the given its line number in the source file. -
Method Summary
Modifier and TypeMethodDescriptionabstract JAST
Performs semantic analysis on this AST and returns the (possibly modified) AST.abstract void
Performs code generation for this AST.int
line()
Returns the line in which the source for the AST was found.void
partialCodegen
(Context context, CLEmitter partial) Generates a partial class for a type, reflecting only the member information required to do analysis.void
toJSON
(JSONElement json) Stores information about this AST in JSON format.static String
Unescapes 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.
-