No empty .Rs/.Re
[netbsd-mini2440.git] / gnu / dist / gettext / gettext-tools / src / po-gram-gen.c
blob434c09b90f9275ac6a5c72489415ca5c2eafc627
1 /* A Bison parser, made from po-gram-gen.y
2 by GNU bison 1.35. */
4 #define YYBISON 1 /* Identify Bison output. */
6 # define COMMENT 257
7 # define DOMAIN 258
8 # define JUNK 259
9 # define MSGID 260
10 # define MSGID_PLURAL 261
11 # define MSGSTR 262
12 # define NAME 263
13 # define NUMBER 264
14 # define STRING 265
16 #line 20 "po-gram-gen.y"
18 #ifdef HAVE_CONFIG_H
19 # include "config.h"
20 #endif
22 /* Specification. */
23 #include "po-gram.h"
25 #include <stdbool.h>
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <string.h>
30 #include "str-list.h"
31 #include "po-lex.h"
32 #include "po-charset.h"
33 #include "error.h"
34 #include "xalloc.h"
35 #include "gettext.h"
36 #include "read-po-abstract.h"
38 #define _(str) gettext (str)
40 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
41 as well as gratuitiously global symbol names, so we can have multiple
42 yacc generated parsers in the same program. Note that these are only
43 the variables produced by yacc. If other parser generators (bison,
44 byacc, etc) produce additional global names that conflict at link time,
45 then those parser generators need to be fixed instead of adding those
46 names to this list. */
48 #define yymaxdepth po_gram_maxdepth
49 #define yyparse po_gram_parse
50 #define yylex po_gram_lex
51 #define yyerror po_gram_error
52 #define yylval po_gram_lval
53 #define yychar po_gram_char
54 #define yydebug po_gram_debug
55 #define yypact po_gram_pact
56 #define yyr1 po_gram_r1
57 #define yyr2 po_gram_r2
58 #define yydef po_gram_def
59 #define yychk po_gram_chk
60 #define yypgo po_gram_pgo
61 #define yyact po_gram_act
62 #define yyexca po_gram_exca
63 #define yyerrflag po_gram_errflag
64 #define yynerrs po_gram_nerrs
65 #define yyps po_gram_ps
66 #define yypv po_gram_pv
67 #define yys po_gram_s
68 #define yy_yys po_gram_yys
69 #define yystate po_gram_state
70 #define yytmp po_gram_tmp
71 #define yyv po_gram_v
72 #define yy_yyv po_gram_yyv
73 #define yyval po_gram_val
74 #define yylloc po_gram_lloc
75 #define yyreds po_gram_reds /* With YYDEBUG defined */
76 #define yytoks po_gram_toks /* With YYDEBUG defined */
77 #define yylhs po_gram_yylhs
78 #define yylen po_gram_yylen
79 #define yydefred po_gram_yydefred
80 #define yydgoto po_gram_yydgoto
81 #define yysindex po_gram_yysindex
82 #define yyrindex po_gram_yyrindex
83 #define yygindex po_gram_yygindex
84 #define yytable po_gram_yytable
85 #define yycheck po_gram_yycheck
87 static long plural_counter;
89 #define check_obsolete(value1,value2) \
90 if ((value1).obsolete != (value2).obsolete) \
91 po_gram_error_at_line (&(value2).pos, _("inconsistent use of #~"));
93 static inline void
94 do_callback_message (char *msgid, lex_pos_ty *msgid_pos, char *msgid_plural,
95 char *msgstr, size_t msgstr_len, lex_pos_ty *msgstr_pos,
96 bool obsolete)
98 /* Test for header entry. Ignore fuzziness of the header entry. */
99 if (msgid[0] == '\0' && !obsolete)
100 po_lex_charset_set (msgstr, gram_pos.file_name);
102 po_callback_message (msgid, msgid_pos, msgid_plural,
103 msgstr, msgstr_len, msgstr_pos,
104 false, obsolete);
108 #line 123 "po-gram-gen.y"
109 #ifndef YYSTYPE
110 typedef union
112 struct { char *string; lex_pos_ty pos; bool obsolete; } string;
113 struct { string_list_ty stringlist; lex_pos_ty pos; bool obsolete; } stringlist;
114 struct { long number; lex_pos_ty pos; bool obsolete; } number;
115 struct { lex_pos_ty pos; bool obsolete; } pos;
116 struct { struct msgstr_def rhs; lex_pos_ty pos; bool obsolete; } rhs;
117 } yystype;
118 # define YYSTYPE yystype
119 # define YYSTYPE_IS_TRIVIAL 1
120 #endif
121 #ifndef YYDEBUG
122 # define YYDEBUG 0
123 #endif
127 #define YYFINAL 28
128 #define YYFLAG -32768
129 #define YYNTBASE 14
131 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
132 #define YYTRANSLATE(x) ((unsigned)(x) <= 265 ? yytranslate[x] : 22)
134 /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
135 static const char yytranslate[] =
137 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
138 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
139 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
140 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
141 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
142 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
143 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
144 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
145 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
146 2, 10, 2, 11, 2, 2, 2, 2, 2, 2,
147 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
148 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
149 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
150 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
151 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
152 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
153 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
154 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
155 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
156 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
157 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
158 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
159 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
160 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
161 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
162 2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
163 6, 7, 8, 9, 12, 13
166 #if YYDEBUG
167 static const short yyprhs[] =
169 0, 0, 1, 4, 7, 10, 13, 16, 21, 26,
170 30, 34, 37, 40, 42, 45, 51, 53, 56
172 static const short yyrhs[] =
174 -1, 14, 21, 0, 14, 15, 0, 14, 16, 0,
175 14, 1, 0, 4, 13, 0, 6, 20, 8, 20,
176 0, 6, 20, 17, 18, 0, 6, 20, 17, 0,
177 6, 20, 18, 0, 6, 20, 0, 7, 20, 0,
178 19, 0, 18, 19, 0, 8, 10, 12, 11, 20,
179 0, 13, 0, 20, 13, 0, 3, 0
182 #endif
184 #if YYDEBUG
185 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
186 static const short yyrline[] =
188 0, 143, 144, 145, 146, 147, 151, 158, 176, 194,
189 202, 210, 219, 230, 234, 249, 271, 278, 289
191 #endif
194 #if (YYDEBUG) || defined YYERROR_VERBOSE
196 /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
197 static const char *const yytname[] =
199 "$", "error", "$undefined.", "COMMENT", "DOMAIN", "JUNK", "MSGID",
200 "MSGID_PLURAL", "MSGSTR", "NAME", "'['", "']'", "NUMBER", "STRING",
201 "msgfmt", "domain", "message", "msgid_pluralform", "pluralform_list",
202 "pluralform", "string_list", "comment", 0
204 #endif
206 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
207 static const short yyr1[] =
209 0, 14, 14, 14, 14, 14, 15, 16, 16, 16,
210 16, 16, 17, 18, 18, 19, 20, 20, 21
213 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
214 static const short yyr2[] =
216 0, 0, 2, 2, 2, 2, 2, 4, 4, 3,
217 3, 2, 2, 1, 2, 5, 1, 2, 1
220 /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
221 doesn't specify something else to do. Zero means the default is an
222 error. */
223 static const short yydefact[] =
225 1, 0, 5, 18, 0, 0, 3, 4, 2, 6,
226 16, 11, 0, 0, 17, 9, 10, 13, 12, 0,
227 7, 0, 8, 14, 0, 0, 15, 0, 0
230 static const short yydefgoto[] =
232 1, 6, 7, 15, 16, 17, 11, 8
235 static const short yypact[] =
237 -32768, 2,-32768,-32768, -1, 1,-32768,-32768,-32768,-32768,
238 -32768, 3, 1, -6,-32768, 9, 9,-32768, 5, 7,
239 5, 10, 9,-32768, 11, 1, 5, 21,-32768
242 static const short yypgoto[] =
244 -32768,-32768,-32768,-32768, 8, -7, -12,-32768
248 #define YYLAST 23
251 static const short yytable[] =
253 18, 20, 27, 2, 19, 3, 4, 10, 5, 23,
254 12, 13, 9, 26, 10, 23, 14, 21, 14, 24,
255 19, 28, 25, 22
258 static const short yycheck[] =
260 12, 13, 0, 1, 10, 3, 4, 13, 6, 16,
261 7, 8, 13, 25, 13, 22, 13, 8, 13, 12,
262 10, 0, 11, 15
264 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
265 #line 3 "/usr/local/share/bison/bison.simple"
267 /* Skeleton output parser for bison,
269 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
270 Foundation, Inc.
272 This program is free software; you can redistribute it and/or modify
273 it under the terms of the GNU General Public License as published by
274 the Free Software Foundation; either version 2, or (at your option)
275 any later version.
277 This program is distributed in the hope that it will be useful,
278 but WITHOUT ANY WARRANTY; without even the implied warranty of
279 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
280 GNU General Public License for more details.
282 You should have received a copy of the GNU General Public License
283 along with this program; if not, write to the Free Software
284 Foundation, Inc., 59 Temple Place - Suite 330,
285 Boston, MA 02111-1307, USA. */
287 /* As a special exception, when this file is copied by Bison into a
288 Bison output file, you may use that output file without restriction.
289 This special exception was added by the Free Software Foundation
290 in version 1.24 of Bison. */
292 /* This is the parser code that is written into each bison parser when
293 the %semantic_parser declaration is not specified in the grammar.
294 It was written by Richard Stallman by simplifying the hairy parser
295 used when %semantic_parser is specified. */
297 /* All symbols defined below should begin with yy or YY, to avoid
298 infringing on user name space. This should be done even for local
299 variables, as they might otherwise be expanded by user macros.
300 There are some unavoidable exceptions within include files to
301 define necessary library symbols; they are noted "INFRINGES ON
302 USER NAME SPACE" below. */
304 #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
306 /* The parser invokes alloca or malloc; define the necessary symbols. */
308 # if YYSTACK_USE_ALLOCA
309 # define YYSTACK_ALLOC alloca
310 # else
311 # ifndef YYSTACK_USE_ALLOCA
312 # if defined (alloca) || defined (_ALLOCA_H)
313 # define YYSTACK_ALLOC alloca
314 # else
315 # ifdef __GNUC__
316 # define YYSTACK_ALLOC __builtin_alloca
317 # endif
318 # endif
319 # endif
320 # endif
322 # ifdef YYSTACK_ALLOC
323 /* Pacify GCC's `empty if-body' warning. */
324 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
325 # else
326 # if defined (__STDC__) || defined (__cplusplus)
327 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
328 # define YYSIZE_T size_t
329 # endif
330 # define YYSTACK_ALLOC malloc
331 # define YYSTACK_FREE free
332 # endif
333 #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
336 #if (! defined (yyoverflow) \
337 && (! defined (__cplusplus) \
338 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
340 /* A type that is properly aligned for any stack member. */
341 union yyalloc
343 short yyss;
344 YYSTYPE yyvs;
345 # if YYLSP_NEEDED
346 YYLTYPE yyls;
347 # endif
350 /* The size of the maximum gap between one aligned stack and the next. */
351 # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
353 /* The size of an array large to enough to hold all stacks, each with
354 N elements. */
355 # if YYLSP_NEEDED
356 # define YYSTACK_BYTES(N) \
357 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
358 + 2 * YYSTACK_GAP_MAX)
359 # else
360 # define YYSTACK_BYTES(N) \
361 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
362 + YYSTACK_GAP_MAX)
363 # endif
365 /* Copy COUNT objects from FROM to TO. The source and destination do
366 not overlap. */
367 # ifndef YYCOPY
368 # if 1 < __GNUC__
369 # define YYCOPY(To, From, Count) \
370 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
371 # else
372 # define YYCOPY(To, From, Count) \
373 do \
375 register YYSIZE_T yyi; \
376 for (yyi = 0; yyi < (Count); yyi++) \
377 (To)[yyi] = (From)[yyi]; \
379 while (0)
380 # endif
381 # endif
383 /* Relocate STACK from its old location to the new one. The
384 local variables YYSIZE and YYSTACKSIZE give the old and new number of
385 elements in the stack, and YYPTR gives the new location of the
386 stack. Advance YYPTR to a properly aligned location for the next
387 stack. */
388 # define YYSTACK_RELOCATE(Stack) \
389 do \
391 YYSIZE_T yynewbytes; \
392 YYCOPY (&yyptr->Stack, Stack, yysize); \
393 Stack = &yyptr->Stack; \
394 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
395 yyptr += yynewbytes / sizeof (*yyptr); \
397 while (0)
399 #endif
402 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
403 # define YYSIZE_T __SIZE_TYPE__
404 #endif
405 #if ! defined (YYSIZE_T) && defined (size_t)
406 # define YYSIZE_T size_t
407 #endif
408 #if ! defined (YYSIZE_T)
409 # if defined (__STDC__) || defined (__cplusplus)
410 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
411 # define YYSIZE_T size_t
412 # endif
413 #endif
414 #if ! defined (YYSIZE_T)
415 # define YYSIZE_T unsigned int
416 #endif
418 #define yyerrok (yyerrstatus = 0)
419 #define yyclearin (yychar = YYEMPTY)
420 #define YYEMPTY -2
421 #define YYEOF 0
422 #define YYACCEPT goto yyacceptlab
423 #define YYABORT goto yyabortlab
424 #define YYERROR goto yyerrlab1
425 /* Like YYERROR except do call yyerror. This remains here temporarily
426 to ease the transition to the new meaning of YYERROR, for GCC.
427 Once GCC version 2 has supplanted version 1, this can go. */
428 #define YYFAIL goto yyerrlab
429 #define YYRECOVERING() (!!yyerrstatus)
430 #define YYBACKUP(Token, Value) \
431 do \
432 if (yychar == YYEMPTY && yylen == 1) \
434 yychar = (Token); \
435 yylval = (Value); \
436 yychar1 = YYTRANSLATE (yychar); \
437 YYPOPSTACK; \
438 goto yybackup; \
440 else \
442 yyerror ("syntax error: cannot back up"); \
443 YYERROR; \
445 while (0)
447 #define YYTERROR 1
448 #define YYERRCODE 256
451 /* YYLLOC_DEFAULT -- Compute the default location (before the actions
452 are run).
454 When YYLLOC_DEFAULT is run, CURRENT is set the location of the
455 first token. By default, to implement support for ranges, extend
456 its range to the last symbol. */
458 #ifndef YYLLOC_DEFAULT
459 # define YYLLOC_DEFAULT(Current, Rhs, N) \
460 Current.last_line = Rhs[N].last_line; \
461 Current.last_column = Rhs[N].last_column;
462 #endif
465 /* YYLEX -- calling `yylex' with the right arguments. */
467 #if YYPURE
468 # if YYLSP_NEEDED
469 # ifdef YYLEX_PARAM
470 # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
471 # else
472 # define YYLEX yylex (&yylval, &yylloc)
473 # endif
474 # else /* !YYLSP_NEEDED */
475 # ifdef YYLEX_PARAM
476 # define YYLEX yylex (&yylval, YYLEX_PARAM)
477 # else
478 # define YYLEX yylex (&yylval)
479 # endif
480 # endif /* !YYLSP_NEEDED */
481 #else /* !YYPURE */
482 # define YYLEX yylex ()
483 #endif /* !YYPURE */
486 /* Enable debugging if requested. */
487 #if YYDEBUG
489 # ifndef YYFPRINTF
490 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
491 # define YYFPRINTF fprintf
492 # endif
494 # define YYDPRINTF(Args) \
495 do { \
496 if (yydebug) \
497 YYFPRINTF Args; \
498 } while (0)
499 /* Nonzero means print parse trace. It is left uninitialized so that
500 multiple parsers can coexist. */
501 int yydebug;
502 #else /* !YYDEBUG */
503 # define YYDPRINTF(Args)
504 #endif /* !YYDEBUG */
506 /* YYINITDEPTH -- initial size of the parser's stacks. */
507 #ifndef YYINITDEPTH
508 # define YYINITDEPTH 200
509 #endif
511 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
512 if the built-in stack extension method is used).
514 Do not make this value too large; the results are undefined if
515 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
516 evaluated with infinite-precision integer arithmetic. */
518 #if YYMAXDEPTH == 0
519 # undef YYMAXDEPTH
520 #endif
522 #ifndef YYMAXDEPTH
523 # define YYMAXDEPTH 10000
524 #endif
526 #ifdef YYERROR_VERBOSE
528 # ifndef yystrlen
529 # if defined (__GLIBC__) && defined (_STRING_H)
530 # define yystrlen strlen
531 # else
532 /* Return the length of YYSTR. */
533 static YYSIZE_T
534 # if defined (__STDC__) || defined (__cplusplus)
535 yystrlen (const char *yystr)
536 # else
537 yystrlen (yystr)
538 const char *yystr;
539 # endif
541 register const char *yys = yystr;
543 while (*yys++ != '\0')
544 continue;
546 return yys - yystr - 1;
548 # endif
549 # endif
551 # ifndef yystpcpy
552 # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
553 # define yystpcpy stpcpy
554 # else
555 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
556 YYDEST. */
557 static char *
558 # if defined (__STDC__) || defined (__cplusplus)
559 yystpcpy (char *yydest, const char *yysrc)
560 # else
561 yystpcpy (yydest, yysrc)
562 char *yydest;
563 const char *yysrc;
564 # endif
566 register char *yyd = yydest;
567 register const char *yys = yysrc;
569 while ((*yyd++ = *yys++) != '\0')
570 continue;
572 return yyd - 1;
574 # endif
575 # endif
576 #endif
578 #line 315 "/usr/local/share/bison/bison.simple"
581 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
582 into yyparse. The argument should have type void *.
583 It should actually point to an object.
584 Grammar actions can access the variable by casting it
585 to the proper pointer type. */
587 #ifdef YYPARSE_PARAM
588 # if defined (__STDC__) || defined (__cplusplus)
589 # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
590 # define YYPARSE_PARAM_DECL
591 # else
592 # define YYPARSE_PARAM_ARG YYPARSE_PARAM
593 # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
594 # endif
595 #else /* !YYPARSE_PARAM */
596 # define YYPARSE_PARAM_ARG
597 # define YYPARSE_PARAM_DECL
598 #endif /* !YYPARSE_PARAM */
600 /* Prevent warning if -Wstrict-prototypes. */
601 #ifdef __GNUC__
602 # ifdef YYPARSE_PARAM
603 int yyparse (void *);
604 # else
605 int yyparse (void);
606 # endif
607 #endif
609 /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
610 variables are global, or local to YYPARSE. */
612 #define YY_DECL_NON_LSP_VARIABLES \
613 /* The lookahead symbol. */ \
614 int yychar; \
616 /* The semantic value of the lookahead symbol. */ \
617 YYSTYPE yylval; \
619 /* Number of parse errors so far. */ \
620 int yynerrs;
622 #if YYLSP_NEEDED
623 # define YY_DECL_VARIABLES \
624 YY_DECL_NON_LSP_VARIABLES \
626 /* Location data for the lookahead symbol. */ \
627 YYLTYPE yylloc;
628 #else
629 # define YY_DECL_VARIABLES \
630 YY_DECL_NON_LSP_VARIABLES
631 #endif
634 /* If nonreentrant, generate the variables here. */
636 #if !YYPURE
637 YY_DECL_VARIABLES
638 #endif /* !YYPURE */
641 yyparse (YYPARSE_PARAM_ARG)
642 YYPARSE_PARAM_DECL
644 /* If reentrant, generate the variables here. */
645 #if YYPURE
646 YY_DECL_VARIABLES
647 #endif /* !YYPURE */
649 register int yystate;
650 register int yyn;
651 int yyresult;
652 /* Number of tokens to shift before error messages enabled. */
653 int yyerrstatus;
654 /* Lookahead token as an internal (translated) token number. */
655 int yychar1 = 0;
657 /* Three stacks and their tools:
658 `yyss': related to states,
659 `yyvs': related to semantic values,
660 `yyls': related to locations.
662 Refer to the stacks thru separate pointers, to allow yyoverflow
663 to reallocate them elsewhere. */
665 /* The state stack. */
666 short yyssa[YYINITDEPTH];
667 short *yyss = yyssa;
668 register short *yyssp;
670 /* The semantic value stack. */
671 YYSTYPE yyvsa[YYINITDEPTH];
672 YYSTYPE *yyvs = yyvsa;
673 register YYSTYPE *yyvsp;
675 #if YYLSP_NEEDED
676 /* The location stack. */
677 YYLTYPE yylsa[YYINITDEPTH];
678 YYLTYPE *yyls = yylsa;
679 YYLTYPE *yylsp;
680 #endif
682 #if YYLSP_NEEDED
683 # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
684 #else
685 # define YYPOPSTACK (yyvsp--, yyssp--)
686 #endif
688 YYSIZE_T yystacksize = YYINITDEPTH;
691 /* The variables used to return semantic value and location from the
692 action routines. */
693 YYSTYPE yyval;
694 #if YYLSP_NEEDED
695 YYLTYPE yyloc;
696 #endif
698 /* When reducing, the number of symbols on the RHS of the reduced
699 rule. */
700 int yylen;
702 YYDPRINTF ((stderr, "Starting parse\n"));
704 yystate = 0;
705 yyerrstatus = 0;
706 yynerrs = 0;
707 yychar = YYEMPTY; /* Cause a token to be read. */
709 /* Initialize stack pointers.
710 Waste one element of value and location stack
711 so that they stay on the same level as the state stack.
712 The wasted elements are never initialized. */
714 yyssp = yyss;
715 yyvsp = yyvs;
716 #if YYLSP_NEEDED
717 yylsp = yyls;
718 #endif
719 goto yysetstate;
721 /*------------------------------------------------------------.
722 | yynewstate -- Push a new state, which is found in yystate. |
723 `------------------------------------------------------------*/
724 yynewstate:
725 /* In all cases, when you get here, the value and location stacks
726 have just been pushed. so pushing a state here evens the stacks.
728 yyssp++;
730 yysetstate:
731 *yyssp = yystate;
733 if (yyssp >= yyss + yystacksize - 1)
735 /* Get the current used size of the three stacks, in elements. */
736 YYSIZE_T yysize = yyssp - yyss + 1;
738 #ifdef yyoverflow
740 /* Give user a chance to reallocate the stack. Use copies of
741 these so that the &'s don't force the real ones into
742 memory. */
743 YYSTYPE *yyvs1 = yyvs;
744 short *yyss1 = yyss;
746 /* Each stack pointer address is followed by the size of the
747 data in use in that stack, in bytes. */
748 # if YYLSP_NEEDED
749 YYLTYPE *yyls1 = yyls;
750 /* This used to be a conditional around just the two extra args,
751 but that might be undefined if yyoverflow is a macro. */
752 yyoverflow ("parser stack overflow",
753 &yyss1, yysize * sizeof (*yyssp),
754 &yyvs1, yysize * sizeof (*yyvsp),
755 &yyls1, yysize * sizeof (*yylsp),
756 &yystacksize);
757 yyls = yyls1;
758 # else
759 yyoverflow ("parser stack overflow",
760 &yyss1, yysize * sizeof (*yyssp),
761 &yyvs1, yysize * sizeof (*yyvsp),
762 &yystacksize);
763 # endif
764 yyss = yyss1;
765 yyvs = yyvs1;
767 #else /* no yyoverflow */
768 # ifndef YYSTACK_RELOCATE
769 goto yyoverflowlab;
770 # else
771 /* Extend the stack our own way. */
772 if (yystacksize >= YYMAXDEPTH)
773 goto yyoverflowlab;
774 yystacksize *= 2;
775 if (yystacksize > YYMAXDEPTH)
776 yystacksize = YYMAXDEPTH;
779 short *yyss1 = yyss;
780 union yyalloc *yyptr =
781 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
782 if (! yyptr)
783 goto yyoverflowlab;
784 YYSTACK_RELOCATE (yyss);
785 YYSTACK_RELOCATE (yyvs);
786 # if YYLSP_NEEDED
787 YYSTACK_RELOCATE (yyls);
788 # endif
789 # undef YYSTACK_RELOCATE
790 if (yyss1 != yyssa)
791 YYSTACK_FREE (yyss1);
793 # endif
794 #endif /* no yyoverflow */
796 yyssp = yyss + yysize - 1;
797 yyvsp = yyvs + yysize - 1;
798 #if YYLSP_NEEDED
799 yylsp = yyls + yysize - 1;
800 #endif
802 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
803 (unsigned long int) yystacksize));
805 if (yyssp >= yyss + yystacksize - 1)
806 YYABORT;
809 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
811 goto yybackup;
814 /*-----------.
815 | yybackup. |
816 `-----------*/
817 yybackup:
819 /* Do appropriate processing given the current state. */
820 /* Read a lookahead token if we need one and don't already have one. */
821 /* yyresume: */
823 /* First try to decide what to do without reference to lookahead token. */
825 yyn = yypact[yystate];
826 if (yyn == YYFLAG)
827 goto yydefault;
829 /* Not known => get a lookahead token if don't already have one. */
831 /* yychar is either YYEMPTY or YYEOF
832 or a valid token in external form. */
834 if (yychar == YYEMPTY)
836 YYDPRINTF ((stderr, "Reading a token: "));
837 yychar = YYLEX;
840 /* Convert token to internal form (in yychar1) for indexing tables with */
842 if (yychar <= 0) /* This means end of input. */
844 yychar1 = 0;
845 yychar = YYEOF; /* Don't call YYLEX any more */
847 YYDPRINTF ((stderr, "Now at end of input.\n"));
849 else
851 yychar1 = YYTRANSLATE (yychar);
853 #if YYDEBUG
854 /* We have to keep this `#if YYDEBUG', since we use variables
855 which are defined only if `YYDEBUG' is set. */
856 if (yydebug)
858 YYFPRINTF (stderr, "Next token is %d (%s",
859 yychar, yytname[yychar1]);
860 /* Give the individual parser a way to print the precise
861 meaning of a token, for further debugging info. */
862 # ifdef YYPRINT
863 YYPRINT (stderr, yychar, yylval);
864 # endif
865 YYFPRINTF (stderr, ")\n");
867 #endif
870 yyn += yychar1;
871 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
872 goto yydefault;
874 yyn = yytable[yyn];
876 /* yyn is what to do for this token type in this state.
877 Negative => reduce, -yyn is rule number.
878 Positive => shift, yyn is new state.
879 New state is final state => don't bother to shift,
880 just return success.
881 0, or most negative number => error. */
883 if (yyn < 0)
885 if (yyn == YYFLAG)
886 goto yyerrlab;
887 yyn = -yyn;
888 goto yyreduce;
890 else if (yyn == 0)
891 goto yyerrlab;
893 if (yyn == YYFINAL)
894 YYACCEPT;
896 /* Shift the lookahead token. */
897 YYDPRINTF ((stderr, "Shifting token %d (%s), ",
898 yychar, yytname[yychar1]));
900 /* Discard the token being shifted unless it is eof. */
901 if (yychar != YYEOF)
902 yychar = YYEMPTY;
904 *++yyvsp = yylval;
905 #if YYLSP_NEEDED
906 *++yylsp = yylloc;
907 #endif
909 /* Count tokens shifted since error; after three, turn off error
910 status. */
911 if (yyerrstatus)
912 yyerrstatus--;
914 yystate = yyn;
915 goto yynewstate;
918 /*-----------------------------------------------------------.
919 | yydefault -- do the default action for the current state. |
920 `-----------------------------------------------------------*/
921 yydefault:
922 yyn = yydefact[yystate];
923 if (yyn == 0)
924 goto yyerrlab;
925 goto yyreduce;
928 /*-----------------------------.
929 | yyreduce -- Do a reduction. |
930 `-----------------------------*/
931 yyreduce:
932 /* yyn is the number of a rule to reduce with. */
933 yylen = yyr2[yyn];
935 /* If YYLEN is nonzero, implement the default value of the action:
936 `$$ = $1'.
938 Otherwise, the following line sets YYVAL to the semantic value of
939 the lookahead token. This behavior is undocumented and Bison
940 users should not rely upon it. Assigning to YYVAL
941 unconditionally makes the parser a bit smaller, and it avoids a
942 GCC warning that YYVAL may be used uninitialized. */
943 yyval = yyvsp[1-yylen];
945 #if YYLSP_NEEDED
946 /* Similarly for the default location. Let the user run additional
947 commands if for instance locations are ranges. */
948 yyloc = yylsp[1-yylen];
949 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
950 #endif
952 #if YYDEBUG
953 /* We have to keep this `#if YYDEBUG', since we use variables which
954 are defined only if `YYDEBUG' is set. */
955 if (yydebug)
957 int yyi;
959 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
960 yyn, yyrline[yyn]);
962 /* Print the symbols being reduced, and their result. */
963 for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
964 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
965 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
967 #endif
969 switch (yyn) {
971 case 6:
972 #line 152 "po-gram-gen.y"
974 po_callback_domain (yyvsp[0].string.string);
976 break;
977 case 7:
978 #line 159 "po-gram-gen.y"
980 char *string2 = string_list_concat_destroy (&yyvsp[-2].stringlist.stringlist);
981 char *string4 = string_list_concat_destroy (&yyvsp[0].stringlist.stringlist);
983 check_obsolete (yyvsp[-3].pos, yyvsp[-2].stringlist);
984 check_obsolete (yyvsp[-3].pos, yyvsp[-1].pos);
985 check_obsolete (yyvsp[-3].pos, yyvsp[0].stringlist);
986 if (!yyvsp[-3].pos.obsolete || pass_obsolete_entries)
987 do_callback_message (string2, &yyvsp[-3].pos.pos, NULL,
988 string4, strlen (string4) + 1, &yyvsp[-1].pos.pos,
989 yyvsp[-3].pos.obsolete);
990 else
992 free (string2);
993 free (string4);
996 break;
997 case 8:
998 #line 177 "po-gram-gen.y"
1000 char *string2 = string_list_concat_destroy (&yyvsp[-2].stringlist.stringlist);
1002 check_obsolete (yyvsp[-3].pos, yyvsp[-2].stringlist);
1003 check_obsolete (yyvsp[-3].pos, yyvsp[-1].string);
1004 check_obsolete (yyvsp[-3].pos, yyvsp[0].rhs);
1005 if (!yyvsp[-3].pos.obsolete || pass_obsolete_entries)
1006 do_callback_message (string2, &yyvsp[-3].pos.pos, yyvsp[-1].string.string,
1007 yyvsp[0].rhs.rhs.msgstr, yyvsp[0].rhs.rhs.msgstr_len, &yyvsp[0].rhs.pos,
1008 yyvsp[-3].pos.obsolete);
1009 else
1011 free (string2);
1012 free (yyvsp[-1].string.string);
1013 free (yyvsp[0].rhs.rhs.msgstr);
1016 break;
1017 case 9:
1018 #line 195 "po-gram-gen.y"
1020 check_obsolete (yyvsp[-2].pos, yyvsp[-1].stringlist);
1021 check_obsolete (yyvsp[-2].pos, yyvsp[0].string);
1022 po_gram_error_at_line (&yyvsp[-2].pos.pos, _("missing `msgstr[]' section"));
1023 string_list_destroy (&yyvsp[-1].stringlist.stringlist);
1024 free (yyvsp[0].string.string);
1026 break;
1027 case 10:
1028 #line 203 "po-gram-gen.y"
1030 check_obsolete (yyvsp[-2].pos, yyvsp[-1].stringlist);
1031 check_obsolete (yyvsp[-2].pos, yyvsp[0].rhs);
1032 po_gram_error_at_line (&yyvsp[-2].pos.pos, _("missing `msgid_plural' section"));
1033 string_list_destroy (&yyvsp[-1].stringlist.stringlist);
1034 free (yyvsp[0].rhs.rhs.msgstr);
1036 break;
1037 case 11:
1038 #line 211 "po-gram-gen.y"
1040 check_obsolete (yyvsp[-1].pos, yyvsp[0].stringlist);
1041 po_gram_error_at_line (&yyvsp[-1].pos.pos, _("missing `msgstr' section"));
1042 string_list_destroy (&yyvsp[0].stringlist.stringlist);
1044 break;
1045 case 12:
1046 #line 220 "po-gram-gen.y"
1048 check_obsolete (yyvsp[-1].pos, yyvsp[0].stringlist);
1049 plural_counter = 0;
1050 yyval.string.string = string_list_concat_destroy (&yyvsp[0].stringlist.stringlist);
1051 yyval.string.pos = yyvsp[-1].pos.pos;
1052 yyval.string.obsolete = yyvsp[-1].pos.obsolete;
1054 break;
1055 case 13:
1056 #line 231 "po-gram-gen.y"
1058 yyval.rhs = yyvsp[0].rhs;
1060 break;
1061 case 14:
1062 #line 235 "po-gram-gen.y"
1064 check_obsolete (yyvsp[-1].rhs, yyvsp[0].rhs);
1065 yyval.rhs.rhs.msgstr = (char *) xmalloc (yyvsp[-1].rhs.rhs.msgstr_len + yyvsp[0].rhs.rhs.msgstr_len);
1066 memcpy (yyval.rhs.rhs.msgstr, yyvsp[-1].rhs.rhs.msgstr, yyvsp[-1].rhs.rhs.msgstr_len);
1067 memcpy (yyval.rhs.rhs.msgstr + yyvsp[-1].rhs.rhs.msgstr_len, yyvsp[0].rhs.rhs.msgstr, yyvsp[0].rhs.rhs.msgstr_len);
1068 yyval.rhs.rhs.msgstr_len = yyvsp[-1].rhs.rhs.msgstr_len + yyvsp[0].rhs.rhs.msgstr_len;
1069 free (yyvsp[-1].rhs.rhs.msgstr);
1070 free (yyvsp[0].rhs.rhs.msgstr);
1071 yyval.rhs.pos = yyvsp[-1].rhs.pos;
1072 yyval.rhs.obsolete = yyvsp[-1].rhs.obsolete;
1074 break;
1075 case 15:
1076 #line 250 "po-gram-gen.y"
1078 check_obsolete (yyvsp[-4].pos, yyvsp[-3].pos);
1079 check_obsolete (yyvsp[-4].pos, yyvsp[-2].number);
1080 check_obsolete (yyvsp[-4].pos, yyvsp[-1].pos);
1081 check_obsolete (yyvsp[-4].pos, yyvsp[0].stringlist);
1082 if (yyvsp[-2].number.number != plural_counter)
1084 if (plural_counter == 0)
1085 po_gram_error_at_line (&yyvsp[-4].pos.pos, _("first plural form has nonzero index"));
1086 else
1087 po_gram_error_at_line (&yyvsp[-4].pos.pos, _("plural form has wrong index"));
1089 plural_counter++;
1090 yyval.rhs.rhs.msgstr = string_list_concat_destroy (&yyvsp[0].stringlist.stringlist);
1091 yyval.rhs.rhs.msgstr_len = strlen (yyval.rhs.rhs.msgstr) + 1;
1092 yyval.rhs.pos = yyvsp[-4].pos.pos;
1093 yyval.rhs.obsolete = yyvsp[-4].pos.obsolete;
1095 break;
1096 case 16:
1097 #line 272 "po-gram-gen.y"
1099 string_list_init (&yyval.stringlist.stringlist);
1100 string_list_append (&yyval.stringlist.stringlist, yyvsp[0].string.string);
1101 yyval.stringlist.pos = yyvsp[0].string.pos;
1102 yyval.stringlist.obsolete = yyvsp[0].string.obsolete;
1104 break;
1105 case 17:
1106 #line 279 "po-gram-gen.y"
1108 check_obsolete (yyvsp[-1].stringlist, yyvsp[0].string);
1109 yyval.stringlist.stringlist = yyvsp[-1].stringlist.stringlist;
1110 string_list_append (&yyval.stringlist.stringlist, yyvsp[0].string.string);
1111 yyval.stringlist.pos = yyvsp[-1].stringlist.pos;
1112 yyval.stringlist.obsolete = yyvsp[-1].stringlist.obsolete;
1114 break;
1115 case 18:
1116 #line 290 "po-gram-gen.y"
1118 po_callback_comment_dispatcher (yyvsp[0].string.string);
1120 break;
1123 #line 705 "/usr/local/share/bison/bison.simple"
1126 yyvsp -= yylen;
1127 yyssp -= yylen;
1128 #if YYLSP_NEEDED
1129 yylsp -= yylen;
1130 #endif
1132 #if YYDEBUG
1133 if (yydebug)
1135 short *yyssp1 = yyss - 1;
1136 YYFPRINTF (stderr, "state stack now");
1137 while (yyssp1 != yyssp)
1138 YYFPRINTF (stderr, " %d", *++yyssp1);
1139 YYFPRINTF (stderr, "\n");
1141 #endif
1143 *++yyvsp = yyval;
1144 #if YYLSP_NEEDED
1145 *++yylsp = yyloc;
1146 #endif
1148 /* Now `shift' the result of the reduction. Determine what state
1149 that goes to, based on the state we popped back to and the rule
1150 number reduced by. */
1152 yyn = yyr1[yyn];
1154 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1155 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1156 yystate = yytable[yystate];
1157 else
1158 yystate = yydefgoto[yyn - YYNTBASE];
1160 goto yynewstate;
1163 /*------------------------------------.
1164 | yyerrlab -- here on detecting error |
1165 `------------------------------------*/
1166 yyerrlab:
1167 /* If not already recovering from an error, report this error. */
1168 if (!yyerrstatus)
1170 ++yynerrs;
1172 #ifdef YYERROR_VERBOSE
1173 yyn = yypact[yystate];
1175 if (yyn > YYFLAG && yyn < YYLAST)
1177 YYSIZE_T yysize = 0;
1178 char *yymsg;
1179 int yyx, yycount;
1181 yycount = 0;
1182 /* Start YYX at -YYN if negative to avoid negative indexes in
1183 YYCHECK. */
1184 for (yyx = yyn < 0 ? -yyn : 0;
1185 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
1186 if (yycheck[yyx + yyn] == yyx)
1187 yysize += yystrlen (yytname[yyx]) + 15, yycount++;
1188 yysize += yystrlen ("parse error, unexpected ") + 1;
1189 yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
1190 yymsg = (char *) YYSTACK_ALLOC (yysize);
1191 if (yymsg != 0)
1193 char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
1194 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
1196 if (yycount < 5)
1198 yycount = 0;
1199 for (yyx = yyn < 0 ? -yyn : 0;
1200 yyx < (int) (sizeof (yytname) / sizeof (char *));
1201 yyx++)
1202 if (yycheck[yyx + yyn] == yyx)
1204 const char *yyq = ! yycount ? ", expecting " : " or ";
1205 yyp = yystpcpy (yyp, yyq);
1206 yyp = yystpcpy (yyp, yytname[yyx]);
1207 yycount++;
1210 yyerror (yymsg);
1211 YYSTACK_FREE (yymsg);
1213 else
1214 yyerror ("parse error; also virtual memory exhausted");
1216 else
1217 #endif /* defined (YYERROR_VERBOSE) */
1218 yyerror ("parse error");
1220 goto yyerrlab1;
1223 /*--------------------------------------------------.
1224 | yyerrlab1 -- error raised explicitly by an action |
1225 `--------------------------------------------------*/
1226 yyerrlab1:
1227 if (yyerrstatus == 3)
1229 /* If just tried and failed to reuse lookahead token after an
1230 error, discard it. */
1232 /* return failure if at end of input */
1233 if (yychar == YYEOF)
1234 YYABORT;
1235 YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
1236 yychar, yytname[yychar1]));
1237 yychar = YYEMPTY;
1240 /* Else will try to reuse lookahead token after shifting the error
1241 token. */
1243 yyerrstatus = 3; /* Each real token shifted decrements this */
1245 goto yyerrhandle;
1248 /*-------------------------------------------------------------------.
1249 | yyerrdefault -- current state does not do anything special for the |
1250 | error token. |
1251 `-------------------------------------------------------------------*/
1252 yyerrdefault:
1253 #if 0
1254 /* This is wrong; only states that explicitly want error tokens
1255 should shift them. */
1257 /* If its default is to accept any token, ok. Otherwise pop it. */
1258 yyn = yydefact[yystate];
1259 if (yyn)
1260 goto yydefault;
1261 #endif
1264 /*---------------------------------------------------------------.
1265 | yyerrpop -- pop the current state because it cannot handle the |
1266 | error token |
1267 `---------------------------------------------------------------*/
1268 yyerrpop:
1269 if (yyssp == yyss)
1270 YYABORT;
1271 yyvsp--;
1272 yystate = *--yyssp;
1273 #if YYLSP_NEEDED
1274 yylsp--;
1275 #endif
1277 #if YYDEBUG
1278 if (yydebug)
1280 short *yyssp1 = yyss - 1;
1281 YYFPRINTF (stderr, "Error: state stack now");
1282 while (yyssp1 != yyssp)
1283 YYFPRINTF (stderr, " %d", *++yyssp1);
1284 YYFPRINTF (stderr, "\n");
1286 #endif
1288 /*--------------.
1289 | yyerrhandle. |
1290 `--------------*/
1291 yyerrhandle:
1292 yyn = yypact[yystate];
1293 if (yyn == YYFLAG)
1294 goto yyerrdefault;
1296 yyn += YYTERROR;
1297 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1298 goto yyerrdefault;
1300 yyn = yytable[yyn];
1301 if (yyn < 0)
1303 if (yyn == YYFLAG)
1304 goto yyerrpop;
1305 yyn = -yyn;
1306 goto yyreduce;
1308 else if (yyn == 0)
1309 goto yyerrpop;
1311 if (yyn == YYFINAL)
1312 YYACCEPT;
1314 YYDPRINTF ((stderr, "Shifting error token, "));
1316 *++yyvsp = yylval;
1317 #if YYLSP_NEEDED
1318 *++yylsp = yylloc;
1319 #endif
1321 yystate = yyn;
1322 goto yynewstate;
1325 /*-------------------------------------.
1326 | yyacceptlab -- YYACCEPT comes here. |
1327 `-------------------------------------*/
1328 yyacceptlab:
1329 yyresult = 0;
1330 goto yyreturn;
1332 /*-----------------------------------.
1333 | yyabortlab -- YYABORT comes here. |
1334 `-----------------------------------*/
1335 yyabortlab:
1336 yyresult = 1;
1337 goto yyreturn;
1339 /*---------------------------------------------.
1340 | yyoverflowab -- parser overflow comes here. |
1341 `---------------------------------------------*/
1342 yyoverflowlab:
1343 yyerror ("parser stack overflow");
1344 yyresult = 2;
1345 /* Fall through. */
1347 yyreturn:
1348 #ifndef yyoverflow
1349 if (yyss != yyssa)
1350 YYSTACK_FREE (yyss);
1351 #endif
1352 return yyresult;
1354 #line 294 "po-gram-gen.y"