]>
sourceware.org Git - glibc.git/blob - intl/plural.c
2 /* A Bison parser, made from plural.y
3 by GNU Bison version 1.28 */
5 #define YYBISON 1 /* Identify Bison output. */
7 #define yyparse __gettextparse
8 #define yylex __gettextlex
9 #define yyerror __gettexterror
10 #define yylval __gettextlval
11 #define yychar __gettextchar
12 #define yydebug __gettextdebug
13 #define yynerrs __gettextnerrs
22 /* Expression parsing for plural form selection.
23 Copyright (C) 2000, 2001 Free Software Foundation, Inc.
24 This file is part of the GNU C Library.
25 Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
27 The GNU C Library is free software; you can redistribute it and/or
28 modify it under the terms of the GNU Lesser General Public
29 License as published by the Free Software Foundation; either
30 version 2.1 of the License, or (at your option) any later version.
32 The GNU C Library is distributed in the hope that it will be useful,
33 but WITHOUT ANY WARRANTY; without even the implied warranty of
34 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
35 Lesser General Public License for more details.
37 You should have received a copy of the GNU Lesser General Public
38 License along with the GNU C Library; if not, write to the Free
39 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
49 /* Names for the libintl functions are a problem. They must not clash
50 with existing names and they should follow ANSI C. But this source
51 code is also used in GNU C Library where the names have a __
52 prefix. So we have to make a difference here. */
54 # define FREE_EXPRESSION __gettext_free_exp
56 # define FREE_EXPRESSION gettext_free_exp__
57 # define __gettextparse gettextparse__
60 #define YYLEX_PARAM &((struct parse_args *) arg)->cp
61 #define YYPARSE_PARAM arg
65 unsigned long int num
;
67 struct expression
* exp
;
71 /* Prototypes for local functions. */
72 static struct expression
* new_exp
PARAMS (( int nargs
, enum operator op
,
73 struct expression
* const * args
));
74 static inline struct expression
* new_exp_0
PARAMS (( enum operator op
));
75 static inline struct expression
* new_exp_1
PARAMS (( enum operator op
,
76 struct expression
* right
));
77 static struct expression
* new_exp_2
PARAMS (( enum operator op
,
78 struct expression
* left
,
79 struct expression
* right
));
80 static inline struct expression
* new_exp_3
PARAMS (( enum operator op
,
81 struct expression
* bexp
,
82 struct expression
* tbranch
,
83 struct expression
* fbranch
));
84 static int yylex
PARAMS (( YYSTYPE
* lval
, const char ** pexp
));
85 static void yyerror
PARAMS (( const char * str
));
87 /* Allocation of expressions. */
89 static struct expression
*
90 new_exp ( nargs
, op
, args
)
93 struct expression
* const * args
;
96 struct expression
* newp
;
98 /* If any of the argument could not be malloc'ed, just return NULL. */
99 for ( i
= nargs
- 1 ; i
>= 0 ; i
--)
103 /* Allocate a new expression. */
104 newp
= ( struct expression
*) malloc ( sizeof (* newp
));
108 newp
-> operation
= op
;
109 for ( i
= nargs
- 1 ; i
>= 0 ; i
--)
110 newp
-> val
. args
[ i
] = args
[ i
];
115 for ( i
= nargs
- 1 ; i
>= 0 ; i
--)
116 FREE_EXPRESSION ( args
[ i
]);
121 static inline struct expression
*
125 return new_exp ( 0 , op
, NULL
);
128 static inline struct expression
*
129 new_exp_1 ( op
, right
)
131 struct expression
* right
;
133 struct expression
* args
[ 1 ];
136 return new_exp ( 1 , op
, args
);
139 static struct expression
*
140 new_exp_2 ( op
, left
, right
)
142 struct expression
* left
;
143 struct expression
* right
;
145 struct expression
* args
[ 2 ];
149 return new_exp ( 2 , op
, args
);
152 static inline struct expression
*
153 new_exp_3 ( op
, bexp
, tbranch
, fbranch
)
155 struct expression
* bexp
;
156 struct expression
* tbranch
;
157 struct expression
* fbranch
;
159 struct expression
* args
[ 3 ];
164 return new_exp ( 3 , op
, args
);
178 #define YYFLAG -32768
181 #define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 18)
183 static const char yytranslate
[] = { 0 ,
184 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
185 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
186 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
187 2 , 2 , 10 , 2 , 2 , 2 , 2 , 5 , 2 , 14 ,
188 15 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
189 2 , 2 , 2 , 2 , 2 , 2 , 2 , 12 , 2 , 2 ,
190 2 , 2 , 3 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
191 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
192 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
193 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
194 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 13 ,
195 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
196 2 , 2 , 2 , 4 , 2 , 2 , 2 , 2 , 2 , 2 ,
197 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
198 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
199 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
200 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
201 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
202 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
203 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
204 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
205 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
206 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
207 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
208 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
209 2 , 2 , 2 , 2 , 2 , 1 , 6 , 7 , 8 , 9 ,
214 static const short yyprhs
[] = { 0 ,
215 0 , 2 , 8 , 12 , 16 , 20 , 24 , 28 , 32 , 35 ,
219 static const short yyrhs
[] = { 17 ,
220 0 , 17 , 3 , 17 , 12 , 17 , 0 , 17 , 4 , 17 ,
221 0 , 17 , 5 , 17 , 0 , 17 , 6 , 17 , 0 , 17 ,
222 7 , 17 , 0 , 17 , 8 , 17 , 0 , 17 , 9 , 17 ,
223 0 , 10 , 17 , 0 , 13 , 0 , 11 , 0 , 14 , 17 ,
230 static const short yyrline
[] = { 0 ,
231 171 , 179 , 183 , 187 , 191 , 195 , 199 , 203 , 207 , 211 ,
237 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
239 static const char * const yytname
[] = { "$" , "error" , "$undefined." , "'?'" , "'|'" ,
240 "'&'" , "EQUOP2" , "CMPOP2" , "ADDOP2" , "MULOP2" , "'!'" , "NUMBER" , "':'" , "'n'" , "'('" , "')'" ,
245 static const short yyr1
[] = { 0 ,
246 16 , 17 , 17 , 17 , 17 , 17 , 17 , 17 , 17 , 17 ,
250 static const short yyr2
[] = { 0 ,
251 1 , 5 , 3 , 3 , 3 , 3 , 3 , 3 , 2 , 1 ,
255 static const short yydefact
[] = { 0 ,
256 0 , 11 , 10 , 0 , 1 , 9 , 0 , 0 , 0 , 0 ,
257 0 , 0 , 0 , 0 , 12 , 0 , 3 , 4 , 5 , 6 ,
261 static const short yydefgoto
[] = { 25 ,
265 static const short yypact
[] = { - 9 ,
266 - 9 ,- 32768 ,- 32768 , - 9 , 34 ,- 32768 , 11 , - 9 , - 9 , - 9 ,
267 - 9 , - 9 , - 9 , - 9 ,- 32768 , 24 , 39 , 43 , 16 , 26 ,
268 - 3 ,- 32768 , - 9 , 34 , 21 , 53 ,- 32768
271 static const short yypgoto
[] = {- 32768 ,
279 static const short yytable
[] = { 6 ,
280 1 , 2 , 7 , 3 , 4 , 14 , 16 , 17 , 18 , 19 ,
281 20 , 21 , 22 , 8 , 9 , 10 , 11 , 12 , 13 , 14 ,
282 26 , 24 , 12 , 13 , 14 , 15 , 8 , 9 , 10 , 11 ,
283 12 , 13 , 14 , 13 , 14 , 23 , 8 , 9 , 10 , 11 ,
284 12 , 13 , 14 , 10 , 11 , 12 , 13 , 14 , 11 , 12 ,
288 static const short yycheck
[] = { 1 ,
289 10 , 11 , 4 , 13 , 14 , 9 , 8 , 9 , 10 , 11 ,
290 12 , 13 , 14 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ,
291 0 , 23 , 7 , 8 , 9 , 15 , 3 , 4 , 5 , 6 ,
292 7 , 8 , 9 , 8 , 9 , 12 , 3 , 4 , 5 , 6 ,
293 7 , 8 , 9 , 5 , 6 , 7 , 8 , 9 , 6 , 7 ,
298 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
299 #line 3 "/usr/share/bison.simple"
300 /* This file comes from bison-1.28. */
302 /* Skeleton output parser for bison,
303 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
305 This program is free software; you can redistribute it and/or modify
306 it under the terms of the GNU General Public License as published by
307 the Free Software Foundation; either version 2, or (at your option)
310 This program is distributed in the hope that it will be useful,
311 but WITHOUT ANY WARRANTY; without even the implied warranty of
312 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
313 GNU General Public License for more details.
315 You should have received a copy of the GNU General Public License
316 along with this program; if not, write to the Free Software
317 Foundation, Inc., 59 Temple Place - Suite 330,
318 Boston, MA 02111-1307, USA. */
320 /* As a special exception, when this file is copied by Bison into a
321 Bison output file, you may use that output file without restriction.
322 This special exception was added by the Free Software Foundation
323 in version 1.24 of Bison. */
325 /* This is the parser code that is written into each bison parser
326 when the %semantic_parser declaration is not specified in the grammar.
327 It was written by Richard Stallman by simplifying the hairy parser
328 used when %semantic_parser is specified. */
330 #ifndef YYPARSE_RETURN_TYPE
331 #define YYPARSE_RETURN_TYPE int
335 #ifndef YYSTACK_USE_ALLOCA
337 #define YYSTACK_USE_ALLOCA
338 #else /* alloca not defined */
340 #define YYSTACK_USE_ALLOCA
341 #define alloca __builtin_alloca
342 #else /* not GNU C. */
343 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
344 #define YYSTACK_USE_ALLOCA
346 #else /* not sparc */
347 /* We think this test detects Watcom and Microsoft C. */
348 /* This used to test MSDOS, but that is a bad idea
349 since that symbol is in the user namespace. */
350 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
351 #if 0 /* No need for malloc.h, which pollutes the namespace;
352 instead, just don't use alloca. */
355 #else /* not MSDOS, or __TURBOC__ */
357 /* I don't know what this was needed for, but it pollutes the namespace.
358 So I turned it off. rms, 2 May 1997. */
359 /* #include <malloc.h> */
361 #define YYSTACK_USE_ALLOCA
362 #else /* not MSDOS, or __TURBOC__, or _AIX */
364 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
365 and on HPUX 10. Eventually we can turn this on. */
366 #define YYSTACK_USE_ALLOCA
367 #define alloca __builtin_alloca
370 #endif /* not _AIX */
371 #endif /* not MSDOS, or __TURBOC__ */
372 #endif /* not sparc */
373 #endif /* not GNU C */
374 #endif /* alloca not defined */
375 #endif /* YYSTACK_USE_ALLOCA not defined */
377 #ifdef YYSTACK_USE_ALLOCA
378 #define YYSTACK_ALLOC alloca
380 #define YYSTACK_ALLOC malloc
383 /* Note: there must be only one dollar sign in this file.
384 It is replaced by the list of actions, each action
385 as one case of the switch. */
387 #define yyerrok (yyerrstatus = 0)
388 #define yyclearin (yychar = YYEMPTY)
391 #define YYACCEPT goto yyacceptlab
392 #define YYABORT goto yyabortlab
393 #define YYERROR goto yyerrlab1
394 /* Like YYERROR except do call yyerror.
395 This remains here temporarily to ease the
396 transition to the new meaning of YYERROR, for GCC.
397 Once GCC version 2 has supplanted version 1, this can go. */
398 #define YYFAIL goto yyerrlab
399 #define YYRECOVERING() (!!yyerrstatus)
400 #define YYBACKUP(token, value) \
402 if (yychar == YYEMPTY && yylen == 1) \
403 { yychar = (token), yylval = (value); \
404 yychar1 = YYTRANSLATE (yychar); \
409 { yyerror ( "syntax error: cannot back up" ); YYERROR; } \
413 #define YYERRCODE 256
416 #define YYLEX yylex()
422 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
424 #define YYLEX yylex(&yylval, &yylloc)
426 #else /* not YYLSP_NEEDED */
428 #define YYLEX yylex(&yylval, YYLEX_PARAM)
430 #define YYLEX yylex(&yylval)
432 #endif /* not YYLSP_NEEDED */
435 /* If nonreentrant, generate the variables here */
439 int yychar
; /* the lookahead symbol */
440 YYSTYPE yylval
; /* the semantic value of the */
441 /* lookahead symbol */
444 YYLTYPE yylloc
; /* location data for the lookahead */
448 int yynerrs
; /* number of parse errors so far */
449 #endif /* not YYPURE */
452 int yydebug
; /* nonzero means print parse trace */
453 /* Since this is uninitialized, it does not stop multiple parsers
457 /* YYINITDEPTH indicates the initial size of the parser's stacks */
460 #define YYINITDEPTH 200
463 /* YYMAXDEPTH is the maximum size the stacks can grow to
464 (effective only if the built-in stack extension method is used). */
471 #define YYMAXDEPTH 10000
474 /* Define __yy_memcpy. Note that the size argument
475 should be passed with type unsigned int, because that is what the non-GCC
476 definitions require. With GCC, __builtin_memcpy takes an arg
477 of type size_t, but it can handle unsigned int. */
479 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
480 #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT)
481 #else /* not GNU C or C++ */
484 /* This is the most reliable way to avoid incompatibilities
485 in available built-in functions on various systems. */
487 __yy_memcpy ( to
, from
, count
)
492 register char * f
= from
;
493 register char * t
= to
;
494 register int i
= count
;
500 #else /* __cplusplus */
502 /* This is the most reliable way to avoid incompatibilities
503 in available built-in functions on various systems. */
505 __yy_memcpy ( char * to
, char * from
, unsigned int count
)
507 register char * t
= to
;
508 register char * f
= from
;
509 register int i
= count
;
518 #line 222 "/usr/share/bison.simple"
520 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
521 into yyparse. The argument should have type void *.
522 It should actually point to an object.
523 Grammar actions can access the variable by casting it
524 to the proper pointer type. */
528 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
529 #define YYPARSE_PARAM_DECL
530 #else /* not __cplusplus */
531 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
532 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
533 #endif /* not __cplusplus */
534 #else /* not YYPARSE_PARAM */
535 #define YYPARSE_PARAM_ARG
536 #define YYPARSE_PARAM_DECL
537 #endif /* not YYPARSE_PARAM */
539 /* Prevent warning if -Wstrict-prototypes. */
551 yyparse ( YYPARSE_PARAM_ARG
)
554 register int yystate
;
556 register short * yyssp
;
557 register YYSTYPE
* yyvsp
;
558 int yyerrstatus
; /* number of tokens to shift before error messages enabled */
559 int yychar1
= 0 ; /* lookahead token as an internal (translated) token number */
561 short yyssa
[ YYINITDEPTH
]; /* the state stack */
562 YYSTYPE yyvsa
[ YYINITDEPTH
]; /* the semantic value stack */
564 short * yyss
= yyssa
; /* refer to the stacks thru separate pointers */
565 YYSTYPE
* yyvs
= yyvsa
; /* to allow yyoverflow to reallocate them elsewhere */
568 YYLTYPE yylsa
[ YYINITDEPTH
]; /* the location stack */
569 YYLTYPE
* yyls
= yylsa
;
572 #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
574 #define YYPOPSTACK (yyvsp--, yyssp--)
577 int yystacksize
= YYINITDEPTH
;
578 #ifndef YYSTACK_USE_ALLOCA
579 int yyfree_stacks
= 0 ;
591 YYSTYPE yyval
; /* the variable used to return */
592 /* semantic values from the action */
599 fprintf ( stderr
, "Starting parse \n " );
605 yychar
= YYEMPTY
; /* Cause a token to be read. */
607 /* Initialize stack pointers.
608 Waste one element of value and location stack
609 so that they stay on the same level as the state stack.
610 The wasted elements are never initialized. */
618 /* Push a new state, which is found in yystate . */
619 /* In all cases, when you get here, the value and location stacks
620 have just been pushed. so pushing a state here evens the stacks. */
625 if ( yyssp
>= yyss
+ yystacksize
- 1 )
627 /* Give user a chance to reallocate the stack */
628 /* Use copies of these so that the &'s don't force the real ones into memory. */
629 YYSTYPE
* yyvs1
= yyvs
;
632 YYLTYPE
* yyls1
= yyls
;
635 /* Get the current used size of the three stacks, in elements. */
636 int size
= yyssp
- yyss
+ 1 ;
639 /* Each stack pointer address is followed by the size of
640 the data in use in that stack, in bytes. */
642 /* This used to be a conditional around just the two extra args,
643 but that might be undefined if yyoverflow is a macro. */
644 yyoverflow ( "parser stack overflow" ,
645 & yyss1
, size
* sizeof (* yyssp
),
646 & yyvs1
, size
* sizeof (* yyvsp
),
647 & yyls1
, size
* sizeof (* yylsp
),
650 yyoverflow ( "parser stack overflow" ,
651 & yyss1
, size
* sizeof (* yyssp
),
652 & yyvs1
, size
* sizeof (* yyvsp
),
656 yyss
= yyss1
; yyvs
= yyvs1
;
660 #else /* no yyoverflow */
661 /* Extend the stack our own way. */
662 if ( yystacksize
>= YYMAXDEPTH
)
664 yyerror ( "parser stack overflow" );
665 #ifndef YYSTACK_USE_ALLOCA
678 if ( yystacksize
> YYMAXDEPTH
)
679 yystacksize
= YYMAXDEPTH
;
680 #ifndef YYSTACK_USE_ALLOCA
683 yyss
= ( short *) YYSTACK_ALLOC ( yystacksize
* sizeof (* yyssp
));
684 __yy_memcpy (( char *) yyss
, ( char *) yyss1
,
685 size
* ( unsigned int ) sizeof (* yyssp
));
686 yyvs
= ( YYSTYPE
*) YYSTACK_ALLOC ( yystacksize
* sizeof (* yyvsp
));
687 __yy_memcpy (( char *) yyvs
, ( char *) yyvs1
,
688 size
* ( unsigned int ) sizeof (* yyvsp
));
690 yyls
= ( YYLTYPE
*) YYSTACK_ALLOC ( yystacksize
* sizeof (* yylsp
));
691 __yy_memcpy (( char *) yyls
, ( char *) yyls1
,
692 size
* ( unsigned int ) sizeof (* yylsp
));
694 #endif /* no yyoverflow */
696 yyssp
= yyss
+ size
- 1 ;
697 yyvsp
= yyvs
+ size
- 1 ;
699 yylsp
= yyls
+ size
- 1 ;
704 fprintf ( stderr
, "Stack size increased to %d \n " , yystacksize
);
707 if ( yyssp
>= yyss
+ yystacksize
- 1 )
713 fprintf ( stderr
, "Entering state %d \n " , yystate
);
719 /* Do appropriate processing given the current state. */
720 /* Read a lookahead token if we need one and don't already have one. */
723 /* First try to decide what to do without reference to lookahead token. */
725 yyn
= yypact
[ yystate
];
729 /* Not known => get a lookahead token if don't already have one. */
731 /* yychar is either YYEMPTY or YYEOF
732 or a valid token in external form. */
734 if ( yychar
== YYEMPTY
)
738 fprintf ( stderr
, "Reading a token: " );
743 /* Convert token to internal form (in yychar1) for indexing tables with */
745 if ( yychar
<= 0 ) /* This means end of input. */
748 yychar
= YYEOF
; /* Don't call YYLEX any more */
752 fprintf ( stderr
, "Now at end of input. \n " );
757 yychar1
= YYTRANSLATE ( yychar
);
762 fprintf ( stderr
, "Next token is %d (%s" , yychar
, yytname
[ yychar1
]);
763 /* Give the individual parser a way to print the precise meaning
764 of a token, for further debugging info. */
766 YYPRINT ( stderr
, yychar
, yylval
);
768 fprintf ( stderr
, ") \n " );
774 if ( yyn
< 0 || yyn
> YYLAST
|| yycheck
[ yyn
] != yychar1
)
779 /* yyn is what to do for this token type in this state.
780 Negative => reduce, -yyn is rule number.
781 Positive => shift, yyn is new state.
782 New state is final state => don't bother to shift,
784 0, or most negative number => error. */
799 /* Shift the lookahead token. */
803 fprintf ( stderr
, "Shifting token %d (%s), " , yychar
, yytname
[ yychar1
]);
806 /* Discard the token being shifted unless it is eof. */
815 /* count tokens shifted since error; after three, turn off error status. */
816 if ( yyerrstatus
) yyerrstatus
--;
821 /* Do the default action for the current state. */
824 yyn
= yydefact
[ yystate
];
828 /* Do a reduction. yyn is the number of a rule to reduce with. */
832 yyval
= yyvsp
[ 1 - yylen
]; /* implement default value of the action */
839 fprintf ( stderr
, "Reducing via rule %d (line %d), " ,
842 /* Print the symbols being reduced, and their result. */
843 for ( i
= yyprhs
[ yyn
]; yyrhs
[ i
] > 0 ; i
++)
844 fprintf ( stderr
, "%s " , yytname
[ yyrhs
[ i
]]);
845 fprintf ( stderr
, " -> %s \n " , yytname
[ yyr1
[ yyn
]]);
855 if ( yyvsp
[ 0 ]. exp
== NULL
)
857 (( struct parse_args
*) arg
)-> res
= yyvsp
[ 0 ]. exp
;
863 yyval
. exp
= new_exp_3 ( qmop
, yyvsp
[- 4 ]. exp
, yyvsp
[- 2 ]. exp
, yyvsp
[ 0 ]. exp
);
869 yyval
. exp
= new_exp_2 ( lor
, yyvsp
[- 2 ]. exp
, yyvsp
[ 0 ]. exp
);
875 yyval
. exp
= new_exp_2 ( land
, yyvsp
[- 2 ]. exp
, yyvsp
[ 0 ]. exp
);
881 yyval
. exp
= new_exp_2 ( yyvsp
[- 1 ]. op
, yyvsp
[- 2 ]. exp
, yyvsp
[ 0 ]. exp
);
887 yyval
. exp
= new_exp_2 ( yyvsp
[- 1 ]. op
, yyvsp
[- 2 ]. exp
, yyvsp
[ 0 ]. exp
);
893 yyval
. exp
= new_exp_2 ( yyvsp
[- 1 ]. op
, yyvsp
[- 2 ]. exp
, yyvsp
[ 0 ]. exp
);
899 yyval
. exp
= new_exp_2 ( yyvsp
[- 1 ]. op
, yyvsp
[- 2 ]. exp
, yyvsp
[ 0 ]. exp
);
905 yyval
. exp
= new_exp_1 ( lnot
, yyvsp
[ 0 ]. exp
);
911 yyval
. exp
= new_exp_0 ( var
);
917 if (( yyval
. exp
= new_exp_0 ( num
)) != NULL
)
918 yyval
. exp
-> val
. num
= yyvsp
[ 0 ]. num
;
924 yyval
. exp
= yyvsp
[- 1 ]. exp
;
928 /* the action file gets copied in in place of this dollarsign */
929 #line 554 "/usr/share/bison.simple"
940 short * ssp1
= yyss
- 1 ;
941 fprintf ( stderr
, "state stack now" );
942 while ( ssp1
!= yyssp
)
943 fprintf ( stderr
, " %d" , *++ ssp1
);
944 fprintf ( stderr
, " \n " );
954 yylsp
-> first_line
= yylloc
. first_line
;
955 yylsp
-> first_column
= yylloc
. first_column
;
956 yylsp
-> last_line
= ( yylsp
- 1 )-> last_line
;
957 yylsp
-> last_column
= ( yylsp
- 1 )-> last_column
;
962 yylsp
-> last_line
= ( yylsp
+ yylen
- 1 )-> last_line
;
963 yylsp
-> last_column
= ( yylsp
+ yylen
- 1 )-> last_column
;
967 /* Now "shift" the result of the reduction.
968 Determine what state that goes to,
969 based on the state we popped back to
970 and the rule number reduced by. */
974 yystate
= yypgoto
[ yyn
- YYNTBASE
] + * yyssp
;
975 if ( yystate
>= 0 && yystate
<= YYLAST
&& yycheck
[ yystate
] == * yyssp
)
976 yystate
= yytable
[ yystate
];
978 yystate
= yydefgoto
[ yyn
- YYNTBASE
];
982 yyerrlab
: /* here on detecting error */
985 /* If not already recovering from an error, report this error. */
989 #ifdef YYERROR_VERBOSE
990 yyn
= yypact
[ yystate
];
992 if ( yyn
> YYFLAG
&& yyn
< YYLAST
)
999 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1000 for ( x
= ( yyn
< 0 ? - yyn
: 0 );
1001 x
< ( sizeof ( yytname
) / sizeof ( char *)); x
++)
1002 if ( yycheck
[ x
+ yyn
] == x
)
1003 size
+= strlen ( yytname
[ x
]) + 15 , count
++;
1004 msg
= ( char *) malloc ( size
+ 15 );
1007 strcpy ( msg
, "parse error" );
1012 for ( x
= ( yyn
< 0 ? - yyn
: 0 );
1013 x
< ( sizeof ( yytname
) / sizeof ( char *)); x
++)
1014 if ( yycheck
[ x
+ yyn
] == x
)
1016 strcat ( msg
, count
== 0 ? ", expecting `" : " or `" );
1017 strcat ( msg
, yytname
[ x
]);
1026 yyerror ( "parse error; also virtual memory exceeded" );
1029 #endif /* YYERROR_VERBOSE */
1030 yyerror ( "parse error" );
1034 yyerrlab1
: /* here on error raised explicitly by an action */
1036 if ( yyerrstatus
== 3 )
1038 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1040 /* return failure if at end of input */
1041 if ( yychar
== YYEOF
)
1046 fprintf ( stderr
, "Discarding token %d (%s). \n " , yychar
, yytname
[ yychar1
]);
1052 /* Else will try to reuse lookahead token
1053 after shifting the error token. */
1055 yyerrstatus
= 3 ; /* Each real token shifted decrements this */
1059 yyerrdefault
: /* current state does not do anything special for the error token. */
1062 /* This is wrong; only states that explicitly want error tokens
1063 should shift them. */
1064 yyn
= yydefact
[ yystate
]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1065 if ( yyn
) goto yydefault
;
1068 yyerrpop
: /* pop the current state because it cannot handle the error token */
1070 if ( yyssp
== yyss
) YYABORT
;
1080 short * ssp1
= yyss
- 1 ;
1081 fprintf ( stderr
, "Error: state stack now" );
1082 while ( ssp1
!= yyssp
)
1083 fprintf ( stderr
, " %d" , *++ ssp1
);
1084 fprintf ( stderr
, " \n " );
1090 yyn
= yypact
[ yystate
];
1095 if ( yyn
< 0 || yyn
> YYLAST
|| yycheck
[ yyn
] != YYTERROR
)
1114 fprintf ( stderr
, "Shifting error token, " );
1126 /* YYACCEPT comes here. */
1127 #ifndef YYSTACK_USE_ALLOCA
1140 /* YYABORT comes here. */
1141 #ifndef YYSTACK_USE_ALLOCA
1153 #line 226 "plural.y"
1158 FREE_EXPRESSION ( exp
)
1159 struct expression
* exp
;
1164 /* Handle the recursive case. */
1168 FREE_EXPRESSION ( exp
-> val
. args
[ 2 ]);
1171 FREE_EXPRESSION ( exp
-> val
. args
[ 1 ]);
1174 FREE_EXPRESSION ( exp
-> val
. args
[ 0 ]);
1189 const char * exp
= * pexp
;
1200 if ( exp
[ 0 ] != ' ' && exp
[ 0 ] != ' \t ' )
1209 case '0' : case '1' : case '2' : case '3' : case '4' :
1210 case '5' : case '6' : case '7' : case '8' : case '9' :
1212 unsigned long int n
= result
- '0' ;
1213 while ( exp
[ 0 ] >= '0' && exp
[ 0 ] <= '9' )
1239 lval
-> op
= not_equal
;
1246 if ( exp
[ 0 ] == result
)
1256 lval
-> op
= less_or_equal
;
1259 lval
-> op
= less_than
;
1267 lval
-> op
= greater_or_equal
;
1270 lval
-> op
= greater_than
;
1304 /* Nothing, just return the character. */
1310 /* Be safe and let the user call this function again. */
1333 /* Do nothing. We don't print error messages here. */
This page took 0.090931 seconds and 5 git commands to generate.