Package org.jboss.byteman.rule.grammar
Class ParseNode
- java.lang.Object
-
- org.jboss.byteman.rule.grammar.ParseNode
-
- Direct Known Subclasses:
ParseNode.BinaryNode
,ParseNode.NullaryNode
,ParseNode.QuaternaryNode
,ParseNode.TernaryNode
,ParseNode.UnaryNode
public abstract class ParseNode extends java.lang.Object
Class used by the JavaCUP parser to construct a parse tree.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ParseNode.BinaryNode
a parse node with two childrenprivate static class
ParseNode.NullaryNode
a parse node with no childrenprivate static class
ParseNode.QuaternaryNode
a parse node with four childrenprivate static class
ParseNode.TernaryNode
a parse node with three childrenprivate static class
ParseNode.UnaryNode
a parse node with one child
-
Field Summary
Fields Modifier and Type Field Description static int
AND
static int
ARRAY
static int
ARRAY_INIT
static int
ASSIGN
static int
BAND
static int
BIND
static int
BINOP
static int
BOOLEAN_LITERAL
static int
BOR
static int
BXOR
static int
CLASS
static int
COLON
private int
column
the column position for this nodestatic int
COMMA
static int
DIV
static int
DOLLAR
static int
EQ
static int
FIELD
private java.lang.String
file
the script file containing the text form which this node was parsedstatic int
FLOAT_LITERAL
static int
GE
static int
GT
static int
IDENTIFIER
static int
INSTANCEOF
static int
INTEGER_LITERAL
static int
LE
private int
line
the line position fo rthis nodestatic int
LSH
static int
LT
static int
METH
static int
MINUS
static int
MOD
static int
MUL
static int
NE
static int
NEW
static int
NOT
static int
NOTHING
static int
NULL_LITERAL
static int
OR
static int
PATH
static int
PLUS
static int
RETURN
static int
RSH
static int
SEMI
static int
STRING_LITERAL
private int
tag
the type tag for this nodestatic int
TERNOP
static int
THROW
static int
TWIDDLE
static int
UMINUS
static int
UNOP
static int
URSH
-
Constructor Summary
Constructors Modifier Constructor Description protected
ParseNode(int tag, java.lang.String file, int line, int column)
generic constructor
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.lang.Object
getChild(int idx)
get the nth child for this node or null if the index exceeds the child countabstract int
getChildCount()
get the child count for this nodeint
getColumn()
get the column position for this nodeint
getLine()
get the line position for this nodejava.lang.String
getPos()
get a string representing the position for this nodeint
getTag()
get the tag for this nodeabstract java.lang.String
getText()
get the display representation of this nodestatic ParseNode
node(int tag, java.lang.String file, int line, int column)
create a simple node for a builtin tokenstatic ParseNode
node(int tag, java.lang.String file, int line, int column, java.lang.Object child0)
create a simple node for a builtin tokenstatic ParseNode
node(int tag, java.lang.String file, int line, int column, java.lang.Object child0, java.lang.Object child1)
create a simple node for a builtin tokenstatic ParseNode
node(int tag, java.lang.String file, int line, int column, java.lang.Object child0, java.lang.Object child1, java.lang.Object child2)
create a simple node for a builtin tokenstatic ParseNode
node(int tag, java.lang.String file, int line, int column, java.lang.Object child0, java.lang.Object child1, java.lang.Object child2, java.lang.Object child3)
create a simple node for a builtin token
-
-
-
Field Detail
-
ARRAY
public static final int ARRAY
- See Also:
- Constant Field Values
-
ASSIGN
public static final int ASSIGN
- See Also:
- Constant Field Values
-
BIND
public static final int BIND
- See Also:
- Constant Field Values
-
BINOP
public static final int BINOP
- See Also:
- Constant Field Values
-
BOOLEAN_LITERAL
public static final int BOOLEAN_LITERAL
- See Also:
- Constant Field Values
-
COMMA
public static final int COMMA
- See Also:
- Constant Field Values
-
COLON
public static final int COLON
- See Also:
- Constant Field Values
-
FIELD
public static final int FIELD
- See Also:
- Constant Field Values
-
FLOAT_LITERAL
public static final int FLOAT_LITERAL
- See Also:
- Constant Field Values
-
IDENTIFIER
public static final int IDENTIFIER
- See Also:
- Constant Field Values
-
INTEGER_LITERAL
public static final int INTEGER_LITERAL
- See Also:
- Constant Field Values
-
METH
public static final int METH
- See Also:
- Constant Field Values
-
NOTHING
public static final int NOTHING
- See Also:
- Constant Field Values
-
PATH
public static final int PATH
- See Also:
- Constant Field Values
-
RETURN
public static final int RETURN
- See Also:
- Constant Field Values
-
SEMI
public static final int SEMI
- See Also:
- Constant Field Values
-
STRING_LITERAL
public static final int STRING_LITERAL
- See Also:
- Constant Field Values
-
TERNOP
public static final int TERNOP
- See Also:
- Constant Field Values
-
THROW
public static final int THROW
- See Also:
- Constant Field Values
-
UNOP
public static final int UNOP
- See Also:
- Constant Field Values
-
NEW
public static final int NEW
- See Also:
- Constant Field Values
-
NULL_LITERAL
public static final int NULL_LITERAL
- See Also:
- Constant Field Values
-
CLASS
public static final int CLASS
- See Also:
- Constant Field Values
-
ARRAY_INIT
public static final int ARRAY_INIT
- See Also:
- Constant Field Values
-
AND
public static final int AND
- See Also:
- Constant Field Values
-
BAND
public static final int BAND
- See Also:
- Constant Field Values
-
BOR
public static final int BOR
- See Also:
- Constant Field Values
-
BXOR
public static final int BXOR
- See Also:
- Constant Field Values
-
DIV
public static final int DIV
- See Also:
- Constant Field Values
-
DOLLAR
public static final int DOLLAR
- See Also:
- Constant Field Values
-
EQ
public static final int EQ
- See Also:
- Constant Field Values
-
GE
public static final int GE
- See Also:
- Constant Field Values
-
GT
public static final int GT
- See Also:
- Constant Field Values
-
LE
public static final int LE
- See Also:
- Constant Field Values
-
LT
public static final int LT
- See Also:
- Constant Field Values
-
MINUS
public static final int MINUS
- See Also:
- Constant Field Values
-
MOD
public static final int MOD
- See Also:
- Constant Field Values
-
MUL
public static final int MUL
- See Also:
- Constant Field Values
-
NE
public static final int NE
- See Also:
- Constant Field Values
-
NOT
public static final int NOT
- See Also:
- Constant Field Values
-
OR
public static final int OR
- See Also:
- Constant Field Values
-
PLUS
public static final int PLUS
- See Also:
- Constant Field Values
-
TWIDDLE
public static final int TWIDDLE
- See Also:
- Constant Field Values
-
UMINUS
public static final int UMINUS
- See Also:
- Constant Field Values
-
LSH
public static final int LSH
- See Also:
- Constant Field Values
-
RSH
public static final int RSH
- See Also:
- Constant Field Values
-
URSH
public static final int URSH
- See Also:
- Constant Field Values
-
INSTANCEOF
public static final int INSTANCEOF
- See Also:
- Constant Field Values
-
tag
private int tag
the type tag for this node
-
file
private java.lang.String file
the script file containing the text form which this node was parsed
-
line
private int line
the line position fo rthis node
-
column
private int column
the column position for this node
-
-
Constructor Detail
-
ParseNode
protected ParseNode(int tag, java.lang.String file, int line, int column)
generic constructor- Parameters:
tag
- identifies the type of this nodefile
- identifies the file containing the node's textline
- identifies the start line for this node's textcolumn
- identifies the start columen for this node's text
-
-
Method Detail
-
getTag
public int getTag()
get the tag for this node- Returns:
- the tag for this node
-
getLine
public int getLine()
get the line position for this node- Returns:
- the line position for this node
-
getColumn
public int getColumn()
get the column position for this node- Returns:
- the column position for this node
-
getChildCount
public abstract int getChildCount()
get the child count for this node- Returns:
- the child count for this node
-
getChild
public abstract java.lang.Object getChild(int idx)
get the nth child for this node or null if the index exceeds the child count- Parameters:
idx
- the child index- Returns:
- the nth child for this node
-
getText
public abstract java.lang.String getText()
get the display representation of this node- Returns:
- the display representation of this node
-
getPos
public java.lang.String getPos()
get a string representing the position for this node- Returns:
- a string representing the position for this node
-
node
public static ParseNode node(int tag, java.lang.String file, int line, int column)
create a simple node for a builtin token- Parameters:
tag
- identifies the type of this nodefile
- identifies the file containing the node's textline
- identifies the start line for this node's textcolumn
- identifies the start columen for this node's text- Returns:
- a simple node for a builtin token
-
node
public static ParseNode node(int tag, java.lang.String file, int line, int column, java.lang.Object child0)
create a simple node for a builtin token- Parameters:
tag
- identifies the type of this nodefile
- identifies the file containing the node's textline
- identifies the start line for this node's textcolumn
- identifies the start columen for this node's textchild0
- the first child for this node- Returns:
- a simple node for a builtin token
-
node
public static ParseNode node(int tag, java.lang.String file, int line, int column, java.lang.Object child0, java.lang.Object child1)
create a simple node for a builtin token- Parameters:
tag
- identifies the type of this nodefile
- identifies the file containing the node's textline
- identifies the start line for this node's textcolumn
- identifies the start columen for this node's textchild0
- the first child for this nodechild1
- the second child for this node- Returns:
- a simple node for a builtin token
-
node
public static ParseNode node(int tag, java.lang.String file, int line, int column, java.lang.Object child0, java.lang.Object child1, java.lang.Object child2)
create a simple node for a builtin token- Parameters:
tag
- identifies the type of this nodefile
- identifies the file containing the node's textline
- identifies the start line for this node's textcolumn
- identifies the start columen for this node's textchild0
- the first child for this nodechild1
- the second child for this nodechild2
- the third child for this node- Returns:
- a simple node for a builtin token
-
node
public static ParseNode node(int tag, java.lang.String file, int line, int column, java.lang.Object child0, java.lang.Object child1, java.lang.Object child2, java.lang.Object child3)
create a simple node for a builtin token- Parameters:
tag
- identifies the type of this nodefile
- identifies the file containing the node's textline
- identifies the start line for this node's textcolumn
- identifies the start columen for this node's textchild0
- the first child for this nodechild1
- the second child for this nodechild2
- the third child for this nodechild3
- the fourth child for this node- Returns:
- a simple node for a builtin token
-
-