|
|
1.1 root 1: /*
2: ** TOKENS.Y -- operator and keyword tables
3: **
4: ** Defines:
5: ** Optab -- operator table
6: ** Kwrdtab -- keyword tables
7: ** Kwrdnum -- number of keywords (for binary search in getkey())
8: ** Tokens -- so lexical routines can know about yacc tokens
9: **
10: ** Requires:
11: ** Kwrdtab must be in alphabetical order!!!
12: **
13: ** Version:
14: ** @(#)tokens.y 7.2 10/27/81
15: */
16:
17:
18: struct optab Kwrdtab [] =
19: {
20: "all", ALL, 0,
21: "and", LBOP, 0,
22: "any", AOP, 0,
23: "append", APPEND, 0,
24: "ascii", FOP, 0,
25: "at", AT, 0,
26: "atan", FOP, 0,
27: "auto", ALLOC, opAUTO,
28: "avg", AOP, 0,
29: "avgu", AOP, 0,
30: "by", BY, 0,
31: "char", TYPE, opSTRING,
32: "concat", FBOP, 0,
33: "copy", COPY, 0,
34: "cos", FOP, 0,
35: "count", AOP, 0,
36: "countu", AOP, 0,
37: "create", CREATE, 0,
38: "define", DEFINE, 0,
39: "delete", DELETE, 0,
40: "destroy", DESTROY, 0,
41: "double", TYPE, opDOUBLE,
42: "exit", EXIT, 0,
43: "extern", ALLOC, opEXTERN,
44: "float", TYPE, opFLOAT,
45: "float4", FOP, 4,
46: "float8", FOP, 8,
47: "from", FROM, 0,
48: "gamma", FOP, 0,
49: "help", HELP, 0,
50: "in", IN, 0,
51: "index", INDEX, 0,
52: "ingres", INGRES, 0,
53: "int", TYPE, opINT,
54: "int1", FOP, 1,
55: "int2", FOP, 2,
56: "int4", FOP, 4,
57: "integrity", INTEGRITY, 0,
58: "into", INTO, 0,
59: "is", IS, 0,
60: "log", FOP, 0,
61: "long", TYPE, opLONG,
62: "max", AOP, 0,
63: "min", AOP, 0,
64: "mod", FBOP, 0,
65: "modify", MODIFY, 0,
66: "not", LUOP, 0,
67: "of", OF, 0,
68: "on", ON, 0,
69: "onto", ONTO, 0,
70: "or", LBOP, 0,
71: "param", PARAM, 0,
72: "permit", PERMIT, 0,
73: "print", PRINT, 0,
74: "rand", FOP, 0,
75: "range", RANGE, 0,
76: "register", ALLOC, opREGISTER,
77: "replace", REPLACE, 0,
78: "retrieve", RETRIEVE, 0,
79: "save", SAVE, 0,
80: "short", TYPE, opSHORT,
81: "sin", FOP, 0,
82: "sqrt", FOP, 0,
83: "static", ALLOC, opSTATIC,
84: "struct", STRUCT, opSTRUCT,
85: "sum", AOP, 0,
86: "sumu", AOP, 0,
87: "to", TO, 0,
88: "unique", UNIQUE, 0,
89: "until", UNTIL, 0,
90: "view", VIEW, 0,
91: "where", WHERE, 0,
92: };
93:
94: /* This decalaration must be here as getkey references it,
95: ** and it must contain the number of elements in the
96: ** Kwrdtab, which is only known here
97: */
98:
99: int Kwrdnum = sizeof Kwrdtab / sizeof Kwrdtab [0];
100:
101: struct optab Optab [] =
102: {
103: /* PUNCTUATION */
104: ",", COMMA, 0,
105: "(", LPAREN, 0,
106: ".", PERIOD, 0,
107: ")", RPAREN, 0,
108: "\"", QUOTE, 0,
109: "/*", BGNCMNT, 0,
110: "*/", ENDCMNT, 0,
111: "#", NONREF, 0,
112: ":", COLON, 0,
113:
114: /* C LANUAGE PUNCTUATION */
115: "{", LBRACE, 0,
116: "}", RBRACE, 0,
117: "[", LBRKT, 0,
118: "]", RBRKT, 0,
119: ";", SEMICOL, 0,
120: "->", POINTER, 0,
121:
122: /* UNARY ARITHMETIC OPERATORS */
123: "+", UOP, 0,
124: "-", UOP, 0,
125:
126: /* BINARY ARITHMETIC OPERATORS */
127: "*", BOP, 0,
128: "/", BOP, 0,
129: "**", BOP, 0,
130:
131: /* BOUNDS OPERATORS */
132: ">", BDOP, 0,
133: ">=", BDOP, 0,
134: "<", BDOP, 0,
135: "<=", BDOP, 0,
136:
137: /* EQUALITY OPERATORS */
138: "!=", EOP, 0,
139: "=", IS, 0,
140: 0
141: };
142:
143:
144: struct special Tokens =
145: {
146: NAME,
147: SCONST,
148: I2CONST,
149: I4CONST,
150: F8CONST,
151: QUOTE,
152: BGNCMNT,
153: ENDCMNT,
154: C_CODE,
155: STRUCT_VAR,
156: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.