org.eclipse.jet.core.parser.ast
Class JETAST

java.lang.Object
  extended by org.eclipse.jet.core.parser.ast.JETAST

public final class JETAST
extends java.lang.Object

The root object of JET AST trees and a factory for JET nodes in that tree.

Since:
0.8.0

Field Summary
static int JET_SPEC_V1
          Compile to the original JET specification (org.eclipse.emf.codegen).
static int JET_SPEC_V2
          Compile according to the JET2 specification (org.eclipse.jet).
 
Constructor Summary
JETAST()
          Create an instance
 
Method Summary
 Comment newComment(int line, int colOffset, int start, int end, int commentStart, int commentEnd, char[] comment)
          Create a new Comment element in the AST
 IncludedContent newIncludedContent(int line, int colOffset, int start, int end, java.net.URI baseLocation, java.lang.String templatePath)
          Create a new InludedContent element in the AST
 JavaDeclaration newJavaDeclaration(int line, int colOffset, int start, int end, int javaStart, int javaEnd, char[] javaContent)
          Create a new Java Declaration element in the AST
 JavaExpression newJavaExpression(int line, int colOffset, int start, int end, int javaStart, int javaEnd, char[] javaContent)
          Create a new Java Expression element in the AST
 JavaScriptlet newJavaScriptlet(int line, int colOffset, int start, int end, int javaStart, int javaEnd, char[] javaContent)
          Create a new Java Scriptlet element in the AST
 JETCompilationUnit newJETCompilationUnit()
          Create a new, unparented JET2Compilation unit that is not based on a template reference
 JETCompilationUnit newJETCompilationUnit(java.net.URI baseLocation, java.lang.String templatePath, java.lang.String encoding)
          Create a new unparented JET2Compilation unit for the given template in the given base location
 JETDirective newJETDirective(int line, int colOffset, int start, int end, java.lang.String directiveName, java.util.Map attributes)
          Create a new Directive element in the AST
 TextElement newTextElement(char[] chars)
          Create a text element in the AST
 XMLBodyElement newXMLBodyElement(int line, int colOffset, int start, int end, java.lang.String tagName, java.util.Map attributeMap, TagDefinition td)
          Create a new XML element with body in the AST
 XMLBodyElementEnd newXMLBodyElementEnd(int line, int col, int start, int end, java.lang.String tagName)
          Create a new XML end element corresponding to the end of a XMLBodyElement.
 XMLEmptyElement newXMLEmptyElement(int line, int colOffset, int start, int end, java.lang.String tagName, java.util.Map attributeMap, TagDefinition td)
          Create a new empty XML element in the AST
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JET_SPEC_V1

public static final int JET_SPEC_V1
Compile to the original JET specification (org.eclipse.emf.codegen).

See Also:
JETASTParser, Constant Field Values

JET_SPEC_V2

public static final int JET_SPEC_V2
Compile according to the JET2 specification (org.eclipse.jet).

See Also:
JETASTParser, Constant Field Values
Constructor Detail

JETAST

public JETAST()
Create an instance

Method Detail

newJETCompilationUnit

public JETCompilationUnit newJETCompilationUnit()
Create a new, unparented JET2Compilation unit that is not based on a template reference

Returns:
the compilation unit node
Since:
0.8.0

newJETCompilationUnit

public JETCompilationUnit newJETCompilationUnit(java.net.URI baseLocation,
                                                java.lang.String templatePath,
                                                java.lang.String encoding)
Create a new unparented JET2Compilation unit for the given template in the given base location

Parameters:
baseLocation -
templatePath -
encoding - the template encoding
Returns:
the compilation unit node
Since:
0.8.0

newTextElement

public TextElement newTextElement(char[] chars)
Create a text element in the AST

Parameters:
chars - the text
Returns:
the new element

newJETDirective

public JETDirective newJETDirective(int line,
                                    int colOffset,
                                    int start,
                                    int end,
                                    java.lang.String directiveName,
                                    java.util.Map attributes)
Create a new Directive element in the AST

Parameters:
line - the start line
colOffset - the offset within the line of the element's start.
start - the start offset (doc relative)
end - the end offset (doc relative)
directiveName - the directive name
attributes - a map off attribute names and values
Returns:
the new element

newJavaExpression

public JavaExpression newJavaExpression(int line,
                                        int colOffset,
                                        int start,
                                        int end,
                                        int javaStart,
                                        int javaEnd,
                                        char[] javaContent)
