KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > idl > runtime > symbol


1
2 package org.jacorb.idl.runtime;
3
4 /** This class represents a (terminal or non-terminal) symbol that, among
5  * other things can be placed on the parse stack. Symbols are used to
6  * keep track of state on the parse stack. The symbol currently on top
7  * of the stack contains the current state in the parse_state field.
8  * In addition to the parse_state field, symbols also maintain a record
9  * of the symbol number that they represent in the sym field. Finally,
10  * symbols are used contain to any attributes used by semantic action (this
11  * is done via fields added in subclasses -- see for example, int_token and
12  * str_token).
13  *
14  * @see org.jacorb.idl.runtime.token
15  * @see org.jacorb.idl.runtime.int_token
16  * @see org.jacorb.idl.runtime.str_token
17  * @version last updated: 11/25/95
18  * @author Scott Hudson
19  */

20
21 public class symbol
22 {
23
24     /** Full constructor. */
25     public symbol(int sym_num, int state)
26     {
27         sym = sym_num;
28         parse_state = state;
29     }
30
31     /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
32
33     /** Constructor without a known state. */
34     public symbol(int sym_num)
35     {
36         this(sym_num, -1);
37     }
38
39     /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
40
41     /** The symbol number of the terminal or non terminal being represented */
42     public int sym;
43
44     /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/
45
46     /** The parse state to be recorded on the parse stack with this symbol.
47      * This field is for the convenience of the parser and shouldn't be
48      * modified except by the parser.
49      */

50     public int parse_state;
51 };
52
53
54
Popular Tags