1 /* A Bison parser, made by GNU Bison 3.4.1.  */
2 
3 /* Bison implementation for Yacc-like parsers in C
4 
5    Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
6    Inc.
7 
8    This program is free software: you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10    the Free Software Foundation, either version 3 of the License, or
11    (at your option) any later version.
12 
13    This program is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16    GNU General Public License for more details.
17 
18    You should have received a copy of the GNU General Public License
19    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
20 
21 /* As a special exception, you may create a larger work that contains
22    part or all of the Bison parser skeleton and distribute that work
23    under terms of your choice, so long as that work isn't itself a
24    parser generator using the skeleton or a modified version thereof
25    as a parser skeleton.  Alternatively, if you modify or redistribute
26    the parser skeleton itself, you may (at your option) remove this
27    special exception, which will cause the skeleton and the resulting
28    Bison output files to be licensed under the GNU General Public
29    License without this special exception.
30 
31    This special exception was added by the Free Software Foundation in
32    version 2.2 of Bison.  */
33 
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35    simplifying the original so-called "semantic" parser.  */
36 
37 /* All symbols defined below should begin with yy or YY, to avoid
38    infringing on user name space.  This should be done even for local
39    variables, as they might otherwise be expanded by user macros.
40    There are some unavoidable exceptions within include files to
41    define necessary library symbols; they are noted "INFRINGES ON
42    USER NAME SPACE" below.  */
43 
44 /* Undocumented macros, especially those whose name start with YY_,
45    are private implementation details.  Do not rely on them.  */
46 
47 /* Identify Bison output.  */
48 #define YYBISON 1
49 
50 /* Bison version.  */
51 #define YYBISON_VERSION "3.4.1"
52 
53 /* Skeleton name.  */
54 #define YYSKELETON_NAME "yacc.c"
55 
56 /* Pure parsers.  */
57 #define YYPURE 1
58 
59 /* Push parsers.  */
60 #define YYPUSH 0
61 
62 /* Pull parsers.  */
63 #define YYPULL 1
64 
65 
66 
67 
68 /* First part of user prologue.  */
69 #line 1 "surveytargetexpressionparser.y"
70 
71 /*
72     Copyright (C) 2017 Volker Krause <vkrause@kde.org>
73 
74     Permission is hereby granted, free of charge, to any person obtaining
75     a copy of this software and associated documentation files (the
76     "Software"), to deal in the Software without restriction, including
77     without limitation the rights to use, copy, modify, merge, publish,
78     distribute, sublicense, and/or sell copies of the Software, and to
79     permit persons to whom the Software is furnished to do so, subject to
80     the following conditions:
81 
82     The above copyright notice and this permission notice shall be included
83     in all copies or substantial portions of the Software.
84 
85     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
87     MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
88     IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
89     CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
90     TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
91     SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
92 */
93 
94 #include "surveytargetexpression.h"
95 #include "surveytargetexpressionparser_p.h"
96 #include "surveytargetexpressionscanner.h"
97 
98 #include <stdio.h>
99 
100 using namespace KUserFeedback;
101 
yyerror(KUserFeedback::SurveyTargetExpression ** expression,yyscan_t scanner,char const * msg)102 void yyerror(KUserFeedback::SurveyTargetExpression **expression, yyscan_t scanner, char const* msg)
103 {
104     Q_UNUSED(expression);
105     Q_UNUSED(scanner);
106     printf("PARSER ERROR: %s\n", msg);
107 }
108 
109 
110 #line 111 "surveytargetexpressionparser_p.cpp"
111 
112 # ifndef YY_NULLPTR
113 #  if defined __cplusplus
114 #   if 201103L <= __cplusplus
115 #    define YY_NULLPTR nullptr
116 #   else
117 #    define YY_NULLPTR 0
118 #   endif
119 #  else
120 #   define YY_NULLPTR ((void*)0)
121 #  endif
122 # endif
123 
124 /* Enabling verbose error messages.  */
125 #ifdef YYERROR_VERBOSE
126 # undef YYERROR_VERBOSE
127 # define YYERROR_VERBOSE 1
128 #else
129 # define YYERROR_VERBOSE 0
130 #endif
131 
132 /* Use api.header.include to #include this header
133    instead of duplicating it here.  */
134 #ifndef YY_YY_SURVEYTARGETEXPRESSIONPARSER_P_H_INCLUDED
135 # define YY_YY_SURVEYTARGETEXPRESSIONPARSER_P_H_INCLUDED
136 /* Debug traces.  */
137 #ifndef YYDEBUG
138 # define YYDEBUG 0
139 #endif
140 #if YYDEBUG
141 extern int yydebug;
142 #endif
143 /* "%code requires" blocks.  */
144 #line 42 "surveytargetexpressionparser.y"
145 
146 
147 #ifndef YY_TYPEDEF_YY_SCANNER_T
148 #define YY_TYPEDEF_YY_SCANNER_T
149 typedef void* yyscan_t;
150 #endif
151 
152 
153 #line 154 "surveytargetexpressionparser_p.cpp"
154 
155 /* Token type.  */
156 #ifndef YYTOKENTYPE
157 # define YYTOKENTYPE
158   enum yytokentype
159   {
160     T_OP_OR = 258,
161     T_OP_AND = 259,
162     T_OP_EQ = 260,
163     T_OP_NEQ = 261,
164     T_OP_GT = 262,
165     T_OP_GE = 263,
166     T_OP_LT = 264,
167     T_OP_LE = 265,
168     T_DOT = 266,
169     T_LPAREN = 267,
170     T_RPAREN = 268,
171     T_LBRACKET = 269,
172     T_RBRACKET = 270,
173     T_DOUBLE = 271,
174     T_INTEGER = 272,
175     T_BOOLEAN = 273,
176     T_STRING = 274,
177     T_IDENTIFIER = 275
178   };
179 #endif
180 
181 /* Value type.  */
182 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
183 union YYSTYPE
184 {
185 #line 56 "surveytargetexpressionparser.y"
186 
187     int intVal;
188     double doubleVal;
189     bool boolVal;
190     char *str;
191     KUserFeedback::SurveyTargetExpression *expression;
192 
193 #line 194 "surveytargetexpressionparser_p.cpp"
194 
195 };
196 typedef union YYSTYPE YYSTYPE;
197 # define YYSTYPE_IS_TRIVIAL 1
198 # define YYSTYPE_IS_DECLARED 1
199 #endif
200 
201 
202 
203 int yyparse (KUserFeedback::SurveyTargetExpression **expression, yyscan_t scanner);
204 
205 #endif /* !YY_YY_SURVEYTARGETEXPRESSIONPARSER_P_H_INCLUDED  */
206 
207 
208 
209 #ifdef short
210 # undef short
211 #endif
212 
213 #ifdef YYTYPE_UINT8
214 typedef YYTYPE_UINT8 yytype_uint8;
215 #else
216 typedef unsigned char yytype_uint8;
217 #endif
218 
219 #ifdef YYTYPE_INT8
220 typedef YYTYPE_INT8 yytype_int8;
221 #else
222 typedef signed char yytype_int8;
223 #endif
224 
225 #ifdef YYTYPE_UINT16
226 typedef YYTYPE_UINT16 yytype_uint16;
227 #else
228 typedef unsigned short yytype_uint16;
229 #endif
230 
231 #ifdef YYTYPE_INT16
232 typedef YYTYPE_INT16 yytype_int16;
233 #else
234 typedef short yytype_int16;
235 #endif
236 
237 #ifndef YYSIZE_T
238 # ifdef __SIZE_TYPE__
239 #  define YYSIZE_T __SIZE_TYPE__
240 # elif defined size_t
241 #  define YYSIZE_T size_t
242 # elif ! defined YYSIZE_T
243 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
244 #  define YYSIZE_T size_t
245 # else
246 #  define YYSIZE_T unsigned
247 # endif
248 #endif
249 
250 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
251 
252 #ifndef YY_
253 # if defined YYENABLE_NLS && YYENABLE_NLS
254 #  if ENABLE_NLS
255 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
256 #   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
257 #  endif
258 # endif
259 # ifndef YY_
260 #  define YY_(Msgid) Msgid
261 # endif
262 #endif
263 
264 #ifndef YY_ATTRIBUTE
265 # if (defined __GNUC__                                               \
266       && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
267      || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
268 #  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
269 # else
270 #  define YY_ATTRIBUTE(Spec) /* empty */
271 # endif
272 #endif
273 
274 #ifndef YY_ATTRIBUTE_PURE
275 # define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
276 #endif
277 
278 #ifndef YY_ATTRIBUTE_UNUSED
279 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
280 #endif
281 
282 /* Suppress unused-variable warnings by "using" E.  */
283 #if ! defined lint || defined __GNUC__
284 # define YYUSE(E) ((void) (E))
285 #else
286 # define YYUSE(E) /* empty */
287 #endif
288 
289 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
290 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
291 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
292     _Pragma ("GCC diagnostic push") \
293     _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
294     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
295 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
296     _Pragma ("GCC diagnostic pop")
297 #else
298 # define YY_INITIAL_VALUE(Value) Value
299 #endif
300 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
301 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
302 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
303 #endif
304 #ifndef YY_INITIAL_VALUE
305 # define YY_INITIAL_VALUE(Value) /* Nothing. */
306 #endif
307 
308 
309 #define YY_ASSERT(E) ((void) (0 && (E)))
310 
311 #if ! defined yyoverflow || YYERROR_VERBOSE
312 
313 /* The parser invokes alloca or malloc; define the necessary symbols.  */
314 
315 # ifdef YYSTACK_USE_ALLOCA
316 #  if YYSTACK_USE_ALLOCA
317 #   ifdef __GNUC__
318 #    define YYSTACK_ALLOC __builtin_alloca
319 #   elif defined __BUILTIN_VA_ARG_INCR
320 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
321 #   elif defined _AIX
322 #    define YYSTACK_ALLOC __alloca
323 #   elif defined _MSC_VER
324 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
325 #    define alloca _alloca
326 #   else
327 #    define YYSTACK_ALLOC alloca
328 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
329 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
330       /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
331 #     ifndef EXIT_SUCCESS
332 #      define EXIT_SUCCESS 0
333 #     endif
334 #    endif
335 #   endif
336 #  endif
337 # endif
338 
339 # ifdef YYSTACK_ALLOC
340    /* Pacify GCC's 'empty if-body' warning.  */
341 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
342 #  ifndef YYSTACK_ALLOC_MAXIMUM
343     /* The OS might guarantee only one guard page at the bottom of the stack,
344        and a page size can be as small as 4096 bytes.  So we cannot safely
345        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
346        to allow for a few compiler-allocated temporary stack slots.  */
347 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
348 #  endif
349 # else
350 #  define YYSTACK_ALLOC YYMALLOC
351 #  define YYSTACK_FREE YYFREE
352 #  ifndef YYSTACK_ALLOC_MAXIMUM
353 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
354 #  endif
355 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
356        && ! ((defined YYMALLOC || defined malloc) \
357              && (defined YYFREE || defined free)))
358 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
359 #   ifndef EXIT_SUCCESS
360 #    define EXIT_SUCCESS 0
361 #   endif
362 #  endif
363 #  ifndef YYMALLOC
364 #   define YYMALLOC malloc
365 #   if ! defined malloc && ! defined EXIT_SUCCESS
366 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
367 #   endif
368 #  endif
369 #  ifndef YYFREE
370 #   define YYFREE free
371 #   if ! defined free && ! defined EXIT_SUCCESS
372 void free (void *); /* INFRINGES ON USER NAME SPACE */
373 #   endif
374 #  endif
375 # endif
376 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
377 
378 
379 #if (! defined yyoverflow \
380      && (! defined __cplusplus \
381          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
382 
383 /* A type that is properly aligned for any stack member.  */
384 union yyalloc
385 {
386   yytype_int16 yyss_alloc;
387   YYSTYPE yyvs_alloc;
388 };
389 
390 /* The size of the maximum gap between one aligned stack and the next.  */
391 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
392 
393 /* The size of an array large to enough to hold all stacks, each with
394    N elements.  */
395 # define YYSTACK_BYTES(N) \
396      ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
397       + YYSTACK_GAP_MAXIMUM)
398 
399 # define YYCOPY_NEEDED 1
400 
401 /* Relocate STACK from its old location to the new one.  The
402    local variables YYSIZE and YYSTACKSIZE give the old and new number of
403    elements in the stack, and YYPTR gives the new location of the
404    stack.  Advance YYPTR to a properly aligned location for the next
405    stack.  */
406 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
407     do                                                                  \
408       {                                                                 \
409         YYSIZE_T yynewbytes;                                            \
410         YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
411         Stack = &yyptr->Stack_alloc;                                    \
412         yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
413         yyptr += yynewbytes / sizeof (*yyptr);                          \
414       }                                                                 \
415     while (0)
416 
417 #endif
418 
419 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
420 /* Copy COUNT objects from SRC to DST.  The source and destination do
421    not overlap.  */
422 # ifndef YYCOPY
423 #  if defined __GNUC__ && 1 < __GNUC__
424 #   define YYCOPY(Dst, Src, Count) \
425       __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
426 #  else
427 #   define YYCOPY(Dst, Src, Count)              \
428       do                                        \
429         {                                       \
430           YYSIZE_T yyi;                         \
431           for (yyi = 0; yyi < (Count); yyi++)   \
432             (Dst)[yyi] = (Src)[yyi];            \
433         }                                       \
434       while (0)
435 #  endif
436 # endif
437 #endif /* !YYCOPY_NEEDED */
438 
439 /* YYFINAL -- State number of the termination state.  */
440 #define YYFINAL  14
441 /* YYLAST -- Last index in YYTABLE.  */
442 #define YYLAST   43
443 
444 /* YYNTOKENS -- Number of terminals.  */
445 #define YYNTOKENS  21
446 /* YYNNTS -- Number of nonterminals.  */
447 #define YYNNTS  5
448 /* YYNRULES -- Number of rules.  */
449 #define YYNRULES  19
450 /* YYNSTATES -- Number of states.  */
451 #define YYNSTATES  41
452 
453 #define YYUNDEFTOK  2
454 #define YYMAXUTOK   275
455 
456 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
457    as returned by yylex, with out-of-bounds checking.  */
458 #define YYTRANSLATE(YYX)                                                \
459   ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
460 
461 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
462    as returned by yylex.  */
463 static const yytype_uint8 yytranslate[] =
464 {
465        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
466        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
467        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
468        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
469        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
470        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
471        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
472        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
473        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
474        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
475        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
476        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
477        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
478        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
479        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
480        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
481        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
482        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
483        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
484        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
485        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
486        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
487        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
488        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
489        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
490        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
491        5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
492       15,    16,    17,    18,    19,    20
493 };
494 
495 #if YYDEBUG
496   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
497 static const yytype_uint8 yyrline[] =
498 {
499        0,    96,    96,    99,   100,   101,   102,   105,   106,   107,
500      108,   109,   110,   113,   118,   123,   129,   130,   131,   132
501 };
502 #endif
503 
504 #if YYDEBUG || YYERROR_VERBOSE || 0
505 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
506    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
507 static const char *const yytname[] =
508 {
509   "$end", "error", "$undefined", "T_OP_OR", "T_OP_AND", "T_OP_EQ",
510   "T_OP_NEQ", "T_OP_GT", "T_OP_GE", "T_OP_LT", "T_OP_LE", "T_DOT",
511   "T_LPAREN", "T_RPAREN", "T_LBRACKET", "T_RBRACKET", "T_DOUBLE",
512   "T_INTEGER", "T_BOOLEAN", "T_STRING", "T_IDENTIFIER", "$accept", "Input",
513   "Expr", "Term", "Value", YY_NULLPTR
514 };
515 #endif
516 
517 # ifdef YYPRINT
518 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
519    (internal) symbol number NUM (which must be that of a token).  */
520 static const yytype_uint16 yytoknum[] =
521 {
522        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
523      265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
524      275
525 };
526 # endif
527 
528 #define YYPACT_NINF -15
529 
530 #define yypact_value_is_default(Yystate) \
531   (!!((Yystate) == (-15)))
532 
533 #define YYTABLE_NINF -1
534 
535 #define yytable_value_is_error(Yytable_value) \
536   0
537 
538   /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
539      STATE-NUM.  */
540 static const yytype_int8 yypact[] =
541 {
542        0,     0,   -15,   -15,   -15,   -15,    21,    13,     6,   -15,
543       16,    -2,    18,    17,   -15,     0,     0,    11,    11,    11,
544       11,    11,    11,   -15,   -15,    22,    24,    29,   -15,   -15,
545      -15,   -15,   -15,   -15,   -15,    30,    31,    20,    23,   -15,
546      -15
547 };
548 
549   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
550      Performed when YYTABLE does not specify something else to do.  Zero
551      means the default is an error.  */
552 static const yytype_uint8 yydefact[] =
553 {
554        0,     0,    16,    17,    18,    19,     0,     0,     2,     3,
555        0,     0,     0,     0,     1,     0,     0,     0,     0,     0,
556        0,     0,     0,     4,    13,     0,     0,     6,     5,     7,
557        8,     9,    10,    11,    12,     0,     0,     0,     0,    14,
558       15
559 };
560 
561   /* YYPGOTO[NTERM-NUM].  */
562 static const yytype_int8 yypgoto[] =
563 {
564      -15,   -15,    -1,   -15,   -14
565 };
566 
567   /* YYDEFGOTO[NTERM-NUM].  */
568 static const yytype_int8 yydefgoto[] =
569 {
570       -1,     7,     8,     9,    10
571 };
572 
573   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
574      positive, shift that token.  If negative, reduce the rule whose
575      number is the opposite.  If YYTABLE_NINF, syntax error.  */
576 static const yytype_uint8 yytable[] =
577 {
578       11,    15,    16,    29,    30,    31,    32,    33,    34,    15,
579       16,    23,     1,    14,    27,    28,     2,     3,     4,     5,
580        6,    17,    18,    19,    20,    21,    22,     2,     3,     4,
581        5,     6,    12,    16,    25,    13,    26,    35,    24,    36,
582       39,    37,    38,    40
583 };
584 
585 static const yytype_uint8 yycheck[] =
586 {
587        1,     3,     4,    17,    18,    19,    20,    21,    22,     3,
588        4,    13,    12,     0,    15,    16,    16,    17,    18,    19,
589       20,     5,     6,     7,     8,     9,    10,    16,    17,    18,
590       19,    20,    11,     4,    17,    14,    19,    15,    20,    15,
591       20,    11,    11,    20
592 };
593 
594   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
595      symbol of state STATE-NUM.  */
596 static const yytype_uint8 yystos[] =
597 {
598        0,    12,    16,    17,    18,    19,    20,    22,    23,    24,
599       25,    23,    11,    14,     0,     3,     4,     5,     6,     7,
600        8,     9,    10,    13,    20,    17,    19,    23,    23,    25,
601       25,    25,    25,    25,    25,    15,    15,    11,    11,    20,
602       20
603 };
604 
605   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
606 static const yytype_uint8 yyr1[] =
607 {
608        0,    21,    22,    23,    23,    23,    23,    24,    24,    24,
609       24,    24,    24,    25,    25,    25,    25,    25,    25,    25
610 };
611 
612   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
613 static const yytype_uint8 yyr2[] =
614 {
615        0,     2,     1,     1,     3,     3,     3,     3,     3,     3,
616        3,     3,     3,     3,     6,     6,     1,     1,     1,     1
617 };
618 
619 
620 #define yyerrok         (yyerrstatus = 0)
621 #define yyclearin       (yychar = YYEMPTY)
622 #define YYEMPTY         (-2)
623 #define YYEOF           0
624 
625 #define YYACCEPT        goto yyacceptlab
626 #define YYABORT         goto yyabortlab
627 #define YYERROR         goto yyerrorlab
628 
629 
630 #define YYRECOVERING()  (!!yyerrstatus)
631 
632 #define YYBACKUP(Token, Value)                                    \
633   do                                                              \
634     if (yychar == YYEMPTY)                                        \
635       {                                                           \
636         yychar = (Token);                                         \
637         yylval = (Value);                                         \
638         YYPOPSTACK (yylen);                                       \
639         yystate = *yyssp;                                         \
640         goto yybackup;                                            \
641       }                                                           \
642     else                                                          \
643       {                                                           \
644         yyerror (expression, scanner, YY_("syntax error: cannot back up")); \
645         YYERROR;                                                  \
646       }                                                           \
647   while (0)
648 
649 /* Error token number */
650 #define YYTERROR        1
651 #define YYERRCODE       256
652 
653 
654 
655 /* Enable debugging if requested.  */
656 #if YYDEBUG
657 
658 # ifndef YYFPRINTF
659 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
660 #  define YYFPRINTF fprintf
661 # endif
662 
663 # define YYDPRINTF(Args)                        \
664 do {                                            \
665   if (yydebug)                                  \
666     YYFPRINTF Args;                             \
667 } while (0)
668 
669 /* This macro is provided for backward compatibility. */
670 #ifndef YY_LOCATION_PRINT
671 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
672 #endif
673 
674 
675 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
676 do {                                                                      \
677   if (yydebug)                                                            \
678     {                                                                     \
679       YYFPRINTF (stderr, "%s ", Title);                                   \
680       yy_symbol_print (stderr,                                            \
681                   Type, Value, expression, scanner); \
682       YYFPRINTF (stderr, "\n");                                           \
683     }                                                                     \
684 } while (0)
685 
686 
687 /*-----------------------------------.
688 | Print this symbol's value on YYO.  |
689 `-----------------------------------*/
690 
691 static void
yy_symbol_value_print(FILE * yyo,int yytype,YYSTYPE const * const yyvaluep,KUserFeedback::SurveyTargetExpression ** expression,yyscan_t scanner)692 yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, KUserFeedback::SurveyTargetExpression **expression, yyscan_t scanner)
693 {
694   FILE *yyoutput = yyo;
695   YYUSE (yyoutput);
696   YYUSE (expression);
697   YYUSE (scanner);
698   if (!yyvaluep)
699     return;
700 # ifdef YYPRINT
701   if (yytype < YYNTOKENS)
702     YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
703 # endif
704   YYUSE (yytype);
705 }
706 
707 
708 /*---------------------------.
709 | Print this symbol on YYO.  |
710 `---------------------------*/
711 
712 static void
yy_symbol_print(FILE * yyo,int yytype,YYSTYPE const * const yyvaluep,KUserFeedback::SurveyTargetExpression ** expression,yyscan_t scanner)713 yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, KUserFeedback::SurveyTargetExpression **expression, yyscan_t scanner)
714 {
715   YYFPRINTF (yyo, "%s %s (",
716              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
717 
718   yy_symbol_value_print (yyo, yytype, yyvaluep, expression, scanner);
719   YYFPRINTF (yyo, ")");
720 }
721 
722 /*------------------------------------------------------------------.
723 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
724 | TOP (included).                                                   |
725 `------------------------------------------------------------------*/
726 
727 static void
yy_stack_print(yytype_int16 * yybottom,yytype_int16 * yytop)728 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
729 {
730   YYFPRINTF (stderr, "Stack now");
731   for (; yybottom <= yytop; yybottom++)
732     {
733       int yybot = *yybottom;
734       YYFPRINTF (stderr, " %d", yybot);
735     }
736   YYFPRINTF (stderr, "\n");
737 }
738 
739 # define YY_STACK_PRINT(Bottom, Top)                            \
740 do {                                                            \
741   if (yydebug)                                                  \
742     yy_stack_print ((Bottom), (Top));                           \
743 } while (0)
744 
745 
746 /*------------------------------------------------.
747 | Report that the YYRULE is going to be reduced.  |
748 `------------------------------------------------*/
749 
750 static void
yy_reduce_print(yytype_int16 * yyssp,YYSTYPE * yyvsp,int yyrule,KUserFeedback::SurveyTargetExpression ** expression,yyscan_t scanner)751 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, KUserFeedback::SurveyTargetExpression **expression, yyscan_t scanner)
752 {
753   unsigned long yylno = yyrline[yyrule];
754   int yynrhs = yyr2[yyrule];
755   int yyi;
756   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
757              yyrule - 1, yylno);
758   /* The symbols being reduced.  */
759   for (yyi = 0; yyi < yynrhs; yyi++)
760     {
761       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
762       yy_symbol_print (stderr,
763                        yystos[yyssp[yyi + 1 - yynrhs]],
764                        &yyvsp[(yyi + 1) - (yynrhs)]
765                                               , expression, scanner);
766       YYFPRINTF (stderr, "\n");
767     }
768 }
769 
770 # define YY_REDUCE_PRINT(Rule)          \
771 do {                                    \
772   if (yydebug)                          \
773     yy_reduce_print (yyssp, yyvsp, Rule, expression, scanner); \
774 } while (0)
775 
776 /* Nonzero means print parse trace.  It is left uninitialized so that
777    multiple parsers can coexist.  */
778 int yydebug;
779 #else /* !YYDEBUG */
780 # define YYDPRINTF(Args)
781 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
782 # define YY_STACK_PRINT(Bottom, Top)
783 # define YY_REDUCE_PRINT(Rule)
784 #endif /* !YYDEBUG */
785 
786 
787 /* YYINITDEPTH -- initial size of the parser's stacks.  */
788 #ifndef YYINITDEPTH
789 # define YYINITDEPTH 200
790 #endif
791 
792 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
793    if the built-in stack extension method is used).
794 
795    Do not make this value too large; the results are undefined if
796    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
797    evaluated with infinite-precision integer arithmetic.  */
798 
799 #ifndef YYMAXDEPTH
800 # define YYMAXDEPTH 10000
801 #endif
802 
803 
804 #if YYERROR_VERBOSE
805 
806 # ifndef yystrlen
807 #  if defined __GLIBC__ && defined _STRING_H
808 #   define yystrlen strlen
809 #  else
810 /* Return the length of YYSTR.  */
811 static YYSIZE_T
yystrlen(const char * yystr)812 yystrlen (const char *yystr)
813 {
814   YYSIZE_T yylen;
815   for (yylen = 0; yystr[yylen]; yylen++)
816     continue;
817   return yylen;
818 }
819 #  endif
820 # endif
821 
822 # ifndef yystpcpy
823 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
824 #   define yystpcpy stpcpy
825 #  else
826 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
827    YYDEST.  */
828 static char *
yystpcpy(char * yydest,const char * yysrc)829 yystpcpy (char *yydest, const char *yysrc)
830 {
831   char *yyd = yydest;
832   const char *yys = yysrc;
833 
834   while ((*yyd++ = *yys++) != '\0')
835     continue;
836 
837   return yyd - 1;
838 }
839 #  endif
840 # endif
841 
842 # ifndef yytnamerr
843 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
844    quotes and backslashes, so that it's suitable for yyerror.  The
845    heuristic is that double-quoting is unnecessary unless the string
846    contains an apostrophe, a comma, or backslash (other than
847    backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
848    null, do not copy; instead, return the length of what the result
849    would have been.  */
850 static YYSIZE_T
yytnamerr(char * yyres,const char * yystr)851 yytnamerr (char *yyres, const char *yystr)
852 {
853   if (*yystr == '"')
854     {
855       YYSIZE_T yyn = 0;
856       char const *yyp = yystr;
857 
858       for (;;)
859         switch (*++yyp)
860           {
861           case '\'':
862           case ',':
863             goto do_not_strip_quotes;
864 
865           case '\\':
866             if (*++yyp != '\\')
867               goto do_not_strip_quotes;
868             else
869               goto append;
870 
871           append:
872           default:
873             if (yyres)
874               yyres[yyn] = *yyp;
875             yyn++;
876             break;
877 
878           case '"':
879             if (yyres)
880               yyres[yyn] = '\0';
881             return yyn;
882           }
883     do_not_strip_quotes: ;
884     }
885 
886   if (! yyres)
887     return yystrlen (yystr);
888 
889   return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
890 }
891 # endif
892 
893 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
894    about the unexpected token YYTOKEN for the state stack whose top is
895    YYSSP.
896 
897    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
898    not large enough to hold the message.  In that case, also set
899    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
900    required number of bytes is too large to store.  */
901 static int
yysyntax_error(YYSIZE_T * yymsg_alloc,char ** yymsg,yytype_int16 * yyssp,int yytoken)902 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
903                 yytype_int16 *yyssp, int yytoken)
904 {
905   YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
906   YYSIZE_T yysize = yysize0;
907   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
908   /* Internationalized format string. */
909   const char *yyformat = YY_NULLPTR;
910   /* Arguments of yyformat. */
911   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
912   /* Number of reported tokens (one for the "unexpected", one per
913      "expected"). */
914   int yycount = 0;
915 
916   /* There are many possibilities here to consider:
917      - If this state is a consistent state with a default action, then
918        the only way this function was invoked is if the default action
919        is an error action.  In that case, don't check for expected
920        tokens because there are none.
921      - The only way there can be no lookahead present (in yychar) is if
922        this state is a consistent state with a default action.  Thus,
923        detecting the absence of a lookahead is sufficient to determine
924        that there is no unexpected or expected token to report.  In that
925        case, just report a simple "syntax error".
926      - Don't assume there isn't a lookahead just because this state is a
927        consistent state with a default action.  There might have been a
928        previous inconsistent state, consistent state with a non-default
929        action, or user semantic action that manipulated yychar.
930      - Of course, the expected token list depends on states to have
931        correct lookahead information, and it depends on the parser not
932        to perform extra reductions after fetching a lookahead from the
933        scanner and before detecting a syntax error.  Thus, state merging
934        (from LALR or IELR) and default reductions corrupt the expected
935        token list.  However, the list is correct for canonical LR with
936        one exception: it will still contain any token that will not be
937        accepted due to an error action in a later state.
938   */
939   if (yytoken != YYEMPTY)
940     {
941       int yyn = yypact[*yyssp];
942       yyarg[yycount++] = yytname[yytoken];
943       if (!yypact_value_is_default (yyn))
944         {
945           /* Start YYX at -YYN if negative to avoid negative indexes in
946              YYCHECK.  In other words, skip the first -YYN actions for
947              this state because they are default actions.  */
948           int yyxbegin = yyn < 0 ? -yyn : 0;
949           /* Stay within bounds of both yycheck and yytname.  */
950           int yychecklim = YYLAST - yyn + 1;
951           int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
952           int yyx;
953 
954           for (yyx = yyxbegin; yyx < yyxend; ++yyx)
955             if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
956                 && !yytable_value_is_error (yytable[yyx + yyn]))
957               {
958                 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
959                   {
960                     yycount = 1;
961                     yysize = yysize0;
962                     break;
963                   }
964                 yyarg[yycount++] = yytname[yyx];
965                 {
966                   YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
967                   if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
968                     yysize = yysize1;
969                   else
970                     return 2;
971                 }
972               }
973         }
974     }
975 
976   switch (yycount)
977     {
978 # define YYCASE_(N, S)                      \
979       case N:                               \
980         yyformat = S;                       \
981       break
982     default: /* Avoid compiler warnings. */
983       YYCASE_(0, YY_("syntax error"));
984       YYCASE_(1, YY_("syntax error, unexpected %s"));
985       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
986       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
987       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
988       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
989 # undef YYCASE_
990     }
991 
992   {
993     YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
994     if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
995       yysize = yysize1;
996     else
997       return 2;
998   }
999 
1000   if (*yymsg_alloc < yysize)
1001     {
1002       *yymsg_alloc = 2 * yysize;
1003       if (! (yysize <= *yymsg_alloc
1004              && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1005         *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1006       return 1;
1007     }
1008 
1009   /* Avoid sprintf, as that infringes on the user's name space.
1010      Don't have undefined behavior even if the translation
1011      produced a string with the wrong number of "%s"s.  */
1012   {
1013     char *yyp = *yymsg;
1014     int yyi = 0;
1015     while ((*yyp = *yyformat) != '\0')
1016       if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1017         {
1018           yyp += yytnamerr (yyp, yyarg[yyi++]);
1019           yyformat += 2;
1020         }
1021       else
1022         {
1023           yyp++;
1024           yyformat++;
1025         }
1026   }
1027   return 0;
1028 }
1029 #endif /* YYERROR_VERBOSE */
1030 
1031 /*-----------------------------------------------.
1032 | Release the memory associated to this symbol.  |
1033 `-----------------------------------------------*/
1034 
1035 static void
yydestruct(const char * yymsg,int yytype,YYSTYPE * yyvaluep,KUserFeedback::SurveyTargetExpression ** expression,yyscan_t scanner)1036 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, KUserFeedback::SurveyTargetExpression **expression, yyscan_t scanner)
1037 {
1038   YYUSE (yyvaluep);
1039   YYUSE (expression);
1040   YYUSE (scanner);
1041   if (!yymsg)
1042     yymsg = "Deleting";
1043   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1044 
1045   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1046   switch (yytype)
1047     {
1048     case 19: /* T_STRING  */
1049 #line 90 "surveytargetexpressionparser.y"
1050       { free(((*yyvaluep).str)); }
1051 #line 1052 "surveytargetexpressionparser_p.cpp"
1052         break;
1053 
1054     case 20: /* T_IDENTIFIER  */
1055 #line 90 "surveytargetexpressionparser.y"
1056       { free(((*yyvaluep).str)); }
1057 #line 1058 "surveytargetexpressionparser_p.cpp"
1058         break;
1059 
1060     case 23: /* Expr  */
1061 #line 91 "surveytargetexpressionparser.y"
1062       { delete ((*yyvaluep).expression); }
1063 #line 1064 "surveytargetexpressionparser_p.cpp"
1064         break;
1065 
1066     case 24: /* Term  */
1067 #line 91 "surveytargetexpressionparser.y"
1068       { delete ((*yyvaluep).expression); }
1069 #line 1070 "surveytargetexpressionparser_p.cpp"
1070         break;
1071 
1072     case 25: /* Value  */
1073 #line 91 "surveytargetexpressionparser.y"
1074       { delete ((*yyvaluep).expression); }
1075 #line 1076 "surveytargetexpressionparser_p.cpp"
1076         break;
1077 
1078       default:
1079         break;
1080     }
1081   YY_IGNORE_MAYBE_UNINITIALIZED_END
1082 }
1083 
1084 
1085 
1086 
1087 /*----------.
1088 | yyparse.  |
1089 `----------*/
1090 
1091 int
yyparse(KUserFeedback::SurveyTargetExpression ** expression,yyscan_t scanner)1092 yyparse (KUserFeedback::SurveyTargetExpression **expression, yyscan_t scanner)
1093 {
1094 /* The lookahead symbol.  */
1095 int yychar;
1096 
1097 
1098 /* The semantic value of the lookahead symbol.  */
1099 /* Default value used for initialization, for pacifying older GCCs
1100    or non-GCC compilers.  */
1101 YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1102 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1103 
1104     /* Number of syntax errors so far.  */
1105     int yynerrs;
1106 
1107     int yystate;
1108     /* Number of tokens to shift before error messages enabled.  */
1109     int yyerrstatus;
1110 
1111     /* The stacks and their tools:
1112        'yyss': related to states.
1113        'yyvs': related to semantic values.
1114 
1115        Refer to the stacks through separate pointers, to allow yyoverflow
1116        to reallocate them elsewhere.  */
1117 
1118     /* The state stack.  */
1119     yytype_int16 yyssa[YYINITDEPTH];
1120     yytype_int16 *yyss;
1121     yytype_int16 *yyssp;
1122 
1123     /* The semantic value stack.  */
1124     YYSTYPE yyvsa[YYINITDEPTH];
1125     YYSTYPE *yyvs;
1126     YYSTYPE *yyvsp;
1127 
1128     YYSIZE_T yystacksize;
1129 
1130   int yyn;
1131   int yyresult;
1132   /* Lookahead token as an internal (translated) token number.  */
1133   int yytoken = 0;
1134   /* The variables used to return semantic value and location from the
1135      action routines.  */
1136   YYSTYPE yyval;
1137 
1138 #if YYERROR_VERBOSE
1139   /* Buffer for error messages, and its allocated size.  */
1140   char yymsgbuf[128];
1141   char *yymsg = yymsgbuf;
1142   YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1143 #endif
1144 
1145 #define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
1146 
1147   /* The number of symbols on the RHS of the reduced rule.
1148      Keep to zero when no symbol should be popped.  */
1149   int yylen = 0;
1150 
1151   yyssp = yyss = yyssa;
1152   yyvsp = yyvs = yyvsa;
1153   yystacksize = YYINITDEPTH;
1154 
1155   YYDPRINTF ((stderr, "Starting parse\n"));
1156 
1157   yystate = 0;
1158   yyerrstatus = 0;
1159   yynerrs = 0;
1160   yychar = YYEMPTY; /* Cause a token to be read.  */
1161   goto yysetstate;
1162 
1163 
1164 /*------------------------------------------------------------.
1165 | yynewstate -- push a new state, which is found in yystate.  |
1166 `------------------------------------------------------------*/
1167 yynewstate:
1168   /* In all cases, when you get here, the value and location stacks
1169      have just been pushed.  So pushing a state here evens the stacks.  */
1170   yyssp++;
1171 
1172 
1173 /*--------------------------------------------------------------------.
1174 | yynewstate -- set current state (the top of the stack) to yystate.  |
1175 `--------------------------------------------------------------------*/
1176 yysetstate:
1177   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1178   YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1179   *yyssp = (yytype_int16) yystate;
1180 
1181   if (yyss + yystacksize - 1 <= yyssp)
1182 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1183     goto yyexhaustedlab;
1184 #else
1185     {
1186       /* Get the current used size of the three stacks, in elements.  */
1187       YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
1188 
1189 # if defined yyoverflow
1190       {
1191         /* Give user a chance to reallocate the stack.  Use copies of
1192            these so that the &'s don't force the real ones into
1193            memory.  */
1194         YYSTYPE *yyvs1 = yyvs;
1195         yytype_int16 *yyss1 = yyss;
1196 
1197         /* Each stack pointer address is followed by the size of the
1198            data in use in that stack, in bytes.  This used to be a
1199            conditional around just the two extra args, but that might
1200            be undefined if yyoverflow is a macro.  */
1201         yyoverflow (YY_("memory exhausted"),
1202                     &yyss1, yysize * sizeof (*yyssp),
1203                     &yyvs1, yysize * sizeof (*yyvsp),
1204                     &yystacksize);
1205         yyss = yyss1;
1206         yyvs = yyvs1;
1207       }
1208 # else /* defined YYSTACK_RELOCATE */
1209       /* Extend the stack our own way.  */
1210       if (YYMAXDEPTH <= yystacksize)
1211         goto yyexhaustedlab;
1212       yystacksize *= 2;
1213       if (YYMAXDEPTH < yystacksize)
1214         yystacksize = YYMAXDEPTH;
1215 
1216       {
1217         yytype_int16 *yyss1 = yyss;
1218         union yyalloc *yyptr =
1219           (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1220         if (! yyptr)
1221           goto yyexhaustedlab;
1222         YYSTACK_RELOCATE (yyss_alloc, yyss);
1223         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1224 # undef YYSTACK_RELOCATE
1225         if (yyss1 != yyssa)
1226           YYSTACK_FREE (yyss1);
1227       }
1228 # endif
1229 
1230       yyssp = yyss + yysize - 1;
1231       yyvsp = yyvs + yysize - 1;
1232 
1233       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1234                   (unsigned long) yystacksize));
1235 
1236       if (yyss + yystacksize - 1 <= yyssp)
1237         YYABORT;
1238     }
1239 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1240 
1241   if (yystate == YYFINAL)
1242     YYACCEPT;
1243 
1244   goto yybackup;
1245 
1246 
1247 /*-----------.
1248 | yybackup.  |
1249 `-----------*/
1250 yybackup:
1251   /* Do appropriate processing given the current state.  Read a
1252      lookahead token if we need one and don't already have one.  */
1253 
1254   /* First try to decide what to do without reference to lookahead token.  */
1255   yyn = yypact[yystate];
1256   if (yypact_value_is_default (yyn))
1257     goto yydefault;
1258 
1259   /* Not known => get a lookahead token if don't already have one.  */
1260 
1261   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
1262   if (yychar == YYEMPTY)
1263     {
1264       YYDPRINTF ((stderr, "Reading a token: "));
1265       yychar = yylex (&yylval, scanner);
1266     }
1267 
1268   if (yychar <= YYEOF)
1269     {
1270       yychar = yytoken = YYEOF;
1271       YYDPRINTF ((stderr, "Now at end of input.\n"));
1272     }
1273   else
1274     {
1275       yytoken = YYTRANSLATE (yychar);
1276       YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1277     }
1278 
1279   /* If the proper action on seeing token YYTOKEN is to reduce or to
1280      detect an error, take that action.  */
1281   yyn += yytoken;
1282   if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1283     goto yydefault;
1284   yyn = yytable[yyn];
1285   if (yyn <= 0)
1286     {
1287       if (yytable_value_is_error (yyn))
1288         goto yyerrlab;
1289       yyn = -yyn;
1290       goto yyreduce;
1291     }
1292 
1293   /* Count tokens shifted since error; after three, turn off error
1294      status.  */
1295   if (yyerrstatus)
1296     yyerrstatus--;
1297 
1298   /* Shift the lookahead token.  */
1299   YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1300 
1301   /* Discard the shifted token.  */
1302   yychar = YYEMPTY;
1303 
1304   yystate = yyn;
1305   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1306   *++yyvsp = yylval;
1307   YY_IGNORE_MAYBE_UNINITIALIZED_END
1308   goto yynewstate;
1309 
1310 
1311 /*-----------------------------------------------------------.
1312 | yydefault -- do the default action for the current state.  |
1313 `-----------------------------------------------------------*/
1314 yydefault:
1315   yyn = yydefact[yystate];
1316   if (yyn == 0)
1317     goto yyerrlab;
1318   goto yyreduce;
1319 
1320 
1321 /*-----------------------------.
1322 | yyreduce -- do a reduction.  |
1323 `-----------------------------*/
1324 yyreduce:
1325   /* yyn is the number of a rule to reduce with.  */
1326   yylen = yyr2[yyn];
1327 
1328   /* If YYLEN is nonzero, implement the default value of the action:
1329      '$$ = $1'.
1330 
1331      Otherwise, the following line sets YYVAL to garbage.
1332      This behavior is undocumented and Bison
1333      users should not rely upon it.  Assigning to YYVAL
1334      unconditionally makes the parser a bit smaller, and it avoids a
1335      GCC warning that YYVAL may be used uninitialized.  */
1336   yyval = yyvsp[1-yylen];
1337 
1338 
1339   YY_REDUCE_PRINT (yyn);
1340   switch (yyn)
1341     {
1342   case 2:
1343 #line 96 "surveytargetexpressionparser.y"
1344     { *expression = (yyvsp[0].expression); }
1345 #line 1346 "surveytargetexpressionparser_p.cpp"
1346     break;
1347 
1348   case 3:
1349 #line 99 "surveytargetexpressionparser.y"
1350     { printf("TERM "); (yyval.expression) = (yyvsp[0].expression); }
1351 #line 1352 "surveytargetexpressionparser_p.cpp"
1352     break;
1353 
1354   case 4:
1355 #line 100 "surveytargetexpressionparser.y"
1356     { (yyval.expression) = (yyvsp[-1].expression); }
1357 #line 1358 "surveytargetexpressionparser_p.cpp"
1358     break;
1359 
1360   case 5:
1361 #line 101 "surveytargetexpressionparser.y"
1362     { (yyval.expression) = new SurveyTargetExpression(SurveyTargetExpression::OpLogicAnd, (yyvsp[-2].expression), (yyvsp[0].expression)); }
1363 #line 1364 "surveytargetexpressionparser_p.cpp"
1364     break;
1365 
1366   case 6:
1367 #line 102 "surveytargetexpressionparser.y"
1368     { (yyval.expression) = new SurveyTargetExpression(SurveyTargetExpression::OpLogicOr, (yyvsp[-2].expression), (yyvsp[0].expression)); }
1369 #line 1370 "surveytargetexpressionparser_p.cpp"
1370     break;
1371 
1372   case 7:
1373 #line 105 "surveytargetexpressionparser.y"
1374     { (yyval.expression) = new SurveyTargetExpression(SurveyTargetExpression::OpEqual, (yyvsp[-2].expression), (yyvsp[0].expression)); }
1375 #line 1376 "surveytargetexpressionparser_p.cpp"
1376     break;
1377 
1378   case 8:
1379 #line 106 "surveytargetexpressionparser.y"
1380     { (yyval.expression) = new SurveyTargetExpression(SurveyTargetExpression::OpNotEqual, (yyvsp[-2].expression), (yyvsp[0].expression)); }
1381 #line 1382 "surveytargetexpressionparser_p.cpp"
1382     break;
1383 
1384   case 9:
1385 #line 107 "surveytargetexpressionparser.y"
1386     { (yyval.expression) = new SurveyTargetExpression(SurveyTargetExpression::OpGreater, (yyvsp[-2].expression), (yyvsp[0].expression)); }
1387 #line 1388 "surveytargetexpressionparser_p.cpp"
1388     break;
1389 
1390   case 10:
1391 #line 108 "surveytargetexpressionparser.y"
1392     { (yyval.expression) = new SurveyTargetExpression(SurveyTargetExpression::OpGreaterEqual, (yyvsp[-2].expression), (yyvsp[0].expression)); }
1393 #line 1394 "surveytargetexpressionparser_p.cpp"
1394     break;
1395 
1396   case 11:
1397 #line 109 "surveytargetexpressionparser.y"
1398     { (yyval.expression) = new SurveyTargetExpression(SurveyTargetExpression::OpLess, (yyvsp[-2].expression), (yyvsp[0].expression)); }
1399 #line 1400 "surveytargetexpressionparser_p.cpp"
1400     break;
1401 
1402   case 12:
1403 #line 110 "surveytargetexpressionparser.y"
1404     { (yyval.expression) = new SurveyTargetExpression(SurveyTargetExpression::OpLessEqual, (yyvsp[-2].expression), (yyvsp[0].expression)); }
1405 #line 1406 "surveytargetexpressionparser_p.cpp"
1406     break;
1407 
1408   case 13:
1409 #line 113 "surveytargetexpressionparser.y"
1410     {
1411         (yyval.expression) = new SurveyTargetExpression(QString::fromUtf8((yyvsp[-2].str)), QVariant(), QString::fromUtf8((yyvsp[0].str)));
1412         free((yyvsp[-2].str));
1413         free((yyvsp[0].str));
1414     }
1415 #line 1416 "surveytargetexpressionparser_p.cpp"
1416     break;
1417 
1418   case 14:
1419 #line 118 "surveytargetexpressionparser.y"
1420     {
1421         (yyval.expression) = new SurveyTargetExpression(QString::fromUtf8((yyvsp[-5].str)), (yyvsp[-3].intVal), QString::fromUtf8((yyvsp[0].str)));
1422         free((yyvsp[-5].str));
1423         free((yyvsp[0].str));
1424     }
1425 #line 1426 "surveytargetexpressionparser_p.cpp"
1426     break;
1427 
1428   case 15:
1429 #line 123 "surveytargetexpressionparser.y"
1430     {
1431         (yyval.expression) = new SurveyTargetExpression(QString::fromUtf8((yyvsp[-5].str)), QString::fromUtf8((yyvsp[-3].str)), QString::fromUtf8((yyvsp[0].str)));
1432         free((yyvsp[-5].str));
1433         free((yyvsp[-3].str));
1434         free((yyvsp[0].str));
1435     }
1436 #line 1437 "surveytargetexpressionparser_p.cpp"
1437     break;
1438 
1439   case 16:
1440 #line 129 "surveytargetexpressionparser.y"
1441     { (yyval.expression) = new SurveyTargetExpression((yyvsp[0].doubleVal)); }
1442 #line 1443 "surveytargetexpressionparser_p.cpp"
1443     break;
1444 
1445   case 17:
1446 #line 130 "surveytargetexpressionparser.y"
1447     { (yyval.expression) = new SurveyTargetExpression((yyvsp[0].intVal)); }
1448 #line 1449 "surveytargetexpressionparser_p.cpp"
1449     break;
1450 
1451   case 18:
1452 #line 131 "surveytargetexpressionparser.y"
1453     { (yyval.expression) = new SurveyTargetExpression((yyvsp[0].boolVal)); }
1454 #line 1455 "surveytargetexpressionparser_p.cpp"
1455     break;
1456 
1457   case 19:
1458 #line 132 "surveytargetexpressionparser.y"
1459     { (yyval.expression) = new SurveyTargetExpression(QString::fromUtf8((yyvsp[0].str))); free((yyvsp[0].str)); }
1460 #line 1461 "surveytargetexpressionparser_p.cpp"
1461     break;
1462 
1463 
1464 #line 1465 "surveytargetexpressionparser_p.cpp"
1465 
1466       default: break;
1467     }
1468   /* User semantic actions sometimes alter yychar, and that requires
1469      that yytoken be updated with the new translation.  We take the
1470      approach of translating immediately before every use of yytoken.
1471      One alternative is translating here after every semantic action,
1472      but that translation would be missed if the semantic action invokes
1473      YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1474      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
1475      incorrect destructor might then be invoked immediately.  In the
1476      case of YYERROR or YYBACKUP, subsequent parser actions might lead
1477      to an incorrect destructor call or verbose syntax error message
1478      before the lookahead is translated.  */
1479   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1480 
1481   YYPOPSTACK (yylen);
1482   yylen = 0;
1483   YY_STACK_PRINT (yyss, yyssp);
1484 
1485   *++yyvsp = yyval;
1486 
1487   /* Now 'shift' the result of the reduction.  Determine what state
1488      that goes to, based on the state we popped back to and the rule
1489      number reduced by.  */
1490   {
1491     const int yylhs = yyr1[yyn] - YYNTOKENS;
1492     const int yyi = yypgoto[yylhs] + *yyssp;
1493     yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1494                ? yytable[yyi]
1495                : yydefgoto[yylhs]);
1496   }
1497 
1498   goto yynewstate;
1499 
1500 
1501 /*--------------------------------------.
1502 | yyerrlab -- here on detecting error.  |
1503 `--------------------------------------*/
1504 yyerrlab:
1505   /* Make sure we have latest lookahead translation.  See comments at
1506      user semantic actions for why this is necessary.  */
1507   yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1508 
1509   /* If not already recovering from an error, report this error.  */
1510   if (!yyerrstatus)
1511     {
1512       ++yynerrs;
1513 #if ! YYERROR_VERBOSE
1514       yyerror (expression, scanner, YY_("syntax error"));
1515 #else
1516 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1517                                         yyssp, yytoken)
1518       {
1519         char const *yymsgp = YY_("syntax error");
1520         int yysyntax_error_status;
1521         yysyntax_error_status = YYSYNTAX_ERROR;
1522         if (yysyntax_error_status == 0)
1523           yymsgp = yymsg;
1524         else if (yysyntax_error_status == 1)
1525           {
1526             if (yymsg != yymsgbuf)
1527               YYSTACK_FREE (yymsg);
1528             yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1529             if (!yymsg)
1530               {
1531                 yymsg = yymsgbuf;
1532                 yymsg_alloc = sizeof yymsgbuf;
1533                 yysyntax_error_status = 2;
1534               }
1535             else
1536               {
1537                 yysyntax_error_status = YYSYNTAX_ERROR;
1538                 yymsgp = yymsg;
1539               }
1540           }
1541         yyerror (expression, scanner, yymsgp);
1542         if (yysyntax_error_status == 2)
1543           goto yyexhaustedlab;
1544       }
1545 # undef YYSYNTAX_ERROR
1546 #endif
1547     }
1548 
1549 
1550 
1551   if (yyerrstatus == 3)
1552     {
1553       /* If just tried and failed to reuse lookahead token after an
1554          error, discard it.  */
1555 
1556       if (yychar <= YYEOF)
1557         {
1558           /* Return failure if at end of input.  */
1559           if (yychar == YYEOF)
1560             YYABORT;
1561         }
1562       else
1563         {
1564           yydestruct ("Error: discarding",
1565                       yytoken, &yylval, expression, scanner);
1566           yychar = YYEMPTY;
1567         }
1568     }
1569 
1570   /* Else will try to reuse lookahead token after shifting the error
1571      token.  */
1572   goto yyerrlab1;
1573 
1574 
1575 /*---------------------------------------------------.
1576 | yyerrorlab -- error raised explicitly by YYERROR.  |
1577 `---------------------------------------------------*/
1578 yyerrorlab:
1579   /* Pacify compilers when the user code never invokes YYERROR and the
1580      label yyerrorlab therefore never appears in user code.  */
1581   if (0)
1582     YYERROR;
1583 
1584   /* Do not reclaim the symbols of the rule whose action triggered
1585      this YYERROR.  */
1586   YYPOPSTACK (yylen);
1587   yylen = 0;
1588   YY_STACK_PRINT (yyss, yyssp);
1589   yystate = *yyssp;
1590   goto yyerrlab1;
1591 
1592 
1593 /*-------------------------------------------------------------.
1594 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
1595 `-------------------------------------------------------------*/
1596 yyerrlab1:
1597   yyerrstatus = 3;      /* Each real token shifted decrements this.  */
1598 
1599   for (;;)
1600     {
1601       yyn = yypact[yystate];
1602       if (!yypact_value_is_default (yyn))
1603         {
1604           yyn += YYTERROR;
1605           if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1606             {
1607               yyn = yytable[yyn];
1608               if (0 < yyn)
1609                 break;
1610             }
1611         }
1612 
1613       /* Pop the current state because it cannot handle the error token.  */
1614       if (yyssp == yyss)
1615         YYABORT;
1616 
1617 
1618       yydestruct ("Error: popping",
1619                   yystos[yystate], yyvsp, expression, scanner);
1620       YYPOPSTACK (1);
1621       yystate = *yyssp;
1622       YY_STACK_PRINT (yyss, yyssp);
1623     }
1624 
1625   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1626   *++yyvsp = yylval;
1627   YY_IGNORE_MAYBE_UNINITIALIZED_END
1628 
1629 
1630   /* Shift the error token.  */
1631   YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1632 
1633   yystate = yyn;
1634   goto yynewstate;
1635 
1636 
1637 /*-------------------------------------.
1638 | yyacceptlab -- YYACCEPT comes here.  |
1639 `-------------------------------------*/
1640 yyacceptlab:
1641   yyresult = 0;
1642   goto yyreturn;
1643 
1644 
1645 /*-----------------------------------.
1646 | yyabortlab -- YYABORT comes here.  |
1647 `-----------------------------------*/
1648 yyabortlab:
1649   yyresult = 1;
1650   goto yyreturn;
1651 
1652 
1653 #if !defined yyoverflow || YYERROR_VERBOSE
1654 /*-------------------------------------------------.
1655 | yyexhaustedlab -- memory exhaustion comes here.  |
1656 `-------------------------------------------------*/
1657 yyexhaustedlab:
1658   yyerror (expression, scanner, YY_("memory exhausted"));
1659   yyresult = 2;
1660   /* Fall through.  */
1661 #endif
1662 
1663 
1664 /*-----------------------------------------------------.
1665 | yyreturn -- parsing is finished, return the result.  |
1666 `-----------------------------------------------------*/
1667 yyreturn:
1668   if (yychar != YYEMPTY)
1669     {
1670       /* Make sure we have latest lookahead translation.  See comments at
1671          user semantic actions for why this is necessary.  */
1672       yytoken = YYTRANSLATE (yychar);
1673       yydestruct ("Cleanup: discarding lookahead",
1674                   yytoken, &yylval, expression, scanner);
1675     }
1676   /* Do not reclaim the symbols of the rule whose action triggered
1677      this YYABORT or YYACCEPT.  */
1678   YYPOPSTACK (yylen);
1679   YY_STACK_PRINT (yyss, yyssp);
1680   while (yyssp != yyss)
1681     {
1682       yydestruct ("Cleanup: popping",
1683                   yystos[*yyssp], yyvsp, expression, scanner);
1684       YYPOPSTACK (1);
1685     }
1686 #ifndef yyoverflow
1687   if (yyss != yyssa)
1688     YYSTACK_FREE (yyss);
1689 #endif
1690 #if YYERROR_VERBOSE
1691   if (yymsg != yymsgbuf)
1692     YYSTACK_FREE (yymsg);
1693 #endif
1694   return yyresult;
1695 }
1696 #line 135 "surveytargetexpressionparser.y"
1697 
1698