Top Description Fields Constructors Methods
java_cup

public Class terminal

extends symbol
Class Inheritance
Imports
java_cup.assoc, java.util.Hashtable, .Enumeration

This class represents a terminal symbol in the grammar. Each terminal has a textual name, an index, and a string which indicates the type of object it will be implemented with at runtime (i.e. the class of object that will be returned by the scanner and pushed on the parse stack to represent it).
Author
Frank Flannery
Version
last updated: 7/3/96

Field Summary

Modifier and TypeField and Description
protected static Hashtable<K, V>
_all

Table of all terminals.

protected static Hashtable<K, V>
_all_by_index

Table of all terminals indexed by their index number.

private int
private int
public static final terminal
EOF

Special terminal for end of input.

public static final terminal
error

special terminal used for error recovery

protected static int
next_index

Static counter to assign unique index.

Inherited from java_cup.symbol:
_index_name_stack_type_use_count

Constructor Summary

AccessConstructor and Description
public
terminal(String
the name of the terminal.
nm
,
String
the type of the terminal.
tp
,
int precedence_side, int precedence_num)

Full constructor.

public
terminal(String nm, String tp)

Constructor for non-precedented terminal

public
terminal(String
the name of the terminal.
nm
)

Constructor with default type.

Method Summary

Modifier and TypeMethod and Description
public static Enumeration<E>
all()

Access to all terminals.

public static terminal
find(String with_name)

Lookup a terminal by name string.

public static terminal
find(int indx)

Lookup a terminal by index.

public boolean
is_non_term()

Implements abstract java_cup.symbol.is_non_term.

Report this symbol as not being a non-terminal.
public static int
number()

Total number of terminals.

public int
precedence_num()

get the precedence of a terminal

public int
public void
set_precedence(int p, int new_prec)

set the precedence of a terminal

public String
toString()

Overrides java_cup.symbol.toString.

Convert to a string.
Inherited from java_cup.symbol:
indexnamenote_usestack_typeuse_count

Field Detail

_allback to summary
protected static Hashtable<K, V> _all

Table of all terminals. Elements are stored using name strings as the key

_all_by_indexback to summary
protected static Hashtable<K, V> _all_by_index

Table of all terminals indexed by their index number.

_precedence_numback to summary
private int _precedence_num
_precedence_sideback to summary
private int _precedence_side
EOFback to summary
public static final terminal EOF

Special terminal for end of input.

errorback to summary
public static final terminal error

special terminal used for error recovery

next_indexback to summary
protected static int next_index

Static counter to assign unique index.

Constructor Detail

terminalback to summary
public terminal(String nm, String tp, int precedence_side, int precedence_num)

Full constructor.

Parameters
nm:String

the name of the terminal.

tp:String

the type of the terminal.

terminalback to summary
public terminal(String nm, String tp)

Constructor for non-precedented terminal

terminalback to summary
public terminal(String nm)

Constructor with default type.

Parameters
nm:String

the name of the terminal.

Method Detail

allback to summary
public static Enumeration<E> all()

Access to all terminals.

findback to summary
public static terminal find(String with_name)

Lookup a terminal by name string.

findback to summary
public static terminal find(int indx)

Lookup a terminal by index.

is_non_termback to summary
public boolean is_non_term()

Implements abstract java_cup.symbol.is_non_term.

Report this symbol as not being a non-terminal.

numberback to summary
public static int number()

Total number of terminals.

precedence_numback to summary
public int precedence_num()

get the precedence of a terminal

precedence_sideback to summary
public int precedence_side()
set_precedenceback to summary
public void set_precedence(int p, int new_prec)

set the precedence of a terminal

toStringback to summary
public String toString()

Overrides java_cup.symbol.toString.

Convert to a string.

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object.