1/* A Bison parser, made from po-gram-gen.y 2 by GNU bison 1.35. */ 3 4#define YYBISON 1 /* Identify Bison output. */ 5 6# define COMMENT 257 7# define DOMAIN 258 8# define JUNK 259 9# define PREV_MSGCTXT 260 10# define PREV_MSGID 261 11# define PREV_MSGID_PLURAL 262 12# define PREV_STRING 263 13# define MSGCTXT 264 14# define MSGID 265 15# define MSGID_PLURAL 266 16# define MSGSTR 267 17# define NAME 268 18# define NUMBER 269 19# define STRING 270 20 21#line 20 "po-gram-gen.y" 22 23#ifdef HAVE_CONFIG_H 24# include "config.h" 25#endif 26 27/* Specification. */ 28#include "po-gram.h" 29 30#include <stdbool.h> 31#include <stdio.h> 32#include <stdlib.h> 33#include <string.h> 34 35#include "str-list.h" 36#include "po-lex.h" 37#include "po-charset.h" 38#include "error.h" 39#include "xalloc.h" 40#include "gettext.h" 41#include "read-catalog-abstract.h" 42 43#define _(str) gettext (str) 44 45/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc), 46 as well as gratuitiously global symbol names, so we can have multiple 47 yacc generated parsers in the same program. Note that these are only 48 the variables produced by yacc. If other parser generators (bison, 49 byacc, etc) produce additional global names that conflict at link time, 50 then those parser generators need to be fixed instead of adding those 51 names to this list. */ 52 53#define yymaxdepth po_gram_maxdepth 54#define yyparse po_gram_parse 55#define yylex po_gram_lex 56#define yyerror po_gram_error 57#define yylval po_gram_lval 58#define yychar po_gram_char 59#define yydebug po_gram_debug 60#define yypact po_gram_pact 61#define yyr1 po_gram_r1 62#define yyr2 po_gram_r2 63#define yydef po_gram_def 64#define yychk po_gram_chk 65#define yypgo po_gram_pgo 66#define yyact po_gram_act 67#define yyexca po_gram_exca 68#define yyerrflag po_gram_errflag 69#define yynerrs po_gram_nerrs 70#define yyps po_gram_ps 71#define yypv po_gram_pv 72#define yys po_gram_s 73#define yy_yys po_gram_yys 74#define yystate po_gram_state 75#define yytmp po_gram_tmp 76#define yyv po_gram_v 77#define yy_yyv po_gram_yyv 78#define yyval po_gram_val 79#define yylloc po_gram_lloc 80#define yyreds po_gram_reds /* With YYDEBUG defined */ 81#define yytoks po_gram_toks /* With YYDEBUG defined */ 82#define yylhs po_gram_yylhs 83#define yylen po_gram_yylen 84#define yydefred po_gram_yydefred 85#define yydgoto po_gram_yydgoto 86#define yysindex po_gram_yysindex 87#define yyrindex po_gram_yyrindex 88#define yygindex po_gram_yygindex 89#define yytable po_gram_yytable 90#define yycheck po_gram_yycheck 91 92static long plural_counter; 93 94#define check_obsolete(value1,value2) \ 95 if ((value1).obsolete != (value2).obsolete) \ 96 po_gram_error_at_line (&(value2).pos, _("inconsistent use of #~")); 97 98static inline void 99do_callback_message (char *msgctxt, 100 char *msgid, lex_pos_ty *msgid_pos, char *msgid_plural, 101 char *msgstr, size_t msgstr_len, lex_pos_ty *msgstr_pos, 102 char *prev_msgctxt, 103 char *prev_msgid, char *prev_msgid_plural, 104 bool obsolete) 105{ 106 /* Test for header entry. Ignore fuzziness of the header entry. */ 107 if (msgctxt == NULL && msgid[0] == '\0' && !obsolete) 108 po_lex_charset_set (msgstr, gram_pos.file_name); 109 110 po_callback_message (msgctxt, 111 msgid, msgid_pos, msgid_plural, 112 msgstr, msgstr_len, msgstr_pos, 113 prev_msgctxt, prev_msgid, prev_msgid_plural, 114 false, obsolete); 115} 116 117#define free_message_intro(value) \ 118 if ((value).prev_ctxt != NULL) \ 119 free ((value).prev_ctxt); \ 120 if ((value).prev_id != NULL) \ 121 free ((value).prev_id); \ 122 if ((value).prev_id_plural != NULL) \ 123 free ((value).prev_id_plural); \ 124 if ((value).ctxt != NULL) \ 125 free ((value).ctxt); 126 127 128#line 143 "po-gram-gen.y" 129#ifndef YYSTYPE 130typedef union 131{ 132 struct { char *string; lex_pos_ty pos; bool obsolete; } string; 133 struct { string_list_ty stringlist; lex_pos_ty pos; bool obsolete; } stringlist; 134 struct { long number; lex_pos_ty pos; bool obsolete; } number; 135 struct { lex_pos_ty pos; bool obsolete; } pos; 136 struct { char *ctxt; char *id; char *id_plural; lex_pos_ty pos; bool obsolete; } prev; 137 struct { char *prev_ctxt; char *prev_id; char *prev_id_plural; char *ctxt; lex_pos_ty pos; bool obsolete; } message_intro; 138 struct { struct msgstr_def rhs; lex_pos_ty pos; bool obsolete; } rhs; 139} yystype; 140# define YYSTYPE yystype 141# define YYSTYPE_IS_TRIVIAL 1 142#endif 143#ifndef YYDEBUG 144# define YYDEBUG 0 145#endif 146 147 148 149#define YYFINAL 46 150#define YYFLAG -32768 151#define YYNTBASE 19 152 153/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ 154#define YYTRANSLATE(x) ((unsigned)(x) <= 270 ? yytranslate[x] : 33) 155 156/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ 157static const char yytranslate[] = 158{ 159 0, 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, 2, 2, 2, 2, 163 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 164 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 165 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 166 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 167 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 168 2, 15, 2, 16, 2, 2, 2, 2, 2, 2, 169 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 170 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 171 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 172 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 173 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 174 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 175 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 176 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 177 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 178 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 179 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 180 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 181 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 182 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 183 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 184 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, 185 6, 7, 8, 9, 10, 11, 12, 13, 14, 17, 186 18 187}; 188 189#if YYDEBUG 190static const short yyprhs[] = 191{ 192 0, 0, 1, 4, 7, 10, 13, 15, 18, 23, 193 28, 32, 36, 39, 41, 44, 47, 51, 53, 57, 194 59, 63, 66, 69, 71, 74, 80, 82, 85, 87 195}; 196static const short yyrhs[] = 197{ 198 -1, 19, 20, 0, 19, 21, 0, 19, 22, 0, 199 19, 1, 0, 3, 0, 4, 18, 0, 23, 31, 200 13, 31, 0, 23, 31, 27, 29, 0, 23, 31, 201 27, 0, 23, 31, 29, 0, 23, 31, 0, 25, 202 0, 24, 25, 0, 26, 32, 0, 26, 32, 28, 203 0, 11, 0, 10, 31, 11, 0, 7, 0, 6, 204 32, 7, 0, 12, 31, 0, 8, 32, 0, 30, 205 0, 29, 30, 0, 13, 15, 17, 16, 31, 0, 206 18, 0, 31, 18, 0, 9, 0, 32, 9, 0 207}; 208 209#endif 210 211#if YYDEBUG 212/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 213static const short yyrline[] = 214{ 215 0, 170, 171, 172, 173, 174, 179, 187, 195, 216, 216 237, 246, 255, 266, 275, 289, 298, 312, 318, 329, 217 335, 347, 358, 369, 373, 388, 411, 418, 429, 436 218}; 219#endif 220 221 222#if (YYDEBUG) || defined YYERROR_VERBOSE 223 224/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ 225static const char *const yytname[] = 226{ 227 "$", "error", "$undefined.", "COMMENT", "DOMAIN", "JUNK", "PREV_MSGCTXT", 228 "PREV_MSGID", "PREV_MSGID_PLURAL", "PREV_STRING", "MSGCTXT", "MSGID", 229 "MSGID_PLURAL", "MSGSTR", "NAME", "'['", "']'", "NUMBER", "STRING", 230 "po_file", "comment", "domain", "message", "message_intro", "prev", 231 "msg_intro", "prev_msg_intro", "msgid_pluralform", 232 "prev_msgid_pluralform", "pluralform_list", "pluralform", "string_list", 233 "prev_string_list", 0 234}; 235#endif 236 237/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 238static const short yyr1[] = 239{ 240 0, 19, 19, 19, 19, 19, 20, 21, 22, 22, 241 22, 22, 22, 23, 23, 24, 24, 25, 25, 26, 242 26, 27, 28, 29, 29, 30, 31, 31, 32, 32 243}; 244 245/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 246static const short yyr2[] = 247{ 248 0, 0, 2, 2, 2, 2, 1, 2, 4, 4, 249 3, 3, 2, 1, 2, 2, 3, 1, 3, 1, 250 3, 2, 2, 1, 2, 5, 1, 2, 1, 2 251}; 252 253/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE 254 doesn't specify something else to do. Zero means the default is an 255 error. */ 256static const short yydefact[] = 257{ 258 1, 0, 5, 6, 0, 0, 19, 0, 17, 2, 259 3, 4, 0, 0, 13, 0, 7, 28, 0, 26, 260 0, 12, 14, 15, 20, 29, 18, 27, 0, 0, 261 10, 11, 23, 0, 16, 21, 0, 8, 0, 9, 262 24, 22, 0, 0, 25, 0, 0 263}; 264 265static const short yydefgoto[] = 266{ 267 1, 9, 10, 11, 12, 13, 14, 15, 30, 34, 268 31, 32, 20, 18 269}; 270 271static const short yypact[] = 272{ 273 -32768, 2,-32768,-32768, -8, 5,-32768, 0,-32768,-32768, 274 -32768,-32768, 0, 13,-32768, 5,-32768,-32768, 20,-32768, 275 -7, 8,-32768, 24,-32768,-32768,-32768,-32768, 0, 7, 276 15, 15,-32768, 5,-32768, 12, 17, 12, 21, 15, 277 -32768, 26, 22, 0, 12, 37,-32768 278}; 279 280static const short yypgoto[] = 281{ 282 -32768,-32768,-32768,-32768,-32768,-32768, 27,-32768,-32768,-32768, 283 9, -24, -12, -14 284}; 285 286 287#define YYLAST 40 288 289 290static const short yytable[] = 291{ 292 21, 23, 45, 2, 26, 3, 4, 40, 5, 6, 293 16, 27, 7, 8, 17, 40, 35, 37, 19, 41, 294 28, 29, 36, 7, 8, 19, 27, 24, 38, 25, 295 27, 44, 33, 25, 42, 25, 36, 46, 43, 39, 296 22 297}; 298 299static const short yycheck[] = 300{ 301 12, 15, 0, 1, 11, 3, 4, 31, 6, 7, 302 18, 18, 10, 11, 9, 39, 28, 29, 18, 33, 303 12, 13, 15, 10, 11, 18, 18, 7, 13, 9, 304 18, 43, 8, 9, 17, 9, 15, 0, 16, 30, 305 13 306}; 307/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ 308#line 3 "bison.simple" 309 310/* Skeleton output parser for bison, 311 312 Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software 313 Foundation, Inc. 314 315 This program is free software; you can redistribute it and/or modify 316 it under the terms of the GNU General Public License as published by 317 the Free Software Foundation; either version 2, or (at your option) 318 any later version. 319 320 This program is distributed in the hope that it will be useful, 321 but WITHOUT ANY WARRANTY; without even the implied warranty of 322 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 323 GNU General Public License for more details. 324 325 You should have received a copy of the GNU General Public License 326 along with this program; if not, write to the Free Software 327 Foundation, Inc., 59 Temple Place - Suite 330, 328 Boston, MA 02111-1307, USA. */ 329 330/* As a special exception, when this file is copied by Bison into a 331 Bison output file, you may use that output file without restriction. 332 This special exception was added by the Free Software Foundation 333 in version 1.24 of Bison. */ 334 335/* This is the parser code that is written into each bison parser when 336 the %semantic_parser declaration is not specified in the grammar. 337 It was written by Richard Stallman by simplifying the hairy parser 338 used when %semantic_parser is specified. */ 339 340/* All symbols defined below should begin with yy or YY, to avoid 341 infringing on user name space. This should be done even for local 342 variables, as they might otherwise be expanded by user macros. 343 There are some unavoidable exceptions within include files to 344 define necessary library symbols; they are noted "INFRINGES ON 345 USER NAME SPACE" below. */ 346 347#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) 348 349/* The parser invokes alloca or malloc; define the necessary symbols. */ 350 351# if YYSTACK_USE_ALLOCA 352# define YYSTACK_ALLOC alloca 353# else 354# ifndef YYSTACK_USE_ALLOCA 355# if defined (alloca) || defined (_ALLOCA_H) 356# define YYSTACK_ALLOC alloca 357# else 358# ifdef __GNUC__ 359# define YYSTACK_ALLOC __builtin_alloca 360# endif 361# endif 362# endif 363# endif 364 365# ifdef YYSTACK_ALLOC 366 /* Pacify GCC's `empty if-body' warning. */ 367# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) 368# else 369# if defined (__STDC__) || defined (__cplusplus) 370# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ 371# define YYSIZE_T size_t 372# endif 373# define YYSTACK_ALLOC malloc 374# define YYSTACK_FREE free 375# endif 376#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ 377 378 379#if (! defined (yyoverflow) \ 380 && (! defined (__cplusplus) \ 381 || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) 382 383/* A type that is properly aligned for any stack member. */ 384union yyalloc 385{ 386 short yyss; 387 YYSTYPE yyvs; 388# if YYLSP_NEEDED 389 YYLTYPE yyls; 390# endif 391}; 392 393/* The size of the maximum gap between one aligned stack and the next. */ 394# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) 395 396/* The size of an array large to enough to hold all stacks, each with 397 N elements. */ 398# if YYLSP_NEEDED 399# define YYSTACK_BYTES(N) \ 400 ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ 401 + 2 * YYSTACK_GAP_MAX) 402# else 403# define YYSTACK_BYTES(N) \ 404 ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ 405 + YYSTACK_GAP_MAX) 406# endif 407 408/* Copy COUNT objects from FROM to TO. The source and destination do 409 not overlap. */ 410# ifndef YYCOPY 411# if 1 < __GNUC__ 412# define YYCOPY(To, From, Count) \ 413 __builtin_memcpy (To, From, (Count) * sizeof (*(From))) 414# else 415# define YYCOPY(To, From, Count) \ 416 do \ 417 { \ 418 register YYSIZE_T yyi; \ 419 for (yyi = 0; yyi < (Count); yyi++) \ 420 (To)[yyi] = (From)[yyi]; \ 421 } \ 422 while (0) 423# endif 424# endif 425 426/* Relocate STACK from its old location to the new one. The 427 local variables YYSIZE and YYSTACKSIZE give the old and new number of 428 elements in the stack, and YYPTR gives the new location of the 429 stack. Advance YYPTR to a properly aligned location for the next 430 stack. */ 431# define YYSTACK_RELOCATE(Stack) \ 432 do \ 433 { \ 434 YYSIZE_T yynewbytes; \ 435 YYCOPY (&yyptr->Stack, Stack, yysize); \ 436 Stack = &yyptr->Stack; \ 437 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ 438 yyptr += yynewbytes / sizeof (*yyptr); \ 439 } \ 440 while (0) 441 442#endif 443 444 445#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) 446# define YYSIZE_T __SIZE_TYPE__ 447#endif 448#if ! defined (YYSIZE_T) && defined (size_t) 449# define YYSIZE_T size_t 450#endif 451#if ! defined (YYSIZE_T) 452# if defined (__STDC__) || defined (__cplusplus) 453# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ 454# define YYSIZE_T size_t 455# endif 456#endif 457#if ! defined (YYSIZE_T) 458# define YYSIZE_T unsigned int 459#endif 460 461#define yyerrok (yyerrstatus = 0) 462#define yyclearin (yychar = YYEMPTY) 463#define YYEMPTY -2 464#define YYEOF 0 465#define YYACCEPT goto yyacceptlab 466#define YYABORT goto yyabortlab 467#define YYERROR goto yyerrlab1 468/* Like YYERROR except do call yyerror. This remains here temporarily 469 to ease the transition to the new meaning of YYERROR, for GCC. 470 Once GCC version 2 has supplanted version 1, this can go. */ 471#define YYFAIL goto yyerrlab 472#define YYRECOVERING() (!!yyerrstatus) 473#define YYBACKUP(Token, Value) \ 474do \ 475 if (yychar == YYEMPTY && yylen == 1) \ 476 { \ 477 yychar = (Token); \ 478 yylval = (Value); \ 479 yychar1 = YYTRANSLATE (yychar); \ 480 YYPOPSTACK; \ 481 goto yybackup; \ 482 } \ 483 else \ 484 { \ 485 yyerror ("syntax error: cannot back up"); \ 486 YYERROR; \ 487 } \ 488while (0) 489 490#define YYTERROR 1 491#define YYERRCODE 256 492 493 494/* YYLLOC_DEFAULT -- Compute the default location (before the actions 495 are run). 496 497 When YYLLOC_DEFAULT is run, CURRENT is set the location of the 498 first token. By default, to implement support for ranges, extend 499 its range to the last symbol. */ 500 501#ifndef YYLLOC_DEFAULT 502# define YYLLOC_DEFAULT(Current, Rhs, N) \ 503 Current.last_line = Rhs[N].last_line; \ 504 Current.last_column = Rhs[N].last_column; 505#endif 506 507 508/* YYLEX -- calling `yylex' with the right arguments. */ 509 510#if YYPURE 511# if YYLSP_NEEDED 512# ifdef YYLEX_PARAM 513# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) 514# else 515# define YYLEX yylex (&yylval, &yylloc) 516# endif 517# else /* !YYLSP_NEEDED */ 518# ifdef YYLEX_PARAM 519# define YYLEX yylex (&yylval, YYLEX_PARAM) 520# else 521# define YYLEX yylex (&yylval) 522# endif 523# endif /* !YYLSP_NEEDED */ 524#else /* !YYPURE */ 525# define YYLEX yylex () 526#endif /* !YYPURE */ 527 528 529/* Enable debugging if requested. */ 530#if YYDEBUG 531 532# ifndef YYFPRINTF 533# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ 534# define YYFPRINTF fprintf 535# endif 536 537# define YYDPRINTF(Args) \ 538do { \ 539 if (yydebug) \ 540 YYFPRINTF Args; \ 541} while (0) 542/* Nonzero means print parse trace. It is left uninitialized so that 543 multiple parsers can coexist. */ 544int yydebug; 545#else /* !YYDEBUG */ 546# define YYDPRINTF(Args) 547#endif /* !YYDEBUG */ 548 549/* YYINITDEPTH -- initial size of the parser's stacks. */ 550#ifndef YYINITDEPTH 551# define YYINITDEPTH 200 552#endif 553 554/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only 555 if the built-in stack extension method is used). 556 557 Do not make this value too large; the results are undefined if 558 SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) 559 evaluated with infinite-precision integer arithmetic. */ 560 561#if YYMAXDEPTH == 0 562# undef YYMAXDEPTH 563#endif 564 565#ifndef YYMAXDEPTH 566# define YYMAXDEPTH 10000 567#endif 568 569#ifdef YYERROR_VERBOSE 570 571# ifndef yystrlen 572# if defined (__GLIBC__) && defined (_STRING_H) 573# define yystrlen strlen 574# else 575/* Return the length of YYSTR. */ 576static YYSIZE_T 577# if defined (__STDC__) || defined (__cplusplus) 578yystrlen (const char *yystr) 579# else 580yystrlen (yystr) 581 const char *yystr; 582# endif 583{ 584 register const char *yys = yystr; 585 586 while (*yys++ != '\0') 587 continue; 588 589 return yys - yystr - 1; 590} 591# endif 592# endif 593 594# ifndef yystpcpy 595# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) 596# define yystpcpy stpcpy 597# else 598/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in 599 YYDEST. */ 600static char * 601# if defined (__STDC__) || defined (__cplusplus) 602yystpcpy (char *yydest, const char *yysrc) 603# else 604yystpcpy (yydest, yysrc) 605 char *yydest; 606 const char *yysrc; 607# endif 608{ 609 register char *yyd = yydest; 610 register const char *yys = yysrc; 611 612 while ((*yyd++ = *yys++) != '\0') 613 continue; 614 615 return yyd - 1; 616} 617# endif 618# endif 619#endif 620 621#line 315 "bison.simple" 622 623 624/* The user can define YYPARSE_PARAM as the name of an argument to be passed 625 into yyparse. The argument should have type void *. 626 It should actually point to an object. 627 Grammar actions can access the variable by casting it 628 to the proper pointer type. */ 629 630#ifdef YYPARSE_PARAM 631# if defined (__STDC__) || defined (__cplusplus) 632# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM 633# define YYPARSE_PARAM_DECL 634# else 635# define YYPARSE_PARAM_ARG YYPARSE_PARAM 636# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; 637# endif 638#else /* !YYPARSE_PARAM */ 639# define YYPARSE_PARAM_ARG 640# define YYPARSE_PARAM_DECL 641#endif /* !YYPARSE_PARAM */ 642 643/* Prevent warning if -Wstrict-prototypes. */ 644#ifdef __GNUC__ 645# ifdef YYPARSE_PARAM 646int yyparse (void *); 647# else 648int yyparse (void); 649# endif 650#endif 651 652/* YY_DECL_VARIABLES -- depending whether we use a pure parser, 653 variables are global, or local to YYPARSE. */ 654 655#define YY_DECL_NON_LSP_VARIABLES \ 656/* The lookahead symbol. */ \ 657int yychar; \ 658 \ 659/* The semantic value of the lookahead symbol. */ \ 660YYSTYPE yylval; \ 661 \ 662/* Number of parse errors so far. */ \ 663int yynerrs; 664 665#if YYLSP_NEEDED 666# define YY_DECL_VARIABLES \ 667YY_DECL_NON_LSP_VARIABLES \ 668 \ 669/* Location data for the lookahead symbol. */ \ 670YYLTYPE yylloc; 671#else 672# define YY_DECL_VARIABLES \ 673YY_DECL_NON_LSP_VARIABLES 674#endif 675 676 677/* If nonreentrant, generate the variables here. */ 678 679#if !YYPURE 680YY_DECL_VARIABLES 681#endif /* !YYPURE */ 682 683int 684yyparse (YYPARSE_PARAM_ARG) 685 YYPARSE_PARAM_DECL 686{ 687 /* If reentrant, generate the variables here. */ 688#if YYPURE 689 YY_DECL_VARIABLES 690#endif /* !YYPURE */ 691 692 register int yystate; 693 register int yyn; 694 int yyresult; 695 /* Number of tokens to shift before error messages enabled. */ 696 int yyerrstatus; 697 /* Lookahead token as an internal (translated) token number. */ 698 int yychar1 = 0; 699 700 /* Three stacks and their tools: 701 `yyss': related to states, 702 `yyvs': related to semantic values, 703 `yyls': related to locations. 704 705 Refer to the stacks thru separate pointers, to allow yyoverflow 706 to reallocate them elsewhere. */ 707 708 /* The state stack. */ 709 short yyssa[YYINITDEPTH]; 710 short *yyss = yyssa; 711 register short *yyssp; 712 713 /* The semantic value stack. */ 714 YYSTYPE yyvsa[YYINITDEPTH]; 715 YYSTYPE *yyvs = yyvsa; 716 register YYSTYPE *yyvsp; 717 718#if YYLSP_NEEDED 719 /* The location stack. */ 720 YYLTYPE yylsa[YYINITDEPTH]; 721 YYLTYPE *yyls = yylsa; 722 YYLTYPE *yylsp; 723#endif 724 725#if YYLSP_NEEDED 726# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) 727#else 728# define YYPOPSTACK (yyvsp--, yyssp--) 729#endif 730 731 YYSIZE_T yystacksize = YYINITDEPTH; 732 733 734 /* The variables used to return semantic value and location from the 735 action routines. */ 736 YYSTYPE yyval; 737#if YYLSP_NEEDED 738 YYLTYPE yyloc; 739#endif 740 741 /* When reducing, the number of symbols on the RHS of the reduced 742 rule. */ 743 int yylen; 744 745 YYDPRINTF ((stderr, "Starting parse\n")); 746 747 yystate = 0; 748 yyerrstatus = 0; 749 yynerrs = 0; 750 yychar = YYEMPTY; /* Cause a token to be read. */ 751 752 /* Initialize stack pointers. 753 Waste one element of value and location stack 754 so that they stay on the same level as the state stack. 755 The wasted elements are never initialized. */ 756 757 yyssp = yyss; 758 yyvsp = yyvs; 759#if YYLSP_NEEDED 760 yylsp = yyls; 761#endif 762 goto yysetstate; 763 764/*------------------------------------------------------------. 765| yynewstate -- Push a new state, which is found in yystate. | 766`------------------------------------------------------------*/ 767 yynewstate: 768 /* In all cases, when you get here, the value and location stacks 769 have just been pushed. so pushing a state here evens the stacks. 770 */ 771 yyssp++; 772 773 yysetstate: 774 *yyssp = yystate; 775 776 if (yyssp >= yyss + yystacksize - 1) 777 { 778 /* Get the current used size of the three stacks, in elements. */ 779 YYSIZE_T yysize = yyssp - yyss + 1; 780 781#ifdef yyoverflow 782 { 783 /* Give user a chance to reallocate the stack. Use copies of 784 these so that the &'s don't force the real ones into 785 memory. */ 786 YYSTYPE *yyvs1 = yyvs; 787 short *yyss1 = yyss; 788 789 /* Each stack pointer address is followed by the size of the 790 data in use in that stack, in bytes. */ 791# if YYLSP_NEEDED 792 YYLTYPE *yyls1 = yyls; 793 /* This used to be a conditional around just the two extra args, 794 but that might be undefined if yyoverflow is a macro. */ 795 yyoverflow ("parser stack overflow", 796 &yyss1, yysize * sizeof (*yyssp), 797 &yyvs1, yysize * sizeof (*yyvsp), 798 &yyls1, yysize * sizeof (*yylsp), 799 &yystacksize); 800 yyls = yyls1; 801# else 802 yyoverflow ("parser stack overflow", 803 &yyss1, yysize * sizeof (*yyssp), 804 &yyvs1, yysize * sizeof (*yyvsp), 805 &yystacksize); 806# endif 807 yyss = yyss1; 808 yyvs = yyvs1; 809 } 810#else /* no yyoverflow */ 811# ifndef YYSTACK_RELOCATE 812 goto yyoverflowlab; 813# else 814 /* Extend the stack our own way. */ 815 if (yystacksize >= YYMAXDEPTH) 816 goto yyoverflowlab; 817 yystacksize *= 2; 818 if (yystacksize > YYMAXDEPTH) 819 yystacksize = YYMAXDEPTH; 820 821 { 822 short *yyss1 = yyss; 823 union yyalloc *yyptr = 824 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); 825 if (! yyptr) 826 goto yyoverflowlab; 827 YYSTACK_RELOCATE (yyss); 828 YYSTACK_RELOCATE (yyvs); 829# if YYLSP_NEEDED 830 YYSTACK_RELOCATE (yyls); 831# endif 832# undef YYSTACK_RELOCATE 833 if (yyss1 != yyssa) 834 YYSTACK_FREE (yyss1); 835 } 836# endif 837#endif /* no yyoverflow */ 838 839 yyssp = yyss + yysize - 1; 840 yyvsp = yyvs + yysize - 1; 841#if YYLSP_NEEDED 842 yylsp = yyls + yysize - 1; 843#endif 844 845 YYDPRINTF ((stderr, "Stack size increased to %lu\n", 846 (unsigned long int) yystacksize)); 847 848 if (yyssp >= yyss + yystacksize - 1) 849 YYABORT; 850 } 851 852 YYDPRINTF ((stderr, "Entering state %d\n", yystate)); 853 854 goto yybackup; 855 856 857/*-----------. 858| yybackup. | 859`-----------*/ 860yybackup: 861 862/* Do appropriate processing given the current state. */ 863/* Read a lookahead token if we need one and don't already have one. */ 864/* yyresume: */ 865 866 /* First try to decide what to do without reference to lookahead token. */ 867 868 yyn = yypact[yystate]; 869 if (yyn == YYFLAG) 870 goto yydefault; 871 872 /* Not known => get a lookahead token if don't already have one. */ 873 874 /* yychar is either YYEMPTY or YYEOF 875 or a valid token in external form. */ 876 877 if (yychar == YYEMPTY) 878 { 879 YYDPRINTF ((stderr, "Reading a token: ")); 880 yychar = YYLEX; 881 } 882 883 /* Convert token to internal form (in yychar1) for indexing tables with */ 884 885 if (yychar <= 0) /* This means end of input. */ 886 { 887 yychar1 = 0; 888 yychar = YYEOF; /* Don't call YYLEX any more */ 889 890 YYDPRINTF ((stderr, "Now at end of input.\n")); 891 } 892 else 893 { 894 yychar1 = YYTRANSLATE (yychar); 895 896#if YYDEBUG 897 /* We have to keep this `#if YYDEBUG', since we use variables 898 which are defined only if `YYDEBUG' is set. */ 899 if (yydebug) 900 { 901 YYFPRINTF (stderr, "Next token is %d (%s", 902 yychar, yytname[yychar1]); 903 /* Give the individual parser a way to print the precise 904 meaning of a token, for further debugging info. */ 905# ifdef YYPRINT 906 YYPRINT (stderr, yychar, yylval); 907# endif 908 YYFPRINTF (stderr, ")\n"); 909 } 910#endif 911 } 912 913 yyn += yychar1; 914 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) 915 goto yydefault; 916 917 yyn = yytable[yyn]; 918 919 /* yyn is what to do for this token type in this state. 920 Negative => reduce, -yyn is rule number. 921 Positive => shift, yyn is new state. 922 New state is final state => don't bother to shift, 923 just return success. 924 0, or most negative number => error. */ 925 926 if (yyn < 0) 927 { 928 if (yyn == YYFLAG) 929 goto yyerrlab; 930 yyn = -yyn; 931 goto yyreduce; 932 } 933 else if (yyn == 0) 934 goto yyerrlab; 935 936 if (yyn == YYFINAL) 937 YYACCEPT; 938 939 /* Shift the lookahead token. */ 940 YYDPRINTF ((stderr, "Shifting token %d (%s), ", 941 yychar, yytname[yychar1])); 942 943 /* Discard the token being shifted unless it is eof. */ 944 if (yychar != YYEOF) 945 yychar = YYEMPTY; 946 947 *++yyvsp = yylval; 948#if YYLSP_NEEDED 949 *++yylsp = yylloc; 950#endif 951 952 /* Count tokens shifted since error; after three, turn off error 953 status. */ 954 if (yyerrstatus) 955 yyerrstatus--; 956 957 yystate = yyn; 958 goto yynewstate; 959 960 961/*-----------------------------------------------------------. 962| yydefault -- do the default action for the current state. | 963`-----------------------------------------------------------*/ 964yydefault: 965 yyn = yydefact[yystate]; 966 if (yyn == 0) 967 goto yyerrlab; 968 goto yyreduce; 969 970 971/*-----------------------------. 972| yyreduce -- Do a reduction. | 973`-----------------------------*/ 974yyreduce: 975 /* yyn is the number of a rule to reduce with. */ 976 yylen = yyr2[yyn]; 977 978 /* If YYLEN is nonzero, implement the default value of the action: 979 `$$ = $1'. 980 981 Otherwise, the following line sets YYVAL to the semantic value of 982 the lookahead token. This behavior is undocumented and Bison 983 users should not rely upon it. Assigning to YYVAL 984 unconditionally makes the parser a bit smaller, and it avoids a 985 GCC warning that YYVAL may be used uninitialized. */ 986 yyval = yyvsp[1-yylen]; 987 988#if YYLSP_NEEDED 989 /* Similarly for the default location. Let the user run additional 990 commands if for instance locations are ranges. */ 991 yyloc = yylsp[1-yylen]; 992 YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); 993#endif 994 995#if YYDEBUG 996 /* We have to keep this `#if YYDEBUG', since we use variables which 997 are defined only if `YYDEBUG' is set. */ 998 if (yydebug) 999 { 1000 int yyi; 1001 1002 YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", 1003 yyn, yyrline[yyn]); 1004 1005 /* Print the symbols being reduced, and their result. */ 1006 for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++) 1007 YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); 1008 YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); 1009 } 1010#endif 1011 1012 switch (yyn) { 1013 1014case 6: 1015#line 180 "po-gram-gen.y" 1016{ 1017 po_callback_comment_dispatcher (yyvsp[0].string.string); 1018 } 1019 break; 1020case 7: 1021#line 188 "po-gram-gen.y" 1022{ 1023 po_callback_domain (yyvsp[0].string.string); 1024 } 1025 break; 1026case 8: 1027#line 196 "po-gram-gen.y" 1028{ 1029 char *string2 = string_list_concat_destroy (&yyvsp[-2].stringlist.stringlist); 1030 char *string4 = string_list_concat_destroy (&yyvsp[0].stringlist.stringlist); 1031 1032 check_obsolete (yyvsp[-3].message_intro, yyvsp[-2].stringlist); 1033 check_obsolete (yyvsp[-3].message_intro, yyvsp[-1].pos); 1034 check_obsolete (yyvsp[-3].message_intro, yyvsp[0].stringlist); 1035 if (!yyvsp[-3].message_intro.obsolete || pass_obsolete_entries) 1036 do_callback_message (yyvsp[-3].message_intro.ctxt, string2, &yyvsp[-3].message_intro.pos, NULL, 1037 string4, strlen (string4) + 1, &yyvsp[-1].pos.pos, 1038 yyvsp[-3].message_intro.prev_ctxt, 1039 yyvsp[-3].message_intro.prev_id, yyvsp[-3].message_intro.prev_id_plural, 1040 yyvsp[-3].message_intro.obsolete); 1041 else 1042 { 1043 free_message_intro (yyvsp[-3].message_intro); 1044 free (string2); 1045 free (string4); 1046 } 1047 } 1048 break; 1049case 9: 1050#line 217 "po-gram-gen.y" 1051{ 1052 char *string2 = string_list_concat_destroy (&yyvsp[-2].stringlist.stringlist); 1053 1054 check_obsolete (yyvsp[-3].message_intro, yyvsp[-2].stringlist); 1055 check_obsolete (yyvsp[-3].message_intro, yyvsp[-1].string); 1056 check_obsolete (yyvsp[-3].message_intro, yyvsp[0].rhs); 1057 if (!yyvsp[-3].message_intro.obsolete || pass_obsolete_entries) 1058 do_callback_message (yyvsp[-3].message_intro.ctxt, string2, &yyvsp[-3].message_intro.pos, yyvsp[-1].string.string, 1059 yyvsp[0].rhs.rhs.msgstr, yyvsp[0].rhs.rhs.msgstr_len, &yyvsp[0].rhs.pos, 1060 yyvsp[-3].message_intro.prev_ctxt, 1061 yyvsp[-3].message_intro.prev_id, yyvsp[-3].message_intro.prev_id_plural, 1062 yyvsp[-3].message_intro.obsolete); 1063 else 1064 { 1065 free_message_intro (yyvsp[-3].message_intro); 1066 free (string2); 1067 free (yyvsp[-1].string.string); 1068 free (yyvsp[0].rhs.rhs.msgstr); 1069 } 1070 } 1071 break; 1072case 10: 1073#line 238 "po-gram-gen.y" 1074{ 1075 check_obsolete (yyvsp[-2].message_intro, yyvsp[-1].stringlist); 1076 check_obsolete (yyvsp[-2].message_intro, yyvsp[0].string); 1077 po_gram_error_at_line (&yyvsp[-2].message_intro.pos, _("missing `msgstr[]' section")); 1078 free_message_intro (yyvsp[-2].message_intro); 1079 string_list_destroy (&yyvsp[-1].stringlist.stringlist); 1080 free (yyvsp[0].string.string); 1081 } 1082 break; 1083case 11: 1084#line 247 "po-gram-gen.y" 1085{ 1086 check_obsolete (yyvsp[-2].message_intro, yyvsp[-1].stringlist); 1087 check_obsolete (yyvsp[-2].message_intro, yyvsp[0].rhs); 1088 po_gram_error_at_line (&yyvsp[-2].message_intro.pos, _("missing `msgid_plural' section")); 1089 free_message_intro (yyvsp[-2].message_intro); 1090 string_list_destroy (&yyvsp[-1].stringlist.stringlist); 1091 free (yyvsp[0].rhs.rhs.msgstr); 1092 } 1093 break; 1094case 12: 1095#line 256 "po-gram-gen.y" 1096{ 1097 check_obsolete (yyvsp[-1].message_intro, yyvsp[0].stringlist); 1098 po_gram_error_at_line (&yyvsp[-1].message_intro.pos, _("missing `msgstr' section")); 1099 free_message_intro (yyvsp[-1].message_intro); 1100 string_list_destroy (&yyvsp[0].stringlist.stringlist); 1101 } 1102 break; 1103case 13: 1104#line 267 "po-gram-gen.y" 1105{ 1106 yyval.message_intro.prev_ctxt = NULL; 1107 yyval.message_intro.prev_id = NULL; 1108 yyval.message_intro.prev_id_plural = NULL; 1109 yyval.message_intro.ctxt = yyvsp[0].string.string; 1110 yyval.message_intro.pos = yyvsp[0].string.pos; 1111 yyval.message_intro.obsolete = yyvsp[0].string.obsolete; 1112 } 1113 break; 1114case 14: 1115#line 276 "po-gram-gen.y" 1116{ 1117 check_obsolete (yyvsp[-1].prev, yyvsp[0].string); 1118 yyval.message_intro.prev_ctxt = yyvsp[-1].prev.ctxt; 1119 yyval.message_intro.prev_id = yyvsp[-1].prev.id; 1120 yyval.message_intro.prev_id_plural = yyvsp[-1].prev.id_plural; 1121 yyval.message_intro.ctxt = yyvsp[0].string.string; 1122 yyval.message_intro.pos = yyvsp[0].string.pos; 1123 yyval.message_intro.obsolete = yyvsp[0].string.obsolete; 1124 } 1125 break; 1126case 15: 1127#line 290 "po-gram-gen.y" 1128{ 1129 check_obsolete (yyvsp[-1].string, yyvsp[0].stringlist); 1130 yyval.prev.ctxt = yyvsp[-1].string.string; 1131 yyval.prev.id = string_list_concat_destroy (&yyvsp[0].stringlist.stringlist); 1132 yyval.prev.id_plural = NULL; 1133 yyval.prev.pos = yyvsp[-1].string.pos; 1134 yyval.prev.obsolete = yyvsp[-1].string.obsolete; 1135 } 1136 break; 1137case 16: 1138#line 299 "po-gram-gen.y" 1139{ 1140 check_obsolete (yyvsp[-2].string, yyvsp[-1].stringlist); 1141 check_obsolete (yyvsp[-2].string, yyvsp[0].string); 1142 yyval.prev.ctxt = yyvsp[-2].string.string; 1143 yyval.prev.id = string_list_concat_destroy (&yyvsp[-1].stringlist.stringlist); 1144 yyval.prev.id_plural = yyvsp[0].string.string; 1145 yyval.prev.pos = yyvsp[-2].string.pos; 1146 yyval.prev.obsolete = yyvsp[-2].string.obsolete; 1147 } 1148 break; 1149case 17: 1150#line 313 "po-gram-gen.y" 1151{ 1152 yyval.string.string = NULL; 1153 yyval.string.pos = yyvsp[0].pos.pos; 1154 yyval.string.obsolete = yyvsp[0].pos.obsolete; 1155 } 1156 break; 1157case 18: 1158#line 319 "po-gram-gen.y" 1159{ 1160 check_obsolete (yyvsp[-2].pos, yyvsp[-1].stringlist); 1161 check_obsolete (yyvsp[-2].pos, yyvsp[0].pos); 1162 yyval.string.string = string_list_concat_destroy (&yyvsp[-1].stringlist.stringlist); 1163 yyval.string.pos = yyvsp[0].pos.pos; 1164 yyval.string.obsolete = yyvsp[0].pos.obsolete; 1165 } 1166 break; 1167case 19: 1168#line 330 "po-gram-gen.y" 1169{ 1170 yyval.string.string = NULL; 1171 yyval.string.pos = yyvsp[0].pos.pos; 1172 yyval.string.obsolete = yyvsp[0].pos.obsolete; 1173 } 1174 break; 1175case 20: 1176#line 336 "po-gram-gen.y" 1177{ 1178 check_obsolete (yyvsp[-2].pos, yyvsp[-1].stringlist); 1179 check_obsolete (yyvsp[-2].pos, yyvsp[0].pos); 1180 yyval.string.string = string_list_concat_destroy (&yyvsp[-1].stringlist.stringlist); 1181 yyval.string.pos = yyvsp[0].pos.pos; 1182 yyval.string.obsolete = yyvsp[0].pos.obsolete; 1183 } 1184 break; 1185case 21: 1186#line 348 "po-gram-gen.y" 1187{ 1188 check_obsolete (yyvsp[-1].pos, yyvsp[0].stringlist); 1189 plural_counter = 0; 1190 yyval.string.string = string_list_concat_destroy (&yyvsp[0].stringlist.stringlist); 1191 yyval.string.pos = yyvsp[-1].pos.pos; 1192 yyval.string.obsolete = yyvsp[-1].pos.obsolete; 1193 } 1194 break; 1195case 22: 1196#line 359 "po-gram-gen.y" 1197{ 1198 check_obsolete (yyvsp[-1].pos, yyvsp[0].stringlist); 1199 yyval.string.string = string_list_concat_destroy (&yyvsp[0].stringlist.stringlist); 1200 yyval.string.pos = yyvsp[-1].pos.pos; 1201 yyval.string.obsolete = yyvsp[-1].pos.obsolete; 1202 } 1203 break; 1204case 23: 1205#line 370 "po-gram-gen.y" 1206{ 1207 yyval.rhs = yyvsp[0].rhs; 1208 } 1209 break; 1210case 24: 1211#line 374 "po-gram-gen.y" 1212{ 1213 check_obsolete (yyvsp[-1].rhs, yyvsp[0].rhs); 1214 yyval.rhs.rhs.msgstr = (char *) xmalloc (yyvsp[-1].rhs.rhs.msgstr_len + yyvsp[0].rhs.rhs.msgstr_len); 1215 memcpy (yyval.rhs.rhs.msgstr, yyvsp[-1].rhs.rhs.msgstr, yyvsp[-1].rhs.rhs.msgstr_len); 1216 memcpy (yyval.rhs.rhs.msgstr + yyvsp[-1].rhs.rhs.msgstr_len, yyvsp[0].rhs.rhs.msgstr, yyvsp[0].rhs.rhs.msgstr_len); 1217 yyval.rhs.rhs.msgstr_len = yyvsp[-1].rhs.rhs.msgstr_len + yyvsp[0].rhs.rhs.msgstr_len; 1218 free (yyvsp[-1].rhs.rhs.msgstr); 1219 free (yyvsp[0].rhs.rhs.msgstr); 1220 yyval.rhs.pos = yyvsp[-1].rhs.pos; 1221 yyval.rhs.obsolete = yyvsp[-1].rhs.obsolete; 1222 } 1223 break; 1224case 25: 1225#line 389 "po-gram-gen.y" 1226{ 1227 check_obsolete (yyvsp[-4].pos, yyvsp[-3].pos); 1228 check_obsolete (yyvsp[-4].pos, yyvsp[-2].number); 1229 check_obsolete (yyvsp[-4].pos, yyvsp[-1].pos); 1230 check_obsolete (yyvsp[-4].pos, yyvsp[0].stringlist); 1231 if (yyvsp[-2].number.number != plural_counter) 1232 { 1233 if (plural_counter == 0) 1234 po_gram_error_at_line (&yyvsp[-4].pos.pos, _("first plural form has nonzero index")); 1235 else 1236 po_gram_error_at_line (&yyvsp[-4].pos.pos, _("plural form has wrong index")); 1237 } 1238 plural_counter++; 1239 yyval.rhs.rhs.msgstr = string_list_concat_destroy (&yyvsp[0].stringlist.stringlist); 1240 yyval.rhs.rhs.msgstr_len = strlen (yyval.rhs.rhs.msgstr) + 1; 1241 yyval.rhs.pos = yyvsp[-4].pos.pos; 1242 yyval.rhs.obsolete = yyvsp[-4].pos.obsolete; 1243 } 1244 break; 1245case 26: 1246#line 412 "po-gram-gen.y" 1247{ 1248 string_list_init (&yyval.stringlist.stringlist); 1249 string_list_append (&yyval.stringlist.stringlist, yyvsp[0].string.string); 1250 yyval.stringlist.pos = yyvsp[0].string.pos; 1251 yyval.stringlist.obsolete = yyvsp[0].string.obsolete; 1252 } 1253 break; 1254case 27: 1255#line 419 "po-gram-gen.y" 1256{ 1257 check_obsolete (yyvsp[-1].stringlist, yyvsp[0].string); 1258 yyval.stringlist.stringlist = yyvsp[-1].stringlist.stringlist; 1259 string_list_append (&yyval.stringlist.stringlist, yyvsp[0].string.string); 1260 yyval.stringlist.pos = yyvsp[-1].stringlist.pos; 1261 yyval.stringlist.obsolete = yyvsp[-1].stringlist.obsolete; 1262 } 1263 break; 1264case 28: 1265#line 430 "po-gram-gen.y" 1266{ 1267 string_list_init (&yyval.stringlist.stringlist); 1268 string_list_append (&yyval.stringlist.stringlist, yyvsp[0].string.string); 1269 yyval.stringlist.pos = yyvsp[0].string.pos; 1270 yyval.stringlist.obsolete = yyvsp[0].string.obsolete; 1271 } 1272 break; 1273case 29: 1274#line 437 "po-gram-gen.y" 1275{ 1276 check_obsolete (yyvsp[-1].stringlist, yyvsp[0].string); 1277 yyval.stringlist.stringlist = yyvsp[-1].stringlist.stringlist; 1278 string_list_append (&yyval.stringlist.stringlist, yyvsp[0].string.string); 1279 yyval.stringlist.pos = yyvsp[-1].stringlist.pos; 1280 yyval.stringlist.obsolete = yyvsp[-1].stringlist.obsolete; 1281 } 1282 break; 1283} 1284 1285#line 705 "bison.simple" 1286 1287 1288 yyvsp -= yylen; 1289 yyssp -= yylen; 1290#if YYLSP_NEEDED 1291 yylsp -= yylen; 1292#endif 1293 1294#if YYDEBUG 1295 if (yydebug) 1296 { 1297 short *yyssp1 = yyss - 1; 1298 YYFPRINTF (stderr, "state stack now"); 1299 while (yyssp1 != yyssp) 1300 YYFPRINTF (stderr, " %d", *++yyssp1); 1301 YYFPRINTF (stderr, "\n"); 1302 } 1303#endif 1304 1305 *++yyvsp = yyval; 1306#if YYLSP_NEEDED 1307 *++yylsp = yyloc; 1308#endif 1309 1310 /* Now `shift' the result of the reduction. Determine what state 1311 that goes to, based on the state we popped back to and the rule 1312 number reduced by. */ 1313 1314 yyn = yyr1[yyn]; 1315 1316 yystate = yypgoto[yyn - YYNTBASE] + *yyssp; 1317 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) 1318 yystate = yytable[yystate]; 1319 else 1320 yystate = yydefgoto[yyn - YYNTBASE]; 1321 1322 goto yynewstate; 1323 1324 1325/*------------------------------------. 1326| yyerrlab -- here on detecting error | 1327`------------------------------------*/ 1328yyerrlab: 1329 /* If not already recovering from an error, report this error. */ 1330 if (!yyerrstatus) 1331 { 1332 ++yynerrs; 1333 1334#ifdef YYERROR_VERBOSE 1335 yyn = yypact[yystate]; 1336 1337 if (yyn > YYFLAG && yyn < YYLAST) 1338 { 1339 YYSIZE_T yysize = 0; 1340 char *yymsg; 1341 int yyx, yycount; 1342 1343 yycount = 0; 1344 /* Start YYX at -YYN if negative to avoid negative indexes in 1345 YYCHECK. */ 1346 for (yyx = yyn < 0 ? -yyn : 0; 1347 yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) 1348 if (yycheck[yyx + yyn] == yyx) 1349 yysize += yystrlen (yytname[yyx]) + 15, yycount++; 1350 yysize += yystrlen ("parse error, unexpected ") + 1; 1351 yysize += yystrlen (yytname[YYTRANSLATE (yychar)]); 1352 yymsg = (char *) YYSTACK_ALLOC (yysize); 1353 if (yymsg != 0) 1354 { 1355 char *yyp = yystpcpy (yymsg, "parse error, unexpected "); 1356 yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]); 1357 1358 if (yycount < 5) 1359 { 1360 yycount = 0; 1361 for (yyx = yyn < 0 ? -yyn : 0; 1362 yyx < (int) (sizeof (yytname) / sizeof (char *)); 1363 yyx++) 1364 if (yycheck[yyx + yyn] == yyx) 1365 { 1366 const char *yyq = ! yycount ? ", expecting " : " or "; 1367 yyp = yystpcpy (yyp, yyq); 1368 yyp = yystpcpy (yyp, yytname[yyx]); 1369 yycount++; 1370 } 1371 } 1372 yyerror (yymsg); 1373 YYSTACK_FREE (yymsg); 1374 } 1375 else 1376 yyerror ("parse error; also virtual memory exhausted"); 1377 } 1378 else 1379#endif /* defined (YYERROR_VERBOSE) */ 1380 yyerror ("parse error"); 1381 } 1382 goto yyerrlab1; 1383 1384 1385/*--------------------------------------------------. 1386| yyerrlab1 -- error raised explicitly by an action | 1387`--------------------------------------------------*/ 1388yyerrlab1: 1389 if (yyerrstatus == 3) 1390 { 1391 /* If just tried and failed to reuse lookahead token after an 1392 error, discard it. */ 1393 1394 /* return failure if at end of input */ 1395 if (yychar == YYEOF) 1396 YYABORT; 1397 YYDPRINTF ((stderr, "Discarding token %d (%s).\n", 1398 yychar, yytname[yychar1])); 1399 yychar = YYEMPTY; 1400 } 1401 1402 /* Else will try to reuse lookahead token after shifting the error 1403 token. */ 1404 1405 yyerrstatus = 3; /* Each real token shifted decrements this */ 1406 1407 goto yyerrhandle; 1408 1409 1410/*-------------------------------------------------------------------. 1411| yyerrdefault -- current state does not do anything special for the | 1412| error token. | 1413`-------------------------------------------------------------------*/ 1414yyerrdefault: 1415#if 0 1416 /* This is wrong; only states that explicitly want error tokens 1417 should shift them. */ 1418 1419 /* If its default is to accept any token, ok. Otherwise pop it. */ 1420 yyn = yydefact[yystate]; 1421 if (yyn) 1422 goto yydefault; 1423#endif 1424 1425 1426/*---------------------------------------------------------------. 1427| yyerrpop -- pop the current state because it cannot handle the | 1428| error token | 1429`---------------------------------------------------------------*/ 1430yyerrpop: 1431 if (yyssp == yyss) 1432 YYABORT; 1433 yyvsp--; 1434 yystate = *--yyssp; 1435#if YYLSP_NEEDED 1436 yylsp--; 1437#endif 1438 1439#if YYDEBUG 1440 if (yydebug) 1441 { 1442 short *yyssp1 = yyss - 1; 1443 YYFPRINTF (stderr, "Error: state stack now"); 1444 while (yyssp1 != yyssp) 1445 YYFPRINTF (stderr, " %d", *++yyssp1); 1446 YYFPRINTF (stderr, "\n"); 1447 } 1448#endif 1449 1450/*--------------. 1451| yyerrhandle. | 1452`--------------*/ 1453yyerrhandle: 1454 yyn = yypact[yystate]; 1455 if (yyn == YYFLAG) 1456 goto yyerrdefault; 1457 1458 yyn += YYTERROR; 1459 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) 1460 goto yyerrdefault; 1461 1462 yyn = yytable[yyn]; 1463 if (yyn < 0) 1464 { 1465 if (yyn == YYFLAG) 1466 goto yyerrpop; 1467 yyn = -yyn; 1468 goto yyreduce; 1469 } 1470 else if (yyn == 0) 1471 goto yyerrpop; 1472 1473 if (yyn == YYFINAL) 1474 YYACCEPT; 1475 1476 YYDPRINTF ((stderr, "Shifting error token, ")); 1477 1478 *++yyvsp = yylval; 1479#if YYLSP_NEEDED 1480 *++yylsp = yylloc; 1481#endif 1482 1483 yystate = yyn; 1484 goto yynewstate; 1485 1486 1487/*-------------------------------------. 1488| yyacceptlab -- YYACCEPT comes here. | 1489`-------------------------------------*/ 1490yyacceptlab: 1491 yyresult = 0; 1492 goto yyreturn; 1493 1494/*-----------------------------------. 1495| yyabortlab -- YYABORT comes here. | 1496`-----------------------------------*/ 1497yyabortlab: 1498 yyresult = 1; 1499 goto yyreturn; 1500 1501/*---------------------------------------------. 1502| yyoverflowab -- parser overflow comes here. | 1503`---------------------------------------------*/ 1504yyoverflowlab: 1505 yyerror ("parser stack overflow"); 1506 yyresult = 2; 1507 /* Fall through. */ 1508 1509yyreturn: 1510#ifndef yyoverflow 1511 if (yyss != yyssa) 1512 YYSTACK_FREE (yyss); 1513#endif 1514 return yyresult; 1515} 1516#line 445 "po-gram-gen.y" 1517