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