1 | /* A Bison parser, made from ./activation-context-query-parser.y |
---|
2 | by GNU bison 1.35. */ |
---|
3 | |
---|
4 | #define YYBISON 1 /* Identify Bison output. */ |
---|
5 | |
---|
6 | # define P_CONST_STRING 257 |
---|
7 | # define P_CONST_NUMBER 258 |
---|
8 | # define P_CONST_BOOLEAN 259 |
---|
9 | # define P_CONST_ID 260 |
---|
10 | # define LPAREN 261 |
---|
11 | # define RPAREN 262 |
---|
12 | # define LBRACKET 263 |
---|
13 | # define RBRACKET 264 |
---|
14 | # define P_NOT 265 |
---|
15 | # define P_NEGATE 266 |
---|
16 | # define P_DOLLAR 267 |
---|
17 | # define P_MULTIPLY 268 |
---|
18 | # define P_DIVIDE 269 |
---|
19 | # define P_ADD 270 |
---|
20 | # define P_SUBTRACT 271 |
---|
21 | # define P_EQ 272 |
---|
22 | # define P_NEQ 273 |
---|
23 | # define P_LEQ 274 |
---|
24 | # define P_GEQ 275 |
---|
25 | # define P_LT 276 |
---|
26 | # define P_GT 277 |
---|
27 | # define P_OR 278 |
---|
28 | # define P_AND 279 |
---|
29 | # define P_XOR 280 |
---|
30 | # define COMMA 281 |
---|
31 | # define PERIOD 282 |
---|
32 | # define PARSE_ERROR 283 |
---|
33 | |
---|
34 | #line 25 "./activation-context-query-parser.y" |
---|
35 | |
---|
36 | #include "activation-context-query.h" |
---|
37 | |
---|
38 | #include <glib.h> |
---|
39 | #include <stdlib.h> |
---|
40 | |
---|
41 | void yyerror(char *s); |
---|
42 | int yylex (); |
---|
43 | int yyparse (void); |
---|
44 | void initFlex (const char *s); |
---|
45 | |
---|
46 | static QueryExpr *parsed_expression; |
---|
47 | |
---|
48 | #line 39 "./activation-context-query-parser.y" |
---|
49 | #ifndef YYSTYPE |
---|
50 | typedef union |
---|
51 | { |
---|
52 | char *val_string; |
---|
53 | char **val_stringv; |
---|
54 | gdouble val_number; |
---|
55 | gboolean val_boolean; |
---|
56 | QueryExpr *qexp; |
---|
57 | GSList *elist; |
---|
58 | int val_enum; |
---|
59 | } yystype; |
---|
60 | # define YYSTYPE yystype |
---|
61 | # define YYSTYPE_IS_TRIVIAL 1 |
---|
62 | #endif |
---|
63 | #ifndef YYDEBUG |
---|
64 | # define YYDEBUG 0 |
---|
65 | #endif |
---|
66 | |
---|
67 | |
---|
68 | |
---|
69 | #define YYFINAL 60 |
---|
70 | #define YYFLAG -32768 |
---|
71 | #define YYNTBASE 30 |
---|
72 | |
---|
73 | /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ |
---|
74 | #define YYTRANSLATE(x) ((unsigned)(x) <= 283 ? yytranslate[x] : 44) |
---|
75 | |
---|
76 | /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ |
---|
77 | static const char yytranslate[] = |
---|
78 | { |
---|
79 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
80 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
81 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
82 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
83 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
84 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
85 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
86 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
87 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
88 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
89 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
90 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
91 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
92 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
93 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
94 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
95 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
96 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
97 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
98 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
99 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
100 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
101 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
102 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
103 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
---|
104 | 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, |
---|
105 | 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, |
---|
106 | 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, |
---|
107 | 26, 27, 28, 29 |
---|
108 | }; |
---|
109 | |
---|
110 | #if YYDEBUG |
---|
111 | static const short yyprhs[] = |
---|
112 | { |
---|
113 | 0, 0, 2, 4, 6, 8, 12, 14, 16, 18, |
---|
114 | 20, 22, 24, 28, 30, 32, 34, 36, 38, 40, |
---|
115 | 42, 44, 46, 48, 50, 52, 54, 58, 61, 64, |
---|
116 | 66, 68, 70, 72, 76, 78, 82, 85, 90, 94, |
---|
117 | 101, 107 |
---|
118 | }; |
---|
119 | static const short yyrhs[] = |
---|
120 | { |
---|
121 | 31, 0, 36, 0, 33, 0, 31, 0, 31, 27, |
---|
122 | 32, 0, 37, 0, 34, 0, 38, 0, 41, 0, |
---|
123 | 42, 0, 43, 0, 7, 31, 8, 0, 14, 0, |
---|
124 | 15, 0, 17, 0, 16, 0, 18, 0, 19, 0, |
---|
125 | 20, 0, 21, 0, 23, 0, 22, 0, 24, 0, |
---|
126 | 25, 0, 26, 0, 33, 35, 31, 0, 11, 33, |
---|
127 | 0, 17, 33, 0, 3, 0, 4, 0, 5, 0, |
---|
128 | 39, 0, 9, 40, 10, 0, 3, 0, 40, 27, |
---|
129 | 3, 0, 13, 6, 0, 6, 7, 32, 8, 0, |
---|
130 | 6, 7, 8, 0, 6, 28, 6, 7, 32, 8, |
---|
131 | 0, 6, 28, 6, 7, 8, 0, 6, 0 |
---|
132 | }; |
---|
133 | |
---|
134 | #endif |
---|
135 | |
---|
136 | #if YYDEBUG |
---|
137 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
---|
138 | static const short yyrline[] = |
---|
139 | { |
---|
140 | 0, 82, 84, 85, 87, 88, 90, 90, 90, 90, |
---|
141 | 90, 90, 92, 94, 95, 96, 97, 98, 99, 100, |
---|
142 | 101, 102, 103, 104, 105, 106, 108, 110, 111, 113, |
---|
143 | 119, 125, 131, 138, 155, 156, 158, 160, 161, 162, |
---|
144 | 164, 167 |
---|
145 | }; |
---|
146 | #endif |
---|
147 | |
---|
148 | |
---|
149 | #if (YYDEBUG) || defined YYERROR_VERBOSE |
---|
150 | |
---|
151 | /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ |
---|
152 | static const char *const yytname[] = |
---|
153 | { |
---|
154 | "$", "error", "$undefined.", "P_CONST_STRING", "P_CONST_NUMBER", |
---|
155 | "P_CONST_BOOLEAN", "P_CONST_ID", "LPAREN", "RPAREN", "LBRACKET", |
---|
156 | "RBRACKET", "P_NOT", "P_NEGATE", "P_DOLLAR", "P_MULTIPLY", "P_DIVIDE", |
---|
157 | "P_ADD", "P_SUBTRACT", "P_EQ", "P_NEQ", "P_LEQ", "P_GEQ", "P_LT", |
---|
158 | "P_GT", "P_OR", "P_AND", "P_XOR", "COMMA", "PERIOD", "PARSE_ERROR", |
---|
159 | "whole_expression", "expr", "exprlist", "expr_obvious", "expr_sub", |
---|
160 | "binop", "expr_binop", "expr_unop", "expr_constant", "expr_stringv", |
---|
161 | "stringlist", "expr_variable", "expr_function", "expr_id", 0 |
---|
162 | }; |
---|
163 | #endif |
---|
164 | |
---|
165 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
---|
166 | static const short yyr1[] = |
---|
167 | { |
---|
168 | 0, 30, 31, 31, 32, 32, 33, 33, 33, 33, |
---|
169 | 33, 33, 34, 35, 35, 35, 35, 35, 35, 35, |
---|
170 | 35, 35, 35, 35, 35, 35, 36, 37, 37, 38, |
---|
171 | 38, 38, 38, 39, 40, 40, 41, 42, 42, 42, |
---|
172 | 42, 43 |
---|
173 | }; |
---|
174 | |
---|
175 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
---|
176 | static const short yyr2[] = |
---|
177 | { |
---|
178 | 0, 1, 1, 1, 1, 3, 1, 1, 1, 1, |
---|
179 | 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, |
---|
180 | 1, 1, 1, 1, 1, 1, 3, 2, 2, 1, |
---|
181 | 1, 1, 1, 3, 1, 3, 2, 4, 3, 6, |
---|
182 | 5, 1 |
---|
183 | }; |
---|
184 | |
---|
185 | /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE |
---|
186 | doesn't specify something else to do. Zero means the default is an |
---|
187 | error. */ |
---|
188 | static const short yydefact[] = |
---|
189 | { |
---|
190 | 0, 29, 30, 31, 41, 0, 0, 0, 0, 0, |
---|
191 | 1, 3, 7, 2, 6, 8, 32, 9, 10, 11, |
---|
192 | 0, 0, 0, 34, 0, 27, 36, 28, 13, 14, |
---|
193 | 16, 15, 17, 18, 19, 20, 22, 21, 23, 24, |
---|
194 | 25, 0, 38, 4, 0, 0, 12, 33, 0, 26, |
---|
195 | 0, 37, 0, 35, 5, 40, 0, 39, 0, 0, |
---|
196 | 0 |
---|
197 | }; |
---|
198 | |
---|
199 | static const short yydefgoto[] = |
---|
200 | { |
---|
201 | 58, 43, 44, 11, 12, 41, 13, 14, 15, 16, |
---|
202 | 24, 17, 18, 19 |
---|
203 | }; |
---|
204 | |
---|
205 | static const short yypact[] = |
---|
206 | { |
---|
207 | 39,-32768,-32768,-32768, -6, 39, 1, 39, -3, 39, |
---|
208 | -32768, 43,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, |
---|
209 | 3, 11, 10,-32768, -8,-32768,-32768,-32768,-32768,-32768, |
---|
210 | -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, |
---|
211 | -32768, 39,-32768, 7, 13, 28,-32768,-32768, 33,-32768, |
---|
212 | 39,-32768, 20,-32768,-32768,-32768, 30,-32768, 40, 47, |
---|
213 | -32768 |
---|
214 | }; |
---|
215 | |
---|
216 | static const short yypgoto[] = |
---|
217 | { |
---|
218 | -32768, 0, -37, 23,-32768,-32768,-32768,-32768,-32768,-32768, |
---|
219 | -32768,-32768,-32768,-32768 |
---|
220 | }; |
---|
221 | |
---|
222 | |
---|
223 | #define YYLAST 69 |
---|
224 | |
---|
225 | |
---|
226 | static const short yytable[] = |
---|
227 | { |
---|
228 | 10, 20, 47, 26, 23, 22, 1, 2, 3, 4, |
---|
229 | 5, 42, 6, 54, 7, 56, 8, 45, 46, 48, |
---|
230 | 9, 51, 21, 1, 2, 3, 4, 5, 55, 6, |
---|
231 | 25, 7, 27, 8, 50, 52, 53, 9, 57, 0, |
---|
232 | 59, 49, 1, 2, 3, 4, 5, 60, 6, 0, |
---|
233 | 7, 0, 8, 0, 0, 0, 9, 28, 29, 30, |
---|
234 | 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 |
---|
235 | }; |
---|
236 | |
---|
237 | static const short yycheck[] = |
---|
238 | { |
---|
239 | 0, 7, 10, 6, 3, 5, 3, 4, 5, 6, |
---|
240 | 7, 8, 9, 50, 11, 52, 13, 6, 8, 27, |
---|
241 | 17, 8, 28, 3, 4, 5, 6, 7, 8, 9, |
---|
242 | 7, 11, 9, 13, 27, 7, 3, 17, 8, -1, |
---|
243 | 0, 41, 3, 4, 5, 6, 7, 0, 9, -1, |
---|
244 | 11, -1, 13, -1, -1, -1, 17, 14, 15, 16, |
---|
245 | 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 |
---|
246 | }; |
---|
247 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ |
---|
248 | #line 3 "/usr/share/bison/bison.simple" |
---|
249 | |
---|
250 | /* Skeleton output parser for bison, |
---|
251 | |
---|
252 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software |
---|
253 | Foundation, Inc. |
---|
254 | |
---|
255 | This program is free software; you can redistribute it and/or modify |
---|
256 | it under the terms of the GNU General Public License as published by |
---|
257 | the Free Software Foundation; either version 2, or (at your option) |
---|
258 | any later version. |
---|
259 | |
---|
260 | This program is distributed in the hope that it will be useful, |
---|
261 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
262 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
263 | GNU General Public License for more details. |
---|
264 | |
---|
265 | You should have received a copy of the GNU General Public License |
---|
266 | along with this program; if not, write to the Free Software |
---|
267 | Foundation, Inc., 59 Temple Place - Suite 330, |
---|
268 | Boston, MA 02111-1307, USA. */ |
---|
269 | |
---|
270 | /* As a special exception, when this file is copied by Bison into a |
---|
271 | Bison output file, you may use that output file without restriction. |
---|
272 | This special exception was added by the Free Software Foundation |
---|
273 | in version 1.24 of Bison. */ |
---|
274 | |
---|
275 | /* This is the parser code that is written into each bison parser when |
---|
276 | the %semantic_parser declaration is not specified in the grammar. |
---|
277 | It was written by Richard Stallman by simplifying the hairy parser |
---|
278 | used when %semantic_parser is specified. */ |
---|
279 | |
---|
280 | /* All symbols defined below should begin with yy or YY, to avoid |
---|
281 | infringing on user name space. This should be done even for local |
---|
282 | variables, as they might otherwise be expanded by user macros. |
---|
283 | There are some unavoidable exceptions within include files to |
---|
284 | define necessary library symbols; they are noted "INFRINGES ON |
---|
285 | USER NAME SPACE" below. */ |
---|
286 | |
---|
287 | #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) |
---|
288 | |
---|
289 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
---|
290 | |
---|
291 | # if YYSTACK_USE_ALLOCA |
---|
292 | # define YYSTACK_ALLOC alloca |
---|
293 | # else |
---|
294 | # ifndef YYSTACK_USE_ALLOCA |
---|
295 | # if defined (alloca) || defined (_ALLOCA_H) |
---|
296 | # define YYSTACK_ALLOC alloca |
---|
297 | # else |
---|
298 | # ifdef __GNUC__ |
---|
299 | # define YYSTACK_ALLOC __builtin_alloca |
---|
300 | # endif |
---|
301 | # endif |
---|
302 | # endif |
---|
303 | # endif |
---|
304 | |
---|
305 | # ifdef YYSTACK_ALLOC |
---|
306 | /* Pacify GCC's `empty if-body' warning. */ |
---|
307 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
---|
308 | # else |
---|
309 | # if defined (__STDC__) || defined (__cplusplus) |
---|
310 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ |
---|
311 | # define YYSIZE_T size_t |
---|
312 | # endif |
---|
313 | # define YYSTACK_ALLOC malloc |
---|
314 | # define YYSTACK_FREE free |
---|
315 | # endif |
---|
316 | #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ |
---|
317 | |
---|
318 | |
---|
319 | #if (! defined (yyoverflow) \ |
---|
320 | && (! defined (__cplusplus) \ |
---|
321 | || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) |
---|
322 | |
---|
323 | /* A type that is properly aligned for any stack member. */ |
---|
324 | union yyalloc |
---|
325 | { |
---|
326 | short yyss; |
---|
327 | YYSTYPE yyvs; |
---|
328 | # if YYLSP_NEEDED |
---|
329 | YYLTYPE yyls; |
---|
330 | # endif |
---|
331 | }; |
---|
332 | |
---|
333 | /* The size of the maximum gap between one aligned stack and the next. */ |
---|
334 | # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) |
---|
335 | |
---|
336 | /* The size of an array large to enough to hold all stacks, each with |
---|
337 | N elements. */ |
---|
338 | # if YYLSP_NEEDED |
---|
339 | # define YYSTACK_BYTES(N) \ |
---|
340 | ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ |
---|
341 | + 2 * YYSTACK_GAP_MAX) |
---|
342 | # else |
---|
343 | # define YYSTACK_BYTES(N) \ |
---|
344 | ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ |
---|
345 | + YYSTACK_GAP_MAX) |
---|
346 | # endif |
---|
347 | |
---|
348 | /* Copy COUNT objects from FROM to TO. The source and destination do |
---|
349 | not overlap. */ |
---|
350 | # ifndef YYCOPY |
---|
351 | # if 1 < __GNUC__ |
---|
352 | # define YYCOPY(To, From, Count) \ |
---|
353 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) |
---|
354 | # else |
---|
355 | # define YYCOPY(To, From, Count) \ |
---|
356 | do \ |
---|
357 | { \ |
---|
358 | register YYSIZE_T yyi; \ |
---|
359 | for (yyi = 0; yyi < (Count); yyi++) \ |
---|
360 | (To)[yyi] = (From)[yyi]; \ |
---|
361 | } \ |
---|
362 | while (0) |
---|
363 | # endif |
---|
364 | # endif |
---|
365 | |
---|
366 | /* Relocate STACK from its old location to the new one. The |
---|
367 | local variables YYSIZE and YYSTACKSIZE give the old and new number of |
---|
368 | elements in the stack, and YYPTR gives the new location of the |
---|
369 | stack. Advance YYPTR to a properly aligned location for the next |
---|
370 | stack. */ |
---|
371 | # define YYSTACK_RELOCATE(Stack) \ |
---|
372 | do \ |
---|
373 | { \ |
---|
374 | YYSIZE_T yynewbytes; \ |
---|
375 | YYCOPY (&yyptr->Stack, Stack, yysize); \ |
---|
376 | Stack = &yyptr->Stack; \ |
---|
377 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ |
---|
378 | yyptr += yynewbytes / sizeof (*yyptr); \ |
---|
379 | } \ |
---|
380 | while (0) |
---|
381 | |
---|
382 | #endif |
---|
383 | |
---|
384 | |
---|
385 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) |
---|
386 | # define YYSIZE_T __SIZE_TYPE__ |
---|
387 | #endif |
---|
388 | #if ! defined (YYSIZE_T) && defined (size_t) |
---|
389 | # define YYSIZE_T size_t |
---|
390 | #endif |
---|
391 | #if ! defined (YYSIZE_T) |
---|
392 | # if defined (__STDC__) || defined (__cplusplus) |
---|
393 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
---|
394 | # define YYSIZE_T size_t |
---|
395 | # endif |
---|
396 | #endif |
---|
397 | #if ! defined (YYSIZE_T) |
---|
398 | # define YYSIZE_T unsigned int |
---|
399 | #endif |
---|
400 | |
---|
401 | #define yyerrok (yyerrstatus = 0) |
---|
402 | #define yyclearin (yychar = YYEMPTY) |
---|
403 | #define YYEMPTY -2 |
---|
404 | #define YYEOF 0 |
---|
405 | #define YYACCEPT goto yyacceptlab |
---|
406 | #define YYABORT goto yyabortlab |
---|
407 | #define YYERROR goto yyerrlab1 |
---|
408 | /* Like YYERROR except do call yyerror. This remains here temporarily |
---|
409 | to ease the transition to the new meaning of YYERROR, for GCC. |
---|
410 | Once GCC version 2 has supplanted version 1, this can go. */ |
---|
411 | #define YYFAIL goto yyerrlab |
---|
412 | #define YYRECOVERING() (!!yyerrstatus) |
---|
413 | #define YYBACKUP(Token, Value) \ |
---|
414 | do \ |
---|
415 | if (yychar == YYEMPTY && yylen == 1) \ |
---|
416 | { \ |
---|
417 | yychar = (Token); \ |
---|
418 | yylval = (Value); \ |
---|
419 | yychar1 = YYTRANSLATE (yychar); \ |
---|
420 | YYPOPSTACK; \ |
---|
421 | goto yybackup; \ |
---|
422 | } \ |
---|
423 | else \ |
---|
424 | { \ |
---|
425 | yyerror ("syntax error: cannot back up"); \ |
---|
426 | YYERROR; \ |
---|
427 | } \ |
---|
428 | while (0) |
---|
429 | |
---|
430 | #define YYTERROR 1 |
---|
431 | #define YYERRCODE 256 |
---|
432 | |
---|
433 | |
---|
434 | /* YYLLOC_DEFAULT -- Compute the default location (before the actions |
---|
435 | are run). |
---|
436 | |
---|
437 | When YYLLOC_DEFAULT is run, CURRENT is set the location of the |
---|
438 | first token. By default, to implement support for ranges, extend |
---|
439 | its range to the last symbol. */ |
---|
440 | |
---|
441 | #ifndef YYLLOC_DEFAULT |
---|
442 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ |
---|
443 | Current.last_line = Rhs[N].last_line; \ |
---|
444 | Current.last_column = Rhs[N].last_column; |
---|
445 | #endif |
---|
446 | |
---|
447 | |
---|
448 | /* YYLEX -- calling `yylex' with the right arguments. */ |
---|
449 | |
---|
450 | #if YYPURE |
---|
451 | # if YYLSP_NEEDED |
---|
452 | # ifdef YYLEX_PARAM |
---|
453 | # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) |
---|
454 | # else |
---|
455 | # define YYLEX yylex (&yylval, &yylloc) |
---|
456 | # endif |
---|
457 | # else /* !YYLSP_NEEDED */ |
---|
458 | # ifdef YYLEX_PARAM |
---|
459 | # define YYLEX yylex (&yylval, YYLEX_PARAM) |
---|
460 | # else |
---|
461 | # define YYLEX yylex (&yylval) |
---|
462 | # endif |
---|
463 | # endif /* !YYLSP_NEEDED */ |
---|
464 | #else /* !YYPURE */ |
---|
465 | # define YYLEX yylex () |
---|
466 | #endif /* !YYPURE */ |
---|
467 | |
---|
468 | |
---|
469 | /* Enable debugging if requested. */ |
---|
470 | #if YYDEBUG |
---|
471 | |
---|
472 | # ifndef YYFPRINTF |
---|
473 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ |
---|
474 | # define YYFPRINTF fprintf |
---|
475 | # endif |
---|
476 | |
---|
477 | # define YYDPRINTF(Args) \ |
---|
478 | do { \ |
---|
479 | if (yydebug) \ |
---|
480 | YYFPRINTF Args; \ |
---|
481 | } while (0) |
---|
482 | /* Nonzero means print parse trace. It is left uninitialized so that |
---|
483 | multiple parsers can coexist. */ |
---|
484 | int yydebug; |
---|
485 | #else /* !YYDEBUG */ |
---|
486 | # define YYDPRINTF(Args) |
---|
487 | #endif /* !YYDEBUG */ |
---|
488 | |
---|
489 | /* YYINITDEPTH -- initial size of the parser's stacks. */ |
---|
490 | #ifndef YYINITDEPTH |
---|
491 | # define YYINITDEPTH 200 |
---|
492 | #endif |
---|
493 | |
---|
494 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
---|
495 | if the built-in stack extension method is used). |
---|
496 | |
---|
497 | Do not make this value too large; the results are undefined if |
---|
498 | SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) |
---|
499 | evaluated with infinite-precision integer arithmetic. */ |
---|
500 | |
---|
501 | #if YYMAXDEPTH == 0 |
---|
502 | # undef YYMAXDEPTH |
---|
503 | #endif |
---|
504 | |
---|
505 | #ifndef YYMAXDEPTH |
---|
506 | # define YYMAXDEPTH 10000 |
---|
507 | #endif |
---|
508 | |
---|
509 | #ifdef YYERROR_VERBOSE |
---|
510 | |
---|
511 | # ifndef yystrlen |
---|
512 | # if defined (__GLIBC__) && defined (_STRING_H) |
---|
513 | # define yystrlen strlen |
---|
514 | # else |
---|
515 | /* Return the length of YYSTR. */ |
---|
516 | static YYSIZE_T |
---|
517 | # if defined (__STDC__) || defined (__cplusplus) |
---|
518 | yystrlen (const char *yystr) |
---|
519 | # else |
---|
520 | yystrlen (yystr) |
---|
521 | const char *yystr; |
---|
522 | # endif |
---|
523 | { |
---|
524 | register const char *yys = yystr; |
---|
525 | |
---|
526 | while (*yys++ != '\0') |
---|
527 | continue; |
---|
528 | |
---|
529 | return yys - yystr - 1; |
---|
530 | } |
---|
531 | # endif |
---|
532 | # endif |
---|
533 | |
---|
534 | # ifndef yystpcpy |
---|
535 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) |
---|
536 | # define yystpcpy stpcpy |
---|
537 | # else |
---|
538 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in |
---|
539 | YYDEST. */ |
---|
540 | static char * |
---|
541 | # if defined (__STDC__) || defined (__cplusplus) |
---|
542 | yystpcpy (char *yydest, const char *yysrc) |
---|
543 | # else |
---|
544 | yystpcpy (yydest, yysrc) |
---|
545 | char *yydest; |
---|
546 | const char *yysrc; |
---|
547 | # endif |
---|
548 | { |
---|
549 | register char *yyd = yydest; |
---|
550 | register const char *yys = yysrc; |
---|
551 | |
---|
552 | while ((*yyd++ = *yys++) != '\0') |
---|
553 | continue; |
---|
554 | |
---|
555 | return yyd - 1; |
---|
556 | } |
---|
557 | # endif |
---|
558 | # endif |
---|
559 | #endif |
---|
560 | |
---|
561 | #line 315 "/usr/share/bison/bison.simple" |
---|
562 | |
---|
563 | |
---|
564 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed |
---|
565 | into yyparse. The argument should have type void *. |
---|
566 | It should actually point to an object. |
---|
567 | Grammar actions can access the variable by casting it |
---|
568 | to the proper pointer type. */ |
---|
569 | |
---|
570 | #ifdef YYPARSE_PARAM |
---|
571 | # if defined (__STDC__) || defined (__cplusplus) |
---|
572 | # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM |
---|
573 | # define YYPARSE_PARAM_DECL |
---|
574 | # else |
---|
575 | # define YYPARSE_PARAM_ARG YYPARSE_PARAM |
---|
576 | # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; |
---|
577 | # endif |
---|
578 | #else /* !YYPARSE_PARAM */ |
---|
579 | # define YYPARSE_PARAM_ARG |
---|
580 | # define YYPARSE_PARAM_DECL |
---|
581 | #endif /* !YYPARSE_PARAM */ |
---|
582 | |
---|
583 | /* Prevent warning if -Wstrict-prototypes. */ |
---|
584 | #ifdef __GNUC__ |
---|
585 | # ifdef YYPARSE_PARAM |
---|
586 | int yyparse (void *); |
---|
587 | # else |
---|
588 | int yyparse (void); |
---|
589 | # endif |
---|
590 | #endif |
---|
591 | |
---|
592 | /* YY_DECL_VARIABLES -- depending whether we use a pure parser, |
---|
593 | variables are global, or local to YYPARSE. */ |
---|
594 | |
---|
595 | #define YY_DECL_NON_LSP_VARIABLES \ |
---|
596 | /* The lookahead symbol. */ \ |
---|
597 | int yychar; \ |
---|
598 | \ |
---|
599 | /* The semantic value of the lookahead symbol. */ \ |
---|
600 | YYSTYPE yylval; \ |
---|
601 | \ |
---|
602 | /* Number of parse errors so far. */ \ |
---|
603 | int yynerrs; |
---|
604 | |
---|
605 | #if YYLSP_NEEDED |
---|
606 | # define YY_DECL_VARIABLES \ |
---|
607 | YY_DECL_NON_LSP_VARIABLES \ |
---|
608 | \ |
---|
609 | /* Location data for the lookahead symbol. */ \ |
---|
610 | YYLTYPE yylloc; |
---|
611 | #else |
---|
612 | # define YY_DECL_VARIABLES \ |
---|
613 | YY_DECL_NON_LSP_VARIABLES |
---|
614 | #endif |
---|
615 | |
---|
616 | |
---|
617 | /* If nonreentrant, generate the variables here. */ |
---|
618 | |
---|
619 | #if !YYPURE |
---|
620 | YY_DECL_VARIABLES |
---|
621 | #endif /* !YYPURE */ |
---|
622 | |
---|
623 | int |
---|
624 | yyparse (YYPARSE_PARAM_ARG) |
---|
625 | YYPARSE_PARAM_DECL |
---|
626 | { |
---|
627 | /* If reentrant, generate the variables here. */ |
---|
628 | #if YYPURE |
---|
629 | YY_DECL_VARIABLES |
---|
630 | #endif /* !YYPURE */ |
---|
631 | |
---|
632 | register int yystate; |
---|
633 | register int yyn; |
---|
634 | int yyresult; |
---|
635 | /* Number of tokens to shift before error messages enabled. */ |
---|
636 | int yyerrstatus; |
---|
637 | /* Lookahead token as an internal (translated) token number. */ |
---|
638 | int yychar1 = 0; |
---|
639 | |
---|
640 | /* Three stacks and their tools: |
---|
641 | `yyss': related to states, |
---|
642 | `yyvs': related to semantic values, |
---|
643 | `yyls': related to locations. |
---|
644 | |
---|
645 | Refer to the stacks thru separate pointers, to allow yyoverflow |
---|
646 | to reallocate them elsewhere. */ |
---|
647 | |
---|
648 | /* The state stack. */ |
---|
649 | short yyssa[YYINITDEPTH]; |
---|
650 | short *yyss = yyssa; |
---|
651 | register short *yyssp; |
---|
652 | |
---|
653 | /* The semantic value stack. */ |
---|
654 | YYSTYPE yyvsa[YYINITDEPTH]; |
---|
655 | YYSTYPE *yyvs = yyvsa; |
---|
656 | register YYSTYPE *yyvsp; |
---|
657 | |
---|
658 | #if YYLSP_NEEDED |
---|
659 | /* The location stack. */ |
---|
660 | YYLTYPE yylsa[YYINITDEPTH]; |
---|
661 | YYLTYPE *yyls = yylsa; |
---|
662 | YYLTYPE *yylsp; |
---|
663 | #endif |
---|
664 | |
---|
665 | #if YYLSP_NEEDED |
---|
666 | # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) |
---|
667 | #else |
---|
668 | # define YYPOPSTACK (yyvsp--, yyssp--) |
---|
669 | #endif |
---|
670 | |
---|
671 | YYSIZE_T yystacksize = YYINITDEPTH; |
---|
672 | |
---|
673 | |
---|
674 | /* The variables used to return semantic value and location from the |
---|
675 | action routines. */ |
---|
676 | YYSTYPE yyval; |
---|
677 | #if YYLSP_NEEDED |
---|
678 | YYLTYPE yyloc; |
---|
679 | #endif |
---|
680 | |
---|
681 | /* When reducing, the number of symbols on the RHS of the reduced |
---|
682 | rule. */ |
---|
683 | int yylen; |
---|
684 | |
---|
685 | YYDPRINTF ((stderr, "Starting parse\n")); |
---|
686 | |
---|
687 | yystate = 0; |
---|
688 | yyerrstatus = 0; |
---|
689 | yynerrs = 0; |
---|
690 | yychar = YYEMPTY; /* Cause a token to be read. */ |
---|
691 | |
---|
692 | /* Initialize stack pointers. |
---|
693 | Waste one element of value and location stack |
---|
694 | so that they stay on the same level as the state stack. |
---|
695 | The wasted elements are never initialized. */ |
---|
696 | |
---|
697 | yyssp = yyss; |
---|
698 | yyvsp = yyvs; |
---|
699 | #if YYLSP_NEEDED |
---|
700 | yylsp = yyls; |
---|
701 | #endif |
---|
702 | goto yysetstate; |
---|
703 | |
---|
704 | /*------------------------------------------------------------. |
---|
705 | | yynewstate -- Push a new state, which is found in yystate. | |
---|
706 | `------------------------------------------------------------*/ |
---|
707 | yynewstate: |
---|
708 | /* In all cases, when you get here, the value and location stacks |
---|
709 | have just been pushed. so pushing a state here evens the stacks. |
---|
710 | */ |
---|
711 | yyssp++; |
---|
712 | |
---|
713 | yysetstate: |
---|
714 | *yyssp = yystate; |
---|
715 | |
---|
716 | if (yyssp >= yyss + yystacksize - 1) |
---|
717 | { |
---|
718 | /* Get the current used size of the three stacks, in elements. */ |
---|
719 | YYSIZE_T yysize = yyssp - yyss + 1; |
---|
720 | |
---|
721 | #ifdef yyoverflow |
---|
722 | { |
---|
723 | /* Give user a chance to reallocate the stack. Use copies of |
---|
724 | these so that the &'s don't force the real ones into |
---|
725 | memory. */ |
---|
726 | YYSTYPE *yyvs1 = yyvs; |
---|
727 | short *yyss1 = yyss; |
---|
728 | |
---|
729 | /* Each stack pointer address is followed by the size of the |
---|
730 | data in use in that stack, in bytes. */ |
---|
731 | # if YYLSP_NEEDED |
---|
732 | YYLTYPE *yyls1 = yyls; |
---|
733 | /* This used to be a conditional around just the two extra args, |
---|
734 | but that might be undefined if yyoverflow is a macro. */ |
---|
735 | yyoverflow ("parser stack overflow", |
---|
736 | &yyss1, yysize * sizeof (*yyssp), |
---|
737 | &yyvs1, yysize * sizeof (*yyvsp), |
---|
738 | &yyls1, yysize * sizeof (*yylsp), |
---|
739 | &yystacksize); |
---|
740 | yyls = yyls1; |
---|
741 | # else |
---|
742 | yyoverflow ("parser stack overflow", |
---|
743 | &yyss1, yysize * sizeof (*yyssp), |
---|
744 | &yyvs1, yysize * sizeof (*yyvsp), |
---|
745 | &yystacksize); |
---|
746 | # endif |
---|
747 | yyss = yyss1; |
---|
748 | yyvs = yyvs1; |
---|
749 | } |
---|
750 | #else /* no yyoverflow */ |
---|
751 | # ifndef YYSTACK_RELOCATE |
---|
752 | goto yyoverflowlab; |
---|
753 | # else |
---|
754 | /* Extend the stack our own way. */ |
---|
755 | if (yystacksize >= YYMAXDEPTH) |
---|
756 | goto yyoverflowlab; |
---|
757 | yystacksize *= 2; |
---|
758 | if (yystacksize > YYMAXDEPTH) |
---|
759 | yystacksize = YYMAXDEPTH; |
---|
760 | |
---|
761 | { |
---|
762 | short *yyss1 = yyss; |
---|
763 | union yyalloc *yyptr = |
---|
764 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
---|
765 | if (! yyptr) |
---|
766 | goto yyoverflowlab; |
---|
767 | YYSTACK_RELOCATE (yyss); |
---|
768 | YYSTACK_RELOCATE (yyvs); |
---|
769 | # if YYLSP_NEEDED |
---|
770 | YYSTACK_RELOCATE (yyls); |
---|
771 | # endif |
---|
772 | # undef YYSTACK_RELOCATE |
---|
773 | if (yyss1 != yyssa) |
---|
774 | YYSTACK_FREE (yyss1); |
---|
775 | } |
---|
776 | # endif |
---|
777 | #endif /* no yyoverflow */ |
---|
778 | |
---|
779 | yyssp = yyss + yysize - 1; |
---|
780 | yyvsp = yyvs + yysize - 1; |
---|
781 | #if YYLSP_NEEDED |
---|
782 | yylsp = yyls + yysize - 1; |
---|
783 | #endif |
---|
784 | |
---|
785 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
---|
786 | (unsigned long int) yystacksize)); |
---|
787 | |
---|
788 | if (yyssp >= yyss + yystacksize - 1) |
---|
789 | YYABORT; |
---|
790 | } |
---|
791 | |
---|
792 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
---|
793 | |
---|
794 | goto yybackup; |
---|
795 | |
---|
796 | |
---|
797 | /*-----------. |
---|
798 | | yybackup. | |
---|
799 | `-----------*/ |
---|
800 | yybackup: |
---|
801 | |
---|
802 | /* Do appropriate processing given the current state. */ |
---|
803 | /* Read a lookahead token if we need one and don't already have one. */ |
---|
804 | /* yyresume: */ |
---|
805 | |
---|
806 | /* First try to decide what to do without reference to lookahead token. */ |
---|
807 | |
---|
808 | yyn = yypact[yystate]; |
---|
809 | if (yyn == YYFLAG) |
---|
810 | goto yydefault; |
---|
811 | |
---|
812 | /* Not known => get a lookahead token if don't already have one. */ |
---|
813 | |
---|
814 | /* yychar is either YYEMPTY or YYEOF |
---|
815 | or a valid token in external form. */ |
---|
816 | |
---|
817 | if (yychar == YYEMPTY) |
---|
818 | { |
---|
819 | YYDPRINTF ((stderr, "Reading a token: ")); |
---|
820 | yychar = YYLEX; |
---|
821 | } |
---|
822 | |
---|
823 | /* Convert token to internal form (in yychar1) for indexing tables with */ |
---|
824 | |
---|
825 | if (yychar <= 0) /* This means end of input. */ |
---|
826 | { |
---|
827 | yychar1 = 0; |
---|
828 | yychar = YYEOF; /* Don't call YYLEX any more */ |
---|
829 | |
---|
830 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
---|
831 | } |
---|
832 | else |
---|
833 | { |
---|
834 | yychar1 = YYTRANSLATE (yychar); |
---|
835 | |
---|
836 | #if YYDEBUG |
---|
837 | /* We have to keep this `#if YYDEBUG', since we use variables |
---|
838 | which are defined only if `YYDEBUG' is set. */ |
---|
839 | if (yydebug) |
---|
840 | { |
---|
841 | YYFPRINTF (stderr, "Next token is %d (%s", |
---|
842 | yychar, yytname[yychar1]); |
---|
843 | /* Give the individual parser a way to print the precise |
---|
844 | meaning of a token, for further debugging info. */ |
---|
845 | # ifdef YYPRINT |
---|
846 | YYPRINT (stderr, yychar, yylval); |
---|
847 | # endif |
---|
848 | YYFPRINTF (stderr, ")\n"); |
---|
849 | } |
---|
850 | #endif |
---|
851 | } |
---|
852 | |
---|
853 | yyn += yychar1; |
---|
854 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) |
---|
855 | goto yydefault; |
---|
856 | |
---|
857 | yyn = yytable[yyn]; |
---|
858 | |
---|
859 | /* yyn is what to do for this token type in this state. |
---|
860 | Negative => reduce, -yyn is rule number. |
---|
861 | Positive => shift, yyn is new state. |
---|
862 | New state is final state => don't bother to shift, |
---|
863 | just return success. |
---|
864 | 0, or most negative number => error. */ |
---|
865 | |
---|
866 | if (yyn < 0) |
---|
867 | { |
---|
868 | if (yyn == YYFLAG) |
---|
869 | goto yyerrlab; |
---|
870 | yyn = -yyn; |
---|
871 | goto yyreduce; |
---|
872 | } |
---|
873 | else if (yyn == 0) |
---|
874 | goto yyerrlab; |
---|
875 | |
---|
876 | if (yyn == YYFINAL) |
---|
877 | YYACCEPT; |
---|
878 | |
---|
879 | /* Shift the lookahead token. */ |
---|
880 | YYDPRINTF ((stderr, "Shifting token %d (%s), ", |
---|
881 | yychar, yytname[yychar1])); |
---|
882 | |
---|
883 | /* Discard the token being shifted unless it is eof. */ |
---|
884 | if (yychar != YYEOF) |
---|
885 | yychar = YYEMPTY; |
---|
886 | |
---|
887 | *++yyvsp = yylval; |
---|
888 | #if YYLSP_NEEDED |
---|
889 | *++yylsp = yylloc; |
---|
890 | #endif |
---|
891 | |
---|
892 | /* Count tokens shifted since error; after three, turn off error |
---|
893 | status. */ |
---|
894 | if (yyerrstatus) |
---|
895 | yyerrstatus--; |
---|
896 | |
---|
897 | yystate = yyn; |
---|
898 | goto yynewstate; |
---|
899 | |
---|
900 | |
---|
901 | /*-----------------------------------------------------------. |
---|
902 | | yydefault -- do the default action for the current state. | |
---|
903 | `-----------------------------------------------------------*/ |
---|
904 | yydefault: |
---|
905 | yyn = yydefact[yystate]; |
---|
906 | if (yyn == 0) |
---|
907 | goto yyerrlab; |
---|
908 | goto yyreduce; |
---|
909 | |
---|
910 | |
---|
911 | /*-----------------------------. |
---|
912 | | yyreduce -- Do a reduction. | |
---|
913 | `-----------------------------*/ |
---|
914 | yyreduce: |
---|
915 | /* yyn is the number of a rule to reduce with. */ |
---|
916 | yylen = yyr2[yyn]; |
---|
917 | |
---|
918 | /* If YYLEN is nonzero, implement the default value of the action: |
---|
919 | `$$ = $1'. |
---|
920 | |
---|
921 | Otherwise, the following line sets YYVAL to the semantic value of |
---|
922 | the lookahead token. This behavior is undocumented and Bison |
---|
923 | users should not rely upon it. Assigning to YYVAL |
---|
924 | unconditionally makes the parser a bit smaller, and it avoids a |
---|
925 | GCC warning that YYVAL may be used uninitialized. */ |
---|
926 | yyval = yyvsp[1-yylen]; |
---|
927 | |
---|
928 | #if YYLSP_NEEDED |
---|
929 | /* Similarly for the default location. Let the user run additional |
---|
930 | commands if for instance locations are ranges. */ |
---|
931 | yyloc = yylsp[1-yylen]; |
---|
932 | YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); |
---|
933 | #endif |
---|
934 | |
---|
935 | #if YYDEBUG |
---|
936 | /* We have to keep this `#if YYDEBUG', since we use variables which |
---|
937 | are defined only if `YYDEBUG' is set. */ |
---|
938 | if (yydebug) |
---|
939 | { |
---|
940 | int yyi; |
---|
941 | |
---|
942 | YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", |
---|
943 | yyn, yyrline[yyn]); |
---|
944 | |
---|
945 | /* Print the symbols being reduced, and their result. */ |
---|
946 | for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++) |
---|
947 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); |
---|
948 | YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); |
---|
949 | } |
---|
950 | #endif |
---|
951 | |
---|
952 | switch (yyn) { |
---|
953 | |
---|
954 | case 1: |
---|
955 | #line 82 "./activation-context-query-parser.y" |
---|
956 | { parsed_expression = yyvsp[0].qexp; } |
---|
957 | break; |
---|
958 | case 4: |
---|
959 | #line 87 "./activation-context-query-parser.y" |
---|
960 | { yyval.elist = g_slist_prepend(NULL, yyvsp[0].qexp); } |
---|
961 | break; |
---|
962 | case 5: |
---|
963 | #line 88 "./activation-context-query-parser.y" |
---|
964 | { yyval.elist = g_slist_prepend(yyvsp[0].elist, yyvsp[-2].qexp); } |
---|
965 | break; |
---|
966 | case 12: |
---|
967 | #line 92 "./activation-context-query-parser.y" |
---|
968 | { yyval.qexp = yyvsp[-1].qexp; } |
---|
969 | break; |
---|
970 | case 13: |
---|
971 | #line 94 "./activation-context-query-parser.y" |
---|
972 | { yyval.val_enum = P_MULTIPLY; } |
---|
973 | break; |
---|
974 | case 14: |
---|
975 | #line 95 "./activation-context-query-parser.y" |
---|
976 | { yyval.val_enum = P_DIVIDE; } |
---|
977 | break; |
---|
978 | case 15: |
---|
979 | #line 96 "./activation-context-query-parser.y" |
---|
980 | { yyval.val_enum = P_SUBTRACT; } |
---|
981 | break; |
---|
982 | case 16: |
---|
983 | #line 97 "./activation-context-query-parser.y" |
---|
984 | { yyval.val_enum = P_ADD; } |
---|
985 | break; |
---|
986 | case 17: |
---|
987 | #line 98 "./activation-context-query-parser.y" |
---|
988 | { yyval.val_enum = P_EQ; } |
---|
989 | break; |
---|
990 | case 18: |
---|
991 | #line 99 "./activation-context-query-parser.y" |
---|
992 | { yyval.val_enum = P_NEQ; } |
---|
993 | break; |
---|
994 | case 19: |
---|
995 | #line 100 "./activation-context-query-parser.y" |
---|
996 | { yyval.val_enum = P_LEQ; } |
---|
997 | break; |
---|
998 | case 20: |
---|
999 | #line 101 "./activation-context-query-parser.y" |
---|
1000 | { yyval.val_enum = P_GEQ; } |
---|
1001 | break; |
---|
1002 | case 21: |
---|
1003 | #line 102 "./activation-context-query-parser.y" |
---|
1004 | { yyval.val_enum = P_GT; } |
---|
1005 | break; |
---|
1006 | case 22: |
---|
1007 | #line 103 "./activation-context-query-parser.y" |
---|
1008 | { yyval.val_enum = P_LT; } |
---|
1009 | break; |
---|
1010 | case 23: |
---|
1011 | #line 104 "./activation-context-query-parser.y" |
---|
1012 | { yyval.val_enum = P_OR; } |
---|
1013 | break; |
---|
1014 | case 24: |
---|
1015 | #line 105 "./activation-context-query-parser.y" |
---|
1016 | { yyval.val_enum = P_AND; } |
---|
1017 | break; |
---|
1018 | case 25: |
---|
1019 | #line 106 "./activation-context-query-parser.y" |
---|
1020 | { yyval.val_enum = P_XOR; } |
---|
1021 | break; |
---|
1022 | case 26: |
---|
1023 | #line 108 "./activation-context-query-parser.y" |
---|
1024 | { yyval.qexp = qexp_binop_new (yyvsp[-2].qexp, yyvsp[-1].val_enum, yyvsp[0].qexp); } |
---|
1025 | break; |
---|
1026 | case 27: |
---|
1027 | #line 110 "./activation-context-query-parser.y" |
---|
1028 | { yyval.qexp = qexp_unop_new (P_NOT, yyvsp[0].qexp); } |
---|
1029 | break; |
---|
1030 | case 28: |
---|
1031 | #line 111 "./activation-context-query-parser.y" |
---|
1032 | { yyval.qexp = qexp_unop_new (P_NEGATE, yyvsp[0].qexp); } |
---|
1033 | break; |
---|
1034 | case 29: |
---|
1035 | #line 113 "./activation-context-query-parser.y" |
---|
1036 | { |
---|
1037 | QueryExprConst qctmp; |
---|
1038 | qctmp.type = CONST_STRING; |
---|
1039 | qctmp.u.v_string = yyvsp[0].val_string; |
---|
1040 | yyval.qexp = qexp_constant_new (qctmp); |
---|
1041 | } |
---|
1042 | break; |
---|
1043 | case 30: |
---|
1044 | #line 119 "./activation-context-query-parser.y" |
---|
1045 | { |
---|
1046 | QueryExprConst qctmp; |
---|
1047 | qctmp.type = CONST_NUMBER; |
---|
1048 | qctmp.u.v_number = yyvsp[0].val_number; |
---|
1049 | yyval.qexp = qexp_constant_new (qctmp); |
---|
1050 | } |
---|
1051 | break; |
---|
1052 | case 31: |
---|
1053 | #line 125 "./activation-context-query-parser.y" |
---|
1054 | { |
---|
1055 | QueryExprConst qctmp; |
---|
1056 | qctmp.type = CONST_BOOLEAN; |
---|
1057 | qctmp.u.v_boolean = yyvsp[0].val_boolean; |
---|
1058 | yyval.qexp = qexp_constant_new (qctmp); |
---|
1059 | } |
---|
1060 | break; |
---|
1061 | case 32: |
---|
1062 | #line 131 "./activation-context-query-parser.y" |
---|
1063 | { |
---|
1064 | QueryExprConst qctmp; |
---|
1065 | qctmp.type = CONST_STRINGV; |
---|
1066 | qctmp.u.v_stringv = yyvsp[0].val_stringv; |
---|
1067 | yyval.qexp = qexp_constant_new (qctmp); |
---|
1068 | } |
---|
1069 | break; |
---|
1070 | case 33: |
---|
1071 | #line 138 "./activation-context-query-parser.y" |
---|
1072 | { |
---|
1073 | char **new_stringv; |
---|
1074 | int i, n; |
---|
1075 | GSList *cur; |
---|
1076 | |
---|
1077 | n = g_slist_length(yyvsp[-1].elist); |
---|
1078 | new_stringv = g_new (char *, n + 1); |
---|
1079 | for (cur = yyvsp[-1].elist, i = 0; i < n; i++, cur = cur->next) { |
---|
1080 | new_stringv[i] = cur->data; |
---|
1081 | } |
---|
1082 | new_stringv[i] = NULL; |
---|
1083 | |
---|
1084 | g_slist_free (yyvsp[-1].elist); |
---|
1085 | |
---|
1086 | yyval.val_stringv = new_stringv; |
---|
1087 | } |
---|
1088 | break; |
---|
1089 | case 34: |
---|
1090 | #line 155 "./activation-context-query-parser.y" |
---|
1091 | { yyval.elist = g_slist_prepend (NULL, yyvsp[0].val_string); } |
---|
1092 | break; |
---|
1093 | case 35: |
---|
1094 | #line 156 "./activation-context-query-parser.y" |
---|
1095 | { yyval.elist = g_slist_append (yyvsp[-2].elist, yyvsp[0].val_string); } |
---|
1096 | break; |
---|
1097 | case 36: |
---|
1098 | #line 158 "./activation-context-query-parser.y" |
---|
1099 | { yyval.qexp = qexp_variable_new (yyvsp[0].val_string); } |
---|
1100 | break; |
---|
1101 | case 37: |
---|
1102 | #line 160 "./activation-context-query-parser.y" |
---|
1103 | { yyval.qexp = qexp_function_new (yyvsp[-3].val_string, yyvsp[-1].elist); } |
---|
1104 | break; |
---|
1105 | case 38: |
---|
1106 | #line 161 "./activation-context-query-parser.y" |
---|
1107 | { yyval.qexp = qexp_function_new (yyvsp[-2].val_string, NULL); } |
---|
1108 | break; |
---|
1109 | case 39: |
---|
1110 | #line 162 "./activation-context-query-parser.y" |
---|
1111 | { |
---|
1112 | yyval.qexp = qexp_function_new(yyvsp[-3].val_string, g_slist_prepend (yyvsp[-1].elist, qexp_id_new (yyvsp[-5].val_string))); } |
---|
1113 | break; |
---|
1114 | case 40: |
---|
1115 | #line 164 "./activation-context-query-parser.y" |
---|
1116 | { |
---|
1117 | yyval.qexp = qexp_function_new(yyvsp[-2].val_string, g_slist_prepend (NULL, qexp_id_new (yyvsp[-4].val_string))); } |
---|
1118 | break; |
---|
1119 | case 41: |
---|
1120 | #line 167 "./activation-context-query-parser.y" |
---|
1121 | { yyval.qexp = qexp_id_new (yyvsp[0].val_string); } |
---|
1122 | break; |
---|
1123 | } |
---|
1124 | |
---|
1125 | #line 705 "/usr/share/bison/bison.simple" |
---|
1126 | |
---|
1127 | |
---|
1128 | yyvsp -= yylen; |
---|
1129 | yyssp -= yylen; |
---|
1130 | #if YYLSP_NEEDED |
---|
1131 | yylsp -= yylen; |
---|
1132 | #endif |
---|
1133 | |
---|
1134 | #if YYDEBUG |
---|
1135 | if (yydebug) |
---|
1136 | { |
---|
1137 | short *yyssp1 = yyss - 1; |
---|
1138 | YYFPRINTF (stderr, "state stack now"); |
---|
1139 | while (yyssp1 != yyssp) |
---|
1140 | YYFPRINTF (stderr, " %d", *++yyssp1); |
---|
1141 | YYFPRINTF (stderr, "\n"); |
---|
1142 | } |
---|
1143 | #endif |
---|
1144 | |
---|
1145 | *++yyvsp = yyval; |
---|
1146 | #if YYLSP_NEEDED |
---|
1147 | *++yylsp = yyloc; |
---|
1148 | #endif |
---|
1149 | |
---|
1150 | /* Now `shift' the result of the reduction. Determine what state |
---|
1151 | that goes to, based on the state we popped back to and the rule |
---|
1152 | number reduced by. */ |
---|
1153 | |
---|
1154 | yyn = yyr1[yyn]; |
---|
1155 | |
---|
1156 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp; |
---|
1157 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
---|
1158 | yystate = yytable[yystate]; |
---|
1159 | else |
---|
1160 | yystate = yydefgoto[yyn - YYNTBASE]; |
---|
1161 | |
---|
1162 | goto yynewstate; |
---|
1163 | |
---|
1164 | |
---|
1165 | /*------------------------------------. |
---|
1166 | | yyerrlab -- here on detecting error | |
---|
1167 | `------------------------------------*/ |
---|
1168 | yyerrlab: |
---|
1169 | /* If not already recovering from an error, report this error. */ |
---|
1170 | if (!yyerrstatus) |
---|
1171 | { |
---|
1172 | ++yynerrs; |
---|
1173 | |
---|
1174 | #ifdef YYERROR_VERBOSE |
---|
1175 | yyn = yypact[yystate]; |
---|
1176 | |
---|
1177 | if (yyn > YYFLAG && yyn < YYLAST) |
---|
1178 | { |
---|
1179 | YYSIZE_T yysize = 0; |
---|
1180 | char *yymsg; |
---|
1181 | int yyx, yycount; |
---|
1182 | |
---|
1183 | yycount = 0; |
---|
1184 | /* Start YYX at -YYN if negative to avoid negative indexes in |
---|
1185 | YYCHECK. */ |
---|
1186 | for (yyx = yyn < 0 ? -yyn : 0; |
---|
1187 | yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) |
---|
1188 | if (yycheck[yyx + yyn] == yyx) |
---|
1189 | yysize += yystrlen (yytname[yyx]) + 15, yycount++; |
---|
1190 | yysize += yystrlen ("parse error, unexpected ") + 1; |
---|
1191 | yysize += yystrlen (yytname[YYTRANSLATE (yychar)]); |
---|
1192 | yymsg = (char *) YYSTACK_ALLOC (yysize); |
---|
1193 | if (yymsg != 0) |
---|
1194 | { |
---|
1195 | char *yyp = yystpcpy (yymsg, "parse error, unexpected "); |
---|
1196 | yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]); |
---|
1197 | |
---|
1198 | if (yycount < 5) |
---|
1199 | { |
---|
1200 | yycount = 0; |
---|
1201 | for (yyx = yyn < 0 ? -yyn : 0; |
---|
1202 | yyx < (int) (sizeof (yytname) / sizeof (char *)); |
---|
1203 | yyx++) |
---|
1204 | if (yycheck[yyx + yyn] == yyx) |
---|
1205 | { |
---|
1206 | const char *yyq = ! yycount ? ", expecting " : " or "; |
---|
1207 | yyp = yystpcpy (yyp, yyq); |
---|
1208 | yyp = yystpcpy (yyp, yytname[yyx]); |
---|
1209 | yycount++; |
---|
1210 | } |
---|
1211 | } |
---|
1212 | yyerror (yymsg); |
---|
1213 | YYSTACK_FREE (yymsg); |
---|
1214 | } |
---|
1215 | else |
---|
1216 | yyerror ("parse error; also virtual memory exhausted"); |
---|
1217 | } |
---|
1218 | else |
---|
1219 | #endif /* defined (YYERROR_VERBOSE) */ |
---|
1220 | yyerror ("parse error"); |
---|
1221 | } |
---|
1222 | goto yyerrlab1; |
---|
1223 | |
---|
1224 | |
---|
1225 | /*--------------------------------------------------. |
---|
1226 | | yyerrlab1 -- error raised explicitly by an action | |
---|
1227 | `--------------------------------------------------*/ |
---|
1228 | yyerrlab1: |
---|
1229 | if (yyerrstatus == 3) |
---|
1230 | { |
---|
1231 | /* If just tried and failed to reuse lookahead token after an |
---|
1232 | error, discard it. */ |
---|
1233 | |
---|
1234 | /* return failure if at end of input */ |
---|
1235 | if (yychar == YYEOF) |
---|
1236 | YYABORT; |
---|
1237 | YYDPRINTF ((stderr, "Discarding token %d (%s).\n", |
---|
1238 | yychar, yytname[yychar1])); |
---|
1239 | yychar = YYEMPTY; |
---|
1240 | } |
---|
1241 | |
---|
1242 | /* Else will try to reuse lookahead token after shifting the error |
---|
1243 | token. */ |
---|
1244 | |
---|
1245 | yyerrstatus = 3; /* Each real token shifted decrements this */ |
---|
1246 | |
---|
1247 | goto yyerrhandle; |
---|
1248 | |
---|
1249 | |
---|
1250 | /*-------------------------------------------------------------------. |
---|
1251 | | yyerrdefault -- current state does not do anything special for the | |
---|
1252 | | error token. | |
---|
1253 | `-------------------------------------------------------------------*/ |
---|
1254 | yyerrdefault: |
---|
1255 | #if 0 |
---|
1256 | /* This is wrong; only states that explicitly want error tokens |
---|
1257 | should shift them. */ |
---|
1258 | |
---|
1259 | /* If its default is to accept any token, ok. Otherwise pop it. */ |
---|
1260 | yyn = yydefact[yystate]; |
---|
1261 | if (yyn) |
---|
1262 | goto yydefault; |
---|
1263 | #endif |
---|
1264 | |
---|
1265 | |
---|
1266 | /*---------------------------------------------------------------. |
---|
1267 | | yyerrpop -- pop the current state because it cannot handle the | |
---|
1268 | | error token | |
---|
1269 | `---------------------------------------------------------------*/ |
---|
1270 | yyerrpop: |
---|
1271 | if (yyssp == yyss) |
---|
1272 | YYABORT; |
---|
1273 | yyvsp--; |
---|
1274 | yystate = *--yyssp; |
---|
1275 | #if YYLSP_NEEDED |
---|
1276 | yylsp--; |
---|
1277 | #endif |
---|
1278 | |
---|
1279 | #if YYDEBUG |
---|
1280 | if (yydebug) |
---|
1281 | { |
---|
1282 | short *yyssp1 = yyss - 1; |
---|
1283 | YYFPRINTF (stderr, "Error: state stack now"); |
---|
1284 | while (yyssp1 != yyssp) |
---|
1285 | YYFPRINTF (stderr, " %d", *++yyssp1); |
---|
1286 | YYFPRINTF (stderr, "\n"); |
---|
1287 | } |
---|
1288 | #endif |
---|
1289 | |
---|
1290 | /*--------------. |
---|
1291 | | yyerrhandle. | |
---|
1292 | `--------------*/ |
---|
1293 | yyerrhandle: |
---|
1294 | yyn = yypact[yystate]; |
---|
1295 | if (yyn == YYFLAG) |
---|
1296 | goto yyerrdefault; |
---|
1297 | |
---|
1298 | yyn += YYTERROR; |
---|
1299 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) |
---|
1300 | goto yyerrdefault; |
---|
1301 | |
---|
1302 | yyn = yytable[yyn]; |
---|
1303 | if (yyn < 0) |
---|
1304 | { |
---|
1305 | if (yyn == YYFLAG) |
---|
1306 | goto yyerrpop; |
---|
1307 | yyn = -yyn; |
---|
1308 | goto yyreduce; |
---|
1309 | } |
---|
1310 | else if (yyn == 0) |
---|
1311 | goto yyerrpop; |
---|
1312 | |
---|
1313 | if (yyn == YYFINAL) |
---|
1314 | YYACCEPT; |
---|
1315 | |
---|
1316 | YYDPRINTF ((stderr, "Shifting error token, ")); |
---|
1317 | |
---|
1318 | *++yyvsp = yylval; |
---|
1319 | #if YYLSP_NEEDED |
---|
1320 | *++yylsp = yylloc; |
---|
1321 | #endif |
---|
1322 | |
---|
1323 | yystate = yyn; |
---|
1324 | goto yynewstate; |
---|
1325 | |
---|
1326 | |
---|
1327 | /*-------------------------------------. |
---|
1328 | | yyacceptlab -- YYACCEPT comes here. | |
---|
1329 | `-------------------------------------*/ |
---|
1330 | yyacceptlab: |
---|
1331 | yyresult = 0; |
---|
1332 | goto yyreturn; |
---|
1333 | |
---|
1334 | /*-----------------------------------. |
---|
1335 | | yyabortlab -- YYABORT comes here. | |
---|
1336 | `-----------------------------------*/ |
---|
1337 | yyabortlab: |
---|
1338 | yyresult = 1; |
---|
1339 | goto yyreturn; |
---|
1340 | |
---|
1341 | /*---------------------------------------------. |
---|
1342 | | yyoverflowab -- parser overflow comes here. | |
---|
1343 | `---------------------------------------------*/ |
---|
1344 | yyoverflowlab: |
---|
1345 | yyerror ("parser stack overflow"); |
---|
1346 | yyresult = 2; |
---|
1347 | /* Fall through. */ |
---|
1348 | |
---|
1349 | yyreturn: |
---|
1350 | #ifndef yyoverflow |
---|
1351 | if (yyss != yyssa) |
---|
1352 | YYSTACK_FREE (yyss); |
---|
1353 | #endif |
---|
1354 | return yyresult; |
---|
1355 | } |
---|
1356 | #line 169 "./activation-context-query-parser.y" |
---|
1357 | |
---|
1358 | |
---|
1359 | static GString *parse_errors = NULL; |
---|
1360 | |
---|
1361 | void yyerror (char *s) |
---|
1362 | { |
---|
1363 | g_string_append (parse_errors, s); |
---|
1364 | g_string_append_c (parse_errors, '\n'); |
---|
1365 | } |
---|
1366 | |
---|
1367 | const char *qexp_parse (const char *_code, |
---|
1368 | QueryExpr **retme) |
---|
1369 | { |
---|
1370 | parsed_expression = NULL; |
---|
1371 | |
---|
1372 | g_assert (retme); |
---|
1373 | |
---|
1374 | if (!parse_errors) |
---|
1375 | parse_errors = g_string_new (NULL); |
---|
1376 | else |
---|
1377 | g_string_truncate (parse_errors, 0); |
---|
1378 | |
---|
1379 | initFlex (_code); |
---|
1380 | yyparse(); |
---|
1381 | |
---|
1382 | *retme = parsed_expression; |
---|
1383 | |
---|
1384 | if (parse_errors->len) |
---|
1385 | return parse_errors->str; |
---|
1386 | else |
---|
1387 | return NULL; |
---|
1388 | } |
---|