Create a new Java Expression element in the AST

Parameters:
line - the start line
colOffset - the offset within the line of the element's start.
start - the offset of the expression element (doc relative)
end - the end offset of the expression element (doc relative)
javaStart - the offset of the Java code (doc relative)
javaEnd - the end offset of the Java code
javaContent - the Java content
Returns:
the new element

newJavaScriptlet

public JavaScriptlet newJavaScriptlet(int line,
                                      int colOffset,
                                      int start,
                                      int end,
                                      int javaStart,
                                      int javaEnd,
                                      char[] javaContent)
Create a new Java Scriptlet element in the AST

Parameters:
line - the start line
colOffset - the offset within the line of the element's start.
start - the offset of the scriptlet element (doc relative)
end - the end offset of the scriplet element (doc relative)
javaStart - the offset of the Java code (doc relative)
javaEnd - the end offset of the Java code
javaContent - the Java content
Returns:
the new element

newJavaDeclaration

public JavaDeclaration newJavaDeclaration(int line,
                                          int colOffset,
                                          int start,
                                          int end,
                                          int javaStart,
                                          int javaEnd,
                                          char[] javaContent)
Create a new Java Declaration element in the AST

Parameters:
line - the start line
colOffset - the offset within the line of the element's start.
start - the offset of the declaration element (doc relative)
end - the end offset of the declaration element (doc relative)
javaStart - the offset of the Java code (doc relative)
javaEnd - the end offset of the Java code
javaContent - the Java content
Returns:
the new element

newXMLEmptyElement

public XMLEmptyElement newXMLEmptyElement(int line,
                                          int colOffset,
                                          int start,
                                          int end,
                                          java.lang.String tagName,
                                          java.util.Map attributeMap,
                                          TagDefinition td)
Create a new empty XML element in the AST

Parameters:
line - the start line of the element
colOffset - the offset within the line of the element's start.
start - the start offset of the element (doc relative)
end - the end offset of the element (doc relative)
tagName - the QName of the element
attributeMap - a Map off element attribute names and values
td - the TagDefinition of the element
Returns:
the new element

newXMLBodyElement

public XMLBodyElement newXMLBodyElement(int line,
                                        int colOffset,
                                        int start,
                                        int end,
                                        java.lang.String tagName,
                                        java.util.Map attributeMap,
                                        TagDefinition td)
Create a new XML element with body in the AST

Parameters:
line - the start line of the element
colOffset - the offset within the line of the element's start.
start - the start offset of the element (doc relative)
end - the end offset of the element (doc relative)
tagName - the QName of the element
attributeMap - a Map off element attribute names and values
td - the TagDefinition of the tag
Returns:
the new element

newComment

public Comment newComment(int line,
                          int colOffset,
                          int start,
                          int end,
                          int commentStart,
                          int commentEnd,
                          char[] comment)
Create a new Comment element in the AST

Parameters:
line - the start line of the element
colOffset - the offset within the line of the element's start.
start - the start offset of the element (doc relative)
end - the end offset of the element (doc relative)
commentStart - the start offset of the comment text (doc relative)
commentEnd - the end offset of the comment text (doc relative)
comment - the comment text
Returns:
the new element

newIncludedContent

public IncludedContent newIncludedContent(int line,
                                          int colOffset,
                                          int start,
                                          int end,
                                          java.net.URI baseLocation,
                                          java.lang.String templatePath)
Create a new InludedContent element in the AST

Parameters:
line - the start line of the element
colOffset - the offset within the line of the element's start.
start - the start offset of the element (doc relative)
end - the end offset of the element (doc relative)
baseLocation - the base Location URI of the resolved include
templatePath - the templatePath (relative to the base location
Returns:
the IncludedContent element

newXMLBodyElementEnd

public XMLBodyElementEnd newXMLBodyElementEnd(int line,
                                              int col,
                                              int start,
                                              int end,
                                              java.lang.String tagName)
Create a new XML end element corresponding to the end of a XMLBodyElement.

Parameters:
line - the start line of the element
col - the offset within the line of the element's start.
start - the start offset of the element (doc relative)
end - the end offset of the element (doc relative)
tagName - the fully qualified tag name
Returns:
the new XML BodyElementEnd

Copyright 2006 IBM Corporation and others.
All Rights Reserved.