|
Jalopy 1.0b10 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.hunsicker.antlr.BaseAST | +--de.hunsicker.antlr.CommonAST | +--de.hunsicker.antlr.CommonASTWithHiddenTokens | +--de.hunsicker.jalopy.language.Node
A node which stores information about its span.
Field Summary | |
protected int |
endColumn
Column number where this node ends. |
protected int |
endLine
Line number where this node ends. |
protected int |
startColumn
Column number where this node starts. |
protected int |
startLine
Line number where this node starts. |
protected String |
text
Node text. |
protected int |
type
Node type. |
Fields inherited from class de.hunsicker.antlr.CommonASTWithHiddenTokens |
hiddenAfter, hiddenBefore |
Fields inherited from class de.hunsicker.antlr.BaseAST |
down, right |
Constructor Summary | |
Node()
Creates a new Node object. |
|
Node(int startLine,
int startColumn,
int endLine,
int endColumn)
Creates a new Node object. |
|
Node(int type,
String text)
Creates a new Node object. |
|
Node(int type,
String text,
int startLine,
int startColumn,
int endLine,
int endColumn)
Creates a new Node object. |
|
Node(String text)
Creates a new Node object. |
|
Node(Token tok)
Creates a new Node object from the given token. |
Method Summary | |
int |
compareTo(Object o)
Compares this object with the specified object for order. |
boolean |
contains(int line,
int column)
Checks whether this node contains the given position. |
boolean |
contains(int startLine,
int startColumn,
int endLine,
int endColumn)
Checks whether this node contains the given position. |
boolean |
contains(Node node)
Checks whether this node contains the given node. |
boolean |
endsAfter(Node other)
Determines whether this node starts after another one. |
boolean |
equals(Object o)
Compares the specified object with this object for equality. |
int |
getEndColumn()
Returns the column number where this node ends. |
int |
getEndLine()
Returns the line number where this node ends. |
int |
getStartColumn()
Returns the column number where this node starts. |
int |
getStartLine()
Returns the line number where this node starts. |
String |
getText()
Get the token text for this node |
int |
getType()
Get the token type for this node |
void |
initialize(AST node)
Initializes this node with information from the given node. |
void |
initialize(int type,
String text)
Initializes this node with the given information. |
void |
initialize(Token tok)
Initializes this node with information from the given token. |
boolean |
isPositionKnown()
Indicates whether this node has its location information set. |
void |
setEndColumn(int column)
Sets the end column value. |
void |
setEndLine(int line)
Sets the end line value. |
void |
setHiddenAfter(CommonHiddenStreamToken token)
Sets the first hidden token that appears after this node. |
void |
setHiddenBefore(CommonHiddenStreamToken token)
Sets the first hidden token that appears before this node. |
void |
setStartColumn(int column)
Sets the column where this node starts. |
void |
setStartLine(int line)
Sets the line where this node starts. |
void |
setText(String text)
Sets the text of this node. |
void |
setType(int type)
Sets the type of this node. |
boolean |
startsBefore(Node other)
Determines whether this node starts before another one. |
String |
toString()
Returns a string representation of this node. |
Methods inherited from class de.hunsicker.antlr.CommonASTWithHiddenTokens |
getHiddenAfter, getHiddenBefore |
Methods inherited from class de.hunsicker.antlr.BaseAST |
addChild, decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getFirstChild, getNextSibling, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, toStringList, toStringTree, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected String text
protected int endColumn
protected int endLine
protected int startColumn
protected int startLine
protected int type
Constructor Detail |
public Node()
public Node(int type, String text, int startLine, int startColumn, int endLine, int endColumn)
type
- node typetext
- node text.startLine
- line number where this node starts.startColumn
- column number where this node starts.endLine
- line number where this node ends.endColumn
- column number where this node ends.public Node(int startLine, int startColumn, int endLine, int endColumn)
startLine
- line number where this node starts.startColumn
- column number where this node starts.endLine
- line number where this node ends.endColumn
- column number where this node ends.public Node(int type, String text)
type
- node typetext
- node text.public Node(Token tok)
tok
- token to initialize this node with.public Node(String text)
text
- text to add.Method Detail |
public void setEndColumn(int column)
column
- new end column value.public int getEndColumn()
public void setEndLine(int line)
line
- new end line value.public int getEndLine()
public void setHiddenAfter(CommonHiddenStreamToken token)
token
- a hidden token.public void setHiddenBefore(CommonHiddenStreamToken token)
token
- a hidden token.public boolean isPositionKnown()
true
if this node has its location information set.public void setStartColumn(int column)
column
- the column where this node starts.public int getStartColumn()
public void setStartLine(int line)
line
- the line where this node starts.public int getStartLine()
public void setText(String text)
setText
in class CommonAST
text
- text to set.public String getText()
getText
in class CommonAST
public void setType(int type)
setType
in class CommonAST
type
- type to set.public int getType()
getType
in class CommonAST
public int compareTo(Object o)
compareTo
in interface Comparable
o
- the Object to be comparedNullPointerException
- if object == null
ClassCastException
- if the specified object's type prevents it from being
compared to this object.public boolean contains(Node node)
node
- to check.true
if the given node is contained in this node.public boolean contains(int startLine, int startColumn, int endLine, int endColumn)
startLine
- start line to check.startColumn
- start column to check.endLine
- end line to check.endColumn
- end column to check.true
if the given position is contained in this span.public boolean contains(int line, int column)
line
- line to check.column
- column to check.true
if the given position is contained in this span.public boolean endsAfter(Node other)
other
- node to check for.true
if this node ends after the other node.public boolean equals(Object o)
true
if and only if the specified object is also an Node and both
nodes have the same text and type. So it does actually the same job as BaseAST.equals(AST)
.equals
in class Object
o
- the object to be compared for equality with this node.true
if the specified object is equal to this object.public void initialize(AST node)
initialize
in class CommonAST
node
- node to setup this node with.public void initialize(int type, String text)
initialize
in class CommonAST
type
- type to set.text
- text to set.public void initialize(Token tok)
initialize
in class CommonASTWithHiddenTokens
tok
- token to setup this node with.public boolean startsBefore(Node other)
other
- node to check for.true
if this node starts before the other one.public String toString()
toString
in class BaseAST
|
Jalopy 1.0b10 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |