1 |
|
|
#include <stdlib.h> |
2 |
|
|
#include <string.h> |
3 |
|
|
#define YYBYACC 1 |
4 |
|
|
#define YYMAJOR 1 |
5 |
|
|
#define YYMINOR 9 |
6 |
|
|
#define YYLEX yylex() |
7 |
|
|
#define YYEMPTY -1 |
8 |
|
|
#define yyclearin (yychar=(YYEMPTY)) |
9 |
|
|
#define yyerrok (yyerrflag=0) |
10 |
|
|
#define YYRECOVERING() (yyerrflag!=0) |
11 |
|
|
#define yyparse knparse |
12 |
|
|
#define yylex knlex |
13 |
|
|
#define yyerror knerror |
14 |
|
|
#define yychar knchar |
15 |
|
|
#define yyval knval |
16 |
|
|
#define yylval knlval |
17 |
|
|
#define yydebug kndebug |
18 |
|
|
#define yynerrs knnerrs |
19 |
|
|
#define yyerrflag knerrflag |
20 |
|
|
#define yyss knss |
21 |
|
|
#define yysslim knsslim |
22 |
|
|
#define yyssp knssp |
23 |
|
|
#define yyvs knvs |
24 |
|
|
#define yyvsp knvsp |
25 |
|
|
#define yystacksize knstacksize |
26 |
|
|
#define yylhs knlhs |
27 |
|
|
#define yylen knlen |
28 |
|
|
#define yydefred kndefred |
29 |
|
|
#define yydgoto kndgoto |
30 |
|
|
#define yysindex knsindex |
31 |
|
|
#define yyrindex knrindex |
32 |
|
|
#define yygindex kngindex |
33 |
|
|
#define yytable kntable |
34 |
|
|
#define yycheck kncheck |
35 |
|
|
#define yyname knname |
36 |
|
|
#define yyrule knrule |
37 |
|
|
#define YYPREFIX "kn" |
38 |
|
|
#line 21 "/usr/src/lib/libkeynote/keynote.y" |
39 |
|
|
#ifndef YYSTYPE_DEFINED |
40 |
|
|
#define YYSTYPE_DEFINED |
41 |
|
|
typedef union { |
42 |
|
|
char *string; |
43 |
|
|
double doubval; |
44 |
|
|
int intval; |
45 |
|
|
int bool; |
46 |
|
|
} YYSTYPE; |
47 |
|
|
#endif /* YYSTYPE_DEFINED */ |
48 |
|
|
#line 46 "/usr/src/lib/libkeynote/keynote.y" |
49 |
|
|
#include <sys/types.h> |
50 |
|
|
|
51 |
|
|
#include <ctype.h> |
52 |
|
|
#include <math.h> |
53 |
|
|
#include <regex.h> |
54 |
|
|
#include <stdio.h> |
55 |
|
|
#include <stdlib.h> |
56 |
|
|
#include <string.h> |
57 |
|
|
|
58 |
|
|
#include "keynote.h" |
59 |
|
|
#include "assertion.h" |
60 |
|
|
|
61 |
|
|
static int *keynote_kth_array = NULL; |
62 |
|
|
static int keylistcount = 0; |
63 |
|
|
|
64 |
|
|
static int resolve_assertion(char *); |
65 |
|
|
static int keynote_init_kth(void); |
66 |
|
|
static int isfloatstring(char *); |
67 |
|
|
static int checkexception(int); |
68 |
|
|
static char *my_lookup(char *); |
69 |
|
|
static int intpow(int, int); |
70 |
|
|
static int get_kth(int); |
71 |
|
|
#line 72 "k.tab.c" |
72 |
|
|
#define NUM 257 |
73 |
|
|
#define KOF 258 |
74 |
|
|
#define FLOAT 259 |
75 |
|
|
#define STRING 260 |
76 |
|
|
#define VARIABLE 261 |
77 |
|
|
#define TRUE 262 |
78 |
|
|
#define FALSE 263 |
79 |
|
|
#define OPENPAREN 264 |
80 |
|
|
#define CLOSEPAREN 265 |
81 |
|
|
#define EQQ 266 |
82 |
|
|
#define COMMA 267 |
83 |
|
|
#define ACTSTR 268 |
84 |
|
|
#define LOCINI 269 |
85 |
|
|
#define KEYPRE 270 |
86 |
|
|
#define KNVERSION 271 |
87 |
|
|
#define DOTT 272 |
88 |
|
|
#define SIGNERKEY 273 |
89 |
|
|
#define HINT 274 |
90 |
|
|
#define OPENBLOCK 275 |
91 |
|
|
#define CLOSEBLOCK 276 |
92 |
|
|
#define SIGNATUREENTRY 277 |
93 |
|
|
#define PRIVATEKEY 278 |
94 |
|
|
#define SEMICOLON 279 |
95 |
|
|
#define EQ 280 |
96 |
|
|
#define NE 281 |
97 |
|
|
#define LT 282 |
98 |
|
|
#define GT 283 |
99 |
|
|
#define LE 284 |
100 |
|
|
#define GE 285 |
101 |
|
|
#define REGEXP 286 |
102 |
|
|
#define OR 287 |
103 |
|
|
#define AND 288 |
104 |
|
|
#define NOT 289 |
105 |
|
|
#define PLUS 290 |
106 |
|
|
#define MINUS 291 |
107 |
|
|
#define MULT 292 |
108 |
|
|
#define DIV 293 |
109 |
|
|
#define MOD 294 |
110 |
|
|
#define EXP 295 |
111 |
|
|
#define UNARYMINUS 296 |
112 |
|
|
#define DEREF 297 |
113 |
|
|
#define OPENNUM 298 |
114 |
|
|
#define OPENFLT 299 |
115 |
|
|
#define YYERRCODE 256 |
116 |
|
|
const short knlhs[] = |
117 |
|
|
{ -1, |
118 |
|
|
17, 0, 19, 0, 21, 0, 22, 0, 23, 0, |
119 |
|
|
24, 0, 25, 0, 20, 20, 8, 8, 26, 11, |
120 |
|
|
27, 11, 11, 28, 29, 11, 12, 12, 10, 16, |
121 |
|
|
16, 30, 31, 30, 18, 9, 32, 9, 7, 7, |
122 |
|
|
6, 6, 3, 33, 3, 34, 3, 3, 3, 3, |
123 |
|
|
3, 3, 3, 2, 2, 2, 2, 2, 2, 4, |
124 |
|
|
4, 4, 4, 5, 5, 5, 5, 5, 5, 5, |
125 |
|
|
5, 5, 5, 13, 13, 13, 13, 13, 13, 13, |
126 |
|
|
13, 13, 1, 1, 1, 1, 1, 1, 1, 14, |
127 |
|
|
14, 15, 15, 15, 15, |
128 |
|
|
}; |
129 |
|
|
const short knlen[] = |
130 |
|
|
{ 2, |
131 |
|
|
0, 3, 0, 3, 0, 3, 0, 3, 0, 3, |
132 |
|
|
0, 3, 0, 3, 0, 1, 1, 1, 0, 4, |
133 |
|
|
0, 4, 3, 0, 0, 6, 1, 3, 1, 0, |
134 |
|
|
1, 3, 0, 5, 1, 0, 0, 4, 3, 1, |
135 |
|
|
1, 3, 3, 0, 4, 0, 4, 2, 1, 1, |
136 |
|
|
1, 1, 1, 3, 3, 3, 3, 3, 3, 3, |
137 |
|
|
3, 3, 3, 3, 3, 3, 3, 3, 3, 2, |
138 |
|
|
3, 1, 2, 3, 3, 3, 3, 3, 2, 3, |
139 |
|
|
1, 2, 3, 3, 3, 3, 3, 3, 3, 3, |
140 |
|
|
1, 1, 3, 1, 2, |
141 |
|
|
}; |
142 |
|
|
const short kndefred[] = |
143 |
|
|
{ 0, |
144 |
|
|
3, 1, 5, 11, 7, 9, 13, 0, 0, 0, |
145 |
|
|
0, 0, 0, 0, 0, 72, 81, 92, 94, 52, |
146 |
|
|
53, 0, 0, 0, 0, 0, 0, 51, 49, 0, |
147 |
|
|
50, 0, 37, 35, 0, 0, 91, 4, 0, 2, |
148 |
|
|
31, 24, 0, 0, 17, 18, 0, 6, 12, 0, |
149 |
|
|
8, 10, 14, 0, 0, 0, 0, 48, 0, 70, |
150 |
|
|
79, 95, 73, 82, 0, 46, 44, 0, 0, 0, |
151 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
152 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
153 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
154 |
|
|
0, 0, 21, 19, 0, 43, 71, 80, 93, 0, |
155 |
|
|
0, 0, 39, 0, 0, 0, 0, 0, 0, 0, |
156 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 69, |
157 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
158 |
|
|
0, 78, 90, 0, 0, 0, 0, 0, 0, 0, |
159 |
|
|
0, 25, 23, 0, 0, 0, 0, 45, 38, 0, |
160 |
|
|
0, 0, 20, 42, 34, 0, 0, 0, 26, 28, |
161 |
|
|
}; |
162 |
|
|
const short kndgoto[] = |
163 |
|
|
{ 8, |
164 |
|
|
28, 29, 30, 31, 32, 113, 33, 44, 34, 45, |
165 |
|
|
46, 167, 35, 47, 37, 40, 10, 38, 9, 48, |
166 |
|
|
11, 13, 14, 12, 15, 155, 154, 99, 161, 41, |
167 |
|
|
160, 80, 116, 115, |
168 |
|
|
}; |
169 |
|
|
const short knsindex[] = |
170 |
|
|
{ 254, |
171 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, -240, -236, |
172 |
|
|
-147, -249, -133, -133, -214, 0, 0, 0, 0, 0, |
173 |
|
|
0, -240, -240, -231, -133, -133, -133, 0, 0, -113, |
174 |
|
|
0, 205, 0, 0, 226, 221, 0, 0, -216, 0, |
175 |
|
|
0, 0, -147, -233, 0, 0, -241, 0, 0, -133, |
176 |
|
|
0, 0, 0, -250, -114, -100, 198, 0, -231, 0, |
177 |
|
|
0, 0, 0, 0, -135, 0, 0, -149, -149, -149, |
178 |
|
|
-149, -149, -149, -149, -149, -149, -149, -149, -149, -174, |
179 |
|
|
-155, -155, -155, -155, -155, -155, -155, -155, -155, -133, |
180 |
|
|
-133, -133, -133, -133, -133, -133, -133, -150, -152, -233, |
181 |
|
|
-141, -230, 0, 0, -230, 0, 0, 0, 0, -229, |
182 |
|
|
-93, -240, 0, -241, -240, -240, -149, -149, 243, 243, |
183 |
|
|
243, 243, 243, 243, -106, -106, -179, -179, -179, 0, |
184 |
|
|
-240, -155, -155, 249, 249, 249, 249, -88, -88, -165, |
185 |
|
|
-165, 0, 0, -241, -241, -241, -241, -241, -241, -241, |
186 |
|
|
0, 0, 0, -147, -147, -143, -153, 0, 0, -236, |
187 |
|
|
-133, -136, 0, 0, 0, -126, -118, -133, 0, 0,}; |
188 |
|
|
const short knrindex[] = |
189 |
|
|
{ 0, |
190 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, 163, 173, |
191 |
|
|
196, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
192 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, -78, |
193 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
194 |
|
|
0, 0, 0, 206, 0, 0, 1, 0, 0, 0, |
195 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
196 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
197 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
198 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
199 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
200 |
|
|
-209, -129, 0, 0, 0, 0, 0, 0, 0, 0, |
201 |
|
|
0, -58, 0, -54, 0, 0, 0, 0, -235, -142, |
202 |
|
|
-131, -2, 5, 118, -29, 67, -71, -50, 16, 0, |
203 |
|
|
2, 0, 0, 124, 130, 134, 136, 88, 103, 37, |
204 |
|
|
52, 0, 0, 151, 154, 161, 171, 178, 181, 188, |
205 |
|
|
3, 0, 0, 0, 0, 0, -247, 0, 0, 0, |
206 |
|
|
0, 4, 0, 0, 0, -39, 0, 0, 0, 0,}; |
207 |
|
|
const short kngindex[] = |
208 |
|
|
{ 0, |
209 |
|
|
0, 0, -14, 0, 21, 0, 0, -36, -83, -8, |
210 |
|
|
184, 60, -12, -9, 128, 0, 0, 0, 0, 0, |
211 |
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 79, |
212 |
|
|
0, 0, 0, 0, |
213 |
|
|
}; |
214 |
|
|
#define YYTABLESIZE 544 |
215 |
|
|
const short kntable[] = |
216 |
|
|
{ 36, |
217 |
|
|
29, 36, 32, 22, 51, 52, 100, 54, 58, 56, |
218 |
|
|
49, 61, 57, 36, 106, 62, 16, 47, 17, 18, |
219 |
|
|
19, 20, 21, 22, 39, 16, 47, 17, 156, 56, |
220 |
|
|
90, 47, 59, 102, 109, 107, 66, 67, 56, 47, |
221 |
|
|
105, 90, 55, 56, 60, 53, 111, 159, 23, 98, |
222 |
|
|
24, 56, 56, 103, 104, 114, 25, 26, 27, 24, |
223 |
|
|
74, 75, 76, 77, 78, 79, 26, 27, 134, 135, |
224 |
|
|
136, 137, 138, 139, 140, 141, 142, 18, 18, 110, |
225 |
|
|
143, 144, 145, 146, 147, 148, 149, 150, 119, 120, |
226 |
|
|
121, 122, 123, 124, 125, 126, 127, 128, 129, 130, |
227 |
|
|
157, 158, 36, 17, 131, 36, 36, 16, 132, 151, |
228 |
|
|
42, 152, 18, 19, 117, 79, 43, 162, 163, 111, |
229 |
|
|
61, 36, 59, 153, 18, 19, 18, 19, 50, 89, |
230 |
|
|
50, 59, 164, 54, 67, 133, 59, 110, 60, 112, |
231 |
|
|
168, 118, 54, 27, 59, 59, 169, 54, 26, 25, |
232 |
|
|
107, 104, 166, 63, 64, 54, 54, 29, 29, 166, |
233 |
|
|
65, 25, 36, 25, 108, 68, 69, 70, 71, 72, |
234 |
|
|
73, 108, 30, 66, 67, 74, 75, 76, 77, 78, |
235 |
|
|
79, 81, 82, 83, 84, 76, 77, 78, 79, 85, |
236 |
|
|
86, 87, 88, 66, 89, 15, 85, 86, 87, 88, |
237 |
|
|
40, 89, 66, 87, 88, 16, 89, 66, 66, 66, |
238 |
|
|
66, 66, 66, 66, 67, 66, 66, 36, 66, 66, |
239 |
|
|
66, 66, 66, 67, 41, 27, 101, 170, 67, 67, |
240 |
|
|
67, 67, 67, 67, 67, 64, 67, 67, 165, 67, |
241 |
|
|
67, 67, 67, 67, 64, 0, 0, 0, 0, 64, |
242 |
|
|
64, 64, 64, 64, 64, 64, 0, 64, 64, 0, |
243 |
|
|
64, 64, 55, 33, 0, 29, 0, 29, 22, 57, |
244 |
|
|
0, 55, 0, 0, 0, 0, 55, 36, 57, 0, |
245 |
|
|
68, 0, 0, 57, 55, 55, 0, 29, 29, 68, |
246 |
|
|
22, 57, 57, 0, 68, 68, 68, 68, 68, 68, |
247 |
|
|
68, 76, 68, 68, 0, 68, 68, 68, 68, 68, |
248 |
|
|
76, 0, 0, 0, 0, 76, 77, 0, 76, 76, |
249 |
|
|
76, 76, 0, 76, 76, 77, 76, 76, 76, 76, |
250 |
|
|
77, 65, 0, 77, 77, 77, 77, 0, 77, 77, |
251 |
|
|
65, 77, 77, 77, 77, 65, 65, 65, 65, 65, |
252 |
|
|
65, 65, 74, 65, 65, 0, 65, 65, 0, 0, |
253 |
|
|
0, 74, 0, 0, 0, 0, 74, 75, 0, 74, |
254 |
|
|
74, 74, 74, 0, 74, 74, 75, 74, 74, 0, |
255 |
|
|
0, 75, 58, 0, 75, 75, 75, 75, 60, 75, |
256 |
|
|
75, 58, 75, 75, 61, 0, 58, 60, 62, 0, |
257 |
|
|
63, 0, 60, 61, 58, 58, 0, 62, 61, 63, |
258 |
|
|
60, 60, 62, 0, 63, 83, 61, 61, 84, 0, |
259 |
|
|
62, 62, 63, 63, 83, 85, 0, 84, 0, 83, |
260 |
|
|
0, 0, 84, 0, 85, 86, 0, 83, 83, 85, |
261 |
|
|
84, 84, 87, 0, 86, 88, 0, 85, 85, 86, |
262 |
|
|
0, 87, 89, 0, 88, 0, 87, 86, 86, 88, |
263 |
|
|
0, 89, 109, 0, 87, 87, 89, 88, 88, 90, |
264 |
|
|
0, 0, 0, 0, 89, 89, 0, 91, 92, 93, |
265 |
|
|
94, 95, 96, 97, 68, 69, 70, 71, 72, 73, |
266 |
|
|
0, 0, 90, 0, 74, 75, 76, 77, 78, 79, |
267 |
|
|
91, 92, 93, 94, 95, 96, 97, 81, 82, 83, |
268 |
|
|
84, 0, 0, 0, 0, 85, 86, 87, 88, 0, |
269 |
|
|
89, 1, 2, 3, 4, 0, 5, 0, 0, 0, |
270 |
|
|
6, 7, 74, 75, 76, 77, 78, 79, 85, 86, |
271 |
|
|
87, 88, 0, 89, |
272 |
|
|
}; |
273 |
|
|
const short kncheck[] = |
274 |
|
|
{ 9, |
275 |
|
|
0, 0, 0, 0, 13, 14, 43, 22, 23, 22, |
276 |
|
|
260, 24, 22, 23, 265, 25, 257, 265, 259, 260, |
277 |
|
|
261, 262, 263, 264, 261, 257, 274, 259, 112, 265, |
278 |
|
|
272, 279, 264, 43, 265, 265, 287, 288, 274, 287, |
279 |
|
|
50, 272, 22, 279, 24, 260, 59, 131, 289, 266, |
280 |
|
|
291, 287, 288, 287, 288, 65, 297, 298, 299, 291, |
281 |
|
|
290, 291, 292, 293, 294, 295, 298, 299, 81, 82, |
282 |
|
|
83, 84, 85, 86, 87, 88, 89, 287, 288, 59, |
283 |
|
|
90, 91, 92, 93, 94, 95, 96, 97, 68, 69, |
284 |
|
|
70, 71, 72, 73, 74, 75, 76, 77, 78, 79, |
285 |
|
|
115, 116, 112, 259, 279, 115, 116, 257, 264, 260, |
286 |
|
|
258, 264, 260, 261, 264, 295, 264, 154, 155, 132, |
287 |
|
|
133, 131, 265, 265, 260, 261, 260, 261, 264, 295, |
288 |
|
|
264, 274, 276, 265, 288, 291, 279, 117, 118, 275, |
289 |
|
|
267, 291, 274, 299, 287, 288, 265, 279, 298, 297, |
290 |
|
|
265, 288, 161, 26, 27, 287, 288, 287, 288, 168, |
291 |
|
|
274, 297, 0, 297, 265, 280, 281, 282, 283, 284, |
292 |
|
|
285, 265, 0, 287, 288, 290, 291, 292, 293, 294, |
293 |
|
|
295, 282, 283, 284, 285, 292, 293, 294, 295, 290, |
294 |
|
|
291, 292, 293, 265, 295, 0, 290, 291, 292, 293, |
295 |
|
|
279, 295, 274, 292, 293, 0, 295, 279, 280, 281, |
296 |
|
|
282, 283, 284, 285, 265, 287, 288, 276, 290, 291, |
297 |
|
|
292, 293, 294, 274, 279, 265, 43, 168, 279, 280, |
298 |
|
|
281, 282, 283, 284, 285, 265, 287, 288, 160, 290, |
299 |
|
|
291, 292, 293, 294, 274, -1, -1, -1, -1, 279, |
300 |
|
|
280, 281, 282, 283, 284, 285, -1, 287, 288, -1, |
301 |
|
|
290, 291, 265, 261, -1, 265, -1, 267, 265, 265, |
302 |
|
|
-1, 274, -1, -1, -1, -1, 279, 276, 274, -1, |
303 |
|
|
265, -1, -1, 279, 287, 288, -1, 287, 288, 274, |
304 |
|
|
287, 287, 288, -1, 279, 280, 281, 282, 283, 284, |
305 |
|
|
285, 265, 287, 288, -1, 290, 291, 292, 293, 294, |
306 |
|
|
274, -1, -1, -1, -1, 279, 265, -1, 282, 283, |
307 |
|
|
284, 285, -1, 287, 288, 274, 290, 291, 292, 293, |
308 |
|
|
279, 265, -1, 282, 283, 284, 285, -1, 287, 288, |
309 |
|
|
274, 290, 291, 292, 293, 279, 280, 281, 282, 283, |
310 |
|
|
284, 285, 265, 287, 288, -1, 290, 291, -1, -1, |
311 |
|
|
-1, 274, -1, -1, -1, -1, 279, 265, -1, 282, |
312 |
|
|
283, 284, 285, -1, 287, 288, 274, 290, 291, -1, |
313 |
|
|
-1, 279, 265, -1, 282, 283, 284, 285, 265, 287, |
314 |
|
|
288, 274, 290, 291, 265, -1, 279, 274, 265, -1, |
315 |
|
|
265, -1, 279, 274, 287, 288, -1, 274, 279, 274, |
316 |
|
|
287, 288, 279, -1, 279, 265, 287, 288, 265, -1, |
317 |
|
|
287, 288, 287, 288, 274, 265, -1, 274, -1, 279, |
318 |
|
|
-1, -1, 279, -1, 274, 265, -1, 287, 288, 279, |
319 |
|
|
287, 288, 265, -1, 274, 265, -1, 287, 288, 279, |
320 |
|
|
-1, 274, 265, -1, 274, -1, 279, 287, 288, 279, |
321 |
|
|
-1, 274, 265, -1, 287, 288, 279, 287, 288, 272, |
322 |
|
|
-1, -1, -1, -1, 287, 288, -1, 280, 281, 282, |
323 |
|
|
283, 284, 285, 286, 280, 281, 282, 283, 284, 285, |
324 |
|
|
-1, -1, 272, -1, 290, 291, 292, 293, 294, 295, |
325 |
|
|
280, 281, 282, 283, 284, 285, 286, 282, 283, 284, |
326 |
|
|
285, -1, -1, -1, -1, 290, 291, 292, 293, -1, |
327 |
|
|
295, 268, 269, 270, 271, -1, 273, -1, -1, -1, |
328 |
|
|
277, 278, 290, 291, 292, 293, 294, 295, 290, 291, |
329 |
|
|
292, 293, -1, 295, |
330 |
|
|
}; |
331 |
|
|
#define YYFINAL 8 |
332 |
|
|
#ifndef YYDEBUG |
333 |
|
|
#define YYDEBUG 0 |
334 |
|
|
#endif |
335 |
|
|
#define YYMAXTOKEN 299 |
336 |
|
|
#if YYDEBUG |
337 |
|
|
const char * const knname[] = |
338 |
|
|
{ |
339 |
|
|
"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
340 |
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
341 |
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
342 |
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
343 |
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
344 |
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, |
345 |
|
|
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"NUM","KOF","FLOAT","STRING", |
346 |
|
|
"VARIABLE","TRUE","FALSE","OPENPAREN","CLOSEPAREN","EQQ","COMMA","ACTSTR", |
347 |
|
|
"LOCINI","KEYPRE","KNVERSION","DOTT","SIGNERKEY","HINT","OPENBLOCK", |
348 |
|
|
"CLOSEBLOCK","SIGNATUREENTRY","PRIVATEKEY","SEMICOLON","EQ","NE","LT","GT","LE", |
349 |
|
|
"GE","REGEXP","OR","AND","NOT","PLUS","MINUS","MULT","DIV","MOD","EXP", |
350 |
|
|
"UNARYMINUS","DEREF","OPENNUM","OPENFLT", |
351 |
|
|
}; |
352 |
|
|
const char * const knrule[] = |
353 |
|
|
{"$accept : grammarswitch", |
354 |
|
|
"$$1 :", |
355 |
|
|
"grammarswitch : LOCINI $$1 localinit", |
356 |
|
|
"$$2 :", |
357 |
|
|
"grammarswitch : ACTSTR $$2 program", |
358 |
|
|
"$$3 :", |
359 |
|
|
"grammarswitch : KEYPRE $$3 keypredicate", |
360 |
|
|
"$$4 :", |
361 |
|
|
"grammarswitch : SIGNERKEY $$4 key", |
362 |
|
|
"$$5 :", |
363 |
|
|
"grammarswitch : SIGNATUREENTRY $$5 key", |
364 |
|
|
"$$6 :", |
365 |
|
|
"grammarswitch : KNVERSION $$6 STRING", |
366 |
|
|
"$$7 :", |
367 |
|
|
"grammarswitch : PRIVATEKEY $$7 STRING", |
368 |
|
|
"keypredicate :", |
369 |
|
|
"keypredicate : notemptykeypredicate", |
370 |
|
|
"notemptykeypredicate : key", |
371 |
|
|
"notemptykeypredicate : keyexp", |
372 |
|
|
"$$8 :", |
373 |
|
|
"keyexp : notemptykeypredicate AND $$8 notemptykeypredicate", |
374 |
|
|
"$$9 :", |
375 |
|
|
"keyexp : notemptykeypredicate OR $$9 notemptykeypredicate", |
376 |
|
|
"keyexp : OPENPAREN keyexp CLOSEPAREN", |
377 |
|
|
"$$10 :", |
378 |
|
|
"$$11 :", |
379 |
|
|
"keyexp : KOF $$10 OPENPAREN $$11 keylist CLOSEPAREN", |
380 |
|
|
"keylist : key", |
381 |
|
|
"keylist : key COMMA keylist", |
382 |
|
|
"key : str", |
383 |
|
|
"localinit :", |
384 |
|
|
"localinit : localconstants", |
385 |
|
|
"localconstants : VARIABLE EQQ STRING", |
386 |
|
|
"$$12 :", |
387 |
|
|
"localconstants : VARIABLE EQQ STRING $$12 localconstants", |
388 |
|
|
"program : prog", |
389 |
|
|
"prog :", |
390 |
|
|
"$$13 :", |
391 |
|
|
"prog : notemptyprog $$13 SEMICOLON prog", |
392 |
|
|
"notemptyprog : expr HINT afterhint", |
393 |
|
|
"notemptyprog : expr", |
394 |
|
|
"afterhint : str", |
395 |
|
|
"afterhint : OPENBLOCK prog CLOSEBLOCK", |
396 |
|
|
"expr : OPENPAREN expr CLOSEPAREN", |
397 |
|
|
"$$14 :", |
398 |
|
|
"expr : expr AND $$14 expr", |
399 |
|
|
"$$15 :", |
400 |
|
|
"expr : expr OR $$15 expr", |
401 |
|
|
"expr : NOT expr", |
402 |
|
|
"expr : numexp", |
403 |
|
|
"expr : floatexp", |
404 |
|
|
"expr : stringexp", |
405 |
|
|
"expr : TRUE", |
406 |
|
|
"expr : FALSE", |
407 |
|
|
"numexp : numex LT numex", |
408 |
|
|
"numexp : numex GT numex", |
409 |
|
|
"numexp : numex EQ numex", |
410 |
|
|
"numexp : numex LE numex", |
411 |
|
|
"numexp : numex GE numex", |
412 |
|
|
"numexp : numex NE numex", |
413 |
|
|
"floatexp : floatex LT floatex", |
414 |
|
|
"floatexp : floatex GT floatex", |
415 |
|
|
"floatexp : floatex LE floatex", |
416 |
|
|
"floatexp : floatex GE floatex", |
417 |
|
|
"numex : numex PLUS numex", |
418 |
|
|
"numex : numex MINUS numex", |
419 |
|
|
"numex : numex MULT numex", |
420 |
|
|
"numex : numex DIV numex", |
421 |
|
|
"numex : numex MOD numex", |
422 |
|
|
"numex : numex EXP numex", |
423 |
|
|
"numex : MINUS numex", |
424 |
|
|
"numex : OPENPAREN numex CLOSEPAREN", |
425 |
|
|
"numex : NUM", |
426 |
|
|
"numex : OPENNUM strnotconcat", |
427 |
|
|
"floatex : floatex PLUS floatex", |
428 |
|
|
"floatex : floatex MINUS floatex", |
429 |
|
|
"floatex : floatex MULT floatex", |
430 |
|
|
"floatex : floatex DIV floatex", |
431 |
|
|
"floatex : floatex EXP floatex", |
432 |
|
|
"floatex : MINUS floatex", |
433 |
|
|
"floatex : OPENPAREN floatex CLOSEPAREN", |
434 |
|
|
"floatex : FLOAT", |
435 |
|
|
"floatex : OPENFLT strnotconcat", |
436 |
|
|
"stringexp : str EQ str", |
437 |
|
|
"stringexp : str NE str", |
438 |
|
|
"stringexp : str LT str", |
439 |
|
|
"stringexp : str GT str", |
440 |
|
|
"stringexp : str LE str", |
441 |
|
|
"stringexp : str GE str", |
442 |
|
|
"stringexp : str REGEXP str", |
443 |
|
|
"str : str DOTT str", |
444 |
|
|
"str : strnotconcat", |
445 |
|
|
"strnotconcat : STRING", |
446 |
|
|
"strnotconcat : OPENPAREN str CLOSEPAREN", |
447 |
|
|
"strnotconcat : VARIABLE", |
448 |
|
|
"strnotconcat : DEREF str", |
449 |
|
|
}; |
450 |
|
|
#endif |
451 |
|
|
#ifdef YYSTACKSIZE |
452 |
|
|
#undef YYMAXDEPTH |
453 |
|
|
#define YYMAXDEPTH YYSTACKSIZE |
454 |
|
|
#else |
455 |
|
|
#ifdef YYMAXDEPTH |
456 |
|
|
#define YYSTACKSIZE YYMAXDEPTH |
457 |
|
|
#else |
458 |
|
|
#define YYSTACKSIZE 10000 |
459 |
|
|
#define YYMAXDEPTH 10000 |
460 |
|
|
#endif |
461 |
|
|
#endif |
462 |
|
|
#define YYINITSTACKSIZE 200 |
463 |
|
|
/* LINTUSED */ |
464 |
|
|
int yydebug; |
465 |
|
|
int yynerrs; |
466 |
|
|
int yyerrflag; |
467 |
|
|
int yychar; |
468 |
|
|
short *yyssp; |
469 |
|
|
YYSTYPE *yyvsp; |
470 |
|
|
YYSTYPE yyval; |
471 |
|
|
YYSTYPE yylval; |
472 |
|
|
short *yyss; |
473 |
|
|
short *yysslim; |
474 |
|
|
YYSTYPE *yyvs; |
475 |
|
|
unsigned int yystacksize; |
476 |
|
|
int yyparse(void); |
477 |
|
|
#line 646 "/usr/src/lib/libkeynote/keynote.y" |
478 |
|
|
|
479 |
|
|
/* |
480 |
|
|
* Find all assertions signed by s and give us the one with the highest |
481 |
|
|
* return value. |
482 |
|
|
*/ |
483 |
|
|
static int |
484 |
|
|
resolve_assertion(char *s) |
485 |
|
|
{ |
486 |
|
|
int i, alg = KEYNOTE_ALGORITHM_NONE, p = 0; |
487 |
|
|
void *key = (void *) s; |
488 |
|
|
struct assertion *as; |
489 |
|
|
struct keylist *kl; |
490 |
|
|
|
491 |
|
|
kl = keynote_keylist_find(keynote_current_assertion->as_keylist, s); |
492 |
|
|
if (kl != NULL) |
493 |
|
|
{ |
494 |
|
|
alg = kl->key_alg; |
495 |
|
|
key = kl->key_key; |
496 |
|
|
} |
497 |
|
|
|
498 |
|
|
for (i = 0;; i++) |
499 |
|
|
{ |
500 |
|
|
as = keynote_find_assertion(key, i, alg); |
501 |
|
|
if (as == NULL) /* Gone through all of them */ |
502 |
|
|
return p; |
503 |
|
|
|
504 |
|
|
if (as->as_kresult == KRESULT_DONE) |
505 |
|
|
if (p < as->as_result) |
506 |
|
|
p = as->as_result; |
507 |
|
|
|
508 |
|
|
/* Short circuit if we find an assertion with maximum return value */ |
509 |
|
|
if (p == (keynote_current_session->ks_values_num - 1)) |
510 |
|
|
return p; |
511 |
|
|
} |
512 |
|
|
|
513 |
|
|
return 0; |
514 |
|
|
} |
515 |
|
|
|
516 |
|
|
/* |
517 |
|
|
* Environment variable lookup. |
518 |
|
|
*/ |
519 |
|
|
static char * |
520 |
|
|
my_lookup(char *s) |
521 |
|
|
{ |
522 |
|
|
struct keynote_session *ks = keynote_current_session; |
523 |
|
|
char *ret; |
524 |
|
|
|
525 |
|
|
if (!strcmp(s, "_MIN_TRUST")) |
526 |
|
|
{ |
527 |
|
|
keynote_used_variable = 1; |
528 |
|
|
return ks->ks_values[0]; |
529 |
|
|
} |
530 |
|
|
else |
531 |
|
|
{ |
532 |
|
|
if (!strcmp(s, "_MAX_TRUST")) |
533 |
|
|
{ |
534 |
|
|
keynote_used_variable = 1; |
535 |
|
|
return ks->ks_values[ks->ks_values_num - 1]; |
536 |
|
|
} |
537 |
|
|
else |
538 |
|
|
{ |
539 |
|
|
if (!strcmp(s, "_VALUES")) |
540 |
|
|
{ |
541 |
|
|
keynote_used_variable = 1; |
542 |
|
|
return keynote_env_lookup("_VALUES", ks->ks_env_table, |
543 |
|
|
HASHTABLESIZE); |
544 |
|
|
} |
545 |
|
|
else |
546 |
|
|
{ |
547 |
|
|
if (!strcmp(s, "_ACTION_AUTHORIZERS")) |
548 |
|
|
{ |
549 |
|
|
keynote_used_variable = 1; |
550 |
|
|
return keynote_env_lookup("_ACTION_AUTHORIZERS", |
551 |
|
|
ks->ks_env_table, HASHTABLESIZE); |
552 |
|
|
} |
553 |
|
|
} |
554 |
|
|
} |
555 |
|
|
} |
556 |
|
|
|
557 |
|
|
/* Temporary list (regexp results) */ |
558 |
|
|
if (keynote_temp_list != NULL) |
559 |
|
|
{ |
560 |
|
|
ret = keynote_env_lookup(s, &keynote_temp_list, 1); |
561 |
|
|
if (ret != NULL) |
562 |
|
|
return ret; |
563 |
|
|
else |
564 |
|
|
if (keynote_errno != 0) |
565 |
|
|
return NULL; |
566 |
|
|
} |
567 |
|
|
|
568 |
|
|
/* Local-Constants */ |
569 |
|
|
if (keynote_init_list != NULL) |
570 |
|
|
{ |
571 |
|
|
ret = keynote_env_lookup(s, &keynote_init_list, 1); |
572 |
|
|
if (ret != NULL) |
573 |
|
|
return ret; |
574 |
|
|
else |
575 |
|
|
if (keynote_errno != 0) |
576 |
|
|
return NULL; |
577 |
|
|
} |
578 |
|
|
|
579 |
|
|
if (ks != NULL) |
580 |
|
|
{ |
581 |
|
|
/* Action environment */ |
582 |
|
|
ret = keynote_env_lookup(s, ks->ks_env_table, HASHTABLESIZE); |
583 |
|
|
if (ret != NULL) |
584 |
|
|
{ |
585 |
|
|
keynote_used_variable = 1; |
586 |
|
|
return ret; |
587 |
|
|
} |
588 |
|
|
else |
589 |
|
|
if (keynote_errno != 0) |
590 |
|
|
return NULL; |
591 |
|
|
} |
592 |
|
|
|
593 |
|
|
/* Regex table */ |
594 |
|
|
if ((ks != NULL) && (ks->ks_env_regex != NULL)) |
595 |
|
|
{ |
596 |
|
|
ret = keynote_env_lookup(s, &(ks->ks_env_regex), 1); |
597 |
|
|
if (ret != NULL) |
598 |
|
|
{ |
599 |
|
|
keynote_used_variable = 1; |
600 |
|
|
return ret; |
601 |
|
|
} |
602 |
|
|
|
603 |
|
|
return NULL; |
604 |
|
|
} |
605 |
|
|
|
606 |
|
|
return NULL; |
607 |
|
|
} |
608 |
|
|
|
609 |
|
|
/* |
610 |
|
|
* If we had an exception, the boolean expression should return false. |
611 |
|
|
* Otherwise, return the result of the expression (the argument). |
612 |
|
|
*/ |
613 |
|
|
static int |
614 |
|
|
checkexception(int i) |
615 |
|
|
{ |
616 |
|
|
if (keynote_exceptionflag) |
617 |
|
|
{ |
618 |
|
|
keynote_exceptionflag = 0; |
619 |
|
|
return 0; |
620 |
|
|
} |
621 |
|
|
else |
622 |
|
|
return i; |
623 |
|
|
} |
624 |
|
|
|
625 |
|
|
|
626 |
|
|
/* |
627 |
|
|
* Integer exponentation -- copied from Schneier's AC2, page 244. |
628 |
|
|
*/ |
629 |
|
|
static int |
630 |
|
|
intpow(int x, int y) |
631 |
|
|
{ |
632 |
|
|
int s = 1; |
633 |
|
|
|
634 |
|
|
/* |
635 |
|
|
* x^y with y < 0 is equivalent to 1/(x^y), which for |
636 |
|
|
* integer arithmetic is 0. |
637 |
|
|
*/ |
638 |
|
|
if (y < 0) |
639 |
|
|
return 0; |
640 |
|
|
|
641 |
|
|
while (y) |
642 |
|
|
{ |
643 |
|
|
if (y & 1) |
644 |
|
|
s *= x; |
645 |
|
|
|
646 |
|
|
y >>= 1; |
647 |
|
|
x *= x; |
648 |
|
|
} |
649 |
|
|
|
650 |
|
|
return s; |
651 |
|
|
} |
652 |
|
|
|
653 |
|
|
/* |
654 |
|
|
* Check whether the string is a floating point number. |
655 |
|
|
*/ |
656 |
|
|
static int |
657 |
|
|
isfloatstring(char *s) |
658 |
|
|
{ |
659 |
|
|
int i, point = 0; |
660 |
|
|
|
661 |
|
|
for (i = strlen(s) - 1; i >= 0; i--) |
662 |
|
|
if (!isdigit((unsigned char)s[i])) |
663 |
|
|
{ |
664 |
|
|
if (s[i] == '.') |
665 |
|
|
{ |
666 |
|
|
if (point == 1) |
667 |
|
|
return 0; |
668 |
|
|
else |
669 |
|
|
point = 1; |
670 |
|
|
} |
671 |
|
|
else |
672 |
|
|
return 0; |
673 |
|
|
} |
674 |
|
|
|
675 |
|
|
return 1; |
676 |
|
|
} |
677 |
|
|
|
678 |
|
|
/* |
679 |
|
|
* Initialize array for threshold search. |
680 |
|
|
*/ |
681 |
|
|
static int |
682 |
|
|
keynote_init_kth(void) |
683 |
|
|
{ |
684 |
|
|
int i = keynote_current_session->ks_values_num; |
685 |
|
|
|
686 |
|
|
if (i == -1) |
687 |
|
|
return -1; |
688 |
|
|
|
689 |
|
|
keynote_kth_array = calloc(i, sizeof(int)); |
690 |
|
|
if (keynote_kth_array == NULL) |
691 |
|
|
{ |
692 |
|
|
keynote_errno = ERROR_MEMORY; |
693 |
|
|
return -1; |
694 |
|
|
} |
695 |
|
|
|
696 |
|
|
return RESULT_TRUE; |
697 |
|
|
} |
698 |
|
|
|
699 |
|
|
/* |
700 |
|
|
* Get the k-th best return value. |
701 |
|
|
*/ |
702 |
|
|
static int |
703 |
|
|
get_kth(int k) |
704 |
|
|
{ |
705 |
|
|
int i; |
706 |
|
|
|
707 |
|
|
for (i = keynote_current_session->ks_values_num - 1; i >= 0; i--) |
708 |
|
|
{ |
709 |
|
|
k -= keynote_kth_array[i]; |
710 |
|
|
|
711 |
|
|
if (k <= 0) |
712 |
|
|
return i; |
713 |
|
|
} |
714 |
|
|
|
715 |
|
|
return 0; |
716 |
|
|
} |
717 |
|
|
|
718 |
|
|
/* |
719 |
|
|
* Cleanup array. |
720 |
|
|
*/ |
721 |
|
|
void |
722 |
|
|
keynote_cleanup_kth(void) |
723 |
|
|
{ |
724 |
|
|
if (keynote_kth_array != NULL) |
725 |
|
|
{ |
726 |
|
|
free(keynote_kth_array); |
727 |
|
|
keynote_kth_array = NULL; |
728 |
|
|
} |
729 |
|
|
} |
730 |
|
|
|
731 |
|
|
void |
732 |
|
|
knerror(char *s) |
733 |
|
|
{} |
734 |
|
|
#line 727 "k.tab.c" |
735 |
|
|
/* allocate initial stack or double stack size, up to YYMAXDEPTH */ |
736 |
|
|
static int yygrowstack(void) |
737 |
|
|
{ |
738 |
|
|
unsigned int newsize; |
739 |
|
|
long sslen; |
740 |
|
|
short *newss; |
741 |
|
|
YYSTYPE *newvs; |
742 |
|
|
|
743 |
|
|
if ((newsize = yystacksize) == 0) |
744 |
|
|
newsize = YYINITSTACKSIZE; |
745 |
|
|
else if (newsize >= YYMAXDEPTH) |
746 |
|
|
return -1; |
747 |
|
|
else if ((newsize *= 2) > YYMAXDEPTH) |
748 |
|
|
newsize = YYMAXDEPTH; |
749 |
|
|
sslen = yyssp - yyss; |
750 |
|
|
#ifdef SIZE_MAX |
751 |
|
|
#define YY_SIZE_MAX SIZE_MAX |
752 |
|
|
#else |
753 |
|
|
#define YY_SIZE_MAX 0xffffffffU |
754 |
|
|
#endif |
755 |
|
|
if (newsize && YY_SIZE_MAX / newsize < sizeof *newss) |
756 |
|
|
goto bail; |
757 |
|
|
newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) : |
758 |
|
|
(short *)malloc(newsize * sizeof *newss); /* overflow check above */ |
759 |
|
|
if (newss == NULL) |
760 |
|
|
goto bail; |
761 |
|
|
yyss = newss; |
762 |
|
|
yyssp = newss + sslen; |
763 |
|
|
if (newsize && YY_SIZE_MAX / newsize < sizeof *newvs) |
764 |
|
|
goto bail; |
765 |
|
|
newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) : |
766 |
|
|
(YYSTYPE *)malloc(newsize * sizeof *newvs); /* overflow check above */ |
767 |
|
|
if (newvs == NULL) |
768 |
|
|
goto bail; |
769 |
|
|
yyvs = newvs; |
770 |
|
|
yyvsp = newvs + sslen; |
771 |
|
|
yystacksize = newsize; |
772 |
|
|
yysslim = yyss + newsize - 1; |
773 |
|
|
return 0; |
774 |
|
|
bail: |
775 |
|
|
if (yyss) |
776 |
|
|
free(yyss); |
777 |
|
|
if (yyvs) |
778 |
|
|
free(yyvs); |
779 |
|
|
yyss = yyssp = NULL; |
780 |
|
|
yyvs = yyvsp = NULL; |
781 |
|
|
yystacksize = 0; |
782 |
|
|
return -1; |
783 |
|
|
} |
784 |
|
|
|
785 |
|
|
#define YYABORT goto yyabort |
786 |
|
|
#define YYREJECT goto yyabort |
787 |
|
|
#define YYACCEPT goto yyaccept |
788 |
|
|
#define YYERROR goto yyerrlab |
789 |
|
|
int |
790 |
|
|
yyparse(void) |
791 |
|
|
{ |
792 |
|
|
int yym, yyn, yystate; |
793 |
|
|
#if YYDEBUG |
794 |
|
|
const char *yys; |
795 |
|
|
|
796 |
|
|
if ((yys = getenv("YYDEBUG"))) |
797 |
|
|
{ |
798 |
|
|
yyn = *yys; |
799 |
|
|
if (yyn >= '0' && yyn <= '9') |
800 |
|
|
yydebug = yyn - '0'; |
801 |
|
|
} |
802 |
|
|
#endif /* YYDEBUG */ |
803 |
|
|
|
804 |
|
|
yynerrs = 0; |
805 |
|
|
yyerrflag = 0; |
806 |
|
|
yychar = (-1); |
807 |
|
|
|
808 |
|
|
if (yyss == NULL && yygrowstack()) goto yyoverflow; |
809 |
|
|
yyssp = yyss; |
810 |
|
|
yyvsp = yyvs; |
811 |
|
|
*yyssp = yystate = 0; |
812 |
|
|
|
813 |
|
|
yyloop: |
814 |
|
|
if ((yyn = yydefred[yystate]) != 0) goto yyreduce; |
815 |
|
|
if (yychar < 0) |
816 |
|
|
{ |
817 |
|
|
if ((yychar = yylex()) < 0) yychar = 0; |
818 |
|
|
#if YYDEBUG |
819 |
|
|
if (yydebug) |
820 |
|
|
{ |
821 |
|
|
yys = 0; |
822 |
|
|
if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
823 |
|
|
if (!yys) yys = "illegal-symbol"; |
824 |
|
|
printf("%sdebug: state %d, reading %d (%s)\n", |
825 |
|
|
YYPREFIX, yystate, yychar, yys); |
826 |
|
|
} |
827 |
|
|
#endif |
828 |
|
|
} |
829 |
|
|
if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 && |
830 |
|
|
yyn <= YYTABLESIZE && yycheck[yyn] == yychar) |
831 |
|
|
{ |
832 |
|
|
#if YYDEBUG |
833 |
|
|
if (yydebug) |
834 |
|
|
printf("%sdebug: state %d, shifting to state %d\n", |
835 |
|
|
YYPREFIX, yystate, yytable[yyn]); |
836 |
|
|
#endif |
837 |
|
|
if (yyssp >= yysslim && yygrowstack()) |
838 |
|
|
{ |
839 |
|
|
goto yyoverflow; |
840 |
|
|
} |
841 |
|
|
*++yyssp = yystate = yytable[yyn]; |
842 |
|
|
*++yyvsp = yylval; |
843 |
|
|
yychar = (-1); |
844 |
|
|
if (yyerrflag > 0) --yyerrflag; |
845 |
|
|
goto yyloop; |
846 |
|
|
} |
847 |
|
|
if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 && |
848 |
|
|
yyn <= YYTABLESIZE && yycheck[yyn] == yychar) |
849 |
|
|
{ |
850 |
|
|
yyn = yytable[yyn]; |
851 |
|
|
goto yyreduce; |
852 |
|
|
} |
853 |
|
|
if (yyerrflag) goto yyinrecovery; |
854 |
|
|
#if defined(__GNUC__) |
855 |
|
|
goto yynewerror; |
856 |
|
|
#endif |
857 |
|
|
yynewerror: |
858 |
|
|
yyerror("syntax error"); |
859 |
|
|
#if defined(__GNUC__) |
860 |
|
|
goto yyerrlab; |
861 |
|
|
#endif |
862 |
|
|
yyerrlab: |
863 |
|
|
++yynerrs; |
864 |
|
|
yyinrecovery: |
865 |
|
|
if (yyerrflag < 3) |
866 |
|
|
{ |
867 |
|
|
yyerrflag = 3; |
868 |
|
|
for (;;) |
869 |
|
|
{ |
870 |
|
|
if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 && |
871 |
|
|
yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE) |
872 |
|
|
{ |
873 |
|
|
#if YYDEBUG |
874 |
|
|
if (yydebug) |
875 |
|
|
printf("%sdebug: state %d, error recovery shifting\ |
876 |
|
|
to state %d\n", YYPREFIX, *yyssp, yytable[yyn]); |
877 |
|
|
#endif |
878 |
|
|
if (yyssp >= yysslim && yygrowstack()) |
879 |
|
|
{ |
880 |
|
|
goto yyoverflow; |
881 |
|
|
} |
882 |
|
|
*++yyssp = yystate = yytable[yyn]; |
883 |
|
|
*++yyvsp = yylval; |
884 |
|
|
goto yyloop; |
885 |
|
|
} |
886 |
|
|
else |
887 |
|
|
{ |
888 |
|
|
#if YYDEBUG |
889 |
|
|
if (yydebug) |
890 |
|
|
printf("%sdebug: error recovery discarding state %d\n", |
891 |
|
|
YYPREFIX, *yyssp); |
892 |
|
|
#endif |
893 |
|
|
if (yyssp <= yyss) goto yyabort; |
894 |
|
|
--yyssp; |
895 |
|
|
--yyvsp; |
896 |
|
|
} |
897 |
|
|
} |
898 |
|
|
} |
899 |
|
|
else |
900 |
|
|
{ |
901 |
|
|
if (yychar == 0) goto yyabort; |
902 |
|
|
#if YYDEBUG |
903 |
|
|
if (yydebug) |
904 |
|
|
{ |
905 |
|
|
yys = 0; |
906 |
|
|
if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
907 |
|
|
if (!yys) yys = "illegal-symbol"; |
908 |
|
|
printf("%sdebug: state %d, error recovery discards token %d (%s)\n", |
909 |
|
|
YYPREFIX, yystate, yychar, yys); |
910 |
|
|
} |
911 |
|
|
#endif |
912 |
|
|
yychar = (-1); |
913 |
|
|
goto yyloop; |
914 |
|
|
} |
915 |
|
|
yyreduce: |
916 |
|
|
#if YYDEBUG |
917 |
|
|
if (yydebug) |
918 |
|
|
printf("%sdebug: state %d, reducing by rule %d (%s)\n", |
919 |
|
|
YYPREFIX, yystate, yyn, yyrule[yyn]); |
920 |
|
|
#endif |
921 |
|
|
yym = yylen[yyn]; |
922 |
|
|
if (yym) |
923 |
|
|
yyval = yyvsp[1-yym]; |
924 |
|
|
else |
925 |
|
|
memset(&yyval, 0, sizeof yyval); |
926 |
|
|
switch (yyn) |
927 |
|
|
{ |
928 |
|
|
case 1: |
929 |
|
|
#line 71 "/usr/src/lib/libkeynote/keynote.y" |
930 |
|
|
{ keynote_exceptionflag = keynote_donteval = 0; } |
931 |
|
|
break; |
932 |
|
|
case 3: |
933 |
|
|
#line 73 "/usr/src/lib/libkeynote/keynote.y" |
934 |
|
|
{ keynote_exceptionflag = keynote_donteval = 0; } |
935 |
|
|
break; |
936 |
|
|
case 5: |
937 |
|
|
#line 74 "/usr/src/lib/libkeynote/keynote.y" |
938 |
|
|
{ keynote_exceptionflag = keynote_donteval = 0; } |
939 |
|
|
break; |
940 |
|
|
case 7: |
941 |
|
|
#line 76 "/usr/src/lib/libkeynote/keynote.y" |
942 |
|
|
{ keynote_exceptionflag = keynote_donteval = 0; } |
943 |
|
|
break; |
944 |
|
|
case 9: |
945 |
|
|
#line 77 "/usr/src/lib/libkeynote/keynote.y" |
946 |
|
|
{ keynote_exceptionflag = keynote_donteval = 0; } |
947 |
|
|
break; |
948 |
|
|
case 11: |
949 |
|
|
#line 79 "/usr/src/lib/libkeynote/keynote.y" |
950 |
|
|
{ keynote_exceptionflag = keynote_donteval = 0; } |
951 |
|
|
break; |
952 |
|
|
case 12: |
953 |
|
|
#line 80 "/usr/src/lib/libkeynote/keynote.y" |
954 |
|
|
{ keynote_lex_remove(yyvsp[0].string); |
955 |
|
|
if (strcmp(yyvsp[0].string, KEYNOTE_VERSION_STRING)) |
956 |
|
|
keynote_errno = ERROR_SYNTAX; |
957 |
|
|
free(yyvsp[0].string); |
958 |
|
|
} |
959 |
|
|
break; |
960 |
|
|
case 13: |
961 |
|
|
#line 85 "/usr/src/lib/libkeynote/keynote.y" |
962 |
|
|
{ keynote_exceptionflag = keynote_donteval = 0; } |
963 |
|
|
break; |
964 |
|
|
case 14: |
965 |
|
|
#line 86 "/usr/src/lib/libkeynote/keynote.y" |
966 |
|
|
{ keynote_lex_remove(yyvsp[0].string); |
967 |
|
|
keynote_privkey = yyvsp[0].string; |
968 |
|
|
} |
969 |
|
|
break; |
970 |
|
|
case 15: |
971 |
|
|
#line 90 "/usr/src/lib/libkeynote/keynote.y" |
972 |
|
|
{ keynote_returnvalue = 0; |
973 |
|
|
return 0; |
974 |
|
|
} |
975 |
|
|
break; |
976 |
|
|
case 16: |
977 |
|
|
#line 93 "/usr/src/lib/libkeynote/keynote.y" |
978 |
|
|
{ keynote_returnvalue = yyvsp[0].intval; |
979 |
|
|
return 0; |
980 |
|
|
} |
981 |
|
|
break; |
982 |
|
|
case 17: |
983 |
|
|
#line 97 "/usr/src/lib/libkeynote/keynote.y" |
984 |
|
|
{ yyval.intval = yyvsp[0].intval; } |
985 |
|
|
break; |
986 |
|
|
case 18: |
987 |
|
|
#line 98 "/usr/src/lib/libkeynote/keynote.y" |
988 |
|
|
{ yyval.intval = yyvsp[0].intval; } |
989 |
|
|
break; |
990 |
|
|
case 19: |
991 |
|
|
#line 100 "/usr/src/lib/libkeynote/keynote.y" |
992 |
|
|
{ if ((yyvsp[-1].intval == 0) && !keynote_justrecord) |
993 |
|
|
keynote_donteval = 1; |
994 |
|
|
} |
995 |
|
|
break; |
996 |
|
|
case 20: |
997 |
|
|
#line 103 "/usr/src/lib/libkeynote/keynote.y" |
998 |
|
|
{ if (yyvsp[-3].intval > yyvsp[0].intval) |
999 |
|
|
yyval.intval = yyvsp[0].intval; |
1000 |
|
|
else |
1001 |
|
|
yyval.intval = yyvsp[-3].intval; |
1002 |
|
|
keynote_donteval = 0; |
1003 |
|
|
} |
1004 |
|
|
break; |
1005 |
|
|
case 21: |
1006 |
|
|
#line 109 "/usr/src/lib/libkeynote/keynote.y" |
1007 |
|
|
{ if ((yyvsp[-1].intval == (keynote_current_session->ks_values_num - 1)) && !keynote_justrecord) |
1008 |
|
|
keynote_donteval = 1; |
1009 |
|
|
} |
1010 |
|
|
break; |
1011 |
|
|
case 22: |
1012 |
|
|
#line 112 "/usr/src/lib/libkeynote/keynote.y" |
1013 |
|
|
{ if (yyvsp[-3].intval >= yyvsp[0].intval) |
1014 |
|
|
yyval.intval = yyvsp[-3].intval; |
1015 |
|
|
else |
1016 |
|
|
yyval.intval = yyvsp[0].intval; |
1017 |
|
|
keynote_donteval = 0; |
1018 |
|
|
} |
1019 |
|
|
break; |
1020 |
|
|
case 23: |
1021 |
|
|
#line 118 "/usr/src/lib/libkeynote/keynote.y" |
1022 |
|
|
{ yyval.intval = yyvsp[-1].intval; } |
1023 |
|
|
break; |
1024 |
|
|
case 24: |
1025 |
|
|
#line 119 "/usr/src/lib/libkeynote/keynote.y" |
1026 |
|
|
{ keylistcount = 0; } |
1027 |
|
|
break; |
1028 |
|
|
case 25: |
1029 |
|
|
#line 119 "/usr/src/lib/libkeynote/keynote.y" |
1030 |
|
|
{ |
1031 |
|
|
if (!keynote_justrecord && !keynote_donteval) |
1032 |
|
|
if (keynote_init_kth() == -1) |
1033 |
|
|
return -1; |
1034 |
|
|
} |
1035 |
|
|
break; |
1036 |
|
|
case 26: |
1037 |
|
|
#line 124 "/usr/src/lib/libkeynote/keynote.y" |
1038 |
|
|
{ |
1039 |
|
|
if (keylistcount < yyvsp[-5].intval) |
1040 |
|
|
{ |
1041 |
|
|
keynote_errno = ERROR_SYNTAX; |
1042 |
|
|
return -1; |
1043 |
|
|
} |
1044 |
|
|
|
1045 |
|
|
if (!keynote_justrecord && !keynote_donteval) |
1046 |
|
|
yyval.intval = get_kth(yyvsp[-5].intval); |
1047 |
|
|
else |
1048 |
|
|
yyval.intval = 0; |
1049 |
|
|
} |
1050 |
|
|
break; |
1051 |
|
|
case 27: |
1052 |
|
|
#line 138 "/usr/src/lib/libkeynote/keynote.y" |
1053 |
|
|
{ /* Don't do anything if we're just recording */ |
1054 |
|
|
if (!keynote_justrecord && !keynote_donteval) |
1055 |
|
|
if ((yyvsp[0].intval < keynote_current_session->ks_values_num) && (yyvsp[0].intval >= 0)) |
1056 |
|
|
keynote_kth_array[yyvsp[0].intval]++; |
1057 |
|
|
|
1058 |
|
|
keylistcount++; |
1059 |
|
|
} |
1060 |
|
|
break; |
1061 |
|
|
case 28: |
1062 |
|
|
#line 146 "/usr/src/lib/libkeynote/keynote.y" |
1063 |
|
|
{ /* Don't do anything if we're just recording */ |
1064 |
|
|
if (!keynote_justrecord && !keynote_donteval) |
1065 |
|
|
if ((yyvsp[-2].intval < keynote_current_session->ks_values_num) && (yyvsp[-2].intval >= 0)) |
1066 |
|
|
keynote_kth_array[yyvsp[-2].intval]++; |
1067 |
|
|
|
1068 |
|
|
keylistcount++; |
1069 |
|
|
} |
1070 |
|
|
break; |
1071 |
|
|
case 29: |
1072 |
|
|
#line 154 "/usr/src/lib/libkeynote/keynote.y" |
1073 |
|
|
{ |
1074 |
|
|
if (keynote_donteval) |
1075 |
|
|
yyval.intval = 0; |
1076 |
|
|
else |
1077 |
|
|
{ |
1078 |
|
|
keynote_lex_remove(yyvsp[0].string); |
1079 |
|
|
if (keynote_justrecord) |
1080 |
|
|
{ |
1081 |
|
|
if (keynote_keylist_add(&keynote_keypred_keylist, |
1082 |
|
|
yyvsp[0].string) == -1) |
1083 |
|
|
{ |
1084 |
|
|
free(yyvsp[0].string); |
1085 |
|
|
return -1; |
1086 |
|
|
} |
1087 |
|
|
|
1088 |
|
|
yyval.intval = 0; |
1089 |
|
|
} |
1090 |
|
|
else |
1091 |
|
|
switch (keynote_in_action_authorizers(yyvsp[0].string, KEYNOTE_ALGORITHM_UNSPEC)) |
1092 |
|
|
{ |
1093 |
|
|
case -1: |
1094 |
|
|
free(yyvsp[0].string); |
1095 |
|
|
return -1; |
1096 |
|
|
|
1097 |
|
|
case RESULT_TRUE: |
1098 |
|
|
free(yyvsp[0].string); |
1099 |
|
|
yyval.intval = keynote_current_session->ks_values_num - |
1100 |
|
|
1; |
1101 |
|
|
break; |
1102 |
|
|
|
1103 |
|
|
default: |
1104 |
|
|
yyval.intval = resolve_assertion(yyvsp[0].string); |
1105 |
|
|
free(yyvsp[0].string); |
1106 |
|
|
break; |
1107 |
|
|
} |
1108 |
|
|
} |
1109 |
|
|
} |
1110 |
|
|
break; |
1111 |
|
|
case 32: |
1112 |
|
|
#line 196 "/usr/src/lib/libkeynote/keynote.y" |
1113 |
|
|
{ |
1114 |
|
|
int i; |
1115 |
|
|
|
1116 |
|
|
keynote_lex_remove(yyvsp[-2].string); |
1117 |
|
|
keynote_lex_remove(yyvsp[0].string); |
1118 |
|
|
|
1119 |
|
|
/* |
1120 |
|
|
* Variable names starting with underscores are illegal here. |
1121 |
|
|
*/ |
1122 |
|
|
if (yyvsp[-2].string[0] == '_') |
1123 |
|
|
{ |
1124 |
|
|
free(yyvsp[-2].string); |
1125 |
|
|
free(yyvsp[0].string); |
1126 |
|
|
keynote_errno = ERROR_SYNTAX; |
1127 |
|
|
return -1; |
1128 |
|
|
} |
1129 |
|
|
|
1130 |
|
|
/* If the identifier already exists, report error. */ |
1131 |
|
|
if (keynote_env_lookup(yyvsp[-2].string, &keynote_init_list, 1) != NULL) |
1132 |
|
|
{ |
1133 |
|
|
free(yyvsp[-2].string); |
1134 |
|
|
free(yyvsp[0].string); |
1135 |
|
|
keynote_errno = ERROR_SYNTAX; |
1136 |
|
|
return -1; |
1137 |
|
|
} |
1138 |
|
|
|
1139 |
|
|
i = keynote_env_add(yyvsp[-2].string, yyvsp[0].string, &keynote_init_list, 1, 0); |
1140 |
|
|
free(yyvsp[-2].string); |
1141 |
|
|
free(yyvsp[0].string); |
1142 |
|
|
|
1143 |
|
|
if (i != RESULT_TRUE) |
1144 |
|
|
return -1; |
1145 |
|
|
} |
1146 |
|
|
break; |
1147 |
|
|
case 33: |
1148 |
|
|
#line 230 "/usr/src/lib/libkeynote/keynote.y" |
1149 |
|
|
{ |
1150 |
|
|
int i; |
1151 |
|
|
|
1152 |
|
|
keynote_lex_remove(yyvsp[-2].string); |
1153 |
|
|
keynote_lex_remove(yyvsp[0].string); |
1154 |
|
|
|
1155 |
|
|
/* |
1156 |
|
|
* Variable names starting with underscores are illegal here. |
1157 |
|
|
*/ |
1158 |
|
|
if (yyvsp[-2].string[0] == '_') |
1159 |
|
|
{ |
1160 |
|
|
free(yyvsp[-2].string); |
1161 |
|
|
free(yyvsp[0].string); |
1162 |
|
|
keynote_errno = ERROR_SYNTAX; |
1163 |
|
|
return -1; |
1164 |
|
|
} |
1165 |
|
|
|
1166 |
|
|
/* If the identifier already exists, report error. */ |
1167 |
|
|
if (keynote_env_lookup(yyvsp[-2].string, &keynote_init_list, 1) != NULL) |
1168 |
|
|
{ |
1169 |
|
|
free(yyvsp[-2].string); |
1170 |
|
|
free(yyvsp[0].string); |
1171 |
|
|
keynote_errno = ERROR_SYNTAX; |
1172 |
|
|
return -1; |
1173 |
|
|
} |
1174 |
|
|
|
1175 |
|
|
i = keynote_env_add(yyvsp[-2].string, yyvsp[0].string, &keynote_init_list, 1, 0); |
1176 |
|
|
free(yyvsp[-2].string); |
1177 |
|
|
free(yyvsp[0].string); |
1178 |
|
|
|
1179 |
|
|
if (i != RESULT_TRUE) |
1180 |
|
|
return -1; |
1181 |
|
|
} |
1182 |
|
|
break; |
1183 |
|
|
case 35: |
1184 |
|
|
#line 264 "/usr/src/lib/libkeynote/keynote.y" |
1185 |
|
|
{ |
1186 |
|
|
keynote_returnvalue = yyvsp[0].intval; |
1187 |
|
|
return 0; |
1188 |
|
|
} |
1189 |
|
|
break; |
1190 |
|
|
case 36: |
1191 |
|
|
#line 269 "/usr/src/lib/libkeynote/keynote.y" |
1192 |
|
|
{ yyval.intval = 0; } |
1193 |
|
|
break; |
1194 |
|
|
case 37: |
1195 |
|
|
#line 270 "/usr/src/lib/libkeynote/keynote.y" |
1196 |
|
|
{ |
1197 |
|
|
/* |
1198 |
|
|
* Cleanup envlist of additions such as |
1199 |
|
|
* regexp results |
1200 |
|
|
*/ |
1201 |
|
|
keynote_env_cleanup(&keynote_temp_list, 1); |
1202 |
|
|
} |
1203 |
|
|
break; |
1204 |
|
|
case 38: |
1205 |
|
|
#line 277 "/usr/src/lib/libkeynote/keynote.y" |
1206 |
|
|
{ |
1207 |
|
|
if (yyvsp[-3].intval > yyvsp[0].intval) |
1208 |
|
|
yyval.intval = yyvsp[-3].intval; |
1209 |
|
|
else |
1210 |
|
|
yyval.intval = yyvsp[0].intval; |
1211 |
|
|
} |
1212 |
|
|
break; |
1213 |
|
|
case 39: |
1214 |
|
|
#line 285 "/usr/src/lib/libkeynote/keynote.y" |
1215 |
|
|
{ |
1216 |
|
|
if (checkexception(yyvsp[-2].bool)) |
1217 |
|
|
yyval.intval = yyvsp[0].intval; |
1218 |
|
|
else |
1219 |
|
|
yyval.intval = 0; |
1220 |
|
|
} |
1221 |
|
|
break; |
1222 |
|
|
case 40: |
1223 |
|
|
#line 292 "/usr/src/lib/libkeynote/keynote.y" |
1224 |
|
|
{ |
1225 |
|
|
if (checkexception(yyvsp[0].bool)) |
1226 |
|
|
yyval.intval = keynote_current_session->ks_values_num - 1; |
1227 |
|
|
else |
1228 |
|
|
yyval.intval = 0; |
1229 |
|
|
} |
1230 |
|
|
break; |
1231 |
|
|
case 41: |
1232 |
|
|
#line 299 "/usr/src/lib/libkeynote/keynote.y" |
1233 |
|
|
{ if (keynote_exceptionflag || keynote_donteval) |
1234 |
|
|
yyval.intval = 0; |
1235 |
|
|
else |
1236 |
|
|
{ |
1237 |
|
|
keynote_lex_remove(yyvsp[0].string); |
1238 |
|
|
|
1239 |
|
|
yyval.intval = keynote_retindex(yyvsp[0].string); |
1240 |
|
|
if (yyval.intval == -1) /* Invalid return value */ |
1241 |
|
|
yyval.intval = 0; |
1242 |
|
|
|
1243 |
|
|
free(yyvsp[0].string); |
1244 |
|
|
} |
1245 |
|
|
} |
1246 |
|
|
break; |
1247 |
|
|
case 42: |
1248 |
|
|
#line 312 "/usr/src/lib/libkeynote/keynote.y" |
1249 |
|
|
{ yyval.intval = yyvsp[-1].intval; } |
1250 |
|
|
break; |
1251 |
|
|
case 43: |
1252 |
|
|
#line 315 "/usr/src/lib/libkeynote/keynote.y" |
1253 |
|
|
{ yyval.bool = yyvsp[-1].bool; } |
1254 |
|
|
break; |
1255 |
|
|
case 44: |
1256 |
|
|
#line 316 "/usr/src/lib/libkeynote/keynote.y" |
1257 |
|
|
{ if (yyvsp[-1].bool == 0) |
1258 |
|
|
keynote_donteval = 1; |
1259 |
|
|
} |
1260 |
|
|
break; |
1261 |
|
|
case 45: |
1262 |
|
|
#line 318 "/usr/src/lib/libkeynote/keynote.y" |
1263 |
|
|
{ yyval.bool = (yyvsp[-3].bool && yyvsp[0].bool); |
1264 |
|
|
keynote_donteval = 0; |
1265 |
|
|
} |
1266 |
|
|
break; |
1267 |
|
|
case 46: |
1268 |
|
|
#line 321 "/usr/src/lib/libkeynote/keynote.y" |
1269 |
|
|
{ if (yyvsp[-1].bool) |
1270 |
|
|
keynote_donteval = 1; |
1271 |
|
|
} |
1272 |
|
|
break; |
1273 |
|
|
case 47: |
1274 |
|
|
#line 323 "/usr/src/lib/libkeynote/keynote.y" |
1275 |
|
|
{ yyval.bool = (yyvsp[-3].bool || yyvsp[0].bool); |
1276 |
|
|
keynote_donteval = 0; |
1277 |
|
|
} |
1278 |
|
|
break; |
1279 |
|
|
case 48: |
1280 |
|
|
#line 326 "/usr/src/lib/libkeynote/keynote.y" |
1281 |
|
|
{ yyval.bool = !(yyvsp[0].bool); } |
1282 |
|
|
break; |
1283 |
|
|
case 49: |
1284 |
|
|
#line 327 "/usr/src/lib/libkeynote/keynote.y" |
1285 |
|
|
{ yyval.bool = yyvsp[0].bool; } |
1286 |
|
|
break; |
1287 |
|
|
case 50: |
1288 |
|
|
#line 328 "/usr/src/lib/libkeynote/keynote.y" |
1289 |
|
|
{ yyval.bool = yyvsp[0].bool; } |
1290 |
|
|
break; |
1291 |
|
|
case 51: |
1292 |
|
|
#line 329 "/usr/src/lib/libkeynote/keynote.y" |
1293 |
|
|
{ yyval.bool = yyvsp[0].bool; } |
1294 |
|
|
break; |
1295 |
|
|
case 52: |
1296 |
|
|
#line 330 "/usr/src/lib/libkeynote/keynote.y" |
1297 |
|
|
{ yyval.bool = 1; } |
1298 |
|
|
break; |
1299 |
|
|
case 53: |
1300 |
|
|
#line 331 "/usr/src/lib/libkeynote/keynote.y" |
1301 |
|
|
{ yyval.bool = 0; } |
1302 |
|
|
break; |
1303 |
|
|
case 54: |
1304 |
|
|
#line 333 "/usr/src/lib/libkeynote/keynote.y" |
1305 |
|
|
{ yyval.bool = yyvsp[-2].intval < yyvsp[0].intval; } |
1306 |
|
|
break; |
1307 |
|
|
case 55: |
1308 |
|
|
#line 334 "/usr/src/lib/libkeynote/keynote.y" |
1309 |
|
|
{ yyval.bool = yyvsp[-2].intval > yyvsp[0].intval; } |
1310 |
|
|
break; |
1311 |
|
|
case 56: |
1312 |
|
|
#line 335 "/usr/src/lib/libkeynote/keynote.y" |
1313 |
|
|
{ yyval.bool = yyvsp[-2].intval == yyvsp[0].intval; } |
1314 |
|
|
break; |
1315 |
|
|
case 57: |
1316 |
|
|
#line 336 "/usr/src/lib/libkeynote/keynote.y" |
1317 |
|
|
{ yyval.bool = yyvsp[-2].intval <= yyvsp[0].intval; } |
1318 |
|
|
break; |
1319 |
|
|
case 58: |
1320 |
|
|
#line 337 "/usr/src/lib/libkeynote/keynote.y" |
1321 |
|
|
{ yyval.bool = yyvsp[-2].intval >= yyvsp[0].intval; } |
1322 |
|
|
break; |
1323 |
|
|
case 59: |
1324 |
|
|
#line 338 "/usr/src/lib/libkeynote/keynote.y" |
1325 |
|
|
{ yyval.bool = yyvsp[-2].intval != yyvsp[0].intval; } |
1326 |
|
|
break; |
1327 |
|
|
case 60: |
1328 |
|
|
#line 340 "/usr/src/lib/libkeynote/keynote.y" |
1329 |
|
|
{ yyval.bool = yyvsp[-2].doubval < yyvsp[0].doubval; } |
1330 |
|
|
break; |
1331 |
|
|
case 61: |
1332 |
|
|
#line 341 "/usr/src/lib/libkeynote/keynote.y" |
1333 |
|
|
{ yyval.bool = yyvsp[-2].doubval > yyvsp[0].doubval; } |
1334 |
|
|
break; |
1335 |
|
|
case 62: |
1336 |
|
|
#line 342 "/usr/src/lib/libkeynote/keynote.y" |
1337 |
|
|
{ yyval.bool = yyvsp[-2].doubval <= yyvsp[0].doubval; } |
1338 |
|
|
break; |
1339 |
|
|
case 63: |
1340 |
|
|
#line 343 "/usr/src/lib/libkeynote/keynote.y" |
1341 |
|
|
{ yyval.bool = yyvsp[-2].doubval >= yyvsp[0].doubval; } |
1342 |
|
|
break; |
1343 |
|
|
case 64: |
1344 |
|
|
#line 345 "/usr/src/lib/libkeynote/keynote.y" |
1345 |
|
|
{ yyval.intval = yyvsp[-2].intval + yyvsp[0].intval; } |
1346 |
|
|
break; |
1347 |
|
|
case 65: |
1348 |
|
|
#line 346 "/usr/src/lib/libkeynote/keynote.y" |
1349 |
|
|
{ yyval.intval = yyvsp[-2].intval - yyvsp[0].intval; } |
1350 |
|
|
break; |
1351 |
|
|
case 66: |
1352 |
|
|
#line 347 "/usr/src/lib/libkeynote/keynote.y" |
1353 |
|
|
{ yyval.intval = yyvsp[-2].intval * yyvsp[0].intval; } |
1354 |
|
|
break; |
1355 |
|
|
case 67: |
1356 |
|
|
#line 348 "/usr/src/lib/libkeynote/keynote.y" |
1357 |
|
|
{ if (yyvsp[0].intval == 0) |
1358 |
|
|
{ |
1359 |
|
|
if (!keynote_donteval) |
1360 |
|
|
keynote_exceptionflag = 1; |
1361 |
|
|
} |
1362 |
|
|
else |
1363 |
|
|
yyval.intval = (yyvsp[-2].intval / yyvsp[0].intval); |
1364 |
|
|
} |
1365 |
|
|
break; |
1366 |
|
|
case 68: |
1367 |
|
|
#line 356 "/usr/src/lib/libkeynote/keynote.y" |
1368 |
|
|
{ if (yyvsp[0].intval == 0) |
1369 |
|
|
{ |
1370 |
|
|
if (!keynote_donteval) |
1371 |
|
|
keynote_exceptionflag = 1; |
1372 |
|
|
} |
1373 |
|
|
else |
1374 |
|
|
yyval.intval = yyvsp[-2].intval % yyvsp[0].intval; |
1375 |
|
|
} |
1376 |
|
|
break; |
1377 |
|
|
case 69: |
1378 |
|
|
#line 364 "/usr/src/lib/libkeynote/keynote.y" |
1379 |
|
|
{ yyval.intval = intpow(yyvsp[-2].intval, yyvsp[0].intval); } |
1380 |
|
|
break; |
1381 |
|
|
case 70: |
1382 |
|
|
#line 365 "/usr/src/lib/libkeynote/keynote.y" |
1383 |
|
|
{ yyval.intval = -(yyvsp[0].intval); } |
1384 |
|
|
break; |
1385 |
|
|
case 71: |
1386 |
|
|
#line 366 "/usr/src/lib/libkeynote/keynote.y" |
1387 |
|
|
{ yyval.intval = yyvsp[-1].intval; } |
1388 |
|
|
break; |
1389 |
|
|
case 72: |
1390 |
|
|
#line 367 "/usr/src/lib/libkeynote/keynote.y" |
1391 |
|
|
{ yyval.intval = yyvsp[0].intval; } |
1392 |
|
|
break; |
1393 |
|
|
case 73: |
1394 |
|
|
#line 368 "/usr/src/lib/libkeynote/keynote.y" |
1395 |
|
|
{ if (keynote_exceptionflag || |
1396 |
|
|
keynote_donteval) |
1397 |
|
|
yyval.intval = 0; |
1398 |
|
|
else |
1399 |
|
|
{ |
1400 |
|
|
keynote_lex_remove(yyvsp[0].string); |
1401 |
|
|
|
1402 |
|
|
if (!isfloatstring(yyvsp[0].string)) |
1403 |
|
|
yyval.intval = 0; |
1404 |
|
|
else |
1405 |
|
|
yyval.intval = (int) floor(atof(yyvsp[0].string)); |
1406 |
|
|
free(yyvsp[0].string); |
1407 |
|
|
} |
1408 |
|
|
} |
1409 |
|
|
break; |
1410 |
|
|
case 74: |
1411 |
|
|
#line 383 "/usr/src/lib/libkeynote/keynote.y" |
1412 |
|
|
{ yyval.doubval = (yyvsp[-2].doubval + yyvsp[0].doubval); } |
1413 |
|
|
break; |
1414 |
|
|
case 75: |
1415 |
|
|
#line 384 "/usr/src/lib/libkeynote/keynote.y" |
1416 |
|
|
{ yyval.doubval = (yyvsp[-2].doubval - yyvsp[0].doubval); } |
1417 |
|
|
break; |
1418 |
|
|
case 76: |
1419 |
|
|
#line 385 "/usr/src/lib/libkeynote/keynote.y" |
1420 |
|
|
{ yyval.doubval = (yyvsp[-2].doubval * yyvsp[0].doubval); } |
1421 |
|
|
break; |
1422 |
|
|
case 77: |
1423 |
|
|
#line 386 "/usr/src/lib/libkeynote/keynote.y" |
1424 |
|
|
{ if (yyvsp[0].doubval == 0) |
1425 |
|
|
{ |
1426 |
|
|
if (!keynote_donteval) |
1427 |
|
|
keynote_exceptionflag = 1; |
1428 |
|
|
} |
1429 |
|
|
else |
1430 |
|
|
yyval.doubval = (yyvsp[-2].doubval / yyvsp[0].doubval); |
1431 |
|
|
} |
1432 |
|
|
break; |
1433 |
|
|
case 78: |
1434 |
|
|
#line 394 "/usr/src/lib/libkeynote/keynote.y" |
1435 |
|
|
{ if (!keynote_exceptionflag && |
1436 |
|
|
!keynote_donteval) |
1437 |
|
|
yyval.doubval = pow(yyvsp[-2].doubval, yyvsp[0].doubval); |
1438 |
|
|
} |
1439 |
|
|
break; |
1440 |
|
|
case 79: |
1441 |
|
|
#line 398 "/usr/src/lib/libkeynote/keynote.y" |
1442 |
|
|
{ yyval.doubval = -(yyvsp[0].doubval); } |
1443 |
|
|
break; |
1444 |
|
|
case 80: |
1445 |
|
|
#line 399 "/usr/src/lib/libkeynote/keynote.y" |
1446 |
|
|
{ yyval.doubval = yyvsp[-1].doubval; } |
1447 |
|
|
break; |
1448 |
|
|
case 81: |
1449 |
|
|
#line 400 "/usr/src/lib/libkeynote/keynote.y" |
1450 |
|
|
{ yyval.doubval = yyvsp[0].doubval; } |
1451 |
|
|
break; |
1452 |
|
|
case 82: |
1453 |
|
|
#line 401 "/usr/src/lib/libkeynote/keynote.y" |
1454 |
|
|
{ |
1455 |
|
|
if (keynote_exceptionflag || |
1456 |
|
|
keynote_donteval) |
1457 |
|
|
yyval.doubval = 0.0; |
1458 |
|
|
else |
1459 |
|
|
{ |
1460 |
|
|
keynote_lex_remove(yyvsp[0].string); |
1461 |
|
|
|
1462 |
|
|
if (!isfloatstring(yyvsp[0].string)) |
1463 |
|
|
yyval.doubval = 0.0; |
1464 |
|
|
else |
1465 |
|
|
yyval.doubval = atof(yyvsp[0].string); |
1466 |
|
|
free(yyvsp[0].string); |
1467 |
|
|
} |
1468 |
|
|
} |
1469 |
|
|
break; |
1470 |
|
|
case 83: |
1471 |
|
|
#line 417 "/usr/src/lib/libkeynote/keynote.y" |
1472 |
|
|
{ |
1473 |
|
|
if (keynote_exceptionflag || keynote_donteval) |
1474 |
|
|
yyval.bool = 0; |
1475 |
|
|
else |
1476 |
|
|
{ |
1477 |
|
|
yyval.bool = strcmp(yyvsp[-2].string, yyvsp[0].string) == 0 ? 1 : 0; |
1478 |
|
|
keynote_lex_remove(yyvsp[-2].string); |
1479 |
|
|
keynote_lex_remove(yyvsp[0].string); |
1480 |
|
|
free(yyvsp[-2].string); |
1481 |
|
|
free(yyvsp[0].string); |
1482 |
|
|
} |
1483 |
|
|
} |
1484 |
|
|
break; |
1485 |
|
|
case 84: |
1486 |
|
|
#line 429 "/usr/src/lib/libkeynote/keynote.y" |
1487 |
|
|
{ |
1488 |
|
|
if (keynote_exceptionflag || keynote_donteval) |
1489 |
|
|
yyval.bool = 0; |
1490 |
|
|
else |
1491 |
|
|
{ |
1492 |
|
|
yyval.bool = strcmp(yyvsp[-2].string, yyvsp[0].string) != 0 ? 1 : 0; |
1493 |
|
|
keynote_lex_remove(yyvsp[-2].string); |
1494 |
|
|
keynote_lex_remove(yyvsp[0].string); |
1495 |
|
|
free(yyvsp[-2].string); |
1496 |
|
|
free(yyvsp[0].string); |
1497 |
|
|
} |
1498 |
|
|
} |
1499 |
|
|
break; |
1500 |
|
|
case 85: |
1501 |
|
|
#line 441 "/usr/src/lib/libkeynote/keynote.y" |
1502 |
|
|
{ |
1503 |
|
|
if (keynote_exceptionflag || keynote_donteval) |
1504 |
|
|
yyval.bool = 0; |
1505 |
|
|
else |
1506 |
|
|
{ |
1507 |
|
|
yyval.bool = strcmp(yyvsp[-2].string, yyvsp[0].string) < 0 ? 1 : 0; |
1508 |
|
|
keynote_lex_remove(yyvsp[-2].string); |
1509 |
|
|
keynote_lex_remove(yyvsp[0].string); |
1510 |
|
|
free(yyvsp[-2].string); |
1511 |
|
|
free(yyvsp[0].string); |
1512 |
|
|
} |
1513 |
|
|
} |
1514 |
|
|
break; |
1515 |
|
|
case 86: |
1516 |
|
|
#line 453 "/usr/src/lib/libkeynote/keynote.y" |
1517 |
|
|
{ |
1518 |
|
|
if (keynote_exceptionflag || keynote_donteval) |
1519 |
|
|
yyval.bool = 0; |
1520 |
|
|
else |
1521 |
|
|
{ |
1522 |
|
|
yyval.bool = strcmp(yyvsp[-2].string, yyvsp[0].string) > 0 ? 1 : 0; |
1523 |
|
|
keynote_lex_remove(yyvsp[-2].string); |
1524 |
|
|
keynote_lex_remove(yyvsp[0].string); |
1525 |
|
|
free(yyvsp[-2].string); |
1526 |
|
|
free(yyvsp[0].string); |
1527 |
|
|
} |
1528 |
|
|
} |
1529 |
|
|
break; |
1530 |
|
|
case 87: |
1531 |
|
|
#line 465 "/usr/src/lib/libkeynote/keynote.y" |
1532 |
|
|
{ |
1533 |
|
|
if (keynote_exceptionflag || keynote_donteval) |
1534 |
|
|
yyval.bool = 0; |
1535 |
|
|
else |
1536 |
|
|
{ |
1537 |
|
|
yyval.bool = strcmp(yyvsp[-2].string, yyvsp[0].string) <= 0 ? 1 : 0; |
1538 |
|
|
keynote_lex_remove(yyvsp[-2].string); |
1539 |
|
|
keynote_lex_remove(yyvsp[0].string); |
1540 |
|
|
free(yyvsp[-2].string); |
1541 |
|
|
free(yyvsp[0].string); |
1542 |
|
|
} |
1543 |
|
|
} |
1544 |
|
|
break; |
1545 |
|
|
case 88: |
1546 |
|
|
#line 477 "/usr/src/lib/libkeynote/keynote.y" |
1547 |
|
|
{ |
1548 |
|
|
if (keynote_exceptionflag || keynote_donteval) |
1549 |
|
|
yyval.bool = 0; |
1550 |
|
|
else |
1551 |
|
|
{ |
1552 |
|
|
yyval.bool = strcmp(yyvsp[-2].string, yyvsp[0].string) >= 0 ? 1 : 0; |
1553 |
|
|
keynote_lex_remove(yyvsp[-2].string); |
1554 |
|
|
keynote_lex_remove(yyvsp[0].string); |
1555 |
|
|
free(yyvsp[-2].string); |
1556 |
|
|
free(yyvsp[0].string); |
1557 |
|
|
} |
1558 |
|
|
} |
1559 |
|
|
break; |
1560 |
|
|
case 89: |
1561 |
|
|
#line 490 "/usr/src/lib/libkeynote/keynote.y" |
1562 |
|
|
{ |
1563 |
|
|
regmatch_t pmatch[32]; |
1564 |
|
|
char grp[10], *gr; |
1565 |
|
|
regex_t preg; |
1566 |
|
|
int i; |
1567 |
|
|
|
1568 |
|
|
if (keynote_exceptionflag || keynote_donteval) |
1569 |
|
|
yyval.bool = 0; |
1570 |
|
|
else |
1571 |
|
|
{ |
1572 |
|
|
keynote_lex_remove(yyvsp[-2].string); |
1573 |
|
|
keynote_lex_remove(yyvsp[0].string); |
1574 |
|
|
|
1575 |
|
|
memset(pmatch, 0, sizeof(pmatch)); |
1576 |
|
|
memset(grp, 0, sizeof(grp)); |
1577 |
|
|
|
1578 |
|
|
if (regcomp(&preg, yyvsp[0].string, REG_EXTENDED)) |
1579 |
|
|
{ |
1580 |
|
|
free(yyvsp[-2].string); |
1581 |
|
|
free(yyvsp[0].string); |
1582 |
|
|
keynote_exceptionflag = 1; |
1583 |
|
|
} |
1584 |
|
|
else |
1585 |
|
|
{ |
1586 |
|
|
/* Clean-up residuals from previous regexps */ |
1587 |
|
|
keynote_env_cleanup(&keynote_temp_list, 1); |
1588 |
|
|
|
1589 |
|
|
free(yyvsp[0].string); |
1590 |
|
|
i = regexec(&preg, yyvsp[-2].string, 32, pmatch, 0); |
1591 |
|
|
yyval.bool = (i == 0 ? 1 : 0); |
1592 |
|
|
if (i == 0) |
1593 |
|
|
{ |
1594 |
|
|
snprintf(grp, sizeof grp, "%lu", |
1595 |
|
|
(unsigned long)preg.re_nsub); |
1596 |
|
|
if (keynote_env_add("_0", grp, &keynote_temp_list, |
1597 |
|
|
1, 0) != RESULT_TRUE) |
1598 |
|
|
{ |
1599 |
|
|
free(yyvsp[-2].string); |
1600 |
|
|
regfree(&preg); |
1601 |
|
|
return -1; |
1602 |
|
|
} |
1603 |
|
|
|
1604 |
|
|
for (i = 1; i < 32 && pmatch[i].rm_so != -1; i++) |
1605 |
|
|
{ |
1606 |
|
|
gr = calloc(pmatch[i].rm_eo - pmatch[i].rm_so + |
1607 |
|
|
1, sizeof(char)); |
1608 |
|
|
if (gr == NULL) |
1609 |
|
|
{ |
1610 |
|
|
free(yyvsp[-2].string); |
1611 |
|
|
regfree(&preg); |
1612 |
|
|
keynote_errno = ERROR_MEMORY; |
1613 |
|
|
return -1; |
1614 |
|
|
} |
1615 |
|
|
|
1616 |
|
|
strncpy(gr, yyvsp[-2].string + pmatch[i].rm_so, |
1617 |
|
|
pmatch[i].rm_eo - pmatch[i].rm_so); |
1618 |
|
|
gr[pmatch[i].rm_eo - pmatch[i].rm_so] = '\0'; |
1619 |
|
|
snprintf(grp, sizeof grp, "_%d", i); |
1620 |
|
|
if (keynote_env_add(grp, gr, &keynote_temp_list, |
1621 |
|
|
1, 0) == -1) |
1622 |
|
|
{ |
1623 |
|
|
free(yyvsp[-2].string); |
1624 |
|
|
regfree(&preg); |
1625 |
|
|
free(gr); |
1626 |
|
|
return -1; |
1627 |
|
|
} |
1628 |
|
|
else |
1629 |
|
|
free(gr); |
1630 |
|
|
} |
1631 |
|
|
} |
1632 |
|
|
|
1633 |
|
|
regfree(&preg); |
1634 |
|
|
free(yyvsp[-2].string); |
1635 |
|
|
} |
1636 |
|
|
} |
1637 |
|
|
} |
1638 |
|
|
break; |
1639 |
|
|
case 90: |
1640 |
|
|
#line 567 "/usr/src/lib/libkeynote/keynote.y" |
1641 |
|
|
{ if (keynote_exceptionflag || keynote_donteval) |
1642 |
|
|
yyval.string = NULL; |
1643 |
|
|
else |
1644 |
|
|
{ |
1645 |
|
|
int len = strlen(yyvsp[-2].string) + strlen(yyvsp[0].string) + 1; |
1646 |
|
|
yyval.string = calloc(len, sizeof(char)); |
1647 |
|
|
keynote_lex_remove(yyvsp[-2].string); |
1648 |
|
|
keynote_lex_remove(yyvsp[0].string); |
1649 |
|
|
if (yyval.string == NULL) |
1650 |
|
|
{ |
1651 |
|
|
free(yyvsp[-2].string); |
1652 |
|
|
free(yyvsp[0].string); |
1653 |
|
|
keynote_errno = ERROR_MEMORY; |
1654 |
|
|
return -1; |
1655 |
|
|
} |
1656 |
|
|
snprintf(yyval.string, len, "%s%s", yyvsp[-2].string, yyvsp[0].string); |
1657 |
|
|
free(yyvsp[-2].string); |
1658 |
|
|
free(yyvsp[0].string); |
1659 |
|
|
if (keynote_lex_add(yyval.string, LEXTYPE_CHAR) == -1) |
1660 |
|
|
return -1; |
1661 |
|
|
} |
1662 |
|
|
} |
1663 |
|
|
break; |
1664 |
|
|
case 91: |
1665 |
|
|
#line 589 "/usr/src/lib/libkeynote/keynote.y" |
1666 |
|
|
{ yyval.string = yyvsp[0].string; } |
1667 |
|
|
break; |
1668 |
|
|
case 92: |
1669 |
|
|
#line 591 "/usr/src/lib/libkeynote/keynote.y" |
1670 |
|
|
{ yyval.string = yyvsp[0].string; } |
1671 |
|
|
break; |
1672 |
|
|
case 93: |
1673 |
|
|
#line 592 "/usr/src/lib/libkeynote/keynote.y" |
1674 |
|
|
{ yyval.string = yyvsp[-1].string; } |
1675 |
|
|
break; |
1676 |
|
|
case 94: |
1677 |
|
|
#line 593 "/usr/src/lib/libkeynote/keynote.y" |
1678 |
|
|
{ if (keynote_exceptionflag || keynote_donteval) |
1679 |
|
|
yyval.string = NULL; |
1680 |
|
|
else |
1681 |
|
|
{ |
1682 |
|
|
yyval.string = my_lookup(yyvsp[0].string); |
1683 |
|
|
keynote_lex_remove(yyvsp[0].string); |
1684 |
|
|
free(yyvsp[0].string); |
1685 |
|
|
if (yyval.string == NULL) |
1686 |
|
|
{ |
1687 |
|
|
if (keynote_errno) |
1688 |
|
|
return -1; |
1689 |
|
|
yyval.string = strdup(""); |
1690 |
|
|
} |
1691 |
|
|
else |
1692 |
|
|
yyval.string = strdup(yyval.string); |
1693 |
|
|
|
1694 |
|
|
if (yyval.string == NULL) |
1695 |
|
|
{ |
1696 |
|
|
keynote_errno = ERROR_MEMORY; |
1697 |
|
|
return -1; |
1698 |
|
|
} |
1699 |
|
|
|
1700 |
|
|
if (keynote_lex_add(yyval.string, LEXTYPE_CHAR) == -1) |
1701 |
|
|
return -1; |
1702 |
|
|
} |
1703 |
|
|
} |
1704 |
|
|
break; |
1705 |
|
|
case 95: |
1706 |
|
|
#line 619 "/usr/src/lib/libkeynote/keynote.y" |
1707 |
|
|
{ if (keynote_exceptionflag || keynote_donteval) |
1708 |
|
|
yyval.string = NULL; |
1709 |
|
|
else |
1710 |
|
|
{ |
1711 |
|
|
yyval.string = my_lookup(yyvsp[0].string); |
1712 |
|
|
keynote_lex_remove(yyvsp[0].string); |
1713 |
|
|
free(yyvsp[0].string); |
1714 |
|
|
if (yyval.string == NULL) |
1715 |
|
|
{ |
1716 |
|
|
if (keynote_errno) |
1717 |
|
|
return -1; |
1718 |
|
|
yyval.string = strdup(""); |
1719 |
|
|
} |
1720 |
|
|
else |
1721 |
|
|
yyval.string = strdup(yyval.string); |
1722 |
|
|
|
1723 |
|
|
if (yyval.string == NULL) |
1724 |
|
|
{ |
1725 |
|
|
keynote_errno = ERROR_MEMORY; |
1726 |
|
|
return -1; |
1727 |
|
|
} |
1728 |
|
|
|
1729 |
|
|
if (keynote_lex_add(yyval.string, LEXTYPE_CHAR) == -1) |
1730 |
|
|
return -1; |
1731 |
|
|
} |
1732 |
|
|
} |
1733 |
|
|
break; |
1734 |
|
|
#line 1727 "k.tab.c" |
1735 |
|
|
} |
1736 |
|
|
yyssp -= yym; |
1737 |
|
|
yystate = *yyssp; |
1738 |
|
|
yyvsp -= yym; |
1739 |
|
|
yym = yylhs[yyn]; |
1740 |
|
|
if (yystate == 0 && yym == 0) |
1741 |
|
|
{ |
1742 |
|
|
#if YYDEBUG |
1743 |
|
|
if (yydebug) |
1744 |
|
|
printf("%sdebug: after reduction, shifting from state 0 to\ |
1745 |
|
|
state %d\n", YYPREFIX, YYFINAL); |
1746 |
|
|
#endif |
1747 |
|
|
yystate = YYFINAL; |
1748 |
|
|
*++yyssp = YYFINAL; |
1749 |
|
|
*++yyvsp = yyval; |
1750 |
|
|
if (yychar < 0) |
1751 |
|
|
{ |
1752 |
|
|
if ((yychar = yylex()) < 0) yychar = 0; |
1753 |
|
|
#if YYDEBUG |
1754 |
|
|
if (yydebug) |
1755 |
|
|
{ |
1756 |
|
|
yys = 0; |
1757 |
|
|
if (yychar <= YYMAXTOKEN) yys = yyname[yychar]; |
1758 |
|
|
if (!yys) yys = "illegal-symbol"; |
1759 |
|
|
printf("%sdebug: state %d, reading %d (%s)\n", |
1760 |
|
|
YYPREFIX, YYFINAL, yychar, yys); |
1761 |
|
|
} |
1762 |
|
|
#endif |
1763 |
|
|
} |
1764 |
|
|
if (yychar == 0) goto yyaccept; |
1765 |
|
|
goto yyloop; |
1766 |
|
|
} |
1767 |
|
|
if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 && |
1768 |
|
|
yyn <= YYTABLESIZE && yycheck[yyn] == yystate) |
1769 |
|
|
yystate = yytable[yyn]; |
1770 |
|
|
else |
1771 |
|
|
yystate = yydgoto[yym]; |
1772 |
|
|
#if YYDEBUG |
1773 |
|
|
if (yydebug) |
1774 |
|
|
printf("%sdebug: after reduction, shifting from state %d \ |
1775 |
|
|
to state %d\n", YYPREFIX, *yyssp, yystate); |
1776 |
|
|
#endif |
1777 |
|
|
if (yyssp >= yysslim && yygrowstack()) |
1778 |
|
|
{ |
1779 |
|
|
goto yyoverflow; |
1780 |
|
|
} |
1781 |
|
|
*++yyssp = yystate; |
1782 |
|
|
*++yyvsp = yyval; |
1783 |
|
|
goto yyloop; |
1784 |
|
|
yyoverflow: |
1785 |
|
|
yyerror("yacc stack overflow"); |
1786 |
|
|
yyabort: |
1787 |
|
|
if (yyss) |
1788 |
|
|
free(yyss); |
1789 |
|
|
if (yyvs) |
1790 |
|
|
free(yyvs); |
1791 |
|
|
yyss = yyssp = NULL; |
1792 |
|
|
yyvs = yyvsp = NULL; |
1793 |
|
|
yystacksize = 0; |
1794 |
|
|
return (1); |
1795 |
|
|
yyaccept: |
1796 |
|
|
if (yyss) |
1797 |
|
|
free(yyss); |
1798 |
|
|
if (yyvs) |
1799 |
|
|
free(yyvs); |
1800 |
|
|
yyss = yyssp = NULL; |
1801 |
|
|
yyvs = yyvsp = NULL; |
1802 |
|
|
yystacksize = 0; |
1803 |
|
|
return (0); |
1804 |
|
|
} |