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