1 /* A Bison parser, made by GNU Bison 3.8.2. */
2
3 /* Bison implementation for Yacc-like parsers in C
4
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 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 <https://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 /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
38 especially those whose name start with YY_ or yy_. They are
39 private implementation details that can be changed or removed. */
40
41 /* All symbols defined below should begin with yy or YY, to avoid
42 infringing on user name space. This should be done even for local
43 variables, as they might otherwise be expanded by user macros.
44 There are some unavoidable exceptions within include files to
45 define necessary library symbols; they are noted "INFRINGES ON
46 USER NAME SPACE" below. */
47
48 /* Identify Bison output, and Bison version. */
49 #define YYBISON 30802
50
51 /* Bison version string. */
52 #define YYBISON_VERSION "3.8.2"
53
54 /* Skeleton name. */
55 #define YYSKELETON_NAME "yacc.c"
56
57 /* Pure parsers. */
58 #define YYPURE 0
59
60 /* Push parsers. */
61 #define YYPUSH 0
62
63 /* Pull parsers. */
64 #define YYPULL 1
65
66 /* Substitute the type names. */
67 #define YYSTYPE PO_GRAM_STYPE
68 /* Substitute the variable and function names. */
69 #define yyparse po_gram_parse
70 #define yylex po_gram_lex
71 #define yyerror po_gram_error
72 #define yydebug po_gram_debug
73 #define yynerrs po_gram_nerrs
74 #define yylval po_gram_lval
75 #define yychar po_gram_char
76
77 /* First part of user prologue. */
78 #line 20 "po-gram-gen.y"
79
80 #ifdef HAVE_CONFIG_H
81 # include "config.h"
82 #endif
83
84 /* Specification. */
85 #include "po-gram.h"
86
87 #include <stdbool.h>
88 #include <stdio.h>
89 #include <stdlib.h>
90 #include <string.h>
91
92 #include "str-list.h"
93 #include "po-lex.h"
94 #include "po-charset.h"
95 #include "error.h"
96 #include "xalloc.h"
97 #include "gettext.h"
98 #include "read-catalog-abstract.h"
99
100 #define _(str) gettext (str)
101
102 static long plural_counter;
103
104 #define check_obsolete(value1,value2) \
105 if ((value1).obsolete != (value2).obsolete) \
106 po_gram_error_at_line (&(value2).pos, _("inconsistent use of #~"));
107
108 static inline void
109 do_callback_message (char *msgctxt,
110 char *msgid, lex_pos_ty *msgid_pos, char *msgid_plural,
111 char *msgstr, size_t msgstr_len, lex_pos_ty *msgstr_pos,
112 char *prev_msgctxt,
113 char *prev_msgid, char *prev_msgid_plural,
114 bool obsolete)
115 {
116 /* Test for header entry. Ignore fuzziness of the header entry. */
117 if (msgctxt == NULL && msgid[0] == '\0' && !obsolete)
118 po_lex_charset_set (msgstr, gram_pos.file_name);
119
120 po_callback_message (msgctxt,
121 msgid, msgid_pos, msgid_plural,
122 msgstr, msgstr_len, msgstr_pos,
123 prev_msgctxt, prev_msgid, prev_msgid_plural,
124 false, obsolete);
125 }
126
127 #define free_message_intro(value) \
128 if ((value).prev_ctxt != NULL) \
129 free ((value).prev_ctxt); \
130 if ((value).prev_id != NULL) \
131 free ((value).prev_id); \
132 if ((value).prev_id_plural != NULL) \
133 free ((value).prev_id_plural); \
134 if ((value).ctxt != NULL) \
135 free ((value).ctxt);
136
137
138 #line 139 "po-gram-gen.c"
139
140 # ifndef YY_CAST
141 # ifdef __cplusplus
142 # define YY_CAST(Type, Val) static_cast<Type> (Val)
143 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
144 # else
145 # define YY_CAST(Type, Val) ((Type) (Val))
146 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
147 # endif
148 # endif
149 # ifndef YY_NULLPTR
150 # if defined __cplusplus
151 # if 201103L <= __cplusplus
152 # define YY_NULLPTR nullptr
153 # else
154 # define YY_NULLPTR 0
155 # endif
156 # else
157 # define YY_NULLPTR ((void*)0)
158 # endif
159 # endif
160
161 #include "po-gram-gen.h"
162 /* Symbol kind. */
163 enum yysymbol_kind_t
164 {
165 YYSYMBOL_YYEMPTY = -2,
166 YYSYMBOL_YYEOF = 0, /* "end of file" */
167 YYSYMBOL_YYerror = 1, /* error */
168 YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
169 YYSYMBOL_COMMENT = 3, /* COMMENT */
170 YYSYMBOL_DOMAIN = 4, /* DOMAIN */
171 YYSYMBOL_JUNK = 5, /* JUNK */
172 YYSYMBOL_PREV_MSGCTXT = 6, /* PREV_MSGCTXT */
173 YYSYMBOL_PREV_MSGID = 7, /* PREV_MSGID */
174 YYSYMBOL_PREV_MSGID_PLURAL = 8, /* PREV_MSGID_PLURAL */
175 YYSYMBOL_PREV_STRING = 9, /* PREV_STRING */
176 YYSYMBOL_MSGCTXT = 10, /* MSGCTXT */
177 YYSYMBOL_MSGID = 11, /* MSGID */
178 YYSYMBOL_MSGID_PLURAL = 12, /* MSGID_PLURAL */
179 YYSYMBOL_MSGSTR = 13, /* MSGSTR */
180 YYSYMBOL_NAME = 14, /* NAME */
181 YYSYMBOL_15_ = 15, /* '[' */
182 YYSYMBOL_16_ = 16, /* ']' */
183 YYSYMBOL_NUMBER = 17, /* NUMBER */
184 YYSYMBOL_STRING = 18, /* STRING */
185 YYSYMBOL_YYACCEPT = 19, /* $accept */
186 YYSYMBOL_po_file = 20, /* po_file */
187 YYSYMBOL_comment = 21, /* comment */
188 YYSYMBOL_domain = 22, /* domain */
189 YYSYMBOL_message = 23, /* message */
190 YYSYMBOL_message_intro = 24, /* message_intro */
191 YYSYMBOL_prev = 25, /* prev */
192 YYSYMBOL_msg_intro = 26, /* msg_intro */
193 YYSYMBOL_prev_msg_intro = 27, /* prev_msg_intro */
194 YYSYMBOL_msgid_pluralform = 28, /* msgid_pluralform */
195 YYSYMBOL_prev_msgid_pluralform = 29, /* prev_msgid_pluralform */
196 YYSYMBOL_pluralform_list = 30, /* pluralform_list */
197 YYSYMBOL_pluralform = 31, /* pluralform */
198 YYSYMBOL_string_list = 32, /* string_list */
199 YYSYMBOL_prev_string_list = 33 /* prev_string_list */
200 };
201 typedef enum yysymbol_kind_t yysymbol_kind_t;
202
203
204
205
206 #ifdef short
207 # undef short
208 #endif
209
210 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
211 <limits.h> and (if available) <stdint.h> are included
212 so that the code can choose integer types of a good width. */
213
214 #ifndef __PTRDIFF_MAX__
215 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
216 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
217 # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
218 # define YY_STDINT_H
219 # endif
220 #endif
221
222 /* Narrow types that promote to a signed type and that can represent a
223 signed or unsigned integer of at least N bits. In tables they can
224 save space and decrease cache pressure. Promoting to a signed type
225 helps avoid bugs in integer arithmetic. */
226
227 #ifdef __INT_LEAST8_MAX__
228 typedef __INT_LEAST8_TYPE__ yytype_int8;
229 #elif defined YY_STDINT_H
230 typedef int_least8_t yytype_int8;
231 #else
232 typedef signed char yytype_int8;
233 #endif
234
235 #ifdef __INT_LEAST16_MAX__
236 typedef __INT_LEAST16_TYPE__ yytype_int16;
237 #elif defined YY_STDINT_H
238 typedef int_least16_t yytype_int16;
239 #else
240 typedef short yytype_int16;
241 #endif
242
243 /* Work around bug in HP-UX 11.23, which defines these macros
244 incorrectly for preprocessor constants. This workaround can likely
245 be removed in 2023, as HPE has promised support for HP-UX 11.23
246 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
247 <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
248 #ifdef __hpux
249 # undef UINT_LEAST8_MAX
250 # undef UINT_LEAST16_MAX
251 # define UINT_LEAST8_MAX 255
252 # define UINT_LEAST16_MAX 65535
253 #endif
254
255 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
256 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
257 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
258 && UINT_LEAST8_MAX <= INT_MAX)
259 typedef uint_least8_t yytype_uint8;
260 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
261 typedef unsigned char yytype_uint8;
262 #else
263 typedef short yytype_uint8;
264 #endif
265
266 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
267 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
268 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
269 && UINT_LEAST16_MAX <= INT_MAX)
270 typedef uint_least16_t yytype_uint16;
271 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
272 typedef unsigned short yytype_uint16;
273 #else
274 typedef int yytype_uint16;
275 #endif
276
277 #ifndef YYPTRDIFF_T
278 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
279 # define YYPTRDIFF_T __PTRDIFF_TYPE__
280 # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
281 # elif defined PTRDIFF_MAX
282 # ifndef ptrdiff_t
283 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
284 # endif
285 # define YYPTRDIFF_T ptrdiff_t
286 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
287 # else
288 # define YYPTRDIFF_T long
289 # define YYPTRDIFF_MAXIMUM LONG_MAX
290 # endif
291 #endif
292
293 #ifndef YYSIZE_T
294 # ifdef __SIZE_TYPE__
295 # define YYSIZE_T __SIZE_TYPE__
296 # elif defined size_t
297 # define YYSIZE_T size_t
298 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
299 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
300 # define YYSIZE_T size_t
301 # else
302 # define YYSIZE_T unsigned
303 # endif
304 #endif
305
306 #define YYSIZE_MAXIMUM \
307 YY_CAST (YYPTRDIFF_T, \
308 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
309 ? YYPTRDIFF_MAXIMUM \
310 : YY_CAST (YYSIZE_T, -1)))
311
312 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
313
314
315 /* Stored state numbers (used for stacks). */
316 typedef yytype_int8 yy_state_t;
317
318 /* State numbers in computations. */
319 typedef int yy_state_fast_t;
320
321 #ifndef YY_
322 # if defined YYENABLE_NLS && YYENABLE_NLS
323 # if ENABLE_NLS
324 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
325 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
326 # endif
327 # endif
328 # ifndef YY_
329 # define YY_(Msgid) Msgid
330 # endif
331 #endif
332
333
334 #ifndef YY_ATTRIBUTE_PURE
335 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
336 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
337 # else
338 # define YY_ATTRIBUTE_PURE
339 # endif
340 #endif
341
342 #ifndef YY_ATTRIBUTE_UNUSED
343 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
344 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
345 # else
346 # define YY_ATTRIBUTE_UNUSED
347 # endif
348 #endif
349
350 /* Suppress unused-variable warnings by "using" E. */
351 #if ! defined lint || defined __GNUC__
352 # define YY_USE(E) ((void) (E))
353 #else
354 # define YY_USE(E) /* empty */
355 #endif
356
357 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
358 #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
359 # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
360 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
361 _Pragma ("GCC diagnostic push") \
362 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
363 # else
364 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
365 _Pragma ("GCC diagnostic push") \
366 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
367 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
368 # endif
369 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
370 _Pragma ("GCC diagnostic pop")
371 #else
372 # define YY_INITIAL_VALUE(Value) Value
373 #endif
374 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
375 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
376 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
377 #endif
378 #ifndef YY_INITIAL_VALUE
379 # define YY_INITIAL_VALUE(Value) /* Nothing. */
380 #endif
381
382 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
383 # define YY_IGNORE_USELESS_CAST_BEGIN \
384 _Pragma ("GCC diagnostic push") \
385 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
386 # define YY_IGNORE_USELESS_CAST_END \
387 _Pragma ("GCC diagnostic pop")
388 #endif
389 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
390 # define YY_IGNORE_USELESS_CAST_BEGIN
391 # define YY_IGNORE_USELESS_CAST_END
392 #endif
393
394
395 #define YY_ASSERT(E) ((void) (0 && (E)))
396
397 #if !defined yyoverflow
398
399 /* The parser invokes alloca or malloc; define the necessary symbols. */
400
401 # ifdef YYSTACK_USE_ALLOCA
402 # if YYSTACK_USE_ALLOCA
403 # ifdef __GNUC__
404 # define YYSTACK_ALLOC __builtin_alloca
405 # elif defined __BUILTIN_VA_ARG_INCR
406 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
407 # elif defined _AIX
408 # define YYSTACK_ALLOC __alloca
409 # elif defined _MSC_VER
410 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
411 # define alloca _alloca
412 # else
413 # define YYSTACK_ALLOC alloca
414 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
415 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
416 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
417 # ifndef EXIT_SUCCESS
418 # define EXIT_SUCCESS 0
419 # endif
420 # endif
421 # endif
422 # endif
423 # endif
424
425 # ifdef YYSTACK_ALLOC
426 /* Pacify GCC's 'empty if-body' warning. */
427 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
428 # ifndef YYSTACK_ALLOC_MAXIMUM
429 /* The OS might guarantee only one guard page at the bottom of the stack,
430 and a page size can be as small as 4096 bytes. So we cannot safely
431 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
432 to allow for a few compiler-allocated temporary stack slots. */
433 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
434 # endif
435 # else
436 # define YYSTACK_ALLOC YYMALLOC
437 # define YYSTACK_FREE YYFREE
438 # ifndef YYSTACK_ALLOC_MAXIMUM
439 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
440 # endif
441 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
442 && ! ((defined YYMALLOC || defined malloc) \
443 && (defined YYFREE || defined free)))
444 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
445 # ifndef EXIT_SUCCESS
446 # define EXIT_SUCCESS 0
447 # endif
448 # endif
449 # ifndef YYMALLOC
450 # define YYMALLOC malloc
451 # if ! defined malloc && ! defined EXIT_SUCCESS
452 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
453 # endif
454 # endif
455 # ifndef YYFREE
456 # define YYFREE free
457 # if ! defined free && ! defined EXIT_SUCCESS
458 void free (void *); /* INFRINGES ON USER NAME SPACE */
459 # endif
460 # endif
461 # endif
462 #endif /* !defined yyoverflow */
463
464 #if (! defined yyoverflow \
465 && (! defined __cplusplus \
466 || (defined PO_GRAM_STYPE_IS_TRIVIAL && PO_GRAM_STYPE_IS_TRIVIAL)))
467
468 /* A type that is properly aligned for any stack member. */
469 union yyalloc
470 {
471 yy_state_t yyss_alloc;
472 YYSTYPE yyvs_alloc;
473 };
474
475 /* The size of the maximum gap between one aligned stack and the next. */
476 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
477
478 /* The size of an array large to enough to hold all stacks, each with
479 N elements. */
480 # define YYSTACK_BYTES(N) \
481 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
482 + YYSTACK_GAP_MAXIMUM)
483
484 # define YYCOPY_NEEDED 1
485
486 /* Relocate STACK from its old location to the new one. The
487 local variables YYSIZE and YYSTACKSIZE give the old and new number of
488 elements in the stack, and YYPTR gives the new location of the
489 stack. Advance YYPTR to a properly aligned location for the next
490 stack. */
491 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
492 do \
493 { \
494 YYPTRDIFF_T yynewbytes; \
495 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
496 Stack = &yyptr->Stack_alloc; \
497 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
498 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
499 } \
500 while (0)
501
502 #endif
503
504 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
505 /* Copy COUNT objects from SRC to DST. The source and destination do
506 not overlap. */
507 # ifndef YYCOPY
508 # if defined __GNUC__ && 1 < __GNUC__
509 # define YYCOPY(Dst, Src, Count) \
510 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
511 # else
512 # define YYCOPY(Dst, Src, Count) \
513 do \
514 { \
515 YYPTRDIFF_T yyi; \
516 for (yyi = 0; yyi < (Count); yyi++) \
517 (Dst)[yyi] = (Src)[yyi]; \
518 } \
519 while (0)
520 # endif
521 # endif
522 #endif /* !YYCOPY_NEEDED */
523
524 /* YYFINAL -- State number of the termination state. */
525 #define YYFINAL 2
526 /* YYLAST -- Last index in YYTABLE. */
527 #define YYLAST 40
528
529 /* YYNTOKENS -- Number of terminals. */
530 #define YYNTOKENS 19
531 /* YYNNTS -- Number of nonterminals. */
532 #define YYNNTS 15
533 /* YYNRULES -- Number of rules. */
534 #define YYNRULES 30
535 /* YYNSTATES -- Number of states. */
536 #define YYNSTATES 46
537
538 /* YYMAXUTOK -- Last valid token kind. */
539 #define YYMAXUTOK 271
540
541
542 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
543 as returned by yylex, with out-of-bounds checking. */
544 #define YYTRANSLATE(YYX) \
545 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
546 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
547 : YYSYMBOL_YYUNDEF)
548
549 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
550 as returned by yylex. */
551 static const yytype_int8 yytranslate[] =
552 {
553 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
554 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
555 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
556 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
557 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
558 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
559 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
560 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
561 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
562 2, 15, 2, 16, 2, 2, 2, 2, 2, 2,
563 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
564 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
565 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
566 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
567 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
568 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
579 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
580 17, 18
581 };
582
583 #if PO_GRAM_DEBUG
584 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
585 static const yytype_int16 yyrline[] =
586 {
587 0, 129, 129, 130, 131, 132, 133, 138, 146, 154,
588 175, 196, 205, 214, 225, 234, 248, 257, 271, 277,
589 288, 294, 306, 317, 328, 332, 347, 370, 378, 390,
590 398
591 };
592 #endif
593
594 /** Accessing symbol of state STATE. */
595 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
596
597 #if PO_GRAM_DEBUG || 0
598 /* The user-facing name of the symbol whose (internal) number is
599 YYSYMBOL. No bounds checking. */
600 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
601
602 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
603 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
604 static const char *const yytname[] =
605 {
606 "\"end of file\"", "error", "\"invalid token\"", "COMMENT", "DOMAIN",
607 "JUNK", "PREV_MSGCTXT", "PREV_MSGID", "PREV_MSGID_PLURAL", "PREV_STRING",
608 "MSGCTXT", "MSGID", "MSGID_PLURAL", "MSGSTR", "NAME", "'['", "']'",
609 "NUMBER", "STRING", "$accept", "po_file", "comment", "domain", "message",
610 "message_intro", "prev", "msg_intro", "prev_msg_intro",
611 "msgid_pluralform", "prev_msgid_pluralform", "pluralform_list",
612 "pluralform", "string_list", "prev_string_list", YY_NULLPTR
613 };
614
615 static const char *
616 yysymbol_name (yysymbol_kind_t yysymbol)
617 {
618 return yytname[yysymbol];
619 }
620 #endif
621
622 #define YYPACT_NINF (-26)
623
624 #define yypact_value_is_default(Yyn) \
625 ((Yyn) == YYPACT_NINF)
626
627 #define YYTABLE_NINF (-1)
628
629 #define yytable_value_is_error(Yyn) \
630 0
631
632 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
633 STATE-NUM. */
634 static const yytype_int8 yypact[] =
635 {
636 -26, 2, -26, -26, -26, -8, 5, -26, 0, -26,
637 -26, -26, -26, 0, 13, -26, 5, -26, -26, 20,
638 -26, -7, 8, -26, 24, -26, -26, -26, -26, 0,
639 7, 15, 15, -26, 5, -26, 12, 17, 12, 21,
640 15, -26, 26, 22, 0, 12
641 };
642
643 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
644 Performed when YYTABLE does not specify something else to do. Zero
645 means the default is an error. */
646 static const yytype_int8 yydefact[] =
647 {
648 2, 0, 1, 6, 7, 0, 0, 20, 0, 18,
649 3, 4, 5, 0, 0, 14, 0, 8, 29, 0,
650 27, 0, 13, 15, 16, 21, 30, 19, 28, 0,
651 0, 11, 12, 24, 0, 17, 22, 0, 9, 0,
652 10, 25, 23, 0, 0, 26
653 };
654
655 /* YYPGOTO[NTERM-NUM]. */
656 static const yytype_int8 yypgoto[] =
657 {
658 -26, -26, -26, -26, -26, -26, -26, 23, -26, -26,
659 -26, 9, -25, -13, -15
660 };
661
662 /* YYDEFGOTO[NTERM-NUM]. */
663 static const yytype_int8 yydefgoto[] =
664 {
665 0, 1, 10, 11, 12, 13, 14, 15, 16, 31,
666 35, 32, 33, 21, 19
667 };
668
669 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
670 positive, shift that token. If negative, reduce the rule whose
671 number is the opposite. If YYTABLE_NINF, syntax error. */
672 static const yytype_int8 yytable[] =
673 {
674 22, 24, 2, 3, 27, 4, 5, 41, 6, 7,
675 17, 28, 8, 9, 18, 41, 36, 38, 20, 42,
676 29, 30, 37, 8, 9, 20, 28, 25, 39, 26,
677 28, 45, 34, 26, 43, 26, 37, 23, 44, 0,
678 40
679 };
680
681 static const yytype_int8 yycheck[] =
682 {
683 13, 16, 0, 1, 11, 3, 4, 32, 6, 7,
684 18, 18, 10, 11, 9, 40, 29, 30, 18, 34,
685 12, 13, 15, 10, 11, 18, 18, 7, 13, 9,
686 18, 44, 8, 9, 17, 9, 15, 14, 16, -1,
687 31
688 };
689
690 /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
691 state STATE-NUM. */
692 static const yytype_int8 yystos[] =
693 {
694 0, 20, 0, 1, 3, 4, 6, 7, 10, 11,
695 21, 22, 23, 24, 25, 26, 27, 18, 9, 33,
696 18, 32, 32, 26, 33, 7, 9, 11, 18, 12,
697 13, 28, 30, 31, 8, 29, 32, 15, 32, 13,
698 30, 31, 33, 17, 16, 32
699 };
700
701 /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
702 static const yytype_int8 yyr1[] =
703 {
704 0, 19, 20, 20, 20, 20, 20, 21, 22, 23,
705 23, 23, 23, 23, 24, 24, 25, 25, 26, 26,
706 27, 27, 28, 29, 30, 30, 31, 32, 32, 33,
707 33
708 };
709
710 /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
711 static const yytype_int8 yyr2[] =
712 {
713 0, 2, 0, 2, 2, 2, 2, 1, 2, 4,
714 4, 3, 3, 2, 1, 2, 2, 3, 1, 3,
715 1, 3, 2, 2, 1, 2, 5, 1, 2, 1,
716 2
717 };
718
719
720 enum { YYENOMEM = -2 };
721
722 #define yyerrok (yyerrstatus = 0)
723 #define yyclearin (yychar = PO_GRAM_EMPTY)
724
725 #define YYACCEPT goto yyacceptlab
726 #define YYABORT goto yyabortlab
727 #define YYERROR goto yyerrorlab
728 #define YYNOMEM goto yyexhaustedlab
729
730
731 #define YYRECOVERING() (!!yyerrstatus)
732
733 #define YYBACKUP(Token, Value) \
734 do \
735 if (yychar == PO_GRAM_EMPTY) \
736 { \
737 yychar = (Token); \
738 yylval = (Value); \
739 YYPOPSTACK (yylen); \
740 yystate = *yyssp; \
741 goto yybackup; \
742 } \
743 else \
744 { \
745 yyerror (YY_("syntax error: cannot back up")); \
746 YYERROR; \
747 } \
748 while (0)
749
750 /* Backward compatibility with an undocumented macro.
751 Use PO_GRAM_error or PO_GRAM_UNDEF. */
752 #define YYERRCODE PO_GRAM_UNDEF
753
754
755 /* Enable debugging if requested. */
756 #if PO_GRAM_DEBUG
757
758 # ifndef YYFPRINTF
759 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
760 # define YYFPRINTF fprintf
761 # endif
762
763 # define YYDPRINTF(Args) \
764 do { \
765 if (yydebug) \
766 YYFPRINTF Args; \
767 } while (0)
768
769
770
771
772 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
773 do { \
774 if (yydebug) \
775 { \
776 YYFPRINTF (stderr, "%s ", Title); \
777 yy_symbol_print (stderr, \
778 Kind, Value); \
779 YYFPRINTF (stderr, "\n"); \
780 } \
781 } while (0)
782
783
784 /*-----------------------------------.
785 | Print this symbol's value on YYO. |
786 `-----------------------------------*/
787
788 static void
789 yy_symbol_value_print (FILE *yyo,
790 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
791 {
792 FILE *yyoutput = yyo;
793 YY_USE (yyoutput);
794 if (!yyvaluep)
795 return;
796 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
797 YY_USE (yykind);
798 YY_IGNORE_MAYBE_UNINITIALIZED_END
799 }
800
801
802 /*---------------------------.
803 | Print this symbol on YYO. |
804 `---------------------------*/
805
806 static void
807 yy_symbol_print (FILE *yyo,
808 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
809 {
810 YYFPRINTF (yyo, "%s %s (",
811 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
812
813 yy_symbol_value_print (yyo, yykind, yyvaluep);
814 YYFPRINTF (yyo, ")");
815 }
816
817 /*------------------------------------------------------------------.
818 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
819 | TOP (included). |
820 `------------------------------------------------------------------*/
821
822 static void
823 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
824 {
825 YYFPRINTF (stderr, "Stack now");
826 for (; yybottom <= yytop; yybottom++)
827 {
828 int yybot = *yybottom;
829 YYFPRINTF (stderr, " %d", yybot);
830 }
831 YYFPRINTF (stderr, "\n");
832 }
833
834 # define YY_STACK_PRINT(Bottom, Top) \
835 do { \
836 if (yydebug) \
837 yy_stack_print ((Bottom), (Top)); \
838 } while (0)
839
840
841 /*------------------------------------------------.
842 | Report that the YYRULE is going to be reduced. |
843 `------------------------------------------------*/
844
845 static void
846 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
847 int yyrule)
848 {
849 int yylno = yyrline[yyrule];
850 int yynrhs = yyr2[yyrule];
851 int yyi;
852 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
853 yyrule - 1, yylno);
854 /* The symbols being reduced. */
855 for (yyi = 0; yyi < yynrhs; yyi++)
856 {
857 YYFPRINTF (stderr, " $%d = ", yyi + 1);
858 yy_symbol_print (stderr,
859 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
860 &yyvsp[(yyi + 1) - (yynrhs)]);
861 YYFPRINTF (stderr, "\n");
862 }
863 }
864
865 # define YY_REDUCE_PRINT(Rule) \
866 do { \
867 if (yydebug) \
868 yy_reduce_print (yyssp, yyvsp, Rule); \
869 } while (0)
870
871 /* Nonzero means print parse trace. It is left uninitialized so that
872 multiple parsers can coexist. */
873 int yydebug;
874 #else /* !PO_GRAM_DEBUG */
875 # define YYDPRINTF(Args) ((void) 0)
876 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
877 # define YY_STACK_PRINT(Bottom, Top)
878 # define YY_REDUCE_PRINT(Rule)
879 #endif /* !PO_GRAM_DEBUG */
880
881
882 /* YYINITDEPTH -- initial size of the parser's stacks. */
883 #ifndef YYINITDEPTH
884 # define YYINITDEPTH 200
885 #endif
886
887 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
888 if the built-in stack extension method is used).
889
890 Do not make this value too large; the results are undefined if
891 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
892 evaluated with infinite-precision integer arithmetic. */
893
894 #ifndef YYMAXDEPTH
895 # define YYMAXDEPTH 10000
896 #endif
897
898
899
900
901
902
903 /*-----------------------------------------------.
904 | Release the memory associated to this symbol. |
905 `-----------------------------------------------*/
906
907 static void
908 yydestruct (const char *yymsg,
909 yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
910 {
911 YY_USE (yyvaluep);
912 if (!yymsg)
913 yymsg = "Deleting";
914 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
915
916 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
917 YY_USE (yykind);
918 YY_IGNORE_MAYBE_UNINITIALIZED_END
919 }
920
921
922 /* Lookahead token kind. */
923 int yychar;
924
925 /* The semantic value of the lookahead symbol. */
926 YYSTYPE yylval;
927 /* Number of syntax errors so far. */
928 int yynerrs;
929
930
931
932
933 /*----------.
934 | yyparse. |
935 `----------*/
936
937 int
938 yyparse (void)
939 {
940 yy_state_fast_t yystate = 0;
941 /* Number of tokens to shift before error messages enabled. */
942 int yyerrstatus = 0;
943
944 /* Refer to the stacks through separate pointers, to allow yyoverflow
945 to reallocate them elsewhere. */
946
947 /* Their size. */
948 YYPTRDIFF_T yystacksize = YYINITDEPTH;
949
950 /* The state stack: array, bottom, top. */
951 yy_state_t yyssa[YYINITDEPTH];
952 yy_state_t *yyss = yyssa;
953 yy_state_t *yyssp = yyss;
954
955 /* The semantic value stack: array, bottom, top. */
956 YYSTYPE yyvsa[YYINITDEPTH];
957 YYSTYPE *yyvs = yyvsa;
958 YYSTYPE *yyvsp = yyvs;
959
960 int yyn;
961 /* The return value of yyparse. */
962 int yyresult;
963 /* Lookahead symbol kind. */
964 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
965 /* The variables used to return semantic value and location from the
966 action routines. */
967 YYSTYPE yyval;
968
969
970
971 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
972
973 /* The number of symbols on the RHS of the reduced rule.
974 Keep to zero when no symbol should be popped. */
975 int yylen = 0;
976
977 YYDPRINTF ((stderr, "Starting parse\n"));
978
979 yychar = PO_GRAM_EMPTY; /* Cause a token to be read. */
980
981 goto yysetstate;
982
983
984 /*------------------------------------------------------------.
985 | yynewstate -- push a new state, which is found in yystate. |
986 `------------------------------------------------------------*/
987 yynewstate:
988 /* In all cases, when you get here, the value and location stacks
989 have just been pushed. So pushing a state here evens the stacks. */
990 yyssp++;
991
992
993 /*--------------------------------------------------------------------.
994 | yysetstate -- set current state (the top of the stack) to yystate. |
995 `--------------------------------------------------------------------*/
996 yysetstate:
997 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
998 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
999 YY_IGNORE_USELESS_CAST_BEGIN
1000 *yyssp = YY_CAST (yy_state_t, yystate);
1001 YY_IGNORE_USELESS_CAST_END
1002 YY_STACK_PRINT (yyss, yyssp);
1003
1004 if (yyss + yystacksize - 1 <= yyssp)
1005 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1006 YYNOMEM;
1007 #else
1008 {
1009 /* Get the current used size of the three stacks, in elements. */
1010 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1011
1012 # if defined yyoverflow
1013 {
1014 /* Give user a chance to reallocate the stack. Use copies of
1015 these so that the &'s don't force the real ones into
1016 memory. */
1017 yy_state_t *yyss1 = yyss;
1018 YYSTYPE *yyvs1 = yyvs;
1019
1020 /* Each stack pointer address is followed by the size of the
1021 data in use in that stack, in bytes. This used to be a
1022 conditional around just the two extra args, but that might
1023 be undefined if yyoverflow is a macro. */
1024 yyoverflow (YY_("memory exhausted"),
1025 &yyss1, yysize * YYSIZEOF (*yyssp),
1026 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1027 &yystacksize);
1028 yyss = yyss1;
1029 yyvs = yyvs1;
1030 }
1031 # else /* defined YYSTACK_RELOCATE */
1032 /* Extend the stack our own way. */
1033 if (YYMAXDEPTH <= yystacksize)
1034 YYNOMEM;
1035 yystacksize *= 2;
1036 if (YYMAXDEPTH < yystacksize)
1037 yystacksize = YYMAXDEPTH;
1038
1039 {
1040 yy_state_t *yyss1 = yyss;
1041 union yyalloc *yyptr =
1042 YY_CAST (union yyalloc *,
1043 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1044 if (! yyptr)
1045 YYNOMEM;
1046 YYSTACK_RELOCATE (yyss_alloc, yyss);
1047 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1048 # undef YYSTACK_RELOCATE
1049 if (yyss1 != yyssa)
1050 YYSTACK_FREE (yyss1);
1051 }
1052 # endif
1053
1054 yyssp = yyss + yysize - 1;
1055 yyvsp = yyvs + yysize - 1;
1056
1057 YY_IGNORE_USELESS_CAST_BEGIN
1058 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1059 YY_CAST (long, yystacksize)));
1060 YY_IGNORE_USELESS_CAST_END
1061
1062 if (yyss + yystacksize - 1 <= yyssp)
1063 YYABORT;
1064 }
1065 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1066
1067
1068 if (yystate == YYFINAL)
1069 YYACCEPT;
1070
1071 goto yybackup;
1072
1073
1074 /*-----------.
1075 | yybackup. |
1076 `-----------*/
1077 yybackup:
1078 /* Do appropriate processing given the current state. Read a
1079 lookahead token if we need one and don't already have one. */
1080
1081 /* First try to decide what to do without reference to lookahead token. */
1082 yyn = yypact[yystate];
1083 if (yypact_value_is_default (yyn))
1084 goto yydefault;
1085
1086 /* Not known => get a lookahead token if don't already have one. */
1087
1088 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1089 if (yychar == PO_GRAM_EMPTY)
1090 {
1091 YYDPRINTF ((stderr, "Reading a token\n"));
1092 yychar = yylex ();
1093 }
1094
1095 if (yychar <= PO_GRAM_EOF)
1096 {
1097 yychar = PO_GRAM_EOF;
1098 yytoken = YYSYMBOL_YYEOF;
1099 YYDPRINTF ((stderr, "Now at end of input.\n"));
1100 }
1101 else if (yychar == PO_GRAM_error)
1102 {
1103 /* The scanner already issued an error message, process directly
1104 to error recovery. But do not keep the error token as
1105 lookahead, it is too special and may lead us to an endless
1106 loop in error recovery. */
1107 yychar = PO_GRAM_UNDEF;
1108 yytoken = YYSYMBOL_YYerror;
1109 goto yyerrlab1;
1110 }
1111 else
1112 {
1113 yytoken = YYTRANSLATE (yychar);
1114 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1115 }
1116
1117 /* If the proper action on seeing token YYTOKEN is to reduce or to
1118 detect an error, take that action. */
1119 yyn += yytoken;
1120 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1121 goto yydefault;
1122 yyn = yytable[yyn];
1123 if (yyn <= 0)
1124 {
1125 if (yytable_value_is_error (yyn))
1126 goto yyerrlab;
1127 yyn = -yyn;
1128 goto yyreduce;
1129 }
1130
1131 /* Count tokens shifted since error; after three, turn off error
1132 status. */
1133 if (yyerrstatus)
1134 yyerrstatus--;
1135
1136 /* Shift the lookahead token. */
1137 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1138 yystate = yyn;
1139 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1140 *++yyvsp = yylval;
1141 YY_IGNORE_MAYBE_UNINITIALIZED_END
1142
1143 /* Discard the shifted token. */
1144 yychar = PO_GRAM_EMPTY;
1145 goto yynewstate;
1146
1147
1148 /*-----------------------------------------------------------.
1149 | yydefault -- do the default action for the current state. |
1150 `-----------------------------------------------------------*/
1151 yydefault:
1152 yyn = yydefact[yystate];
1153 if (yyn == 0)
1154 goto yyerrlab;
1155 goto yyreduce;
1156
1157
1158 /*-----------------------------.
1159 | yyreduce -- do a reduction. |
1160 `-----------------------------*/
1161 yyreduce:
1162 /* yyn is the number of a rule to reduce with. */
1163 yylen = yyr2[yyn];
1164
1165 /* If YYLEN is nonzero, implement the default value of the action:
1166 '$$ = $1'.
1167
1168 Otherwise, the following line sets YYVAL to garbage.
1169 This behavior is undocumented and Bison
1170 users should not rely upon it. Assigning to YYVAL
1171 unconditionally makes the parser a bit smaller, and it avoids a
1172 GCC warning that YYVAL may be used uninitialized. */
1173 yyval = yyvsp[1-yylen];
1174
1175
1176 YY_REDUCE_PRINT (yyn);
1177 switch (yyn)
1178 {
1179 case 7: /* comment: COMMENT */
1180 #line 139 "po-gram-gen.y"
1181 {
1182 po_callback_comment_dispatcher ((yyvsp[0].string).string);
1183 }
1184 #line 1185 "po-gram-gen.c"
1185 break;
1186
1187 case 8: /* domain: DOMAIN STRING */
1188 #line 147 "po-gram-gen.y"
1189 {
1190 po_callback_domain ((yyvsp[0].string).string);
1191 }
1192 #line 1193 "po-gram-gen.c"
1193 break;
1194
1195 case 9: /* message: message_intro string_list MSGSTR string_list */
1196 #line 155 "po-gram-gen.y"
1197 {
1198 char *string2 = string_list_concat_destroy (&(yyvsp[-2].stringlist).stringlist);
1199 char *string4 = string_list_concat_destroy (&(yyvsp[0].stringlist).stringlist);
1200
1201 check_obsolete ((yyvsp[-3].message_intro), (yyvsp[-2].stringlist));
1202 check_obsolete ((yyvsp[-3].message_intro), (yyvsp[-1].pos));
1203 check_obsolete ((yyvsp[-3].message_intro), (yyvsp[0].stringlist));
1204 if (!(yyvsp[-3].message_intro).obsolete || pass_obsolete_entries)
1205 do_callback_message ((yyvsp[-3].message_intro).ctxt, string2, &(yyvsp[-3].message_intro).pos, NULL,
1206 string4, strlen (string4) + 1, &(yyvsp[-1].pos).pos,
1207 (yyvsp[-3].message_intro).prev_ctxt,
1208 (yyvsp[-3].message_intro).prev_id, (yyvsp[-3].message_intro).prev_id_plural,
1209 (yyvsp[-3].message_intro).obsolete);
1210 else
1211 {
1212 free_message_intro ((yyvsp[-3].message_intro));
1213 free (string2);
1214 free (string4);
1215 }
1216 }
1217 #line 1218 "po-gram-gen.c"
1218 break;
1219
1220 case 10: /* message: message_intro string_list msgid_pluralform pluralform_list */
1221 #line 176 "po-gram-gen.y"
1222 {
1223 char *string2 = string_list_concat_destroy (&(yyvsp[-2].stringlist).stringlist);
1224
1225 check_obsolete ((yyvsp[-3].message_intro), (yyvsp[-2].stringlist));
1226 check_obsolete ((yyvsp[-3].message_intro), (yyvsp[-1].string));
1227 check_obsolete ((yyvsp[-3].message_intro), (yyvsp[0].rhs));
1228 if (!(yyvsp[-3].message_intro).obsolete || pass_obsolete_entries)
1229 do_callback_message ((yyvsp[-3].message_intro).ctxt, string2, &(yyvsp[-3].message_intro).pos, (yyvsp[-1].string).string,
1230 (yyvsp[0].rhs).rhs.msgstr, (yyvsp[0].rhs).rhs.msgstr_len, &(yyvsp[0].rhs).pos,
1231 (yyvsp[-3].message_intro).prev_ctxt,
1232 (yyvsp[-3].message_intro).prev_id, (yyvsp[-3].message_intro).prev_id_plural,
1233 (yyvsp[-3].message_intro).obsolete);
1234 else
1235 {
1236 free_message_intro ((yyvsp[-3].message_intro));
1237 free (string2);
1238 free ((yyvsp[-1].string).string);
1239 free ((yyvsp[0].rhs).rhs.msgstr);
1240 }
1241 }
1242 #line 1243 "po-gram-gen.c"
1243 break;
1244
1245 case 11: /* message: message_intro string_list msgid_pluralform */
1246 #line 197 "po-gram-gen.y"
1247 {
1248 check_obsolete ((yyvsp[-2].message_intro), (yyvsp[-1].stringlist));
1249 check_obsolete ((yyvsp[-2].message_intro), (yyvsp[0].string));
1250 po_gram_error_at_line (&(yyvsp[-2].message_intro).pos, _("missing 'msgstr[]' section"));
1251 free_message_intro ((yyvsp[-2].message_intro));
1252 string_list_destroy (&(yyvsp[-1].stringlist).stringlist);
1253 free ((yyvsp[0].string).string);
1254 }
1255 #line 1256 "po-gram-gen.c"
1256 break;
1257
1258 case 12: /* message: message_intro string_list pluralform_list */
1259 #line 206 "po-gram-gen.y"
1260 {
1261 check_obsolete ((yyvsp[-2].message_intro), (yyvsp[-1].stringlist));
1262 check_obsolete ((yyvsp[-2].message_intro), (yyvsp[0].rhs));
1263 po_gram_error_at_line (&(yyvsp[-2].message_intro).pos, _("missing 'msgid_plural' section"));
1264 free_message_intro ((yyvsp[-2].message_intro));
1265 string_list_destroy (&(yyvsp[-1].stringlist).stringlist);
1266 free ((yyvsp[0].rhs).rhs.msgstr);
1267 }
1268 #line 1269 "po-gram-gen.c"
1269 break;
1270
1271 case 13: /* message: message_intro string_list */
1272 #line 215 "po-gram-gen.y"
1273 {
1274 check_obsolete ((yyvsp[-1].message_intro), (yyvsp[0].stringlist));
1275 po_gram_error_at_line (&(yyvsp[-1].message_intro).pos, _("missing 'msgstr' section"));
1276 free_message_intro ((yyvsp[-1].message_intro));
1277 string_list_destroy (&(yyvsp[0].stringlist).stringlist);
1278 }
1279 #line 1280 "po-gram-gen.c"
1280 break;
1281
1282 case 14: /* message_intro: msg_intro */
1283 #line 226 "po-gram-gen.y"
1284 {
1285 (yyval.message_intro).prev_ctxt = NULL;
1286 (yyval.message_intro).prev_id = NULL;
1287 (yyval.message_intro).prev_id_plural = NULL;
1288 (yyval.message_intro).ctxt = (yyvsp[0].string).string;
1289 (yyval.message_intro).pos = (yyvsp[0].string).pos;
1290 (yyval.message_intro).obsolete = (yyvsp[0].string).obsolete;
1291 }
1292 #line 1293 "po-gram-gen.c"
1293 break;
1294
1295 case 15: /* message_intro: prev msg_intro */
1296 #line 235 "po-gram-gen.y"
1297 {
1298 check_obsolete ((yyvsp[-1].prev), (yyvsp[0].string));
1299 (yyval.message_intro).prev_ctxt = (yyvsp[-1].prev).ctxt;
1300 (yyval.message_intro).prev_id = (yyvsp[-1].prev).id;
1301 (yyval.message_intro).prev_id_plural = (yyvsp[-1].prev).id_plural;
1302 (yyval.message_intro).ctxt = (yyvsp[0].string).string;
1303 (yyval.message_intro).pos = (yyvsp[0].string).pos;
1304 (yyval.message_intro).obsolete = (yyvsp[0].string).obsolete;
1305 }
1306 #line 1307 "po-gram-gen.c"
1307 break;
1308
1309 case 16: /* prev: prev_msg_intro prev_string_list */
1310 #line 249 "po-gram-gen.y"
1311 {
1312 check_obsolete ((yyvsp[-1].string), (yyvsp[0].stringlist));
1313 (yyval.prev).ctxt = (yyvsp[-1].string).string;
1314 (yyval.prev).id = string_list_concat_destroy (&(yyvsp[0].stringlist).stringlist);
1315 (yyval.prev).id_plural = NULL;
1316 (yyval.prev).pos = (yyvsp[-1].string).pos;
1317 (yyval.prev).obsolete = (yyvsp[-1].string).obsolete;
1318 }
1319 #line 1320 "po-gram-gen.c"
1320 break;
1321
1322 case 17: /* prev: prev_msg_intro prev_string_list prev_msgid_pluralform */
1323 #line 258 "po-gram-gen.y"
1324 {
1325 check_obsolete ((yyvsp[-2].string), (yyvsp[-1].stringlist));
1326 check_obsolete ((yyvsp[-2].string), (yyvsp[0].string));
1327 (yyval.prev).ctxt = (yyvsp[-2].string).string;
1328 (yyval.prev).id = string_list_concat_destroy (&(yyvsp[-1].stringlist).stringlist);
1329 (yyval.prev).id_plural = (yyvsp[0].string).string;
1330 (yyval.prev).pos = (yyvsp[-2].string).pos;
1331 (yyval.prev).obsolete = (yyvsp[-2].string).obsolete;
1332 }
1333 #line 1334 "po-gram-gen.c"
1334 break;
1335
1336 case 18: /* msg_intro: MSGID */
1337 #line 272 "po-gram-gen.y"
1338 {
1339 (yyval.string).string = NULL;
1340 (yyval.string).pos = (yyvsp[0].pos).pos;
1341 (yyval.string).obsolete = (yyvsp[0].pos).obsolete;
1342 }
1343 #line 1344 "po-gram-gen.c"
1344 break;
1345
1346 case 19: /* msg_intro: MSGCTXT string_list MSGID */
1347 #line 278 "po-gram-gen.y"
1348 {
1349 check_obsolete ((yyvsp[-2].pos), (yyvsp[-1].stringlist));
1350 check_obsolete ((yyvsp[-2].pos), (yyvsp[0].pos));
1351 (yyval.string).string = string_list_concat_destroy (&(yyvsp[-1].stringlist).stringlist);
1352 (yyval.string).pos = (yyvsp[0].pos).pos;
1353 (yyval.string).obsolete = (yyvsp[0].pos).obsolete;
1354 }
1355 #line 1356 "po-gram-gen.c"
1356 break;
1357
1358 case 20: /* prev_msg_intro: PREV_MSGID */
1359 #line 289 "po-gram-gen.y"
1360 {
1361 (yyval.string).string = NULL;
1362 (yyval.string).pos = (yyvsp[0].pos).pos;
1363 (yyval.string).obsolete = (yyvsp[0].pos).obsolete;
1364 }
1365 #line 1366 "po-gram-gen.c"
1366 break;
1367
1368 case 21: /* prev_msg_intro: PREV_MSGCTXT prev_string_list PREV_MSGID */
1369 #line 295 "po-gram-gen.y"
1370 {
1371 check_obsolete ((yyvsp[-2].pos), (yyvsp[-1].stringlist));
1372 check_obsolete ((yyvsp[-2].pos), (yyvsp[0].pos));
1373 (yyval.string).string = string_list_concat_destroy (&(yyvsp[-1].stringlist).stringlist);
1374 (yyval.string).pos = (yyvsp[0].pos).pos;
1375 (yyval.string).obsolete = (yyvsp[0].pos).obsolete;
1376 }
1377 #line 1378 "po-gram-gen.c"
1378 break;
1379
1380 case 22: /* msgid_pluralform: MSGID_PLURAL string_list */
1381 #line 307 "po-gram-gen.y"
1382 {
1383 check_obsolete ((yyvsp[-1].pos), (yyvsp[0].stringlist));
1384 plural_counter = 0;
1385 (yyval.string).string = string_list_concat_destroy (&(yyvsp[0].stringlist).stringlist);
1386 (yyval.string).pos = (yyvsp[-1].pos).pos;
1387 (yyval.string).obsolete = (yyvsp[-1].pos).obsolete;
1388 }
1389 #line 1390 "po-gram-gen.c"
1390 break;
1391
1392 case 23: /* prev_msgid_pluralform: PREV_MSGID_PLURAL prev_string_list */
1393 #line 318 "po-gram-gen.y"
1394 {
1395 check_obsolete ((yyvsp[-1].pos), (yyvsp[0].stringlist));
1396 (yyval.string).string = string_list_concat_destroy (&(yyvsp[0].stringlist).stringlist);
1397 (yyval.string).pos = (yyvsp[-1].pos).pos;
1398 (yyval.string).obsolete = (yyvsp[-1].pos).obsolete;
1399 }
1400 #line 1401 "po-gram-gen.c"
1401 break;
1402
1403 case 24: /* pluralform_list: pluralform */
1404 #line 329 "po-gram-gen.y"
1405 {
1406 (yyval.rhs) = (yyvsp[0].rhs);
1407 }
1408 #line 1409 "po-gram-gen.c"
1409 break;
1410
1411 case 25: /* pluralform_list: pluralform_list pluralform */
1412 #line 333 "po-gram-gen.y"
1413 {
1414 check_obsolete ((yyvsp[-1].rhs), (yyvsp[0].rhs));
1415 (yyval.rhs).rhs.msgstr = XNMALLOC ((yyvsp[-1].rhs).rhs.msgstr_len + (yyvsp[0].rhs).rhs.msgstr_len, char);
1416 memcpy ((yyval.rhs).rhs.msgstr, (yyvsp[-1].rhs).rhs.msgstr, (yyvsp[-1].rhs).rhs.msgstr_len);
1417 memcpy ((yyval.rhs).rhs.msgstr + (yyvsp[-1].rhs).rhs.msgstr_len, (yyvsp[0].rhs).rhs.msgstr, (yyvsp[0].rhs).rhs.msgstr_len);
1418 (yyval.rhs).rhs.msgstr_len = (yyvsp[-1].rhs).rhs.msgstr_len + (yyvsp[0].rhs).rhs.msgstr_len;
1419 free ((yyvsp[-1].rhs).rhs.msgstr);
1420 free ((yyvsp[0].rhs).rhs.msgstr);
1421 (yyval.rhs).pos = (yyvsp[-1].rhs).pos;
1422 (yyval.rhs).obsolete = (yyvsp[-1].rhs).obsolete;
1423 }
1424 #line 1425 "po-gram-gen.c"
1425 break;
1426
1427 case 26: /* pluralform: MSGSTR '[' NUMBER ']' string_list */
1428 #line 348 "po-gram-gen.y"
1429 {
1430 check_obsolete ((yyvsp[-4].pos), (yyvsp[-3].pos));
1431 check_obsolete ((yyvsp[-4].pos), (yyvsp[-2].number));
1432 check_obsolete ((yyvsp[-4].pos), (yyvsp[-1].pos));
1433 check_obsolete ((yyvsp[-4].pos), (yyvsp[0].stringlist));
1434 if ((yyvsp[-2].number).number != plural_counter)
1435 {
1436 if (plural_counter == 0)
1437 po_gram_error_at_line (&(yyvsp[-4].pos).pos, _("first plural form has nonzero index"));
1438 else
1439 po_gram_error_at_line (&(yyvsp[-4].pos).pos, _("plural form has wrong index"));
1440 }
1441 plural_counter++;
1442 (yyval.rhs).rhs.msgstr = string_list_concat_destroy (&(yyvsp[0].stringlist).stringlist);
1443 (yyval.rhs).rhs.msgstr_len = strlen ((yyval.rhs).rhs.msgstr) + 1;
1444 (yyval.rhs).pos = (yyvsp[-4].pos).pos;
1445 (yyval.rhs).obsolete = (yyvsp[-4].pos).obsolete;
1446 }
1447 #line 1448 "po-gram-gen.c"
1448 break;
1449
1450 case 27: /* string_list: STRING */
1451 #line 371 "po-gram-gen.y"
1452 {
1453 string_list_init (&(yyval.stringlist).stringlist);
1454 string_list_append (&(yyval.stringlist).stringlist, (yyvsp[0].string).string);
1455 free ((yyvsp[0].string).string);
1456 (yyval.stringlist).pos = (yyvsp[0].string).pos;
1457 (yyval.stringlist).obsolete = (yyvsp[0].string).obsolete;
1458 }
1459 #line 1460 "po-gram-gen.c"
1460 break;
1461
1462 case 28: /* string_list: string_list STRING */
1463 #line 379 "po-gram-gen.y"
1464 {
1465 check_obsolete ((yyvsp[-1].stringlist), (yyvsp[0].string));
1466 (yyval.stringlist).stringlist = (yyvsp[-1].stringlist).stringlist;
1467 string_list_append (&(yyval.stringlist).stringlist, (yyvsp[0].string).string);
1468 free ((yyvsp[0].string).string);
1469 (yyval.stringlist).pos = (yyvsp[-1].stringlist).pos;
1470 (yyval.stringlist).obsolete = (yyvsp[-1].stringlist).obsolete;
1471 }
1472 #line 1473 "po-gram-gen.c"
1473 break;
1474
1475 case 29: /* prev_string_list: PREV_STRING */
1476 #line 391 "po-gram-gen.y"
1477 {
1478 string_list_init (&(yyval.stringlist).stringlist);
1479 string_list_append (&(yyval.stringlist).stringlist, (yyvsp[0].string).string);
1480 free ((yyvsp[0].string).string);
1481 (yyval.stringlist).pos = (yyvsp[0].string).pos;
1482 (yyval.stringlist).obsolete = (yyvsp[0].string).obsolete;
1483 }
1484 #line 1485 "po-gram-gen.c"
1485 break;
1486
1487 case 30: /* prev_string_list: prev_string_list PREV_STRING */
1488 #line 399 "po-gram-gen.y"
1489 {
1490 check_obsolete ((yyvsp[-1].stringlist), (yyvsp[0].string));
1491 (yyval.stringlist).stringlist = (yyvsp[-1].stringlist).stringlist;
1492 string_list_append (&(yyval.stringlist).stringlist, (yyvsp[0].string).string);
1493 free ((yyvsp[0].string).string);
1494 (yyval.stringlist).pos = (yyvsp[-1].stringlist).pos;
1495 (yyval.stringlist).obsolete = (yyvsp[-1].stringlist).obsolete;
1496 }
1497 #line 1498 "po-gram-gen.c"
1498 break;
1499
1500
1501 #line 1502 "po-gram-gen.c"
1502
1503 default: break;
1504 }
1505 /* User semantic actions sometimes alter yychar, and that requires
1506 that yytoken be updated with the new translation. We take the
1507 approach of translating immediately before every use of yytoken.
1508 One alternative is translating here after every semantic action,
1509 but that translation would be missed if the semantic action invokes
1510 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1511 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1512 incorrect destructor might then be invoked immediately. In the
1513 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1514 to an incorrect destructor call or verbose syntax error message
1515 before the lookahead is translated. */
1516 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1517
1518 YYPOPSTACK (yylen);
1519 yylen = 0;
1520
1521 *++yyvsp = yyval;
1522
1523 /* Now 'shift' the result of the reduction. Determine what state
1524 that goes to, based on the state we popped back to and the rule
1525 number reduced by. */
1526 {
1527 const int yylhs = yyr1[yyn] - YYNTOKENS;
1528 const int yyi = yypgoto[yylhs] + *yyssp;
1529 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1530 ? yytable[yyi]
1531 : yydefgoto[yylhs]);
1532 }
1533
1534 goto yynewstate;
1535
1536
1537 /*--------------------------------------.
1538 | yyerrlab -- here on detecting error. |
1539 `--------------------------------------*/
1540 yyerrlab:
1541 /* Make sure we have latest lookahead translation. See comments at
1542 user semantic actions for why this is necessary. */
1543 yytoken = yychar == PO_GRAM_EMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1544 /* If not already recovering from an error, report this error. */
1545 if (!yyerrstatus)
1546 {
1547 ++yynerrs;
1548 yyerror (YY_("syntax error"));
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 <= PO_GRAM_EOF)
1557 {
1558 /* Return failure if at end of input. */
1559 if (yychar == PO_GRAM_EOF)
1560 YYABORT;
1561 }
1562 else
1563 {
1564 yydestruct ("Error: discarding",
1565 yytoken, &yylval);
1566 yychar = PO_GRAM_EMPTY;
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 ++yynerrs;
1584
1585 /* Do not reclaim the symbols of the rule whose action triggered
1586 this YYERROR. */
1587 YYPOPSTACK (yylen);
1588 yylen = 0;
1589 YY_STACK_PRINT (yyss, yyssp);
1590 yystate = *yyssp;
1591 goto yyerrlab1;
1592
1593
1594 /*-------------------------------------------------------------.
1595 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1596 `-------------------------------------------------------------*/
1597 yyerrlab1:
1598 yyerrstatus = 3; /* Each real token shifted decrements this. */
1599
1600 /* Pop stack until we find a state that shifts the error token. */
1601 for (;;)
1602 {
1603 yyn = yypact[yystate];
1604 if (!yypact_value_is_default (yyn))
1605 {
1606 yyn += YYSYMBOL_YYerror;
1607 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1608 {
1609 yyn = yytable[yyn];
1610 if (0 < yyn)
1611 break;
1612 }
1613 }
1614
1615 /* Pop the current state because it cannot handle the error token. */
1616 if (yyssp == yyss)
1617 YYABORT;
1618
1619
1620 yydestruct ("Error: popping",
1621 YY_ACCESSING_SYMBOL (yystate), yyvsp);
1622 YYPOPSTACK (1);
1623 yystate = *yyssp;
1624 YY_STACK_PRINT (yyss, yyssp);
1625 }
1626
1627 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1628 *++yyvsp = yylval;
1629 YY_IGNORE_MAYBE_UNINITIALIZED_END
1630
1631
1632 /* Shift the error token. */
1633 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
1634
1635 yystate = yyn;
1636 goto yynewstate;
1637
1638
1639 /*-------------------------------------.
1640 | yyacceptlab -- YYACCEPT comes here. |
1641 `-------------------------------------*/
1642 yyacceptlab:
1643 yyresult = 0;
1644 goto yyreturnlab;
1645
1646
1647 /*-----------------------------------.
1648 | yyabortlab -- YYABORT comes here. |
1649 `-----------------------------------*/
1650 yyabortlab:
1651 yyresult = 1;
1652 goto yyreturnlab;
1653
1654
1655 /*-----------------------------------------------------------.
1656 | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
1657 `-----------------------------------------------------------*/
1658 yyexhaustedlab:
1659 yyerror (YY_("memory exhausted"));
1660 yyresult = 2;
1661 goto yyreturnlab;
1662
1663
1664 /*----------------------------------------------------------.
1665 | yyreturnlab -- parsing is finished, clean up and return. |
1666 `----------------------------------------------------------*/
1667 yyreturnlab:
1668 if (yychar != PO_GRAM_EMPTY)
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);
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 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
1684 YYPOPSTACK (1);
1685 }
1686 #ifndef yyoverflow
1687 if (yyss != yyssa)
1688 YYSTACK_FREE (yyss);
1689 #endif
1690
1691 return yyresult;
1692 }
1693