| java.lang.Object beaver.Symbol
All known Subclasses: expr.eval.Expr, expr.tree.ast.Node, beaver.spec.ast.Node,
Symbol | public class Symbol (Code) | | Represents a symbol of a grammar.
|
Field Summary | |
protected int | end Line and column where this symbol ends. | protected short | id Numeric symbol ID. | protected int | start Line and column where this symbol begins. | final public Object | value Value assigned to this symbol. |
Constructor Summary | |
public | Symbol(short id) | public | Symbol(short id, Object value) | public | Symbol(short id, int start, int end) | public | Symbol(short id, int left, int right, Object value) | public | Symbol(short id, int start_line, int start_column, int length) | public | Symbol(short id, int start_line, int start_column, int length, Object value) | public | Symbol(Object value) | protected | Symbol() Special case constructor that allows creation of explicitly Symbol-ized nonterminals. |
Method Summary | |
public static int | getColumn(int position) Extracts column number from a packed position. | public int | getEnd() Returns a position in a source where this symbol ends. | public short | getId() Returns an ID of this symbol.
This ID typically is, depending on a symbol type, either a terminal ID if a Symbol is a token
created and returned by a Scanner, or a nonterminal ID if a symbol was created by parser based
on that nonterminal definition. | public static int | getLine(int position) Extracts line number from a packed position. | public int | getStart() Returns a position in a source where this symbol starts. | public static int | makePosition(int line, int column) Packes symbol "coordinates" into a single number. |
end | protected int end(Code) | | Line and column where this symbol ends.
|
id | protected short id(Code) | | Numeric symbol ID.
|
start | protected int start(Code) | | Line and column where this symbol begins.
|
value | final public Object value(Code) | | Value assigned to this symbol.
|
Symbol | public Symbol(short id)(Code) | | |
Symbol | public Symbol(short id, int start, int end)(Code) | | |
Symbol | public Symbol(short id, int left, int right, Object value)(Code) | | |
Symbol | public Symbol(short id, int start_line, int start_column, int length)(Code) | | |
Symbol | public Symbol(short id, int start_line, int start_column, int length, Object value)(Code) | | |
Symbol | public Symbol(Object value)(Code) | | Creates Symbol for non-symbolic results of action routines
Parameters: value - attached Symbol's value |
Symbol | protected Symbol()(Code) | | Special case constructor that allows creation of explicitly Symbol-ized nonterminals.
Used by classes descending from Symbol and which instances are returned by reduce actions.
In this case ID and symbol position will be assigned by the parser when reduce action
code returns this symbol.
|
getColumn | public static int getColumn(int position)(Code) | | Extracts column number from a packed position.
|
getEnd | public int getEnd()(Code) | | Returns a position in a source where this symbol ends.
packed line and column numbers |
getId | public short getId()(Code) | | Returns an ID of this symbol.
This ID typically is, depending on a symbol type, either a terminal ID if a Symbol is a token
created and returned by a Scanner, or a nonterminal ID if a symbol was created by parser based
on that nonterminal definition. In the former case the ID is one of IDs generated by Beaver
for terminal symbols. The latter keeps IDs of nonterminal symbols.
symbol's ID |
getLine | public static int getLine(int position)(Code) | | Extracts line number from a packed position.
|
getStart | public int getStart()(Code) | | Returns a position in a source where this symbol starts.
packed line and column numbers |
makePosition | public static int makePosition(int line, int column)(Code) | | Packes symbol "coordinates" into a single number.
|
|
|