]> git.saurik.com Git - bison.git/blame - tests/existing.at
* data/c.m4 (b4_c_modern): New macro, with a new provision for _MSC_VER.
[bison.git] / tests / existing.at
CommitLineData
817e9f41 1# Exercising Bison on actual grammars. -*- Autotest -*-
2740f169 2
affac613 3# Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004, 2005
2740f169 4# Free Software Foundation, Inc.
817e9f41
AD
5
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 2, or (at your option)
9# any later version.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15
16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
0fb669f9
PE
18# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19# 02110-1301, USA.
817e9f41
AD
20
21AT_BANNER([[Existing Grammars.]])
22## ----------------- ##
23## GNU AWK Grammar. ##
24## ----------------- ##
25
26AT_SETUP([GNU AWK Grammar])
27
28# We have been careful to strip all the actions excepts the
29# mid-rule actions. We rely on %expect to check that there are
30# indeed 65 SR conflicts.
31#
32# Bison was once wrong, due to an incorrect computation of nullable.
33# It reported 485 SR conflicts!
34
35AT_DATA([[input.y]],
36[[%expect 65
37
38%token FUNC_CALL NAME REGEXP
39%token ERROR
40%token YNUMBER YSTRING
41%token RELOP APPEND_OP
42%token ASSIGNOP MATCHOP NEWLINE CONCAT_OP
43%token LEX_BEGIN LEX_END LEX_IF LEX_ELSE LEX_RETURN LEX_DELETE
44%token LEX_WHILE LEX_DO LEX_FOR LEX_BREAK LEX_CONTINUE
45%token LEX_PRINT LEX_PRINTF LEX_NEXT LEX_EXIT LEX_FUNCTION
46%token LEX_GETLINE LEX_NEXTFILE
47%token LEX_IN
48%token LEX_AND LEX_OR INCREMENT DECREMENT
49%token LEX_BUILTIN LEX_LENGTH
50
51/* Lowest to highest */
52%right ASSIGNOP
53%right '?' ':'
54%left LEX_OR
55%left LEX_AND
56%left LEX_GETLINE
57%nonassoc LEX_IN
58%left FUNC_CALL LEX_BUILTIN LEX_LENGTH
59%nonassoc ','
60%nonassoc MATCHOP
61%nonassoc RELOP '<' '>' '|' APPEND_OP TWOWAYIO
62%left CONCAT_OP
63%left YSTRING YNUMBER
64%left '+' '-'
65%left '*' '/' '%'
66%right '!' UNARY
67%right '^'
68%left INCREMENT DECREMENT
69%left '$'
70%left '(' ')'
71%%
72
73start
74 : opt_nls program opt_nls
75 ;
76
77program
78 : rule
79 | program rule
80 | error
81 | program error
82 | /* empty */
83 ;
84
85rule
86 : LEX_BEGIN {} action
87 | LEX_END {} action
88 | LEX_BEGIN statement_term
89 | LEX_END statement_term
90 | pattern action
91 | action
92 | pattern statement_term
93 | function_prologue function_body
94 ;
95
96func_name
97 : NAME
98 | FUNC_CALL
99 | lex_builtin
100 ;
101
102lex_builtin
103 : LEX_BUILTIN
104 | LEX_LENGTH
105 ;
106
107function_prologue
108 : LEX_FUNCTION {} func_name '(' opt_param_list r_paren opt_nls
109 ;
110
111function_body
112 : l_brace statements r_brace opt_semi opt_nls
113 | l_brace r_brace opt_semi opt_nls
114 ;
115
817e9f41
AD
116pattern
117 : exp
118 | exp ',' exp
119 ;
120
121regexp
122 /*
123 * In this rule, want_regexp tells yylex that the next thing
124 * is a regexp so it should read up to the closing slash.
125 */
126 : '/' {} REGEXP '/'
127 ;
128
129action
130 : l_brace statements r_brace opt_semi opt_nls
131 | l_brace r_brace opt_semi opt_nls
132 ;
133
134statements
135 : statement
136 | statements statement
137 | error
138 | statements error
139 ;
140
141statement_term
142 : nls
143 | semi opt_nls
144 ;
145
146statement
147 : semi opt_nls
148 | l_brace r_brace
149 | l_brace statements r_brace
150 | if_statement
151 | LEX_WHILE '(' exp r_paren opt_nls statement
152 | LEX_DO opt_nls statement LEX_WHILE '(' exp r_paren opt_nls
153 | LEX_FOR '(' NAME LEX_IN NAME r_paren opt_nls statement
154 | LEX_FOR '(' opt_exp semi opt_nls exp semi opt_nls opt_exp r_paren opt_nls statement
155 | LEX_FOR '(' opt_exp semi opt_nls semi opt_nls opt_exp r_paren opt_nls statement
156 | LEX_BREAK statement_term
157 | LEX_CONTINUE statement_term
158 | print '(' expression_list r_paren output_redir statement_term
159 | print opt_rexpression_list output_redir statement_term
160 | LEX_NEXT statement_term
161 | LEX_NEXTFILE statement_term
162 | LEX_EXIT opt_exp statement_term
163 | LEX_RETURN {} opt_exp statement_term
164 | LEX_DELETE NAME '[' expression_list ']' statement_term
165 | LEX_DELETE NAME statement_term
166 | exp statement_term
167 ;
168
169print
170 : LEX_PRINT
171 | LEX_PRINTF
172 ;
173
174if_statement
175 : LEX_IF '(' exp r_paren opt_nls statement
176 | LEX_IF '(' exp r_paren opt_nls statement
177 LEX_ELSE opt_nls statement
178 ;
179
180nls
181 : NEWLINE
182 | nls NEWLINE
183 ;
184
185opt_nls
186 : /* empty */
187 | nls
188 ;
189
190input_redir
191 : /* empty */
192 | '<' simp_exp
193 ;
194
195output_redir
196 : /* empty */
197 | '>' exp
198 | APPEND_OP exp
199 | '|' exp
200 | TWOWAYIO exp
201 ;
202
203opt_param_list
204 : /* empty */
205 | param_list
206 ;
207
208param_list
209 : NAME
210 | param_list comma NAME
211 | error
212 | param_list error
213 | param_list comma error
214 ;
215
216/* optional expression, as in for loop */
217opt_exp
218 : /* empty */
219 | exp
220 ;
221
222opt_rexpression_list
223 : /* empty */
224 | rexpression_list
225 ;
226
227rexpression_list
228 : rexp
229 | rexpression_list comma rexp
230 | error
231 | rexpression_list error
232 | rexpression_list error rexp
233 | rexpression_list comma error
234 ;
235
236opt_expression_list
237 : /* empty */
238 | expression_list
239 ;
240
241expression_list
242 : exp
243 | expression_list comma exp
244 | error
245 | expression_list error
246 | expression_list error exp
247 | expression_list comma error
248 ;
249
250/* Expressions, not including the comma operator. */
251exp : variable ASSIGNOP {} exp
252 | '(' expression_list r_paren LEX_IN NAME
253 | exp '|' LEX_GETLINE opt_variable
254 | exp TWOWAYIO LEX_GETLINE opt_variable
255 | LEX_GETLINE opt_variable input_redir
256 | exp LEX_AND exp
257 | exp LEX_OR exp
258 | exp MATCHOP exp
259 | regexp
260 | '!' regexp %prec UNARY
261 | exp LEX_IN NAME
262 | exp RELOP exp
263 | exp '<' exp
264 | exp '>' exp
265 | exp '?' exp ':' exp
266 | simp_exp
267 | exp simp_exp %prec CONCAT_OP
268 ;
269
270rexp
271 : variable ASSIGNOP {} rexp
272 | rexp LEX_AND rexp
273 | rexp LEX_OR rexp
274 | LEX_GETLINE opt_variable input_redir
275 | regexp
276 | '!' regexp %prec UNARY
277 | rexp MATCHOP rexp
278 | rexp LEX_IN NAME
279 | rexp RELOP rexp
280 | rexp '?' rexp ':' rexp
281 | simp_exp
282 | rexp simp_exp %prec CONCAT_OP
283 ;
284
285simp_exp
286 : non_post_simp_exp
287 /* Binary operators in order of decreasing precedence. */
288 | simp_exp '^' simp_exp
289 | simp_exp '*' simp_exp
290 | simp_exp '/' simp_exp
291 | simp_exp '%' simp_exp
292 | simp_exp '+' simp_exp
293 | simp_exp '-' simp_exp
294 | variable INCREMENT
295 | variable DECREMENT
296 ;
297
298non_post_simp_exp
299 : '!' simp_exp %prec UNARY
300 | '(' exp r_paren
301 | LEX_BUILTIN
302 '(' opt_expression_list r_paren
303 | LEX_LENGTH '(' opt_expression_list r_paren
304 | LEX_LENGTH
305 | FUNC_CALL '(' opt_expression_list r_paren
306 | variable
307 | INCREMENT variable
308 | DECREMENT variable
309 | YNUMBER
310 | YSTRING
311 | '-' simp_exp %prec UNARY
312 | '+' simp_exp %prec UNARY
313 ;
314
315opt_variable
316 : /* empty */
317 | variable
318 ;
319
320variable
321 : NAME
322 | NAME '[' expression_list ']'
323 | '$' non_post_simp_exp
324 ;
325
326l_brace
affac613
AD
327 : '{' opt_nls
328 ;
817e9f41
AD
329
330r_brace
affac613 331 : '}' opt_nls
817e9f41
AD
332 ;
333
334r_paren
335 : ')'
336 ;
337
338opt_semi
339 : /* empty */
340 | semi
341 ;
342
343semi
344 : ';'
345 ;
346
347comma : ',' opt_nls
348 ;
349
350%%
351]])
352
353# Pass plenty of options, to exercise plenty of code, even if we
354# don't actually check the output. But SEGV is watching us, and
355# so might do dmalloc.
356AT_CHECK([[bison --verbose --defines input.y]])
357
358AT_CLEANUP
359
817e9f41
AD
360## ----------------- ##
361## GNU Cim Grammar. ##
362## ----------------- ##
363
364AT_SETUP([GNU Cim Grammar])
365
366# GNU Cim, the GNU Simula 87 Compiler.
367
368# Bison was once wrong, due to an incorrect computation of the RR conflicts.
369# It reported 80 SR && 99 RR conflicts instead of 78/10!!!
370
371AT_DATA([[input.y]],
affac613 372[[%union {}
817e9f41
AD
373
374%token
375 HACTIVATE HAFTER /*HAND*/ HARRAY HAT
376 HBEFORE HBEGIN HBOOLEAN
377 HCHARACTER HCLASS /*HCOMMENT*/ HCONC
378 HDELAY HDO
379 HELSE HEND HEQ /*HEQV*/ HEXTERNAL
380 HFOR
381 HGE HGO HGOTO HGT
382 HHIDDEN
383 HIF /*HIMP*/ HIN HINNER HINSPECT HINTEGER HIS
384 HLABEL HLE HLONG HLT
385 HNAME HNE HNEW HNONE /*HNOT*/ HNOTEXT
386 /*HOR*/ HOTHERWISE
387 HPRIOR HPROCEDURE HPROTECTED
388 HQUA
389 HREACTIVATE HREAL HREF
390 HSHORT HSTEP HSWITCH
391 HTEXT HTHEN HTHIS HTO
392 HUNTIL
393 HVALUE HVAR HVIRTUAL
394 HWHEN HWHILE
395
396 HASSIGNVALUE HASSIGNREF
397 /*HDOT*/ HPAREXPSEPARATOR HLABELSEPARATOR HSTATEMENTSEPARATOR
398 HBEGPAR HENDPAR
399 HEQR HNER
400 HADD HSUB HMUL HDIV HINTDIV HEXP
04098407 401 HDOTDOTDOT
817e9f41 402
affac613
AD
403%token HIDENTIFIER
404%token HBOOLEANKONST HINTEGERKONST HCHARACTERKONST
405%token HREALKONST
406%token HTEXTKONST
817e9f41 407
817e9f41 408
affac613 409%right HASSIGN
817e9f41
AD
410%left HORELSE
411%left HANDTHEN
412%left HEQV
413%left HIMP
414%left HOR
415%left HAND
416
417%left HNOT
418
affac613 419%left HVALRELOPERATOR HREFRELOPERATOR HOBJRELOPERATOR
817e9f41
AD
420
421%left HCONC
422
affac613
AD
423%left HTERMOPERATOR
424%left UNEAR
425%left HFACTOROPERATOR
817e9f41
AD
426%left HPRIMARYOPERATOR
427
428%left HQUA
429
430%left HDOT
431
432%start MAIN_MODULE
433%%
434/* GRAMATIKK FOR PROGRAM MODULES */
affac613
AD
435MAIN_MODULE : {}
436 MODULS
04098407 437 | error HSTATEMENTSEPARATOR MBEE_DECLSTMS
817e9f41
AD
438 ;
439EXT_DECLARATION : HEXTERNAL
440 MBEE_TYPE
441 HPROCEDURE
affac613 442 {}
817e9f41
AD
443 EXT_LIST
444 |
445 HEXTERNAL
446 HIDENTIFIER
447 HPROCEDURE
affac613
AD
448 {}
449 HIDENTIFIER {}
817e9f41 450 EXTERNAL_KIND_ITEM
817e9f41
AD
451 | HEXTERNAL
452 HCLASS
affac613 453 {}
817e9f41
AD
454 EXT_LIST
455
456 ;
457EXTERNAL_KIND_ITEM: EXT_IDENT
458 HOBJRELOPERATOR
affac613 459 {}
817e9f41
AD
460 MBEE_TYPE HPROCEDURE
461 HIDENTIFIER
affac613 462 {}
817e9f41 463 HEADING EMPTY_BLOCK
affac613 464 {}
817e9f41
AD
465/* |
466 EXT_IDENT
affac613 467 {}
817e9f41 468 MBEE_REST_EXT_LIST
817e9f41
AD
469 ;
470MBEE_REST_EXT_LIST: /* EMPTY
471 | HPAREXPSEPARATOR EXT_KIND_LIST
472 ;
473EXT_KIND_LIST : EXT_KIND_ITEM
474 | EXT_KIND_LIST HPAREXPSEPARATOR EXT_KIND_ITEM
475 ;
476EXT_KIND_ITEM : HIDENTIFIER
477 EXT_IDENT
affac613 478 {}*/
817e9f41
AD
479 ;
480EMPTY_BLOCK : /*EMPT*/
481 | HBEGIN HEND
482 ;
483EXT_LIST : EXT_ITEM
484 | EXT_LIST HPAREXPSEPARATOR EXT_ITEM
485 ;
486EXT_ITEM : HIDENTIFIER
487 EXT_IDENT
817e9f41 488 ;
affac613
AD
489EXT_IDENT : /* EMPTY */
490 | HVALRELOPERATOR {}
491 HTEXTKONST
817e9f41
AD
492 ;
493/* GRAMATIKK FOR TYPER */
affac613 494NO_TYPE : /*EMPT*/
817e9f41
AD
495 ;
496MBEE_TYPE : NO_TYPE
497 | TYPE
498 ;
499TYPE : HREF HBEGPAR
500 HIDENTIFIER
affac613 501 {}
817e9f41 502 HENDPAR
affac613
AD
503 | HTEXT
504 | HBOOLEAN
505 | HCHARACTER
506 | HSHORT HINTEGER
507 | HINTEGER
508 | HREAL
509 | HLONG HREAL
817e9f41
AD
510 ;
511
512/* GRAMATIKK FOR DEL AV SETNINGER */
513MBEE_ELSE_PART : /*EMPT*/
514/* | HELSE
515 HIF
516 EXPRESSION
affac613
AD
517 HTHEN {}
518 BLOCK {}
519 MBEE_ELSE_PART {}*/
520 | HELSE {}
521 BLOCK
817e9f41 522 ;
affac613 523FOR_LIST : FOR_LIST_ELEMENT
817e9f41
AD
524 | FOR_LIST_ELEMENT
525 HPAREXPSEPARATOR
affac613 526 FOR_LIST
817e9f41
AD
527 ;
528FOR_LIST_ELEMENT: EXPRESSION
529 MBEE_F_L_EL_R_PT
530 ;
531MBEE_F_L_EL_R_PT: /*EMPT*/
532 | HWHILE
affac613 533 EXPRESSION
817e9f41
AD
534 | HSTEP
535 EXPRESSION
536 HUNTIL
affac613 537 EXPRESSION
817e9f41
AD
538 ;
539GOTO : HGO
540 HTO
541 | HGOTO
542 ;
543CONN_STATE_R_PT : WHEN_CLAUSE_LIST
affac613
AD
544 | HDO {}
545 BLOCK
817e9f41
AD
546 ;
547WHEN_CLAUSE_LIST: HWHEN
548 HIDENTIFIER
affac613
AD
549 HDO {}
550 BLOCK
817e9f41
AD
551 | WHEN_CLAUSE_LIST
552 HWHEN
553 HIDENTIFIER
affac613
AD
554 HDO {}
555 BLOCK
817e9f41
AD
556 ;
557MBEE_OTWI_CLAUS : /*EMPT*/
affac613 558 | HOTHERWISE {}
817e9f41 559
affac613 560 BLOCK
817e9f41 561 ;
affac613
AD
562ACTIVATOR : HACTIVATE
563 | HREACTIVATE
817e9f41 564 ;
affac613
AD
565SCHEDULE : /*EMPT*/
566 | ATDELAY EXPRESSION {}
817e9f41 567 PRIOR
affac613
AD
568 | BEFOREAFTER {}
569 EXPRESSION
817e9f41 570 ;
affac613
AD
571ATDELAY : HAT
572 | HDELAY
817e9f41 573 ;
affac613
AD
574BEFOREAFTER : HBEFORE
575 | HAFTER
817e9f41 576 ;
affac613
AD
577PRIOR : /*EMPT*/
578 | HPRIOR
817e9f41
AD
579 ;
580/* GRAMATIKK FOR SETNINGER OG DEKLARASJONER */
581MODULSTATEMENT : HWHILE
582 EXPRESSION
affac613
AD
583 HDO {}
584 BLOCK
04098407 585 | HIF
817e9f41 586 EXPRESSION
affac613
AD
587 HTHEN {}
588 BLOCK {}
589 MBEE_ELSE_PART
817e9f41
AD
590 | HFOR
591 HIDENTIFIER
affac613 592 HASSIGN {}
817e9f41 593 FOR_LIST
affac613
AD
594 HDO {}
595 BLOCK
817e9f41 596 | GOTO
affac613 597 EXPRESSION
817e9f41 598 | HINSPECT
affac613 599 EXPRESSION {}
817e9f41 600 CONN_STATE_R_PT
affac613
AD
601 {}
602 MBEE_OTWI_CLAUS
603 | HINNER
817e9f41
AD
604 | HIDENTIFIER
605 HLABELSEPARATOR
affac613
AD
606 {}
607 DECLSTATEMENT
817e9f41
AD
608 | EXPRESSION_SIMP
609 HBEGIN
affac613 610 {}
817e9f41 611 IMPORT_SPEC_MODULE
affac613 612 {}
817e9f41 613 MBEE_DECLSTMS
affac613 614 HEND
817e9f41 615 | EXPRESSION_SIMP HBEGIN error HSTATEMENTSEPARATOR
affac613 616 MBEE_DECLSTMS HEND
817e9f41 617 | EXPRESSION_SIMP HBEGIN error HEND
817e9f41 618 | EXPRESSION_SIMP
817e9f41 619 | ACTIVATOR EXPRESSION SCHEDULE
817e9f41 620 | HBEGIN
affac613 621 {}
817e9f41 622 MBEE_DECLSTMS
affac613 623 HEND
817e9f41
AD
624 | MBEE_TYPE HPROCEDURE
625 HIDENTIFIER
affac613
AD
626 {}
627 HEADING BLOCK
817e9f41
AD
628 | HIDENTIFIER
629 HCLASS
630 NO_TYPE
affac613 631 {}
817e9f41
AD
632 IMPORT_SPEC_MODULE
633 HIDENTIFIER
affac613 634 {}
817e9f41 635 HEADING
affac613 636 BLOCK
817e9f41
AD
637 | HCLASS
638 NO_TYPE
639 HIDENTIFIER
affac613 640 {}
817e9f41 641 HEADING
affac613
AD
642 BLOCK
643 | EXT_DECLARATION
644 | /*EMPT*/
817e9f41 645 ;
affac613 646IMPORT_SPEC_MODULE:
817e9f41
AD
647 ;
648DECLSTATEMENT : MODULSTATEMENT
649 | TYPE
650 HIDENTIFIER
651 MBEE_CONSTANT
652 HPAREXPSEPARATOR
affac613
AD
653 {}
654 IDENTIFIER_LISTC
817e9f41
AD
655 | TYPE
656 HIDENTIFIER
657 MBEE_CONSTANT
817e9f41 658 | MBEE_TYPE
affac613
AD
659 HARRAY {}
660 ARR_SEGMENT_LIST
817e9f41
AD
661 | HSWITCH
662 HIDENTIFIER
affac613
AD
663 HASSIGN {}
664 SWITCH_LIST
817e9f41 665 ;
affac613 666BLOCK : DECLSTATEMENT
817e9f41
AD
667 | HBEGIN MBEE_DECLSTMS HEND
668 | HBEGIN error HSTATEMENTSEPARATOR MBEE_DECLSTMS HEND
669 | HBEGIN error HEND
670 ;
affac613 671MBEE_DECLSTMS : MBEE_DECLSTMSU
817e9f41 672 ;
affac613 673MBEE_DECLSTMSU : DECLSTATEMENT
817e9f41
AD
674 | MBEE_DECLSTMSU
675 HSTATEMENTSEPARATOR
affac613 676 DECLSTATEMENT
817e9f41 677 ;
affac613 678MODULS : MODULSTATEMENT
04098407 679 | MODULS HSTATEMENTSEPARATOR MODULSTATEMENT
817e9f41
AD
680 ;
681/* GRAMATIKK FOR DEL AV DEKLARASJONER */
682ARR_SEGMENT_LIST: ARR_SEGMENT
683 | ARR_SEGMENT_LIST
684 HPAREXPSEPARATOR
685 ARR_SEGMENT
686 ;
687ARR_SEGMENT : ARRAY_SEGMENT
688 HBEGPAR
affac613 689 BAUND_PAIR_LIST HENDPAR
817e9f41 690 ;
affac613 691ARRAY_SEGMENT : ARRAY_SEGMENT_EL {}
817e9f41
AD
692
693 | ARRAY_SEGMENT_EL
694 HPAREXPSEPARATOR
affac613 695 ARRAY_SEGMENT
817e9f41 696 ;
affac613 697ARRAY_SEGMENT_EL: HIDENTIFIER
817e9f41 698 ;
affac613 699BAUND_PAIR_LIST : BAUND_PAIR
817e9f41
AD
700 | BAUND_PAIR
701 HPAREXPSEPARATOR
affac613 702 BAUND_PAIR_LIST
817e9f41
AD
703 ;
704BAUND_PAIR : EXPRESSION
705 HLABELSEPARATOR
affac613 706 EXPRESSION
817e9f41 707 ;
affac613 708SWITCH_LIST : EXPRESSION
817e9f41
AD
709 | EXPRESSION
710 HPAREXPSEPARATOR
affac613 711 SWITCH_LIST
817e9f41 712 ;
affac613
AD
713HEADING : MBEE_FMAL_PAR_P HSTATEMENTSEPARATOR {}
714 MBEE_MODE_PART {}
715 MBEE_SPEC_PART {}
716 MBEE_PROT_PART {}
817e9f41 717 MBEE_VIRT_PART
817e9f41
AD
718 ;
719MBEE_FMAL_PAR_P : /*EMPT*/
720 | FMAL_PAR_PART
721 ;
722FMAL_PAR_PART : HBEGPAR NO_TYPE
723 MBEE_LISTV HENDPAR
724 ;
725MBEE_LISTV : /*EMPT*/
726 | LISTV
727 ;
affac613
AD
728LISTV : HIDENTIFIER
729 | FPP_CATEG HDOTDOTDOT
730 | HIDENTIFIER {}
731 HPAREXPSEPARATOR LISTV
817e9f41
AD
732 | FPP_SPEC
733 | FPP_SPEC
734 HPAREXPSEPARATOR LISTV
735 ;
736FPP_HEADING : HBEGPAR NO_TYPE
737 FPP_MBEE_LISTV HENDPAR
738 ;
739FPP_MBEE_LISTV : /*EMPT*/
740 | FPP_LISTV
741 ;
affac613 742FPP_LISTV : FPP_CATEG HDOTDOTDOT
817e9f41
AD
743 | FPP_SPEC
744 | FPP_SPEC
745 HPAREXPSEPARATOR LISTV
746 ;
747FPP_SPEC : FPP_CATEG SPECIFIER HIDENTIFIER
817e9f41
AD
748 | FPP_CATEG FPP_PROC_DECL_IN_SPEC
749 ;
750FPP_CATEG : HNAME HLABELSEPARATOR
817e9f41 751 | HVALUE HLABELSEPARATOR
817e9f41 752 | HVAR HLABELSEPARATOR
affac613 753 | /*EMPT*/
817e9f41
AD
754 ;
755FPP_PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE
756 HIDENTIFIER
affac613
AD
757 {}
758 FPP_HEADING {} { /* Yes, two "final" actions. */ }
817e9f41 759 ;
affac613
AD
760IDENTIFIER_LISTV: HIDENTIFIER
761 | HDOTDOTDOT
762 | HIDENTIFIER {}
763 HPAREXPSEPARATOR IDENTIFIER_LISTV
817e9f41
AD
764 ;
765MBEE_MODE_PART : /*EMPT*/
766 | MODE_PART
767 ;
768MODE_PART : NAME_PART
769 | VALUE_PART
770 | VAR_PART
771 | NAME_PART VALUE_PART
772 | VALUE_PART NAME_PART
773 | NAME_PART VAR_PART
774 | VAR_PART NAME_PART
775 | VALUE_PART VAR_PART
776 | VAR_PART VALUE_PART
777 | VAR_PART NAME_PART VALUE_PART
778 | NAME_PART VAR_PART VALUE_PART
779 | NAME_PART VALUE_PART VAR_PART
780 | VAR_PART VALUE_PART NAME_PART
781 | VALUE_PART VAR_PART NAME_PART
782 | VALUE_PART NAME_PART VAR_PART
783 ;
affac613 784NAME_PART : HNAME {}
817e9f41
AD
785 IDENTIFIER_LISTV
786 HSTATEMENTSEPARATOR
787 ;
affac613 788VAR_PART : HVAR {}
817e9f41
AD
789 IDENTIFIER_LISTV
790 HSTATEMENTSEPARATOR
791 ;
affac613 792VALUE_PART : HVALUE {}
817e9f41
AD
793 IDENTIFIER_LISTV HSTATEMENTSEPARATOR
794 ;
795MBEE_SPEC_PART : /*EMPT*/
796 | SPEC_PART
797 ;
798SPEC_PART : ONE_SPEC
799 | SPEC_PART ONE_SPEC
800 ;
801ONE_SPEC : SPECIFIER IDENTIFIER_LIST HSTATEMENTSEPARATOR
802 | NO_TYPE HPROCEDURE HIDENTIFIER HOBJRELOPERATOR
affac613 803 {}
817e9f41
AD
804 PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR
805 | FPP_PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR
806 | MBEE_TYPE HPROCEDURE HIDENTIFIER HSTATEMENTSEPARATOR
817e9f41
AD
807 | MBEE_TYPE HPROCEDURE HIDENTIFIER HPAREXPSEPARATOR
808 IDENTIFIER_LIST HSTATEMENTSEPARATOR
817e9f41 809 ;
affac613 810SPECIFIER : TYPE
817e9f41 811 | MBEE_TYPE
affac613
AD
812 HARRAY
813 | HLABEL
814 | HSWITCH
817e9f41
AD
815 ;
816PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE
817 HIDENTIFIER
affac613 818 {}
817e9f41 819 HEADING
affac613 820 {}
817e9f41 821 MBEE_BEGIN_END
817e9f41
AD
822 ;
823MBEE_BEGIN_END : /* EMPTY */
824 | HBEGIN HEND
825 ;
826MBEE_PROT_PART : /*EMPT*/
827 | PROTECTION_PART
828 ;
829PROTECTION_PART : PROT_SPECIFIER IDENTIFIER_LIST
830 HSTATEMENTSEPARATOR
831 | PROTECTION_PART PROT_SPECIFIER
832 IDENTIFIER_LIST HSTATEMENTSEPARATOR
833 ;
affac613
AD
834PROT_SPECIFIER : HHIDDEN
835 | HPROTECTED
817e9f41 836 | HHIDDEN
affac613 837 HPROTECTED
817e9f41 838 | HPROTECTED
affac613 839 HHIDDEN
817e9f41
AD
840 ;
841MBEE_VIRT_PART : /*EMPT*/
842 | VIRTUAL_PART
843 ;
844VIRTUAL_PART : HVIRTUAL
845 HLABELSEPARATOR
846 MBEE_SPEC_PART
847 ;
affac613 848IDENTIFIER_LIST : HIDENTIFIER
817e9f41 849 | IDENTIFIER_LIST HPAREXPSEPARATOR
affac613 850 HIDENTIFIER
817e9f41
AD
851 ;
852IDENTIFIER_LISTC: HIDENTIFIER
affac613 853 MBEE_CONSTANT
817e9f41
AD
854 | IDENTIFIER_LISTC HPAREXPSEPARATOR
855 HIDENTIFIER
affac613 856 MBEE_CONSTANT
817e9f41
AD
857 ;
858MBEE_CONSTANT : /* EMPTY */
859 | HVALRELOPERATOR
affac613
AD
860 {}
861 EXPRESSION
817e9f41
AD
862 ;
863
864/* GRAMATIKK FOR UTTRYKK */
affac613 865EXPRESSION : EXPRESSION_SIMP
817e9f41
AD
866 | HIF
867 EXPRESSION
868 HTHEN
869 EXPRESSION
870 HELSE
affac613 871 EXPRESSION
817e9f41
AD
872 ;
873EXPRESSION_SIMP : EXPRESSION_SIMP
874 HASSIGN
affac613 875 EXPRESSION
817e9f41
AD
876 |
877
878 EXPRESSION_SIMP
879 HCONC
affac613 880 EXPRESSION_SIMP
817e9f41
AD
881 | EXPRESSION_SIMP HOR
882 HELSE
883 EXPRESSION_SIMP
affac613 884 %prec HORELSE
817e9f41
AD
885 | EXPRESSION_SIMP HAND
886 HTHEN
887 EXPRESSION_SIMP
affac613 888 %prec HANDTHEN
817e9f41 889 | EXPRESSION_SIMP
affac613 890 HEQV EXPRESSION_SIMP
817e9f41 891 | EXPRESSION_SIMP
affac613 892 HIMP EXPRESSION_SIMP
817e9f41 893 | EXPRESSION_SIMP
affac613 894 HOR EXPRESSION_SIMP
817e9f41 895 | EXPRESSION_SIMP
affac613
AD
896 HAND EXPRESSION_SIMP
897 | HNOT EXPRESSION_SIMP
817e9f41
AD
898 | EXPRESSION_SIMP
899 HVALRELOPERATOR
900 EXPRESSION_SIMP
817e9f41
AD
901 | EXPRESSION_SIMP
902 HREFRELOPERATOR
903 EXPRESSION_SIMP
817e9f41
AD
904 | EXPRESSION_SIMP
905 HOBJRELOPERATOR
906 EXPRESSION_SIMP
817e9f41
AD
907 | HTERMOPERATOR
908 EXPRESSION_SIMP %prec UNEAR
817e9f41
AD
909 | EXPRESSION_SIMP
910 HTERMOPERATOR
911 EXPRESSION_SIMP
817e9f41
AD
912 | EXPRESSION_SIMP
913 HFACTOROPERATOR
914 EXPRESSION_SIMP
817e9f41
AD
915 | EXPRESSION_SIMP
916 HPRIMARYOPERATOR
affac613 917 EXPRESSION_SIMP
817e9f41 918 | HBEGPAR
affac613
AD
919 EXPRESSION HENDPAR
920 | HTEXTKONST
921 | HCHARACTERKONST
922 | HREALKONST
923 | HINTEGERKONST
924 | HBOOLEANKONST
925 | HNONE
817e9f41 926 | HIDENTIFIER
affac613
AD
927 {}
928 MBEE_ARG_R_PT
929 | HTHIS HIDENTIFIER
817e9f41
AD
930 | HNEW
931 HIDENTIFIER
affac613 932 ARG_R_PT
817e9f41
AD
933 | EXPRESSION_SIMP
934 HDOT
affac613 935 EXPRESSION_SIMP
817e9f41 936 | EXPRESSION_SIMP
affac613 937 HQUA HIDENTIFIER
817e9f41 938 ;
affac613 939ARG_R_PT : /*EMPTY*/
817e9f41
AD
940 | HBEGPAR
941 ARGUMENT_LIST HENDPAR
942 ;
affac613 943MBEE_ARG_R_PT : /*EMPTY*/
817e9f41 944 | HBEGPAR
affac613 945 ARGUMENT_LIST HENDPAR
817e9f41 946 ;
affac613 947ARGUMENT_LIST : EXPRESSION
817e9f41
AD
948 | EXPRESSION
949 HPAREXPSEPARATOR
affac613 950 ARGUMENT_LIST
817e9f41
AD
951 ;
952%%
953]])
954
955# Pass plenty of options, to exercise plenty of code, even if we
956# don't actually check the output. But SEGV is watching us, and
957# so might do dmalloc.
958AT_CHECK([[bison --verbose --defines input.y]], 0, [],
a4b746ea 959[[input.y: conflicts: 78 shift/reduce, 10 reduce/reduce
817e9f41
AD
960]])
961
a4b746ea
PE
962AT_CHECK([[grep '^State.*conflicts:' input.output]], 0,
963[[State 64 conflicts: 14 shift/reduce
964State 164 conflicts: 1 shift/reduce
965State 201 conflicts: 33 shift/reduce, 4 reduce/reduce
966State 206 conflicts: 1 shift/reduce
967State 240 conflicts: 1 shift/reduce
968State 335 conflicts: 9 shift/reduce, 2 reduce/reduce
969State 356 conflicts: 1 shift/reduce
970State 360 conflicts: 9 shift/reduce, 2 reduce/reduce
971State 427 conflicts: 9 shift/reduce, 2 reduce/reduce
817e9f41
AD
972]])
973
974AT_CLEANUP
2740f169 975
2740f169
PE
976## ----------------- ##
977## GNU pic Grammar. ##
978## ----------------- ##
979
980AT_SETUP([GNU pic Grammar])
981
982# GNU pic, part of groff.
983
984# Bison once reported shift/reduce conflicts that it shouldn't have.
985
986AT_DATA([[input.y]],
affac613
AD
987[[%union {}
988
989%token LABEL
990%token VARIABLE
991%token NUMBER
992%token TEXT
993%token COMMAND_LINE
994%token DELIMITED
995%token ORDINAL
2740f169
PE
996%token TH
997%token LEFT_ARROW_HEAD
998%token RIGHT_ARROW_HEAD
999%token DOUBLE_ARROW_HEAD
1000%token LAST
1001%token UP
1002%token DOWN
1003%token LEFT
1004%token RIGHT
1005%token BOX
1006%token CIRCLE
1007%token ELLIPSE
1008%token ARC
1009%token LINE
1010%token ARROW
1011%token MOVE
1012%token SPLINE
1013%token HEIGHT
1014%token RADIUS
1015%token WIDTH
1016%token DIAMETER
1017%token FROM
1018%token TO
1019%token AT
1020%token WITH
1021%token BY
1022%token THEN
1023%token SOLID
1024%token DOTTED
1025%token DASHED
1026%token CHOP
1027%token SAME
1028%token INVISIBLE
1029%token LJUST
1030%token RJUST
1031%token ABOVE
1032%token BELOW
1033%token OF
1034%token THE
1035%token WAY
1036%token BETWEEN
1037%token AND
1038%token HERE
1039%token DOT_N
04098407 1040%token DOT_E
2740f169
PE
1041%token DOT_W
1042%token DOT_S
1043%token DOT_NE
1044%token DOT_SE
1045%token DOT_NW
1046%token DOT_SW
1047%token DOT_C
1048%token DOT_START
1049%token DOT_END
1050%token DOT_X
1051%token DOT_Y
1052%token DOT_HT
1053%token DOT_WID
1054%token DOT_RAD
1055%token SIN
1056%token COS
1057%token ATAN2
1058%token LOG
1059%token EXP
1060%token SQRT
1061%token K_MAX
1062%token K_MIN
1063%token INT
1064%token RAND
1065%token SRAND
1066%token COPY
1067%token THRU
1068%token TOP
1069%token BOTTOM
1070%token UPPER
1071%token LOWER
1072%token SH
1073%token PRINT
1074%token CW
1075%token CCW
1076%token FOR
1077%token DO
1078%token IF
1079%token ELSE
1080%token ANDAND
1081%token OROR
1082%token NOTEQUAL
1083%token EQUALEQUAL
1084%token LESSEQUAL
1085%token GREATEREQUAL
1086%token LEFT_CORNER
1087%token RIGHT_CORNER
1088%token NORTH
1089%token SOUTH
1090%token EAST
1091%token WEST
1092%token CENTER
1093%token END
1094%token START
1095%token RESET
1096%token UNTIL
1097%token PLOT
1098%token THICKNESS
1099%token FILL
1100%token COLORED
1101%token OUTLINED
1102%token SHADED
1103%token ALIGNED
1104%token SPRINTF
1105%token COMMAND
1106
1107%left '.'
1108
1109/* this ensures that plot 17 "%g" parses as (plot 17 "%g") */
1110%left PLOT
1111%left TEXT SPRINTF
1112
1113/* give text adjustments higher precedence than TEXT, so that
1114box "foo" above ljust == box ("foo" above ljust)
1115*/
1116
1117%left LJUST RJUST ABOVE BELOW
1118
1119%left LEFT RIGHT
1120/* Give attributes that take an optional expression a higher
1121precedence than left and right, so that eg `line chop left'
1122parses properly. */
1123%left CHOP SOLID DASHED DOTTED UP DOWN FILL COLORED OUTLINED
1124%left LABEL
1125
04098407 1126%left VARIABLE NUMBER '(' SIN COS ATAN2 LOG EXP SQRT K_MAX K_MIN INT RAND SRAND LAST
2740f169
PE
1127%left ORDINAL HERE '`'
1128
1129%left BOX CIRCLE ELLIPSE ARC LINE ARROW SPLINE '[' /* ] */
1130
1131/* these need to be lower than '-' */
1132%left HEIGHT RADIUS WIDTH DIAMETER FROM TO AT THICKNESS
1133
1134/* these must have higher precedence than CHOP so that `label %prec CHOP'
1135works */
1136%left DOT_N DOT_E DOT_W DOT_S DOT_NE DOT_SE DOT_NW DOT_SW DOT_C
1137%left DOT_START DOT_END TOP BOTTOM LEFT_CORNER RIGHT_CORNER
1138%left UPPER LOWER NORTH SOUTH EAST WEST CENTER START END
1139
1140%left ','
1141%left OROR
1142%left ANDAND
1143%left EQUALEQUAL NOTEQUAL
1144%left '<' '>' LESSEQUAL GREATEREQUAL
1145
1146%left BETWEEN OF
1147%left AND
1148
1149%left '+' '-'
1150%left '*' '/' '%'
1151%right '!'
1152%right '^'
1153
2740f169
PE
1154%%
1155
1156top:
1157 optional_separator
1158 | element_list
2740f169
PE
1159 ;
1160
2740f169
PE
1161element_list:
1162 optional_separator middle_element_list optional_separator
2740f169
PE
1163 ;
1164
1165middle_element_list:
1166 element
2740f169 1167 | middle_element_list separator element
2740f169
PE
1168 ;
1169
1170optional_separator:
1171 /* empty */
1172 | separator
1173 ;
1174
1175separator:
1176 ';'
1177 | separator ';'
1178 ;
1179
1180placeless_element:
1181 VARIABLE '=' any_expr
2740f169 1182 | VARIABLE ':' '=' any_expr
2740f169 1183 | UP
2740f169 1184 | DOWN
2740f169 1185 | LEFT
2740f169 1186 | RIGHT
2740f169 1187 | COMMAND_LINE
2740f169 1188 | COMMAND print_args
2740f169 1189 | PRINT print_args
2740f169 1190 | SH
affac613 1191 {}
2740f169 1192 DELIMITED
2740f169 1193 | COPY TEXT
2740f169 1194 | COPY TEXT THRU
affac613 1195 {}
04098407 1196 DELIMITED
affac613 1197 {}
2740f169 1198 until
2740f169 1199 | COPY THRU
affac613 1200 {}
2740f169 1201 DELIMITED
affac613 1202 {}
2740f169 1203 until
2740f169 1204 | FOR VARIABLE '=' expr TO expr optional_by DO
affac613 1205 {}
2740f169 1206 DELIMITED
2740f169 1207 | simple_if
2740f169 1208 | simple_if ELSE
affac613 1209 {}
2740f169 1210 DELIMITED
2740f169
PE
1211 | reset_variables
1212 | RESET
2740f169
PE
1213 ;
1214
1215reset_variables:
1216 RESET VARIABLE
2740f169 1217 | reset_variables VARIABLE
2740f169 1218 | reset_variables ',' VARIABLE
2740f169
PE
1219 ;
1220
1221print_args:
1222 print_arg
2740f169 1223 | print_args print_arg
2740f169
PE
1224 ;
1225
1226print_arg:
04098407 1227 expr %prec ','
2740f169 1228 | text
2740f169 1229 | position %prec ','
2740f169
PE
1230 ;
1231
1232simple_if:
1233 IF any_expr THEN
affac613 1234 {}
2740f169 1235 DELIMITED
2740f169
PE
1236 ;
1237
1238until:
1239 /* empty */
2740f169 1240 | UNTIL TEXT
2740f169 1241 ;
04098407 1242
2740f169
PE
1243any_expr:
1244 expr
2740f169 1245 | text_expr
2740f169 1246 ;
04098407 1247
2740f169
PE
1248text_expr:
1249 text EQUALEQUAL text
2740f169 1250 | text NOTEQUAL text
2740f169 1251 | text_expr ANDAND text_expr
2740f169 1252 | text_expr ANDAND expr
2740f169 1253 | expr ANDAND text_expr
2740f169 1254 | text_expr OROR text_expr
2740f169 1255 | text_expr OROR expr
2740f169 1256 | expr OROR text_expr
2740f169 1257 | '!' text_expr
2740f169
PE
1258 ;
1259
2740f169
PE
1260optional_by:
1261 /* empty */
2740f169 1262 | BY expr
2740f169 1263 | BY '*' expr
2740f169
PE
1264 ;
1265
1266element:
1267 object_spec
2740f169 1268 | LABEL ':' optional_separator element
2740f169 1269 | LABEL ':' optional_separator position_not_place
2740f169 1270 | LABEL ':' optional_separator place
affac613
AD
1271 | '{}'
1272 {}
2740f169 1273 optional_element
2740f169 1274 | placeless_element
2740f169
PE
1275 ;
1276
1277optional_element:
1278 /* empty */
2740f169 1279 | element
2740f169
PE
1280 ;
1281
1282object_spec:
1283 BOX
2740f169 1284 | CIRCLE
2740f169 1285 | ELLIPSE
2740f169 1286 | ARC
2740f169 1287 | LINE
2740f169 1288 | ARROW
2740f169 1289 | MOVE
2740f169 1290 | SPLINE
2740f169 1291 | text %prec TEXT
2740f169 1292 | PLOT expr
2740f169 1293 | PLOT expr text
04098407 1294 | '['
affac613 1295 {}
2740f169 1296 element_list ']'
2740f169 1297 | object_spec HEIGHT expr
2740f169 1298 | object_spec RADIUS expr
2740f169 1299 | object_spec WIDTH expr
2740f169 1300 | object_spec DIAMETER expr
2740f169 1301 | object_spec expr %prec HEIGHT
2740f169 1302 | object_spec UP
2740f169 1303 | object_spec UP expr
2740f169 1304 | object_spec DOWN
2740f169 1305 | object_spec DOWN expr
2740f169 1306 | object_spec RIGHT
2740f169 1307 | object_spec RIGHT expr
2740f169 1308 | object_spec LEFT
2740f169 1309 | object_spec LEFT expr
2740f169 1310 | object_spec FROM position
2740f169 1311 | object_spec TO position
2740f169 1312 | object_spec AT position
2740f169 1313 | object_spec WITH path
2740f169 1314 | object_spec WITH position %prec ','
2740f169 1315 | object_spec BY expr_pair
2740f169 1316 | object_spec THEN
2740f169 1317 | object_spec SOLID
2740f169 1318 | object_spec DOTTED
2740f169 1319 | object_spec DOTTED expr
2740f169 1320 | object_spec DASHED
2740f169 1321 | object_spec DASHED expr
2740f169 1322 | object_spec FILL
2740f169 1323 | object_spec FILL expr
2740f169 1324 | object_spec SHADED text
2740f169 1325 | object_spec COLORED text
2740f169 1326 | object_spec OUTLINED text
2740f169 1327 | object_spec CHOP
2740f169 1328 | object_spec CHOP expr
2740f169 1329 | object_spec SAME
2740f169 1330 | object_spec INVISIBLE
2740f169 1331 | object_spec LEFT_ARROW_HEAD
2740f169 1332 | object_spec RIGHT_ARROW_HEAD
2740f169 1333 | object_spec DOUBLE_ARROW_HEAD
2740f169 1334 | object_spec CW
2740f169 1335 | object_spec CCW
2740f169 1336 | object_spec text %prec TEXT
2740f169 1337 | object_spec LJUST
2740f169 1338 | object_spec RJUST
2740f169 1339 | object_spec ABOVE
2740f169 1340 | object_spec BELOW
2740f169 1341 | object_spec THICKNESS expr
2740f169 1342 | object_spec ALIGNED
2740f169
PE
1343 ;
1344
1345text:
1346 TEXT
2740f169 1347 | SPRINTF '(' TEXT sprintf_args ')'
2740f169
PE
1348 ;
1349
1350sprintf_args:
1351 /* empty */
2740f169 1352 | sprintf_args ',' expr
2740f169
PE
1353 ;
1354
1355position:
04098407 1356 position_not_place
2740f169 1357 | place
2740f169
PE
1358 ;
1359
1360position_not_place:
1361 expr_pair
2740f169 1362 | position '+' expr_pair
2740f169 1363 | position '-' expr_pair
2740f169 1364 | '(' position ',' position ')'
2740f169 1365 | expr between position AND position
2740f169 1366 | expr '<' position ',' position '>'
2740f169
PE
1367 ;
1368
1369between:
1370 BETWEEN
1371 | OF THE WAY BETWEEN
1372 ;
1373
1374expr_pair:
1375 expr ',' expr
2740f169 1376 | '(' expr_pair ')'
2740f169
PE
1377 ;
1378
1379place:
1380 /* line at A left == line (at A) left */
1381 label %prec CHOP
2740f169 1382 | label corner
2740f169 1383 | corner label
2740f169 1384 | corner OF label
2740f169 1385 | HERE
2740f169
PE
1386 ;
1387
1388label:
1389 LABEL
2740f169 1390 | nth_primitive
2740f169 1391 | label '.' LABEL
2740f169
PE
1392 ;
1393
1394ordinal:
1395 ORDINAL
2740f169 1396 | '`' any_expr TH
2740f169
PE
1397 ;
1398
1399optional_ordinal_last:
1400 LAST
04098407 1401 | ordinal LAST
2740f169
PE
1402 ;
1403
1404nth_primitive:
1405 ordinal object_type
2740f169 1406 | optional_ordinal_last object_type
2740f169
PE
1407 ;
1408
1409object_type:
1410 BOX
2740f169 1411 | CIRCLE
2740f169 1412 | ELLIPSE
2740f169 1413 | ARC
2740f169 1414 | LINE
2740f169 1415 | ARROW
2740f169 1416 | SPLINE
2740f169 1417 | '[' ']'
2740f169 1418 | TEXT
2740f169
PE
1419 ;
1420
1421label_path:
04098407 1422 '.' LABEL
2740f169 1423 | label_path '.' LABEL
2740f169
PE
1424 ;
1425
1426relative_path:
1427 corner %prec CHOP
2740f169
PE
1428 /* give this a lower precedence than LEFT and RIGHT so that
1429 [A: box] with .A left == [A: box] with (.A left) */
04098407 1430 | label_path %prec TEXT
2740f169 1431 | label_path corner
2740f169
PE
1432 ;
1433
1434path:
1435 relative_path
2740f169 1436 | '(' relative_path ',' relative_path ')'
affac613 1437 {}
2740f169
PE
1438 /* The rest of these rules are a compatibility sop. */
1439 | ORDINAL LAST object_type relative_path
2740f169 1440 | LAST object_type relative_path
2740f169 1441 | ORDINAL object_type relative_path
2740f169 1442 | LABEL relative_path
2740f169
PE
1443 ;
1444
1445corner:
1446 DOT_N
04098407 1447 | DOT_E
2740f169 1448 | DOT_W
2740f169 1449 | DOT_S
2740f169 1450 | DOT_NE
2740f169 1451 | DOT_SE
2740f169 1452 | DOT_NW
2740f169 1453 | DOT_SW
2740f169 1454 | DOT_C
2740f169 1455 | DOT_START
2740f169 1456 | DOT_END
04098407 1457 | TOP
2740f169 1458 | BOTTOM
2740f169 1459 | LEFT
2740f169 1460 | RIGHT
2740f169 1461 | UPPER LEFT
2740f169 1462 | LOWER LEFT
2740f169 1463 | UPPER RIGHT
2740f169 1464 | LOWER RIGHT
2740f169 1465 | LEFT_CORNER
2740f169 1466 | RIGHT_CORNER
2740f169 1467 | UPPER LEFT_CORNER
2740f169 1468 | LOWER LEFT_CORNER
2740f169 1469 | UPPER RIGHT_CORNER
2740f169 1470 | LOWER RIGHT_CORNER
2740f169 1471 | NORTH
2740f169 1472 | SOUTH
2740f169 1473 | EAST
2740f169 1474 | WEST
2740f169 1475 | CENTER
2740f169 1476 | START
2740f169 1477 | END
2740f169
PE
1478 ;
1479
1480expr:
1481 VARIABLE
2740f169 1482 | NUMBER
2740f169 1483 | place DOT_X
2740f169 1484 | place DOT_Y
2740f169 1485 | place DOT_HT
2740f169 1486 | place DOT_WID
2740f169 1487 | place DOT_RAD
2740f169 1488 | expr '+' expr
2740f169 1489 | expr '-' expr
2740f169 1490 | expr '*' expr
2740f169 1491 | expr '/' expr
2740f169 1492 | expr '%' expr
2740f169 1493 | expr '^' expr
2740f169 1494 | '-' expr %prec '!'
2740f169 1495 | '(' any_expr ')'
2740f169 1496 | SIN '(' any_expr ')'
2740f169 1497 | COS '(' any_expr ')'
2740f169 1498 | ATAN2 '(' any_expr ',' any_expr ')'
2740f169 1499 | LOG '(' any_expr ')'
2740f169 1500 | EXP '(' any_expr ')'
2740f169 1501 | SQRT '(' any_expr ')'
2740f169 1502 | K_MAX '(' any_expr ',' any_expr ')'
2740f169 1503 | K_MIN '(' any_expr ',' any_expr ')'
2740f169 1504 | INT '(' any_expr ')'
2740f169 1505 | RAND '(' any_expr ')'
2740f169 1506 | RAND '(' ')'
2740f169 1507 | SRAND '(' any_expr ')'
2740f169 1508 | expr '<' expr
2740f169 1509 | expr LESSEQUAL expr
2740f169 1510 | expr '>' expr
2740f169 1511 | expr GREATEREQUAL expr
2740f169 1512 | expr EQUALEQUAL expr
2740f169 1513 | expr NOTEQUAL expr
2740f169 1514 | expr ANDAND expr
2740f169 1515 | expr OROR expr
2740f169 1516 | '!' expr
2740f169
PE
1517 ;
1518]])
1519
1520# Pass plenty of options, to exercise plenty of code, even if we
1521# don't actually check the output. But SEGV is watching us, and
1522# so might do dmalloc.
1523AT_CHECK([[bison --verbose --defines input.y]], 0, [], [])
1524
1525AT_CLEANUP