|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--torero.model.Symbol | +--torero.model.Token
Token Symbol Objects are used in Toreros Attribute Grammar Model to represent Tokens aka Terminal Symbols. As Terminal Symbols usually have a Regular Expression defined by the scanner it is possible to set this expression via setWord(). Some extensions were added to store Yacc specific features (association type and level).
AttributeGrammar
,
SymbolMap
, Serialized FormField Summary | |
static String |
LEFT
|
static String |
NONASSOC
|
static String |
RIGHT
|
Constructor Summary | |
protected |
Token(String name,
String word,
SymbolMap sm)
This constuctor should not be called directly. |
Method Summary | |
void |
clearAssoc()
Clear association type and level (yacc specific). |
String |
getAssocType()
Return association type of this Token (yacc specific). |
int |
getPrecedence()
Returns association level of this Token (yacc specific). |
String |
getWord()
Return the expression described by this Token. |
boolean |
isLeaf()
Returns true because Tokens are Leaf Symbols. |
boolean |
isLiteral()
Returns it this Token is either a Literal or not (Literals are Tokens with equal Name and Expression). |
void |
setAssoc(String assocType,
int precLevel)
Sets the association type and level (yacc specific). |
void |
setTokenNumber(int toknum)
Sets the token number this Token should have (yacc specific). |
void |
setWord(String word)
Sets the word expression for this Token. |
StringBuffer |
toOxDecl(StringBuffer sb)
Support for Ox File generation. |
String |
toString()
Returns String representation for this Token. |
Methods inherited from class torero.model.Symbol |
addAttribute, changeName, compareTo, equals, getAttributePos, getAttributes, getAttributesSize, getName, getStringRep, hasAttribute, isEpsilon, removeAttribute, toDot, toOx |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final String NONASSOC
public static final String LEFT
public static final String RIGHT
Constructor Detail |
protected Token(String name, String word, SymbolMap sm)
Method Detail |
public String getWord()
public void setWord(String word)
word
- takes the (regular) expression for this Tokenpublic void setAssoc(String assocType, int precLevel)
public void clearAssoc()
public int getPrecedence()
public String getAssocType()
public void setTokenNumber(int toknum)
takes
- the number this token should have (yacc specific)public String toString()
toString
in class Object
public boolean isLeaf()
isLeaf
in class Symbol
public boolean isLiteral()
isLiteral
in class Symbol
public StringBuffer toOxDecl(StringBuffer sb)
toOxDecl
in class Symbol
torero.model.Symbol
sb
- the StringBuffer to write onto
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |