61ca113369e5f13247b61fcf1664082f7daaa07c
[reactos.git] / dll / win32 / msi / cond.tab.c
1 /* A Bison parser, made by GNU Bison 3.0.2. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
6
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
29
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
32
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
35
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
42
43 /* Identify Bison output. */
44 #define YYBISON 1
45
46 /* Bison version. */
47 #define YYBISON_VERSION "3.0.2"
48
49 /* Skeleton name. */
50 #define YYSKELETON_NAME "yacc.c"
51
52 /* Pure parsers. */
53 #define YYPURE 1
54
55 /* Push parsers. */
56 #define YYPUSH 0
57
58 /* Pull parsers. */
59 #define YYPULL 1
60
61
62 /* Substitute the variable and function names. */
63 #define yyparse cond_parse
64 #define yylex cond_lex
65 #define yyerror cond_error
66 #define yydebug cond_debug
67 #define yynerrs cond_nerrs
68
69
70 /* Copy the first part of user declarations. */
71 #line 1 "cond.y" /* yacc.c:339 */
72
73
74 /*
75 * Implementation of the Microsoft Installer (msi.dll)
76 *
77 * Copyright 2003 Mike McCormack for CodeWeavers
78 *
79 * This library is free software; you can redistribute it and/or
80 * modify it under the terms of the GNU Lesser General Public
81 * License as published by the Free Software Foundation; either
82 * version 2.1 of the License, or (at your option) any later version.
83 *
84 * This library is distributed in the hope that it will be useful,
85 * but WITHOUT ANY WARRANTY; without even the implied warranty of
86 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
87 * Lesser General Public License for more details.
88 *
89 * You should have received a copy of the GNU Lesser General Public
90 * License along with this library; if not, write to the Free Software
91 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
92 */
93
94 #include "msipriv.h"
95
96 WINE_DEFAULT_DEBUG_CHANNEL(msi);
97
98 typedef struct tag_yyinput
99 {
100 MSIPACKAGE *package;
101 LPCWSTR str;
102 INT n;
103 MSICONDITION result;
104 struct list mem;
105 } COND_input;
106
107 struct cond_str {
108 LPCWSTR data;
109 INT len;
110 };
111
112 static LPWSTR COND_GetString( COND_input *info, const struct cond_str *str );
113 static LPWSTR COND_GetLiteral( COND_input *info, const struct cond_str *str );
114 static int cond_lex( void *COND_lval, COND_input *info);
115 static int cond_error( COND_input *info, const char *str);
116
117 static void *cond_alloc( COND_input *cond, unsigned int sz );
118 static void *cond_track_mem( COND_input *cond, void *ptr, unsigned int sz );
119 static void cond_free( void *ptr );
120
121 static INT compare_int( INT a, INT operator, INT b );
122 static INT compare_string( LPCWSTR a, INT operator, LPCWSTR b, BOOL convert );
123
124 static INT compare_and_free_strings( LPWSTR a, INT op, LPWSTR b, BOOL convert )
125 {
126 INT r;
127
128 r = compare_string( a, op, b, convert );
129 cond_free( a );
130 cond_free( b );
131 return r;
132 }
133
134 static BOOL num_from_prop( LPCWSTR p, INT *val )
135 {
136 INT ret = 0, sign = 1;
137
138 if (!p)
139 return FALSE;
140 if (*p == '-')
141 {
142 sign = -1;
143 p++;
144 }
145 if (!*p)
146 return FALSE;
147 while (*p)
148 {
149 if( *p < '0' || *p > '9' )
150 return FALSE;
151 ret = ret*10 + (*p - '0');
152 p++;
153 }
154 *val = ret*sign;
155 return TRUE;
156 }
157
158
159 #line 180 "cond.tab.c" /* yacc.c:339 */
160
161 # ifndef YY_NULLPTR
162 # if defined __cplusplus && 201103L <= __cplusplus
163 # define YY_NULLPTR nullptr
164 # else
165 # define YY_NULLPTR 0
166 # endif
167 # endif
168
169 /* Enabling verbose error messages. */
170 #ifdef YYERROR_VERBOSE
171 # undef YYERROR_VERBOSE
172 # define YYERROR_VERBOSE 1
173 #else
174 # define YYERROR_VERBOSE 0
175 #endif
176
177
178 /* Debug traces. */
179 #ifndef YYDEBUG
180 # define YYDEBUG 0
181 #endif
182 #if YYDEBUG
183 extern int cond_debug;
184 #endif
185
186 /* Token type. */
187 #ifndef YYTOKENTYPE
188 # define YYTOKENTYPE
189 enum yytokentype
190 {
191 COND_SPACE = 258,
192 COND_EOF = 259,
193 COND_OR = 260,
194 COND_AND = 261,
195 COND_NOT = 262,
196 COND_XOR = 263,
197 COND_IMP = 264,
198 COND_EQV = 265,
199 COND_LT = 266,
200 COND_GT = 267,
201 COND_EQ = 268,
202 COND_NE = 269,
203 COND_GE = 270,
204 COND_LE = 271,
205 COND_ILT = 272,
206 COND_IGT = 273,
207 COND_IEQ = 274,
208 COND_INE = 275,
209 COND_IGE = 276,
210 COND_ILE = 277,
211 COND_LPAR = 278,
212 COND_RPAR = 279,
213 COND_TILDA = 280,
214 COND_SS = 281,
215 COND_ISS = 282,
216 COND_ILHS = 283,
217 COND_IRHS = 284,
218 COND_LHS = 285,
219 COND_RHS = 286,
220 COND_PERCENT = 287,
221 COND_DOLLARS = 288,
222 COND_QUESTION = 289,
223 COND_AMPER = 290,
224 COND_EXCLAM = 291,
225 COND_IDENT = 292,
226 COND_NUMBER = 293,
227 COND_LITER = 294,
228 COND_ERROR = 295
229 };
230 #endif
231
232 /* Value type. */
233 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
234 typedef union YYSTYPE YYSTYPE;
235 union YYSTYPE
236 {
237 #line 114 "cond.y" /* yacc.c:355 */
238
239 struct cond_str str;
240 LPWSTR string;
241 INT value;
242
243 #line 264 "cond.tab.c" /* yacc.c:355 */
244 };
245 # define YYSTYPE_IS_TRIVIAL 1
246 # define YYSTYPE_IS_DECLARED 1
247 #endif
248
249
250
251 int cond_parse (COND_input *info);
252
253
254
255 /* Copy the second part of user declarations. */
256
257 #line 278 "cond.tab.c" /* yacc.c:358 */
258
259 #ifdef short
260 # undef short
261 #endif
262
263 #ifdef YYTYPE_UINT8
264 typedef YYTYPE_UINT8 yytype_uint8;
265 #else
266 typedef unsigned char yytype_uint8;
267 #endif
268
269 #ifdef YYTYPE_INT8
270 typedef YYTYPE_INT8 yytype_int8;
271 #else
272 typedef signed char yytype_int8;
273 #endif
274
275 #ifdef YYTYPE_UINT16
276 typedef YYTYPE_UINT16 yytype_uint16;
277 #else
278 typedef unsigned short int yytype_uint16;
279 #endif
280
281 #ifdef YYTYPE_INT16
282 typedef YYTYPE_INT16 yytype_int16;
283 #else
284 typedef short int yytype_int16;
285 #endif
286
287 #ifndef YYSIZE_T
288 # ifdef __SIZE_TYPE__
289 # define YYSIZE_T __SIZE_TYPE__
290 # elif defined size_t
291 # define YYSIZE_T size_t
292 # elif ! defined YYSIZE_T
293 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
294 # define YYSIZE_T size_t
295 # else
296 # define YYSIZE_T unsigned int
297 # endif
298 #endif
299
300 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
301
302 #ifndef YY_
303 # if defined YYENABLE_NLS && YYENABLE_NLS
304 # if ENABLE_NLS
305 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
306 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
307 # endif
308 # endif
309 # ifndef YY_
310 # define YY_(Msgid) Msgid
311 # endif
312 #endif
313
314 #ifndef YY_ATTRIBUTE
315 # if (defined __GNUC__ \
316 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
317 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
318 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
319 # else
320 # define YY_ATTRIBUTE(Spec) /* empty */
321 # endif
322 #endif
323
324 #ifndef YY_ATTRIBUTE_PURE
325 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
326 #endif
327
328 #ifndef YY_ATTRIBUTE_UNUSED
329 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
330 #endif
331
332 #if !defined _Noreturn \
333 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
334 # if defined _MSC_VER && 1200 <= _MSC_VER
335 # define _Noreturn __declspec (noreturn)
336 # else
337 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
338 # endif
339 #endif
340
341 /* Suppress unused-variable warnings by "using" E. */
342 #if ! defined lint || defined __GNUC__
343 # define YYUSE(E) ((void) (E))
344 #else
345 # define YYUSE(E) /* empty */
346 #endif
347
348 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
349 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
350 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
351 _Pragma ("GCC diagnostic push") \
352 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
353 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
354 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
355 _Pragma ("GCC diagnostic pop")
356 #else
357 # define YY_INITIAL_VALUE(Value) Value
358 #endif
359 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
360 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
361 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
362 #endif
363 #ifndef YY_INITIAL_VALUE
364 # define YY_INITIAL_VALUE(Value) /* Nothing. */
365 #endif
366
367
368 #if ! defined yyoverflow || YYERROR_VERBOSE
369
370 /* The parser invokes alloca or malloc; define the necessary symbols. */
371
372 # ifdef YYSTACK_USE_ALLOCA
373 # if YYSTACK_USE_ALLOCA
374 # ifdef __GNUC__
375 # define YYSTACK_ALLOC __builtin_alloca
376 # elif defined __BUILTIN_VA_ARG_INCR
377 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
378 # elif defined _AIX
379 # define YYSTACK_ALLOC __alloca
380 # elif defined _MSC_VER
381 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
382 # define alloca _alloca
383 # else
384 # define YYSTACK_ALLOC alloca
385 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
386 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
387 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
388 # ifndef EXIT_SUCCESS
389 # define EXIT_SUCCESS 0
390 # endif
391 # endif
392 # endif
393 # endif
394 # endif
395
396 # ifdef YYSTACK_ALLOC
397 /* Pacify GCC's 'empty if-body' warning. */
398 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
399 # ifndef YYSTACK_ALLOC_MAXIMUM
400 /* The OS might guarantee only one guard page at the bottom of the stack,
401 and a page size can be as small as 4096 bytes. So we cannot safely
402 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
403 to allow for a few compiler-allocated temporary stack slots. */
404 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
405 # endif
406 # else
407 # define YYSTACK_ALLOC YYMALLOC
408 # define YYSTACK_FREE YYFREE
409 # ifndef YYSTACK_ALLOC_MAXIMUM
410 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
411 # endif
412 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
413 && ! ((defined YYMALLOC || defined malloc) \
414 && (defined YYFREE || defined free)))
415 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
416 # ifndef EXIT_SUCCESS
417 # define EXIT_SUCCESS 0
418 # endif
419 # endif
420 # ifndef YYMALLOC
421 # define YYMALLOC malloc
422 # if ! defined malloc && ! defined EXIT_SUCCESS
423 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
424 # endif
425 # endif
426 # ifndef YYFREE
427 # define YYFREE free
428 # if ! defined free && ! defined EXIT_SUCCESS
429 void free (void *); /* INFRINGES ON USER NAME SPACE */
430 # endif
431 # endif
432 # endif
433 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
434
435
436 #if (! defined yyoverflow \
437 && (! defined __cplusplus \
438 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
439
440 /* A type that is properly aligned for any stack member. */
441 union yyalloc
442 {
443 yytype_int16 yyss_alloc;
444 YYSTYPE yyvs_alloc;
445 };
446
447 /* The size of the maximum gap between one aligned stack and the next. */
448 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
449
450 /* The size of an array large to enough to hold all stacks, each with
451 N elements. */
452 # define YYSTACK_BYTES(N) \
453 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
454 + YYSTACK_GAP_MAXIMUM)
455
456 # define YYCOPY_NEEDED 1
457
458 /* Relocate STACK from its old location to the new one. The
459 local variables YYSIZE and YYSTACKSIZE give the old and new number of
460 elements in the stack, and YYPTR gives the new location of the
461 stack. Advance YYPTR to a properly aligned location for the next
462 stack. */
463 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
464 do \
465 { \
466 YYSIZE_T yynewbytes; \
467 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
468 Stack = &yyptr->Stack_alloc; \
469 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
470 yyptr += yynewbytes / sizeof (*yyptr); \
471 } \
472 while (0)
473
474 #endif
475
476 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
477 /* Copy COUNT objects from SRC to DST. The source and destination do
478 not overlap. */
479 # ifndef YYCOPY
480 # if defined __GNUC__ && 1 < __GNUC__
481 # define YYCOPY(Dst, Src, Count) \
482 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
483 # else
484 # define YYCOPY(Dst, Src, Count) \
485 do \
486 { \
487 YYSIZE_T yyi; \
488 for (yyi = 0; yyi < (Count); yyi++) \
489 (Dst)[yyi] = (Src)[yyi]; \
490 } \
491 while (0)
492 # endif
493 # endif
494 #endif /* !YYCOPY_NEEDED */
495
496 /* YYFINAL -- State number of the termination state. */
497 #define YYFINAL 28
498 /* YYLAST -- Last index in YYTABLE. */
499 #define YYLAST 71
500
501 /* YYNTOKENS -- Number of terminals. */
502 #define YYNTOKENS 41
503 /* YYNNTS -- Number of nonterminals. */
504 #define YYNNTS 12
505 /* YYNRULES -- Number of rules. */
506 #define YYNRULES 53
507 /* YYNSTATES -- Number of states. */
508 #define YYNSTATES 70
509
510 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
511 by yylex, with out-of-bounds checking. */
512 #define YYUNDEFTOK 2
513 #define YYMAXUTOK 295
514
515 #define YYTRANSLATE(YYX) \
516 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
517
518 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
519 as returned by yylex, without out-of-bounds checking. */
520 static const yytype_uint8 yytranslate[] =
521 {
522 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
523 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
524 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
525 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
526 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
527 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
528 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
529 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
530 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
531 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
532 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
533 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
534 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
535 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
536 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
537 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
538 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
539 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
540 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
541 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
542 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
543 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
544 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
545 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
546 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
547 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
548 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
549 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
550 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
551 35, 36, 37, 38, 39, 40
552 };
553
554 #if YYDEBUG
555 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
556 static const yytype_uint16 yyrline[] =
557 {
558 0, 138, 138, 144, 151, 155, 159, 163, 167, 174,
559 178, 185, 189, 193, 198, 202, 211, 220, 224, 228,
560 232, 236, 241, 246, 254, 255, 256, 257, 258, 259,
561 260, 261, 262, 263, 264, 265, 266, 267, 268, 269,
562 270, 271, 275, 279, 286, 296, 300, 309, 318, 331,
563 343, 356, 373, 383
564 };
565 #endif
566
567 #if YYDEBUG || YYERROR_VERBOSE || 0
568 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
569 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
570 static const char *const yytname[] =
571 {
572 "$end", "error", "$undefined", "COND_SPACE", "COND_EOF", "COND_OR",
573 "COND_AND", "COND_NOT", "COND_XOR", "COND_IMP", "COND_EQV", "COND_LT",
574 "COND_GT", "COND_EQ", "COND_NE", "COND_GE", "COND_LE", "COND_ILT",
575 "COND_IGT", "COND_IEQ", "COND_INE", "COND_IGE", "COND_ILE", "COND_LPAR",
576 "COND_RPAR", "COND_TILDA", "COND_SS", "COND_ISS", "COND_ILHS",
577 "COND_IRHS", "COND_LHS", "COND_RHS", "COND_PERCENT", "COND_DOLLARS",
578 "COND_QUESTION", "COND_AMPER", "COND_EXCLAM", "COND_IDENT",
579 "COND_NUMBER", "COND_LITER", "COND_ERROR", "$accept", "condition",
580 "expression", "boolean_term", "boolean_factor", "operator", "value_s",
581 "literal", "value_i", "symbol_s", "identifier", "integer", YY_NULLPTR
582 };
583 #endif
584
585 # ifdef YYPRINT
586 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
587 (internal) symbol number NUM (which must be that of a token). */
588 static const yytype_uint16 yytoknum[] =
589 {
590 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
591 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
592 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
593 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
594 295
595 };
596 # endif
597
598 #define YYPACT_NINF -15
599
600 #define yypact_value_is_default(Yystate) \
601 (!!((Yystate) == (-15)))
602
603 #define YYTABLE_NINF -1
604
605 #define yytable_value_is_error(Yytable_value) \
606 0
607
608 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
609 STATE-NUM. */
610 static const yytype_int8 yypact[] =
611 {
612 -7, -7, -7, -14, -14, -14, -14, -14, -15, -15,
613 -15, 24, 46, 30, -15, -15, -9, -9, -9, -15,
614 -15, -15, 29, -15, -15, -15, -15, -15, -15, -7,
615 -7, -7, -7, -7, -15, -15, -15, -15, -15, -15,
616 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15,
617 -15, -15, 8, 8, 8, -15, 30, 30, 30, 30,
618 -15, -15, -15, -15, -15, -15, -15, -15, -15, -15
619 };
620
621 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
622 Performed when YYTABLE does not specify something else to do. Zero
623 means the default is an error. */
624 static const yytype_uint8 yydefact[] =
625 {
626 3, 0, 0, 0, 0, 0, 0, 0, 52, 53,
627 44, 0, 2, 4, 9, 13, 43, 12, 42, 50,
628 45, 11, 0, 51, 46, 47, 48, 49, 1, 0,
629 0, 0, 0, 0, 26, 27, 24, 25, 29, 28,
630 33, 34, 31, 32, 36, 35, 30, 37, 40, 41,
631 38, 39, 0, 0, 0, 23, 5, 7, 6, 8,
632 10, 20, 21, 19, 22, 14, 16, 18, 15, 17
633 };
634
635 /* YYPGOTO[NTERM-NUM]. */
636 static const yytype_int8 yypgoto[] =
637 {
638 -15, -15, 50, 33, 0, -3, -15, -4, 14, 17,
639 54, -15
640 };
641
642 /* YYDEFGOTO[NTERM-NUM]. */
643 static const yytype_int8 yydefgoto[] =
644 {
645 -1, 11, 12, 13, 14, 52, 15, 16, 17, 18,
646 19, 20
647 };
648
649 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
650 positive, shift that token. If negative, reduce the rule whose
651 number is the opposite. If YYTABLE_NINF, syntax error. */
652 static const yytype_uint8 yytable[] =
653 {
654 1, 21, 34, 35, 36, 37, 38, 39, 40, 41,
655 42, 43, 44, 45, 53, 54, 2, 46, 47, 48,
656 49, 50, 51, 8, 28, 3, 4, 5, 6, 7,
657 8, 9, 10, 60, 29, 0, 33, 30, 31, 32,
658 3, 4, 5, 6, 7, 8, 9, 10, 61, 64,
659 67, 29, 22, 55, 30, 31, 32, 23, 24, 25,
660 26, 27, 56, 57, 58, 59, 62, 65, 68, 63,
661 66, 69
662 };
663
664 static const yytype_int8 yycheck[] =
665 {
666 7, 1, 11, 12, 13, 14, 15, 16, 17, 18,
667 19, 20, 21, 22, 17, 18, 23, 26, 27, 28,
668 29, 30, 31, 37, 0, 32, 33, 34, 35, 36,
669 37, 38, 39, 33, 5, -1, 6, 8, 9, 10,
670 32, 33, 34, 35, 36, 37, 38, 39, 52, 53,
671 54, 5, 2, 24, 8, 9, 10, 3, 4, 5,
672 6, 7, 29, 30, 31, 32, 52, 53, 54, 52,
673 53, 54
674 };
675
676 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
677 symbol of state STATE-NUM. */
678 static const yytype_uint8 yystos[] =
679 {
680 0, 7, 23, 32, 33, 34, 35, 36, 37, 38,
681 39, 42, 43, 44, 45, 47, 48, 49, 50, 51,
682 52, 45, 43, 51, 51, 51, 51, 51, 0, 5,
683 8, 9, 10, 6, 11, 12, 13, 14, 15, 16,
684 17, 18, 19, 20, 21, 22, 26, 27, 28, 29,
685 30, 31, 46, 46, 46, 24, 44, 44, 44, 44,
686 45, 48, 49, 50, 48, 49, 50, 48, 49, 50
687 };
688
689 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
690 static const yytype_uint8 yyr1[] =
691 {
692 0, 41, 42, 42, 43, 43, 43, 43, 43, 44,
693 44, 45, 45, 45, 45, 45, 45, 45, 45, 45,
694 45, 45, 45, 45, 46, 46, 46, 46, 46, 46,
695 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
696 46, 46, 47, 47, 48, 49, 49, 49, 49, 49,
697 50, 50, 51, 52
698 };
699
700 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
701 static const yytype_uint8 yyr2[] =
702 {
703 0, 2, 1, 0, 1, 3, 3, 3, 3, 1,
704 3, 2, 1, 1, 3, 3, 3, 3, 3, 3,
705 3, 3, 3, 3, 1, 1, 1, 1, 1, 1,
706 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
707 1, 1, 1, 1, 1, 1, 2, 2, 2, 2,
708 1, 2, 1, 1
709 };
710
711
712 #define yyerrok (yyerrstatus = 0)
713 #define yyclearin (yychar = YYEMPTY)
714 #define YYEMPTY (-2)
715 #define YYEOF 0
716
717 #define YYACCEPT goto yyacceptlab
718 #define YYABORT goto yyabortlab
719 #define YYERROR goto yyerrorlab
720
721
722 #define YYRECOVERING() (!!yyerrstatus)
723
724 #define YYBACKUP(Token, Value) \
725 do \
726 if (yychar == YYEMPTY) \
727 { \
728 yychar = (Token); \
729 yylval = (Value); \
730 YYPOPSTACK (yylen); \
731 yystate = *yyssp; \
732 goto yybackup; \
733 } \
734 else \
735 { \
736 yyerror (info, YY_("syntax error: cannot back up")); \
737 YYERROR; \
738 } \
739 while (0)
740
741 /* Error token number */
742 #define YYTERROR 1
743 #define YYERRCODE 256
744
745
746
747 /* Enable debugging if requested. */
748 #if YYDEBUG
749
750 # ifndef YYFPRINTF
751 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
752 # define YYFPRINTF fprintf
753 # endif
754
755 # define YYDPRINTF(Args) \
756 do { \
757 if (yydebug) \
758 YYFPRINTF Args; \
759 } while (0)
760
761 /* This macro is provided for backward compatibility. */
762 #ifndef YY_LOCATION_PRINT
763 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
764 #endif
765
766
767 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
768 do { \
769 if (yydebug) \
770 { \
771 YYFPRINTF (stderr, "%s ", Title); \
772 yy_symbol_print (stderr, \
773 Type, Value, info); \
774 YYFPRINTF (stderr, "\n"); \
775 } \
776 } while (0)
777
778
779 /*----------------------------------------.
780 | Print this symbol's value on YYOUTPUT. |
781 `----------------------------------------*/
782
783 static void
784 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, COND_input *info)
785 {
786 FILE *yyo = yyoutput;
787 YYUSE (yyo);
788 YYUSE (info);
789 if (!yyvaluep)
790 return;
791 # ifdef YYPRINT
792 if (yytype < YYNTOKENS)
793 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
794 # endif
795 YYUSE (yytype);
796 }
797
798
799 /*--------------------------------.
800 | Print this symbol on YYOUTPUT. |
801 `--------------------------------*/
802
803 static void
804 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, COND_input *info)
805 {
806 YYFPRINTF (yyoutput, "%s %s (",
807 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
808
809 yy_symbol_value_print (yyoutput, yytype, yyvaluep, info);
810 YYFPRINTF (yyoutput, ")");
811 }
812
813 /*------------------------------------------------------------------.
814 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
815 | TOP (included). |
816 `------------------------------------------------------------------*/
817
818 static void
819 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
820 {
821 YYFPRINTF (stderr, "Stack now");
822 for (; yybottom <= yytop; yybottom++)
823 {
824 int yybot = *yybottom;
825 YYFPRINTF (stderr, " %d", yybot);
826 }
827 YYFPRINTF (stderr, "\n");
828 }
829
830 # define YY_STACK_PRINT(Bottom, Top) \
831 do { \
832 if (yydebug) \
833 yy_stack_print ((Bottom), (Top)); \
834 } while (0)
835
836
837 /*------------------------------------------------.
838 | Report that the YYRULE is going to be reduced. |
839 `------------------------------------------------*/
840
841 static void
842 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, COND_input *info)
843 {
844 unsigned long int yylno = yyrline[yyrule];
845 int yynrhs = yyr2[yyrule];
846 int yyi;
847 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
848 yyrule - 1, yylno);
849 /* The symbols being reduced. */
850 for (yyi = 0; yyi < yynrhs; yyi++)
851 {
852 YYFPRINTF (stderr, " $%d = ", yyi + 1);
853 yy_symbol_print (stderr,
854 yystos[yyssp[yyi + 1 - yynrhs]],
855 &(yyvsp[(yyi + 1) - (yynrhs)])
856 , info);
857 YYFPRINTF (stderr, "\n");
858 }
859 }
860
861 # define YY_REDUCE_PRINT(Rule) \
862 do { \
863 if (yydebug) \
864 yy_reduce_print (yyssp, yyvsp, Rule, info); \
865 } while (0)
866
867 /* Nonzero means print parse trace. It is left uninitialized so that
868 multiple parsers can coexist. */
869 int yydebug;
870 #else /* !YYDEBUG */
871 # define YYDPRINTF(Args)
872 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
873 # define YY_STACK_PRINT(Bottom, Top)
874 # define YY_REDUCE_PRINT(Rule)
875 #endif /* !YYDEBUG */
876
877
878 /* YYINITDEPTH -- initial size of the parser's stacks. */
879 #ifndef YYINITDEPTH
880 # define YYINITDEPTH 200
881 #endif
882
883 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
884 if the built-in stack extension method is used).
885
886 Do not make this value too large; the results are undefined if
887 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
888 evaluated with infinite-precision integer arithmetic. */
889
890 #ifndef YYMAXDEPTH
891 # define YYMAXDEPTH 10000
892 #endif
893
894
895 #if YYERROR_VERBOSE
896
897 # ifndef yystrlen
898 # if defined __GLIBC__ && defined _STRING_H
899 # define yystrlen strlen
900 # else
901 /* Return the length of YYSTR. */
902 static YYSIZE_T
903 yystrlen (const char *yystr)
904 {
905 YYSIZE_T yylen;
906 for (yylen = 0; yystr[yylen]; yylen++)
907 continue;
908 return yylen;
909 }
910 # endif
911 # endif
912
913 # ifndef yystpcpy
914 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
915 # define yystpcpy stpcpy
916 # else
917 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
918 YYDEST. */
919 static char *
920 yystpcpy (char *yydest, const char *yysrc)
921 {
922 char *yyd = yydest;
923 const char *yys = yysrc;
924
925 while ((*yyd++ = *yys++) != '\0')
926 continue;
927
928 return yyd - 1;
929 }
930 # endif
931 # endif
932
933 # ifndef yytnamerr
934 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
935 quotes and backslashes, so that it's suitable for yyerror. The
936 heuristic is that double-quoting is unnecessary unless the string
937 contains an apostrophe, a comma, or backslash (other than
938 backslash-backslash). YYSTR is taken from yytname. If YYRES is
939 null, do not copy; instead, return the length of what the result
940 would have been. */
941 static YYSIZE_T
942 yytnamerr (char *yyres, const char *yystr)
943 {
944 if (*yystr == '"')
945 {
946 YYSIZE_T yyn = 0;
947 char const *yyp = yystr;
948
949 for (;;)
950 switch (*++yyp)
951 {
952 case '\'':
953 case ',':
954 goto do_not_strip_quotes;
955
956 case '\\':
957 if (*++yyp != '\\')
958 goto do_not_strip_quotes;
959 /* Fall through. */
960 default:
961 if (yyres)
962 yyres[yyn] = *yyp;
963 yyn++;
964 break;
965
966 case '"':
967 if (yyres)
968 yyres[yyn] = '\0';
969 return yyn;
970 }
971 do_not_strip_quotes: ;
972 }
973
974 if (! yyres)
975 return yystrlen (yystr);
976
977 return yystpcpy (yyres, yystr) - yyres;
978 }
979 # endif
980
981 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
982 about the unexpected token YYTOKEN for the state stack whose top is
983 YYSSP.
984
985 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
986 not large enough to hold the message. In that case, also set
987 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
988 required number of bytes is too large to store. */
989 static int
990 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
991 yytype_int16 *yyssp, int yytoken)
992 {
993 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
994 YYSIZE_T yysize = yysize0;
995 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
996 /* Internationalized format string. */
997 const char *yyformat = YY_NULLPTR;
998 /* Arguments of yyformat. */
999 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1000 /* Number of reported tokens (one for the "unexpected", one per
1001 "expected"). */
1002 int yycount = 0;
1003
1004 /* There are many possibilities here to consider:
1005 - If this state is a consistent state with a default action, then
1006 the only way this function was invoked is if the default action
1007 is an error action. In that case, don't check for expected
1008 tokens because there are none.
1009 - The only way there can be no lookahead present (in yychar) is if
1010 this state is a consistent state with a default action. Thus,
1011 detecting the absence of a lookahead is sufficient to determine
1012 that there is no unexpected or expected token to report. In that
1013 case, just report a simple "syntax error".
1014 - Don't assume there isn't a lookahead just because this state is a
1015 consistent state with a default action. There might have been a
1016 previous inconsistent state, consistent state with a non-default
1017 action, or user semantic action that manipulated yychar.
1018 - Of course, the expected token list depends on states to have
1019 correct lookahead information, and it depends on the parser not
1020 to perform extra reductions after fetching a lookahead from the
1021 scanner and before detecting a syntax error. Thus, state merging
1022 (from LALR or IELR) and default reductions corrupt the expected
1023 token list. However, the list is correct for canonical LR with
1024 one exception: it will still contain any token that will not be
1025 accepted due to an error action in a later state.
1026 */
1027 if (yytoken != YYEMPTY)
1028 {
1029 int yyn = yypact[*yyssp];
1030 yyarg[yycount++] = yytname[yytoken];
1031 if (!yypact_value_is_default (yyn))
1032 {
1033 /* Start YYX at -YYN if negative to avoid negative indexes in
1034 YYCHECK. In other words, skip the first -YYN actions for
1035 this state because they are default actions. */
1036 int yyxbegin = yyn < 0 ? -yyn : 0;
1037 /* Stay within bounds of both yycheck and yytname. */
1038 int yychecklim = YYLAST - yyn + 1;
1039 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1040 int yyx;
1041
1042 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1043 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1044 && !yytable_value_is_error (yytable[yyx + yyn]))
1045 {
1046 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1047 {
1048 yycount = 1;
1049 yysize = yysize0;
1050 break;
1051 }
1052 yyarg[yycount++] = yytname[yyx];
1053 {
1054 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1055 if (! (yysize <= yysize1
1056 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1057 return 2;
1058 yysize = yysize1;
1059 }
1060 }
1061 }
1062 }
1063
1064 switch (yycount)
1065 {
1066 # define YYCASE_(N, S) \
1067 case N: \
1068 yyformat = S; \
1069 break
1070 YYCASE_(0, YY_("syntax error"));
1071 YYCASE_(1, YY_("syntax error, unexpected %s"));
1072 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1073 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1074 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1075 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1076 # undef YYCASE_
1077 }
1078
1079 {
1080 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
1081 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
1082 return 2;
1083 yysize = yysize1;
1084 }
1085
1086 if (*yymsg_alloc < yysize)
1087 {
1088 *yymsg_alloc = 2 * yysize;
1089 if (! (yysize <= *yymsg_alloc
1090 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1091 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1092 return 1;
1093 }
1094
1095 /* Avoid sprintf, as that infringes on the user's name space.
1096 Don't have undefined behavior even if the translation
1097 produced a string with the wrong number of "%s"s. */
1098 {
1099 char *yyp = *yymsg;
1100 int yyi = 0;
1101 while ((*yyp = *yyformat) != '\0')
1102 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1103 {
1104 yyp += yytnamerr (yyp, yyarg[yyi++]);
1105 yyformat += 2;
1106 }
1107 else
1108 {
1109 yyp++;
1110 yyformat++;
1111 }
1112 }
1113 return 0;
1114 }
1115 #endif /* YYERROR_VERBOSE */
1116
1117 /*-----------------------------------------------.
1118 | Release the memory associated to this symbol. |
1119 `-----------------------------------------------*/
1120
1121 static void
1122 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, COND_input *info)
1123 {
1124 YYUSE (yyvaluep);
1125 YYUSE (info);
1126 if (!yymsg)
1127 yymsg = "Deleting";
1128 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1129
1130 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1131 YYUSE (yytype);
1132 YY_IGNORE_MAYBE_UNINITIALIZED_END
1133 }
1134
1135
1136
1137
1138 /*----------.
1139 | yyparse. |
1140 `----------*/
1141
1142 int
1143 yyparse (COND_input *info)
1144 {
1145 /* The lookahead symbol. */
1146 int yychar;
1147
1148
1149 /* The semantic value of the lookahead symbol. */
1150 /* Default value used for initialization, for pacifying older GCCs
1151 or non-GCC compilers. */
1152 YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1153 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1154
1155 /* Number of syntax errors so far. */
1156 int yynerrs;
1157
1158 int yystate;
1159 /* Number of tokens to shift before error messages enabled. */
1160 int yyerrstatus;
1161
1162 /* The stacks and their tools:
1163 'yyss': related to states.
1164 'yyvs': related to semantic values.
1165
1166 Refer to the stacks through separate pointers, to allow yyoverflow
1167 to reallocate them elsewhere. */
1168
1169 /* The state stack. */
1170 yytype_int16 yyssa[YYINITDEPTH];
1171 yytype_int16 *yyss;
1172 yytype_int16 *yyssp;
1173
1174 /* The semantic value stack. */
1175 YYSTYPE yyvsa[YYINITDEPTH];
1176 YYSTYPE *yyvs;
1177 YYSTYPE *yyvsp;
1178
1179 YYSIZE_T yystacksize;
1180
1181 int yyn;
1182 int yyresult;
1183 /* Lookahead token as an internal (translated) token number. */
1184 int yytoken = 0;
1185 /* The variables used to return semantic value and location from the
1186 action routines. */
1187 YYSTYPE yyval;
1188
1189 #if YYERROR_VERBOSE
1190 /* Buffer for error messages, and its allocated size. */
1191 char yymsgbuf[128];
1192 char *yymsg = yymsgbuf;
1193 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1194 #endif
1195
1196 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1197
1198 /* The number of symbols on the RHS of the reduced rule.
1199 Keep to zero when no symbol should be popped. */
1200 int yylen = 0;
1201
1202 yyssp = yyss = yyssa;
1203 yyvsp = yyvs = yyvsa;
1204 yystacksize = YYINITDEPTH;
1205
1206 YYDPRINTF ((stderr, "Starting parse\n"));
1207
1208 yystate = 0;
1209 yyerrstatus = 0;
1210 yynerrs = 0;
1211 yychar = YYEMPTY; /* Cause a token to be read. */
1212 goto yysetstate;
1213
1214 /*------------------------------------------------------------.
1215 | yynewstate -- Push a new state, which is found in yystate. |
1216 `------------------------------------------------------------*/
1217 yynewstate:
1218 /* In all cases, when you get here, the value and location stacks
1219 have just been pushed. So pushing a state here evens the stacks. */
1220 yyssp++;
1221
1222 yysetstate:
1223 *yyssp = yystate;
1224
1225 if (yyss + yystacksize - 1 <= yyssp)
1226 {
1227 /* Get the current used size of the three stacks, in elements. */
1228 YYSIZE_T yysize = yyssp - yyss + 1;
1229
1230 #ifdef yyoverflow
1231 {
1232 /* Give user a chance to reallocate the stack. Use copies of
1233 these so that the &'s don't force the real ones into
1234 memory. */
1235 YYSTYPE *yyvs1 = yyvs;
1236 yytype_int16 *yyss1 = yyss;
1237
1238 /* Each stack pointer address is followed by the size of the
1239 data in use in that stack, in bytes. This used to be a
1240 conditional around just the two extra args, but that might
1241 be undefined if yyoverflow is a macro. */
1242 yyoverflow (YY_("memory exhausted"),
1243 &yyss1, yysize * sizeof (*yyssp),
1244 &yyvs1, yysize * sizeof (*yyvsp),
1245 &yystacksize);
1246
1247 yyss = yyss1;
1248 yyvs = yyvs1;
1249 }
1250 #else /* no yyoverflow */
1251 # ifndef YYSTACK_RELOCATE
1252 goto yyexhaustedlab;
1253 # else
1254 /* Extend the stack our own way. */
1255 if (YYMAXDEPTH <= yystacksize)
1256 goto yyexhaustedlab;
1257 yystacksize *= 2;
1258 if (YYMAXDEPTH < yystacksize)
1259 yystacksize = YYMAXDEPTH;
1260
1261 {
1262 yytype_int16 *yyss1 = yyss;
1263 union yyalloc *yyptr =
1264 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1265 if (! yyptr)
1266 goto yyexhaustedlab;
1267 YYSTACK_RELOCATE (yyss_alloc, yyss);
1268 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1269 # undef YYSTACK_RELOCATE
1270 if (yyss1 != yyssa)
1271 YYSTACK_FREE (yyss1);
1272 }
1273 # endif
1274 #endif /* no yyoverflow */
1275
1276 yyssp = yyss + yysize - 1;
1277 yyvsp = yyvs + yysize - 1;
1278
1279 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1280 (unsigned long int) yystacksize));
1281
1282 if (yyss + yystacksize - 1 <= yyssp)
1283 YYABORT;
1284 }
1285
1286 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1287
1288 if (yystate == YYFINAL)
1289 YYACCEPT;
1290
1291 goto yybackup;
1292
1293 /*-----------.
1294 | yybackup. |
1295 `-----------*/
1296 yybackup:
1297
1298 /* Do appropriate processing given the current state. Read a
1299 lookahead token if we need one and don't already have one. */
1300
1301 /* First try to decide what to do without reference to lookahead token. */
1302 yyn = yypact[yystate];
1303 if (yypact_value_is_default (yyn))
1304 goto yydefault;
1305
1306 /* Not known => get a lookahead token if don't already have one. */
1307
1308 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1309 if (yychar == YYEMPTY)
1310 {
1311 YYDPRINTF ((stderr, "Reading a token: "));
1312 yychar = yylex (&yylval, info);
1313 }
1314
1315 if (yychar <= YYEOF)
1316 {
1317 yychar = yytoken = YYEOF;
1318 YYDPRINTF ((stderr, "Now at end of input.\n"));
1319 }
1320 else
1321 {
1322 yytoken = YYTRANSLATE (yychar);
1323 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1324 }
1325
1326 /* If the proper action on seeing token YYTOKEN is to reduce or to
1327 detect an error, take that action. */
1328 yyn += yytoken;
1329 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1330 goto yydefault;
1331 yyn = yytable[yyn];
1332 if (yyn <= 0)
1333 {
1334 if (yytable_value_is_error (yyn))
1335 goto yyerrlab;
1336 yyn = -yyn;
1337 goto yyreduce;
1338 }
1339
1340 /* Count tokens shifted since error; after three, turn off error
1341 status. */
1342 if (yyerrstatus)
1343 yyerrstatus--;
1344
1345 /* Shift the lookahead token. */
1346 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1347
1348 /* Discard the shifted token. */
1349 yychar = YYEMPTY;
1350
1351 yystate = yyn;
1352 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1353 *++yyvsp = yylval;
1354 YY_IGNORE_MAYBE_UNINITIALIZED_END
1355
1356 goto yynewstate;
1357
1358
1359 /*-----------------------------------------------------------.
1360 | yydefault -- do the default action for the current state. |
1361 `-----------------------------------------------------------*/
1362 yydefault:
1363 yyn = yydefact[yystate];
1364 if (yyn == 0)
1365 goto yyerrlab;
1366 goto yyreduce;
1367
1368
1369 /*-----------------------------.
1370 | yyreduce -- Do a reduction. |
1371 `-----------------------------*/
1372 yyreduce:
1373 /* yyn is the number of a rule to reduce with. */
1374 yylen = yyr2[yyn];
1375
1376 /* If YYLEN is nonzero, implement the default value of the action:
1377 '$$ = $1'.
1378
1379 Otherwise, the following line sets YYVAL to garbage.
1380 This behavior is undocumented and Bison
1381 users should not rely upon it. Assigning to YYVAL
1382 unconditionally makes the parser a bit smaller, and it avoids a
1383 GCC warning that YYVAL may be used uninitialized. */
1384 yyval = yyvsp[1-yylen];
1385
1386
1387 YY_REDUCE_PRINT (yyn);
1388 switch (yyn)
1389 {
1390 case 2:
1391 #line 139 "cond.y" /* yacc.c:1646 */
1392 {
1393 COND_input* cond = (COND_input*) info;
1394 cond->result = (yyvsp[0].value);
1395 }
1396 #line 1417 "cond.tab.c" /* yacc.c:1646 */
1397 break;
1398
1399 case 3:
1400 #line 144 "cond.y" /* yacc.c:1646 */
1401 {
1402 COND_input* cond = (COND_input*) info;
1403 cond->result = MSICONDITION_NONE;
1404 }
1405 #line 1426 "cond.tab.c" /* yacc.c:1646 */
1406 break;
1407
1408 case 4:
1409 #line 152 "cond.y" /* yacc.c:1646 */
1410 {
1411 (yyval.value) = (yyvsp[0].value);
1412 }
1413 #line 1434 "cond.tab.c" /* yacc.c:1646 */
1414 break;
1415
1416 case 5:
1417 #line 156 "cond.y" /* yacc.c:1646 */
1418 {
1419 (yyval.value) = (yyvsp[-2].value) || (yyvsp[0].value);
1420 }
1421 #line 1442 "cond.tab.c" /* yacc.c:1646 */
1422 break;
1423
1424 case 6:
1425 #line 160 "cond.y" /* yacc.c:1646 */
1426 {
1427 (yyval.value) = !(yyvsp[-2].value) || (yyvsp[0].value);
1428 }
1429 #line 1450 "cond.tab.c" /* yacc.c:1646 */
1430 break;
1431
1432 case 7:
1433 #line 164 "cond.y" /* yacc.c:1646 */
1434 {
1435 (yyval.value) = ( (yyvsp[-2].value) || (yyvsp[0].value) ) && !( (yyvsp[-2].value) && (yyvsp[0].value) );
1436 }
1437 #line 1458 "cond.tab.c" /* yacc.c:1646 */
1438 break;
1439
1440 case 8:
1441 #line 168 "cond.y" /* yacc.c:1646 */
1442 {
1443 (yyval.value) = ( (yyvsp[-2].value) && (yyvsp[0].value) ) || ( !(yyvsp[-2].value) && !(yyvsp[0].value) );
1444 }
1445 #line 1466 "cond.tab.c" /* yacc.c:1646 */
1446 break;
1447
1448 case 9:
1449 #line 175 "cond.y" /* yacc.c:1646 */
1450 {
1451 (yyval.value) = (yyvsp[0].value);
1452 }
1453 #line 1474 "cond.tab.c" /* yacc.c:1646 */
1454 break;
1455
1456 case 10:
1457 #line 179 "cond.y" /* yacc.c:1646 */
1458 {
1459 (yyval.value) = (yyvsp[-2].value) && (yyvsp[0].value);
1460 }
1461 #line 1482 "cond.tab.c" /* yacc.c:1646 */
1462 break;
1463
1464 case 11:
1465 #line 186 "cond.y" /* yacc.c:1646 */
1466 {
1467 (yyval.value) = (yyvsp[0].value) ? 0 : 1;
1468 }
1469 #line 1490 "cond.tab.c" /* yacc.c:1646 */
1470 break;
1471
1472 case 12:
1473 #line 190 "cond.y" /* yacc.c:1646 */
1474 {
1475 (yyval.value) = (yyvsp[0].value) ? 1 : 0;
1476 }
1477 #line 1498 "cond.tab.c" /* yacc.c:1646 */
1478 break;
1479
1480 case 13:
1481 #line 194 "cond.y" /* yacc.c:1646 */
1482 {
1483 (yyval.value) = ((yyvsp[0].string) && (yyvsp[0].string)[0]) ? 1 : 0;
1484 cond_free( (yyvsp[0].string) );
1485 }
1486 #line 1507 "cond.tab.c" /* yacc.c:1646 */
1487 break;
1488
1489 case 14:
1490 #line 199 "cond.y" /* yacc.c:1646 */
1491 {
1492 (yyval.value) = compare_int( (yyvsp[-2].value), (yyvsp[-1].value), (yyvsp[0].value) );
1493 }
1494 #line 1515 "cond.tab.c" /* yacc.c:1646 */
1495 break;
1496
1497 case 15:
1498 #line 203 "cond.y" /* yacc.c:1646 */
1499 {
1500 int num;
1501 if (num_from_prop( (yyvsp[-2].string), &num ))
1502 (yyval.value) = compare_int( num, (yyvsp[-1].value), (yyvsp[0].value) );
1503 else
1504 (yyval.value) = ((yyvsp[-1].value) == COND_NE || (yyvsp[-1].value) == COND_INE );
1505 cond_free( (yyvsp[-2].string) );
1506 }
1507 #line 1528 "cond.tab.c" /* yacc.c:1646 */
1508 break;
1509
1510 case 16:
1511 #line 212 "cond.y" /* yacc.c:1646 */
1512 {
1513 int num;
1514 if (num_from_prop( (yyvsp[0].string), &num ))
1515 (yyval.value) = compare_int( (yyvsp[-2].value), (yyvsp[-1].value), num );
1516 else
1517 (yyval.value) = ((yyvsp[-1].value) == COND_NE || (yyvsp[-1].value) == COND_INE );
1518 cond_free( (yyvsp[0].string) );
1519 }
1520 #line 1541 "cond.tab.c" /* yacc.c:1646 */
1521 break;
1522
1523 case 17:
1524 #line 221 "cond.y" /* yacc.c:1646 */
1525 {
1526 (yyval.value) = compare_and_free_strings( (yyvsp[-2].string), (yyvsp[-1].value), (yyvsp[0].string), TRUE );
1527 }
1528 #line 1549 "cond.tab.c" /* yacc.c:1646 */
1529 break;
1530
1531 case 18:
1532 #line 225 "cond.y" /* yacc.c:1646 */
1533 {
1534 (yyval.value) = compare_and_free_strings( (yyvsp[-2].string), (yyvsp[-1].value), (yyvsp[0].string), TRUE );
1535 }
1536 #line 1557 "cond.tab.c" /* yacc.c:1646 */
1537 break;
1538
1539 case 19:
1540 #line 229 "cond.y" /* yacc.c:1646 */
1541 {
1542 (yyval.value) = compare_and_free_strings( (yyvsp[-2].string), (yyvsp[-1].value), (yyvsp[0].string), TRUE );
1543 }
1544 #line 1565 "cond.tab.c" /* yacc.c:1646 */
1545 break;
1546
1547 case 20:
1548 #line 233 "cond.y" /* yacc.c:1646 */
1549 {
1550 (yyval.value) = compare_and_free_strings( (yyvsp[-2].string), (yyvsp[-1].value), (yyvsp[0].string), FALSE );
1551 }
1552 #line 1573 "cond.tab.c" /* yacc.c:1646 */
1553 break;
1554
1555 case 21:
1556 #line 237 "cond.y" /* yacc.c:1646 */
1557 {
1558 (yyval.value) = 0;
1559 cond_free( (yyvsp[-2].string) );
1560 }
1561 #line 1582 "cond.tab.c" /* yacc.c:1646 */
1562 break;
1563
1564 case 22:
1565 #line 242 "cond.y" /* yacc.c:1646 */
1566 {
1567 (yyval.value) = 0;
1568 cond_free( (yyvsp[0].string) );
1569 }
1570 #line 1591 "cond.tab.c" /* yacc.c:1646 */
1571 break;
1572
1573 case 23:
1574 #line 247 "cond.y" /* yacc.c:1646 */
1575 {
1576 (yyval.value) = (yyvsp[-1].value);
1577 }
1578 #line 1599 "cond.tab.c" /* yacc.c:1646 */
1579 break;
1580
1581 case 24:
1582 #line 254 "cond.y" /* yacc.c:1646 */
1583 { (yyval.value) = COND_EQ; }
1584 #line 1605 "cond.tab.c" /* yacc.c:1646 */
1585 break;
1586
1587 case 25:
1588 #line 255 "cond.y" /* yacc.c:1646 */
1589 { (yyval.value) = COND_NE; }
1590 #line 1611 "cond.tab.c" /* yacc.c:1646 */
1591 break;
1592
1593 case 26:
1594 #line 256 "cond.y" /* yacc.c:1646 */
1595 { (yyval.value) = COND_LT; }
1596 #line 1617 "cond.tab.c" /* yacc.c:1646 */
1597 break;
1598
1599 case 27:
1600 #line 257 "cond.y" /* yacc.c:1646 */
1601 { (yyval.value) = COND_GT; }
1602 #line 1623 "cond.tab.c" /* yacc.c:1646 */
1603 break;
1604
1605 case 28:
1606 #line 258 "cond.y" /* yacc.c:1646 */
1607 { (yyval.value) = COND_LE; }
1608 #line 1629 "cond.tab.c" /* yacc.c:1646 */
1609 break;
1610
1611 case 29:
1612 #line 259 "cond.y" /* yacc.c:1646 */
1613 { (yyval.value) = COND_GE; }
1614 #line 1635 "cond.tab.c" /* yacc.c:1646 */
1615 break;
1616
1617 case 30:
1618 #line 260 "cond.y" /* yacc.c:1646 */
1619 { (yyval.value) = COND_SS; }
1620 #line 1641 "cond.tab.c" /* yacc.c:1646 */
1621 break;
1622
1623 case 31:
1624 #line 261 "cond.y" /* yacc.c:1646 */
1625 { (yyval.value) = COND_IEQ; }
1626 #line 1647 "cond.tab.c" /* yacc.c:1646 */
1627 break;
1628
1629 case 32:
1630 #line 262 "cond.y" /* yacc.c:1646 */
1631 { (yyval.value) = COND_INE; }
1632 #line 1653 "cond.tab.c" /* yacc.c:1646 */
1633 break;
1634
1635 case 33:
1636 #line 263 "cond.y" /* yacc.c:1646 */
1637 { (yyval.value) = COND_ILT; }
1638 #line 1659 "cond.tab.c" /* yacc.c:1646 */
1639 break;
1640
1641 case 34:
1642 #line 264 "cond.y" /* yacc.c:1646 */
1643 { (yyval.value) = COND_IGT; }
1644 #line 1665 "cond.tab.c" /* yacc.c:1646 */
1645 break;
1646
1647 case 35:
1648 #line 265 "cond.y" /* yacc.c:1646 */
1649 { (yyval.value) = COND_ILE; }
1650 #line 1671 "cond.tab.c" /* yacc.c:1646 */
1651 break;
1652
1653 case 36:
1654 #line 266 "cond.y" /* yacc.c:1646 */
1655 { (yyval.value) = COND_IGE; }
1656 #line 1677 "cond.tab.c" /* yacc.c:1646 */
1657 break;
1658
1659 case 37:
1660 #line 267 "cond.y" /* yacc.c:1646 */
1661 { (yyval.value) = COND_ISS; }
1662 #line 1683 "cond.tab.c" /* yacc.c:1646 */
1663 break;
1664
1665 case 38:
1666 #line 268 "cond.y" /* yacc.c:1646 */
1667 { (yyval.value) = COND_LHS; }
1668 #line 1689 "cond.tab.c" /* yacc.c:1646 */
1669 break;
1670
1671 case 39:
1672 #line 269 "cond.y" /* yacc.c:1646 */
1673 { (yyval.value) = COND_RHS; }
1674 #line 1695 "cond.tab.c" /* yacc.c:1646 */
1675 break;
1676
1677 case 40:
1678 #line 270 "cond.y" /* yacc.c:1646 */
1679 { (yyval.value) = COND_ILHS; }
1680 #line 1701 "cond.tab.c" /* yacc.c:1646 */
1681 break;
1682
1683 case 41:
1684 #line 271 "cond.y" /* yacc.c:1646 */
1685 { (yyval.value) = COND_IRHS; }
1686 #line 1707 "cond.tab.c" /* yacc.c:1646 */
1687 break;
1688
1689 case 42:
1690 #line 276 "cond.y" /* yacc.c:1646 */
1691 {
1692 (yyval.string) = (yyvsp[0].string);
1693 }
1694 #line 1715 "cond.tab.c" /* yacc.c:1646 */
1695 break;
1696
1697 case 43:
1698 #line 280 "cond.y" /* yacc.c:1646 */
1699 {
1700 (yyval.string) = (yyvsp[0].string);
1701 }
1702 #line 1723 "cond.tab.c" /* yacc.c:1646 */
1703 break;
1704
1705 case 44:
1706 #line 287 "cond.y" /* yacc.c:1646 */
1707 {
1708 COND_input* cond = (COND_input*) info;
1709 (yyval.string) = COND_GetLiteral( cond, &(yyvsp[0].str) );
1710 if( !(yyval.string) )
1711 YYABORT;
1712 }
1713 #line 1734 "cond.tab.c" /* yacc.c:1646 */
1714 break;
1715
1716 case 45:
1717 #line 297 "cond.y" /* yacc.c:1646 */
1718 {
1719 (yyval.value) = (yyvsp[0].value);
1720 }
1721 #line 1742 "cond.tab.c" /* yacc.c:1646 */
1722 break;
1723
1724 case 46:
1725 #line 301 "cond.y" /* yacc.c:1646 */
1726 {
1727 COND_input* cond = (COND_input*) info;
1728 INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
1729
1730 MSI_GetComponentStateW(cond->package, (yyvsp[0].string), &install, &action );
1731 (yyval.value) = action;
1732 cond_free( (yyvsp[0].string) );
1733 }
1734 #line 1755 "cond.tab.c" /* yacc.c:1646 */
1735 break;
1736
1737 case 47:
1738 #line 310 "cond.y" /* yacc.c:1646 */
1739 {
1740 COND_input* cond = (COND_input*) info;
1741 INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
1742
1743 MSI_GetComponentStateW(cond->package, (yyvsp[0].string), &install, &action );
1744 (yyval.value) = install;
1745 cond_free( (yyvsp[0].string) );
1746 }
1747 #line 1768 "cond.tab.c" /* yacc.c:1646 */
1748 break;
1749
1750 case 48:
1751 #line 319 "cond.y" /* yacc.c:1646 */
1752 {
1753 COND_input* cond = (COND_input*) info;
1754 INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
1755
1756 MSI_GetFeatureStateW(cond->package, (yyvsp[0].string), &install, &action );
1757 if (action == INSTALLSTATE_UNKNOWN)
1758 (yyval.value) = MSICONDITION_FALSE;
1759 else
1760 (yyval.value) = action;
1761
1762 cond_free( (yyvsp[0].string) );
1763 }
1764 #line 1785 "cond.tab.c" /* yacc.c:1646 */
1765 break;
1766
1767 case 49:
1768 #line 332 "cond.y" /* yacc.c:1646 */
1769 {
1770 COND_input* cond = (COND_input*) info;
1771 INSTALLSTATE install = INSTALLSTATE_UNKNOWN, action = INSTALLSTATE_UNKNOWN;
1772
1773 MSI_GetFeatureStateW(cond->package, (yyvsp[0].string), &install, &action );
1774 (yyval.value) = install;
1775 cond_free( (yyvsp[0].string) );
1776 }
1777 #line 1798 "cond.tab.c" /* yacc.c:1646 */
1778 break;
1779
1780 case 50:
1781 #line 344 "cond.y" /* yacc.c:1646 */
1782 {
1783 COND_input* cond = (COND_input*) info;
1784 UINT len;
1785
1786 (yyval.string) = msi_dup_property( cond->package->db, (yyvsp[0].string) );
1787 if ((yyval.string))
1788 {
1789 len = (lstrlenW((yyval.string)) + 1) * sizeof (WCHAR);
1790 (yyval.string) = cond_track_mem( cond, (yyval.string), len );
1791 }
1792 cond_free( (yyvsp[0].string) );
1793 }
1794 #line 1815 "cond.tab.c" /* yacc.c:1646 */
1795 break;
1796
1797 case 51:
1798 #line 357 "cond.y" /* yacc.c:1646 */
1799 {
1800 COND_input* cond = (COND_input*) info;
1801 UINT len = GetEnvironmentVariableW( (yyvsp[0].string), NULL, 0 );
1802 (yyval.string) = NULL;
1803 if (len++)
1804 {
1805 (yyval.string) = cond_alloc( cond, len*sizeof (WCHAR) );
1806 if( !(yyval.string) )
1807 YYABORT;
1808 GetEnvironmentVariableW( (yyvsp[0].string), (yyval.string), len );
1809 }
1810 cond_free( (yyvsp[0].string) );
1811 }
1812 #line 1833 "cond.tab.c" /* yacc.c:1646 */
1813 break;
1814
1815 case 52:
1816 #line 374 "cond.y" /* yacc.c:1646 */
1817 {
1818 COND_input* cond = (COND_input*) info;
1819 (yyval.string) = COND_GetString( cond, &(yyvsp[0].str) );
1820 if( !(yyval.string) )
1821 YYABORT;
1822 }
1823 #line 1844 "cond.tab.c" /* yacc.c:1646 */
1824 break;
1825
1826 case 53:
1827 #line 384 "cond.y" /* yacc.c:1646 */
1828 {
1829 COND_input* cond = (COND_input*) info;
1830 LPWSTR szNum = COND_GetString( cond, &(yyvsp[0].str) );
1831 if( !szNum )
1832 YYABORT;
1833 (yyval.value) = atoiW( szNum );
1834 cond_free( szNum );
1835 }
1836 #line 1857 "cond.tab.c" /* yacc.c:1646 */
1837 break;
1838
1839
1840 #line 1861 "cond.tab.c" /* yacc.c:1646 */
1841 default: break;
1842 }
1843 /* User semantic actions sometimes alter yychar, and that requires
1844 that yytoken be updated with the new translation. We take the
1845 approach of translating immediately before every use of yytoken.
1846 One alternative is translating here after every semantic action,
1847 but that translation would be missed if the semantic action invokes
1848 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1849 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1850 incorrect destructor might then be invoked immediately. In the
1851 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1852 to an incorrect destructor call or verbose syntax error message
1853 before the lookahead is translated. */
1854 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1855
1856 YYPOPSTACK (yylen);
1857 yylen = 0;
1858 YY_STACK_PRINT (yyss, yyssp);
1859
1860 *++yyvsp = yyval;
1861
1862 /* Now 'shift' the result of the reduction. Determine what state
1863 that goes to, based on the state we popped back to and the rule
1864 number reduced by. */
1865
1866 yyn = yyr1[yyn];
1867
1868 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1869 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1870 yystate = yytable[yystate];
1871 else
1872 yystate = yydefgoto[yyn - YYNTOKENS];
1873
1874 goto yynewstate;
1875
1876
1877 /*--------------------------------------.
1878 | yyerrlab -- here on detecting error. |
1879 `--------------------------------------*/
1880 yyerrlab:
1881 /* Make sure we have latest lookahead translation. See comments at
1882 user semantic actions for why this is necessary. */
1883 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1884
1885 /* If not already recovering from an error, report this error. */
1886 if (!yyerrstatus)
1887 {
1888 ++yynerrs;
1889 #if ! YYERROR_VERBOSE
1890 yyerror (info, YY_("syntax error"));
1891 #else
1892 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1893 yyssp, yytoken)
1894 {
1895 char const *yymsgp = YY_("syntax error");
1896 int yysyntax_error_status;
1897 yysyntax_error_status = YYSYNTAX_ERROR;
1898 if (yysyntax_error_status == 0)
1899 yymsgp = yymsg;
1900 else if (yysyntax_error_status == 1)
1901 {
1902 if (yymsg != yymsgbuf)
1903 YYSTACK_FREE (yymsg);
1904 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1905 if (!yymsg)
1906 {
1907 yymsg = yymsgbuf;
1908 yymsg_alloc = sizeof yymsgbuf;
1909 yysyntax_error_status = 2;
1910 }
1911 else
1912 {
1913 yysyntax_error_status = YYSYNTAX_ERROR;
1914 yymsgp = yymsg;
1915 }
1916 }
1917 yyerror (info, yymsgp);
1918 if (yysyntax_error_status == 2)
1919 goto yyexhaustedlab;
1920 }
1921 # undef YYSYNTAX_ERROR
1922 #endif
1923 }
1924
1925
1926
1927 if (yyerrstatus == 3)
1928 {
1929 /* If just tried and failed to reuse lookahead token after an
1930 error, discard it. */
1931
1932 if (yychar <= YYEOF)
1933 {
1934 /* Return failure if at end of input. */
1935 if (yychar == YYEOF)
1936 YYABORT;
1937 }
1938 else
1939 {
1940 yydestruct ("Error: discarding",
1941 yytoken, &yylval, info);
1942 yychar = YYEMPTY;
1943 }
1944 }
1945
1946 /* Else will try to reuse lookahead token after shifting the error
1947 token. */
1948 goto yyerrlab1;
1949
1950
1951 /*---------------------------------------------------.
1952 | yyerrorlab -- error raised explicitly by YYERROR. |
1953 `---------------------------------------------------*/
1954 yyerrorlab:
1955
1956 /* Pacify compilers like GCC when the user code never invokes
1957 YYERROR and the label yyerrorlab therefore never appears in user
1958 code. */
1959 if (/*CONSTCOND*/ 0)
1960 goto yyerrorlab;
1961
1962 /* Do not reclaim the symbols of the rule whose action triggered
1963 this YYERROR. */
1964 YYPOPSTACK (yylen);
1965 yylen = 0;
1966 YY_STACK_PRINT (yyss, yyssp);
1967 yystate = *yyssp;
1968 goto yyerrlab1;
1969
1970
1971 /*-------------------------------------------------------------.
1972 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1973 `-------------------------------------------------------------*/
1974 yyerrlab1:
1975 yyerrstatus = 3; /* Each real token shifted decrements this. */
1976
1977 for (;;)
1978 {
1979 yyn = yypact[yystate];
1980 if (!yypact_value_is_default (yyn))
1981 {
1982 yyn += YYTERROR;
1983 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1984 {
1985 yyn = yytable[yyn];
1986 if (0 < yyn)
1987 break;
1988 }
1989 }
1990
1991 /* Pop the current state because it cannot handle the error token. */
1992 if (yyssp == yyss)
1993 YYABORT;
1994
1995
1996 yydestruct ("Error: popping",
1997 yystos[yystate], yyvsp, info);
1998 YYPOPSTACK (1);
1999 yystate = *yyssp;
2000 YY_STACK_PRINT (yyss, yyssp);
2001 }
2002
2003 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2004 *++yyvsp = yylval;
2005 YY_IGNORE_MAYBE_UNINITIALIZED_END
2006
2007
2008 /* Shift the error token. */
2009 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2010
2011 yystate = yyn;
2012 goto yynewstate;
2013
2014
2015 /*-------------------------------------.
2016 | yyacceptlab -- YYACCEPT comes here. |
2017 `-------------------------------------*/
2018 yyacceptlab:
2019 yyresult = 0;
2020 goto yyreturn;
2021
2022 /*-----------------------------------.
2023 | yyabortlab -- YYABORT comes here. |
2024 `-----------------------------------*/
2025 yyabortlab:
2026 yyresult = 1;
2027 goto yyreturn;
2028
2029 #if !defined yyoverflow || YYERROR_VERBOSE
2030 /*-------------------------------------------------.
2031 | yyexhaustedlab -- memory exhaustion comes here. |
2032 `-------------------------------------------------*/
2033 yyexhaustedlab:
2034 yyerror (info, YY_("memory exhausted"));
2035 yyresult = 2;
2036 /* Fall through. */
2037 #endif
2038
2039 yyreturn:
2040 if (yychar != YYEMPTY)
2041 {
2042 /* Make sure we have latest lookahead translation. See comments at
2043 user semantic actions for why this is necessary. */
2044 yytoken = YYTRANSLATE (yychar);
2045 yydestruct ("Cleanup: discarding lookahead",
2046 yytoken, &yylval, info);
2047 }
2048 /* Do not reclaim the symbols of the rule whose action triggered
2049 this YYABORT or YYACCEPT. */
2050 YYPOPSTACK (yylen);
2051 YY_STACK_PRINT (yyss, yyssp);
2052 while (yyssp != yyss)
2053 {
2054 yydestruct ("Cleanup: popping",
2055 yystos[*yyssp], yyvsp, info);
2056 YYPOPSTACK (1);
2057 }
2058 #ifndef yyoverflow
2059 if (yyss != yyssa)
2060 YYSTACK_FREE (yyss);
2061 #endif
2062 #if YYERROR_VERBOSE
2063 if (yymsg != yymsgbuf)
2064 YYSTACK_FREE (yymsg);
2065 #endif
2066 return yyresult;
2067 }
2068 #line 394 "cond.y" /* yacc.c:1906 */
2069
2070
2071
2072 static int COND_IsAlpha( WCHAR x )
2073 {
2074 return( ( ( x >= 'A' ) && ( x <= 'Z' ) ) ||
2075 ( ( x >= 'a' ) && ( x <= 'z' ) ) ||
2076 ( ( x == '_' ) ) );
2077 }
2078
2079 static int COND_IsNumber( WCHAR x )
2080 {
2081 return( (( x >= '0' ) && ( x <= '9' )) || (x =='-') || (x =='.') );
2082 }
2083
2084 static WCHAR *strstriW( const WCHAR *str, const WCHAR *sub )
2085 {
2086 LPWSTR strlower, sublower, r;
2087 strlower = CharLowerW( strdupW( str ) );
2088 sublower = CharLowerW( strdupW( sub ) );
2089 r = strstrW( strlower, sublower );
2090 if (r)
2091 r = (LPWSTR)str + (r - strlower);
2092 msi_free( strlower );
2093 msi_free( sublower );
2094 return r;
2095 }
2096
2097 static BOOL str_is_number( LPCWSTR str )
2098 {
2099 int i;
2100
2101 if (!*str)
2102 return FALSE;
2103
2104 for (i = 0; i < lstrlenW( str ); i++)
2105 if (!isdigitW(str[i]))
2106 return FALSE;
2107
2108 return TRUE;
2109 }
2110
2111 static INT compare_substring( LPCWSTR a, INT operator, LPCWSTR b )
2112 {
2113 int lhs, rhs;
2114
2115 /* substring operators return 0 if LHS is missing */
2116 if (!a || !*a)
2117 return 0;
2118
2119 /* substring operators return 1 if RHS is missing */
2120 if (!b || !*b)
2121 return 1;
2122
2123 /* if both strings contain only numbers, use integer comparison */
2124 lhs = atoiW(a);
2125 rhs = atoiW(b);
2126 if (str_is_number(a) && str_is_number(b))
2127 return compare_int( lhs, operator, rhs );
2128
2129 switch (operator)
2130 {
2131 case COND_SS:
2132 return strstrW( a, b ) != 0;
2133 case COND_ISS:
2134 return strstriW( a, b ) != 0;
2135 case COND_LHS:
2136 {
2137 int l = strlenW( a );
2138 int r = strlenW( b );
2139 if (r > l) return 0;
2140 return !strncmpW( a, b, r );
2141 }
2142 case COND_RHS:
2143 {
2144 int l = strlenW( a );
2145 int r = strlenW( b );
2146 if (r > l) return 0;
2147 return !strncmpW( a + (l - r), b, r );
2148 }
2149 case COND_ILHS:
2150 {
2151 int l = strlenW( a );
2152 int r = strlenW( b );
2153 if (r > l) return 0;
2154 return !strncmpiW( a, b, r );
2155 }
2156 case COND_IRHS:
2157 {
2158 int l = strlenW( a );
2159 int r = strlenW( b );
2160 if (r > l) return 0;
2161 return !strncmpiW( a + (l - r), b, r );
2162 }
2163 default:
2164 ERR("invalid substring operator\n");
2165 return 0;
2166 }
2167 return 0;
2168 }
2169
2170 static INT compare_string( LPCWSTR a, INT operator, LPCWSTR b, BOOL convert )
2171 {
2172 if (operator >= COND_SS && operator <= COND_RHS)
2173 return compare_substring( a, operator, b );
2174
2175 /* null and empty string are equivalent */
2176 if (!a) a = szEmpty;
2177 if (!b) b = szEmpty;
2178
2179 if (convert && str_is_number(a) && str_is_number(b))
2180 return compare_int( atoiW(a), operator, atoiW(b) );
2181
2182 /* a or b may be NULL */
2183 switch (operator)
2184 {
2185 case COND_LT:
2186 return strcmpW( a, b ) < 0;
2187 case COND_GT:
2188 return strcmpW( a, b ) > 0;
2189 case COND_EQ:
2190 return strcmpW( a, b ) == 0;
2191 case COND_NE:
2192 return strcmpW( a, b ) != 0;
2193 case COND_GE:
2194 return strcmpW( a, b ) >= 0;
2195 case COND_LE:
2196 return strcmpW( a, b ) <= 0;
2197 case COND_ILT:
2198 return strcmpiW( a, b ) < 0;
2199 case COND_IGT:
2200 return strcmpiW( a, b ) > 0;
2201 case COND_IEQ:
2202 return strcmpiW( a, b ) == 0;
2203 case COND_INE:
2204 return strcmpiW( a, b ) != 0;
2205 case COND_IGE:
2206 return strcmpiW( a, b ) >= 0;
2207 case COND_ILE:
2208 return strcmpiW( a, b ) <= 0;
2209 default:
2210 ERR("invalid string operator\n");
2211 return 0;
2212 }
2213 return 0;
2214 }
2215
2216
2217 static INT compare_int( INT a, INT operator, INT b )
2218 {
2219 switch (operator)
2220 {
2221 case COND_LT:
2222 case COND_ILT:
2223 return a < b;
2224 case COND_GT:
2225 case COND_IGT:
2226 return a > b;
2227 case COND_EQ:
2228 case COND_IEQ:
2229 return a == b;
2230 case COND_NE:
2231 case COND_INE:
2232 return a != b;
2233 case COND_GE:
2234 case COND_IGE:
2235 return a >= b;
2236 case COND_LE:
2237 case COND_ILE:
2238 return a <= b;
2239 case COND_SS:
2240 case COND_ISS:
2241 return ( a & b ) ? 1 : 0;
2242 case COND_RHS:
2243 return ( ( a & 0xffff ) == b ) ? 1 : 0;
2244 case COND_LHS:
2245 return ( ( (a>>16) & 0xffff ) == b ) ? 1 : 0;
2246 default:
2247 ERR("invalid integer operator\n");
2248 return 0;
2249 }
2250 return 0;
2251 }
2252
2253
2254 static int COND_IsIdent( WCHAR x )
2255 {
2256 return( COND_IsAlpha( x ) || COND_IsNumber( x ) || ( x == '_' )
2257 || ( x == '#' ) || (x == '.') );
2258 }
2259
2260 static int COND_GetOperator( COND_input *cond )
2261 {
2262 static const struct {
2263 const WCHAR str[4];
2264 int id;
2265 } table[] = {
2266 { {'~','<','=',0}, COND_ILE },
2267 { {'~','>','<',0}, COND_ISS },
2268 { {'~','>','>',0}, COND_IRHS },
2269 { {'~','<','>',0}, COND_INE },
2270 { {'~','>','=',0}, COND_IGE },
2271 { {'~','<','<',0}, COND_ILHS },
2272 { {'~','=',0}, COND_IEQ },
2273 { {'~','<',0}, COND_ILT },
2274 { {'~','>',0}, COND_IGT },
2275 { {'>','=',0}, COND_GE },
2276 { {'>','<',0}, COND_SS },
2277 { {'<','<',0}, COND_LHS },
2278 { {'<','>',0}, COND_NE },
2279 { {'<','=',0}, COND_LE },
2280 { {'>','>',0}, COND_RHS },
2281 { {'>',0}, COND_GT },
2282 { {'<',0}, COND_LT },
2283 { {0}, 0 }
2284 };
2285 LPCWSTR p = &cond->str[cond->n];
2286 int i = 0, len;
2287
2288 while ( 1 )
2289 {
2290 len = lstrlenW( table[i].str );
2291 if ( !len || 0 == strncmpW( table[i].str, p, len ) )
2292 break;
2293 i++;
2294 }
2295 cond->n += len;
2296 return table[i].id;
2297 }
2298
2299 static int COND_GetOne( struct cond_str *str, COND_input *cond )
2300 {
2301 int rc, len = 1;
2302 WCHAR ch;
2303
2304 str->data = &cond->str[cond->n];
2305
2306 ch = str->data[0];
2307
2308 switch( ch )
2309 {
2310 case 0: return 0;
2311 case '(': rc = COND_LPAR; break;
2312 case ')': rc = COND_RPAR; break;
2313 case '&': rc = COND_AMPER; break;
2314 case '!': rc = COND_EXCLAM; break;
2315 case '$': rc = COND_DOLLARS; break;
2316 case '?': rc = COND_QUESTION; break;
2317 case '%': rc = COND_PERCENT; break;
2318 case ' ': rc = COND_SPACE; break;
2319 case '=': rc = COND_EQ; break;
2320
2321 case '~':
2322 case '<':
2323 case '>':
2324 rc = COND_GetOperator( cond );
2325 if (!rc)
2326 rc = COND_ERROR;
2327 return rc;
2328 default:
2329 rc = 0;
2330 }
2331
2332 if ( rc )
2333 {
2334 cond->n += len;
2335 return rc;
2336 }
2337
2338 if (ch == '"' )
2339 {
2340 LPCWSTR p = strchrW( str->data + 1, '"' );
2341 if (!p) return COND_ERROR;
2342 len = p - str->data + 1;
2343 rc = COND_LITER;
2344 }
2345 else if( COND_IsAlpha( ch ) )
2346 {
2347 static const WCHAR szNot[] = {'N','O','T',0};
2348 static const WCHAR szAnd[] = {'A','N','D',0};
2349 static const WCHAR szXor[] = {'X','O','R',0};
2350 static const WCHAR szEqv[] = {'E','Q','V',0};
2351 static const WCHAR szImp[] = {'I','M','P',0};
2352 static const WCHAR szOr[] = {'O','R',0};
2353
2354 while( COND_IsIdent( str->data[len] ) )
2355 len++;
2356 rc = COND_IDENT;
2357
2358 if ( len == 3 )
2359 {
2360 if ( !strncmpiW( str->data, szNot, len ) )
2361 rc = COND_NOT;
2362 else if( !strncmpiW( str->data, szAnd, len ) )
2363 rc = COND_AND;
2364 else if( !strncmpiW( str->data, szXor, len ) )
2365 rc = COND_XOR;
2366 else if( !strncmpiW( str->data, szEqv, len ) )
2367 rc = COND_EQV;
2368 else if( !strncmpiW( str->data, szImp, len ) )
2369 rc = COND_IMP;
2370 }
2371 else if( (len == 2) && !strncmpiW( str->data, szOr, len ) )
2372 rc = COND_OR;
2373 }
2374 else if( COND_IsNumber( ch ) )
2375 {
2376 while( COND_IsNumber( str->data[len] ) )
2377 len++;
2378 rc = COND_NUMBER;
2379 }
2380 else
2381 {
2382 ERR("Got unknown character %c(%x)\n",ch,ch);
2383 return COND_ERROR;
2384 }
2385
2386 cond->n += len;
2387 str->len = len;
2388
2389 return rc;
2390 }
2391
2392 static int cond_lex( void *COND_lval, COND_input *cond )
2393 {
2394 int rc;
2395 struct cond_str *str = COND_lval;
2396
2397 do {
2398 rc = COND_GetOne( str, cond );
2399 } while (rc == COND_SPACE);
2400
2401 return rc;
2402 }
2403
2404 static LPWSTR COND_GetString( COND_input *cond, const struct cond_str *str )
2405 {
2406 LPWSTR ret;
2407
2408 ret = cond_alloc( cond, (str->len+1) * sizeof (WCHAR) );
2409 if( ret )
2410 {
2411 memcpy( ret, str->data, str->len * sizeof(WCHAR));
2412 ret[str->len]=0;
2413 }
2414 TRACE("Got identifier %s\n",debugstr_w(ret));
2415 return ret;
2416 }
2417
2418 static LPWSTR COND_GetLiteral( COND_input *cond, const struct cond_str *str )
2419 {
2420 LPWSTR ret;
2421
2422 ret = cond_alloc( cond, (str->len-1) * sizeof (WCHAR) );
2423 if( ret )
2424 {
2425 memcpy( ret, str->data+1, (str->len-2) * sizeof(WCHAR) );
2426 ret[str->len - 2]=0;
2427 }
2428 TRACE("Got literal %s\n",debugstr_w(ret));
2429 return ret;
2430 }
2431
2432 static void *cond_alloc( COND_input *cond, unsigned int sz )
2433 {
2434 struct list *mem;
2435
2436 mem = msi_alloc( sizeof (struct list) + sz );
2437 if( !mem )
2438 return NULL;
2439
2440 list_add_head( &(cond->mem), mem );
2441 return mem + 1;
2442 }
2443
2444 static void *cond_track_mem( COND_input *cond, void *ptr, unsigned int sz )
2445 {
2446 void *new_ptr;
2447
2448 if( !ptr )
2449 return ptr;
2450
2451 new_ptr = cond_alloc( cond, sz );
2452 if( !new_ptr )
2453 {
2454 msi_free( ptr );
2455 return NULL;
2456 }
2457
2458 memcpy( new_ptr, ptr, sz );
2459 msi_free( ptr );
2460 return new_ptr;
2461 }
2462
2463 static void cond_free( void *ptr )
2464 {
2465 struct list *mem = (struct list *)ptr - 1;
2466
2467 if( ptr )
2468 {
2469 list_remove( mem );
2470 msi_free( mem );
2471 }
2472 }
2473
2474 static int cond_error( COND_input *info, const char *str )
2475 {
2476 TRACE("%s\n", str );
2477 return 0;
2478 }
2479
2480 MSICONDITION MSI_EvaluateConditionW( MSIPACKAGE *package, LPCWSTR szCondition )
2481 {
2482 COND_input cond;
2483 MSICONDITION r;
2484 struct list *mem, *safety;
2485
2486 TRACE("%s\n", debugstr_w( szCondition ) );
2487
2488 if (szCondition == NULL) return MSICONDITION_NONE;
2489
2490 cond.package = package;
2491 cond.str = szCondition;
2492 cond.n = 0;
2493 cond.result = MSICONDITION_ERROR;
2494
2495 list_init( &cond.mem );
2496
2497 if ( !cond_parse( &cond ) )
2498 r = cond.result;
2499 else
2500 r = MSICONDITION_ERROR;
2501
2502 LIST_FOR_EACH_SAFE( mem, safety, &cond.mem )
2503 {
2504 /* The tracked memory lives directly after the list struct */
2505 void *ptr = mem + 1;
2506 if ( r != MSICONDITION_ERROR )
2507 WARN( "condition parser failed to free up some memory: %p\n", ptr );
2508 cond_free( ptr );
2509 }
2510
2511 TRACE("%i <- %s\n", r, debugstr_w(szCondition));
2512 return r;
2513 }
2514
2515 MSICONDITION WINAPI MsiEvaluateConditionW( MSIHANDLE hInstall, LPCWSTR szCondition )
2516 {
2517 MSIPACKAGE *package;
2518 UINT ret;
2519
2520 package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE);
2521 if( !package )
2522 {
2523 HRESULT hr;
2524 BSTR condition;
2525 IWineMsiRemotePackage *remote_package;
2526
2527 remote_package = (IWineMsiRemotePackage *)msi_get_remote( hInstall );
2528 if (!remote_package)
2529 return MSICONDITION_ERROR;
2530
2531 condition = SysAllocString( szCondition );
2532 if (!condition)
2533 {
2534 IWineMsiRemotePackage_Release( remote_package );
2535 return ERROR_OUTOFMEMORY;
2536 }
2537
2538 hr = IWineMsiRemotePackage_EvaluateCondition( remote_package, condition );
2539
2540 SysFreeString( condition );
2541 IWineMsiRemotePackage_Release( remote_package );
2542
2543 if (FAILED(hr))
2544 {
2545 if (HRESULT_FACILITY(hr) == FACILITY_WIN32)
2546 return HRESULT_CODE(hr);
2547
2548 return ERROR_FUNCTION_FAILED;
2549 }
2550
2551 return ERROR_SUCCESS;
2552 }
2553
2554 ret = MSI_EvaluateConditionW( package, szCondition );
2555 msiobj_release( &package->hdr );
2556 return ret;
2557 }
2558
2559 MSICONDITION WINAPI MsiEvaluateConditionA( MSIHANDLE hInstall, LPCSTR szCondition )
2560 {
2561 LPWSTR szwCond = NULL;
2562 MSICONDITION r;
2563
2564 szwCond = strdupAtoW( szCondition );
2565 if( szCondition && !szwCond )
2566 return MSICONDITION_ERROR;
2567
2568 r = MsiEvaluateConditionW( hInstall, szwCond );
2569 msi_free( szwCond );
2570 return r;
2571 }