01: package org.jacorb.idl.runtime;
02:
03: /** This class represents a (terminal or non-terminal) symbol that, among
04: * other things can be placed on the parse stack. Symbols are used to
05: * keep track of state on the parse stack. The symbol currently on top
06: * of the stack contains the current state in the parse_state field.
07: * In addition to the parse_state field, symbols also maintain a record
08: * of the symbol number that they represent in the sym field. Finally,
09: * symbols are used contain to any attributes used by semantic action (this
10: * is done via fields added in subclasses -- see for example, int_token and
11: * str_token).
12: *
13: * @see org.jacorb.idl.runtime.token
14: * @see org.jacorb.idl.runtime.int_token
15: * @see org.jacorb.idl.runtime.str_token
16: * @version last updated: 11/25/95
17: * @author Scott Hudson
18: */
19:
20: public class symbol {
21:
22: /** Full constructor. */
23: public symbol(int sym_num, int state) {
24: sym = sym_num;
25: parse_state = state;
26: }
27:
28: /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
29:
30: /** Constructor without a known state. */
31: public symbol(int sym_num) {
32: this (sym_num, -1);
33: }
34:
35: /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
36:
37: /** The symbol number of the terminal or non terminal being represented */
38: public int sym;
39:
40: /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
41:
42: /** The parse state to be recorded on the parse stack with this symbol.
43: * This field is for the convenience of the parser and shouldn't be
44: * modified except by the parser.
45: */
46: public int parse_state;
47: };
|