| java.lang.Object java_cup.symbol
All known Subclasses: java_cup.terminal, java_cup.non_terminal,
symbol | abstract public class symbol (Code) | | This abstract class serves as the base class for grammar symbols (i.e.,
both terminals and non-terminals). Each symbol has a name string, and
a string giving the type of object that the symbol will be represented by
on the runtime parse stack. In addition, each symbol maintains a use count
in order to detect symbols that are declared but never used, and an index
number that indicates where it appears in parse tables (index numbers are
unique within terminals or non terminals, but not across both).
See Also: java_cup.terminal See Also: java_cup.non_terminal version: last updated: 7/3/96 author: Frank Flannery |
Field Summary | |
protected int | _index Index of this symbol (terminal or non terminal) in the parse tables.
Note: indexes are unique among terminals and unique among non terminals,
however, a terminal may have the same index as a non-terminal, etc. | protected String | _name String for the human readable name of the symbol. | protected String | _stack_type String for the type of object used for the symbol on the parse stack. | protected int | _use_count Count of how many times the symbol appears in productions. |
Method Summary | |
public int | index() Index of this symbol (terminal or non terminal) in the parse tables.
Note: indexes are unique among terminals and unique among non terminals,
however, a terminal may have the same index as a non-terminal, etc. | abstract public boolean | is_non_term() Indicate if this is a non-terminal. | public String | name() String for the human readable name of the symbol. | public void | note_use() Increment the use count. | public String | stack_type() String for the type of object used for the symbol on the parse stack. | public String | toString() Convert to a string. | public int | use_count() Count of how many times the symbol appears in productions. |
_index | protected int _index(Code) | | Index of this symbol (terminal or non terminal) in the parse tables.
Note: indexes are unique among terminals and unique among non terminals,
however, a terminal may have the same index as a non-terminal, etc.
|
_name | protected String _name(Code) | | String for the human readable name of the symbol.
|
_stack_type | protected String _stack_type(Code) | | String for the type of object used for the symbol on the parse stack.
|
_use_count | protected int _use_count(Code) | | Count of how many times the symbol appears in productions.
|
symbol | public symbol(String nm, String tp)(Code) | | Full constructor.
Parameters: nm - the name of the symbol. Parameters: tp - a string with the type name. |
symbol | public symbol(String nm)(Code) | | Constructor with default type.
Parameters: nm - the name of the symbol. |
index | public int index()(Code) | | Index of this symbol (terminal or non terminal) in the parse tables.
Note: indexes are unique among terminals and unique among non terminals,
however, a terminal may have the same index as a non-terminal, etc.
|
is_non_term | abstract public boolean is_non_term()(Code) | | Indicate if this is a non-terminal. Here in the base class we
don't know, so this is abstract.
|
name | public String name()(Code) | | String for the human readable name of the symbol.
|
note_use | public void note_use()(Code) | | Increment the use count.
|
stack_type | public String stack_type()(Code) | | String for the type of object used for the symbol on the parse stack.
|
use_count | public int use_count()(Code) | | Count of how many times the symbol appears in productions.
|
|
|