|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xalan.xsltc.compiler.SyntaxTreeNode
public abstract class SyntaxTreeNode
Field Summary | |
---|---|
protected AttributeList |
_attributes
|
private java.util.Vector |
_contents
|
private int |
_line
|
private int |
_nodeIDForStylesheetNSLookup
|
protected SyntaxTreeNode |
_parent
|
private Parser |
_parser
|
private java.util.Hashtable |
_prefixMapping
|
protected QName |
_qname
|
private static char[] |
_spaces
|
private Stylesheet |
_stylesheet
|
private Template |
_template
|
(package private) static SyntaxTreeNode |
Dummy
|
protected static int |
IndentIncrement
|
static int |
UNKNOWN_STYLESHEET_NODE_ID
|
Constructor Summary | |
---|---|
SyntaxTreeNode()
Creates a new SyntaxTreeNode with a 'null' QName and no source file line number reference. |
|
SyntaxTreeNode(int line)
Creates a new SyntaxTreeNode with a 'null' QName. |
|
SyntaxTreeNode(java.lang.String uri,
java.lang.String prefix,
java.lang.String local)
Creates a new SyntaxTreeNode with no source file line number reference. |
Method Summary | |
---|---|
protected void |
addAttribute(java.lang.String qname,
java.lang.String value)
|
protected void |
addElement(SyntaxTreeNode element)
Adds a child node to this syntax tree node. |
protected void |
addPrefixMapping(java.lang.String prefix,
java.lang.String uri)
Adds a single prefix mapping to this syntax tree node. |
protected void |
compileResultTree(ClassGenerator classGen,
MethodGenerator methodGen)
Utility method used by parameters and variables to store result trees |
protected boolean |
contextDependent()
Returns true if this expression/instruction depends on the context. |
protected boolean |
dependentContents()
Return true if any of the expressions/instructions in the contents of this node is context dependent. |
void |
display(int indent)
Displays the contents of this syntax tree node (to stdout). |
protected void |
displayContents(int indent)
Displays the contents of this syntax tree node (to stdout). |
protected java.lang.Object |
elementAt(int pos)
Returns a child node at a given position. |
protected int |
elementCount()
Returns the number of children this node has. |
protected java.util.Enumeration |
elements()
Returns an Enumeration of all child nodes of this node. |
protected java.lang.String |
getAttribute(java.lang.String qname)
Returns a value for an attribute from the source element. |
protected java.lang.String |
getAttribute(java.lang.String prefix,
java.lang.String localName)
|
protected org.xml.sax.Attributes |
getAttributes()
Returns a list of all attributes declared for the element represented by this syntax tree node. |
protected java.util.Vector |
getContents()
Returns a Vector containing all the child nodes of this node. |
protected int |
getImportPrecedence()
Get the import precedence of this element. |
int |
getLineNumber()
Get the source file line number for this element. |
protected int |
getNodeIDForStylesheetNSLookup()
Retrieve an ID to identify the namespaces in scope at this point in the stylesheet |
protected SyntaxTreeNode |
getParent()
Returns this syntax tree node's parent node. |
Parser |
getParser()
Returns this node's XSLT parser. |
protected java.util.Hashtable |
getPrefixMapping()
Returns a Hashtable containing the prefix mappings that were declared for this element. |
protected QName |
getQName()
Set the QName for the SyntaxTreeNode |
Stylesheet |
getStylesheet()
Get the Stylesheet node that represents the |
protected SymbolTable |
getSymbolTable()
Returns the XSLT parser's symbol table. |
protected Template |
getTemplate()
Get the Template node that represents the |
protected XSLTC |
getXSLTC()
Returns a reference to the XSLTC (XSLT compiler) in use. |
protected boolean |
hasAttribute(java.lang.String qname)
|
protected boolean |
hasContents()
Tells you if this node has any child nodes. |
protected void |
indent(int indent)
Set the indentation level for debug output. |
private boolean |
isAdaptiveRTF(SyntaxTreeNode node)
Return true if the node represents an adaptive RTF. |
protected boolean |
isDummy()
Returns 'true' if this syntax tree node is the Sentinal node. |
private boolean |
isSimpleRTF(SyntaxTreeNode node)
Return true if the node represents a simple RTF. |
private boolean |
isTextElement(SyntaxTreeNode node,
boolean doExtendedCheck)
Return true if the node only produces Text content. |
protected SyntaxTreeNode |
lastChild()
Returns this element's last child |
protected java.lang.String |
lookupNamespace(java.lang.String prefix)
Returns any namespace URI that is in scope for a given prefix. |
protected java.lang.String |
lookupPrefix(java.lang.String uri)
Returns any namespace prefix that is mapped to a prefix in the current scope. |
protected void |
parseChildren(Parser parser)
Parse all children of this syntax tree node. |
void |
parseContents(Parser parser)
Parse the contents of this syntax tree nodes (child nodes, XPath expressions, patterns and functions). |
protected void |
removeElement(SyntaxTreeNode element)
Removed a child node of this syntax tree node. |
protected void |
reportError(SyntaxTreeNode element,
Parser parser,
java.lang.String errorCode,
java.lang.String message)
Report an error to the parser. |
protected void |
reportWarning(SyntaxTreeNode element,
Parser parser,
java.lang.String errorCode,
java.lang.String message)
Report a recoverable error to the parser. |
protected void |
setAttributes(AttributeList attributes)
Set the attributes for this SyntaxTreeNode. |
protected void |
setFirstElement(SyntaxTreeNode element)
Inserts the first child node of this syntax tree node. |
protected void |
setLineNumber(int line)
Set the source file line number for this element |
protected void |
setParent(SyntaxTreeNode parent)
Set this syntax tree node's parent node |
protected void |
setParser(Parser parser)
Set this node's parser. |
protected void |
setPrefixMapping(java.util.Hashtable mapping)
Sets the prefix mapping for the namespaces that were declared in this element. |
protected void |
setQName(QName qname)
Set the QName for the syntax tree node. |
protected void |
setQName(java.lang.String uri,
java.lang.String prefix,
java.lang.String localname)
Set the QName for the SyntaxTreeNode |
abstract void |
translate(ClassGenerator classGen,
MethodGenerator methodGen)
Translate this abstract syntax tree node into JVM bytecodes. |
protected void |
translateContents(ClassGenerator classGen,
MethodGenerator methodGen)
Call translate() on all child syntax tree nodes. |
abstract Type |
typeCheck(SymbolTable stable)
Type check the children of this node. |
protected Type |
typeCheckContents(SymbolTable stable)
Call typeCheck() on all child syntax tree nodes. |
protected QName |
updateScope(Parser parser,
SyntaxTreeNode node)
Add a node to the current scope and return name of a variable or parameter if the node represents a variable or a parameter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Parser _parser
protected SyntaxTreeNode _parent
private Stylesheet _stylesheet
private Template _template
private final java.util.Vector _contents
protected QName _qname
private int _line
protected AttributeList _attributes
private java.util.Hashtable _prefixMapping
public static final int UNKNOWN_STYLESHEET_NODE_ID
private int _nodeIDForStylesheetNSLookup
static final SyntaxTreeNode Dummy
protected static final int IndentIncrement
private static final char[] _spaces
Constructor Detail |
---|
public SyntaxTreeNode()
public SyntaxTreeNode(int line)
line
- Source file line number referencepublic SyntaxTreeNode(java.lang.String uri, java.lang.String prefix, java.lang.String local)
uri
- The element's namespace URIprefix
- The element's namespace prefixlocal
- The element's local nameMethod Detail |
---|
protected final void setLineNumber(int line)
line
- The source file line number.public final int getLineNumber()
protected void setQName(QName qname)
qname
- The QName for the syntax tree nodeprotected void setQName(java.lang.String uri, java.lang.String prefix, java.lang.String localname)
uri
- The element's namespace URIprefix
- The element's namespace prefixlocal
- The element's local nameprotected QName getQName()
qname
- The QName for the syntax tree nodeprotected void setAttributes(AttributeList attributes)
attributes
- Attributes for the element. Must be passed in as an
implementation of org.xml.sax.Attributes.protected java.lang.String getAttribute(java.lang.String qname)
qname
- The QName of the attribute to return.
protected java.lang.String getAttribute(java.lang.String prefix, java.lang.String localName)
protected boolean hasAttribute(java.lang.String qname)
protected void addAttribute(java.lang.String qname, java.lang.String value)
protected org.xml.sax.Attributes getAttributes()
protected void setPrefixMapping(java.util.Hashtable mapping)
mapping
- The Hashtable containing the mappings.protected java.util.Hashtable getPrefixMapping()
protected void addPrefixMapping(java.lang.String prefix, java.lang.String uri)
prefix
- Namespace prefix.uri
- Namespace URI.protected java.lang.String lookupNamespace(java.lang.String prefix)
prefix
- Namespace prefix.
protected java.lang.String lookupPrefix(java.lang.String uri)
uri
- Namespace URI.
protected void setParser(Parser parser)
parser
- The XSLT parser.public final Parser getParser()
protected void setParent(SyntaxTreeNode parent)
parent
- The parent node.protected final SyntaxTreeNode getParent()
protected final boolean isDummy()
protected int getImportPrecedence()
public Stylesheet getStylesheet()
protected Template getTemplate()
protected final XSLTC getXSLTC()
protected final SymbolTable getSymbolTable()
public void parseContents(Parser parser)
parser
- reference to the XSLT parserprotected final void parseChildren(Parser parser)
parser
- reference to the XSLT parserprotected QName updateScope(Parser parser, SyntaxTreeNode node)
public abstract Type typeCheck(SymbolTable stable) throws TypeCheckError
stable
- The compiler/parser's symbol table
TypeCheckError
protected Type typeCheckContents(SymbolTable stable) throws TypeCheckError
stable
- The compiler/parser's symbol table
TypeCheckError
public abstract void translate(ClassGenerator classGen, MethodGenerator methodGen)
classGen
- BCEL Java class generatormethodGen
- BCEL Java method generatorprotected void translateContents(ClassGenerator classGen, MethodGenerator methodGen)
classGen
- BCEL Java class generatormethodGen
- BCEL Java method generatorprivate boolean isSimpleRTF(SyntaxTreeNode node)
node
- A node
private boolean isAdaptiveRTF(SyntaxTreeNode node)
node
- A node
private boolean isTextElement(SyntaxTreeNode node, boolean doExtendedCheck)
node
- A nodedoExtendedCheck
- If this flag is true, protected void compileResultTree(ClassGenerator classGen, MethodGenerator methodGen)
classGen
- BCEL Java class generatormethodGen
- BCEL Java method generatorprotected final int getNodeIDForStylesheetNSLookup()
int
representing the node ID or -1
if no namespace declarations are in scopeprotected boolean contextDependent()
protected boolean dependentContents()
protected final void addElement(SyntaxTreeNode element)
element
- is the new child node.protected final void setFirstElement(SyntaxTreeNode element)
element
- is the new child node.protected final void removeElement(SyntaxTreeNode element)
element
- is the child node to remove.protected final java.util.Vector getContents()
protected final boolean hasContents()
protected final int elementCount()
protected final java.util.Enumeration elements()
protected final java.lang.Object elementAt(int pos)
pos
- The child node's position.
protected final SyntaxTreeNode lastChild()
public void display(int indent)
indent
- Indentation level for syntax tree levels.protected void displayContents(int indent)
indent
- Indentation level for syntax tree levels.protected final void indent(int indent)
indent
- Indentation level for syntax tree levels.protected void reportError(SyntaxTreeNode element, Parser parser, java.lang.String errorCode, java.lang.String message)
element
- The element in which the error occured (normally 'this'
but it could also be an expression/pattern/etc.)parser
- The XSLT parser to report the error to.error
- The error code (from util/ErrorMsg).message
- Any additional error message.protected void reportWarning(SyntaxTreeNode element, Parser parser, java.lang.String errorCode, java.lang.String message)
element
- The element in which the error occured (normally 'this'
but it could also be an expression/pattern/etc.)parser
- The XSLT parser to report the error to.error
- The error code (from util/ErrorMsg).message
- Any additional error message.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |