# Exercising Bison on actual grammars. -*- Autotest -*-
-# Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2007, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1989-1992, 2000-2005, 2007, 2009-2012 Free Software
+# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
dnl support is rapidly evolving, let's keep that information to be careful.
dnl However, we don't do diffs for canonical LR(1) because the diff is huge.
m4_pushdef([AT_LALR1_DIFF_CHECK],
-[AT_CHECK([[sed 's/^%define lr.type .*$//' input.y > input-lalr.y]])
+[dnl We need diff -u, which is not portable.
+AT_CHECK([diff -u /dev/null /dev/null || exit 77], [0], [ignore])
+
+AT_CHECK([[sed 's/^%define lr.type .*$//' input.y > input-lalr.y]])
AT_BISON_CHECK([[--report=all input-lalr.y]], [[0]], [ignore], [ignore])
AT_CHECK([[diff -u input-lalr.output input.output \
| sed -n '/^@@/,$p' | sed 's/^ $//']],
]],
[[
start
- : opt_nls program opt_nls
- ;
+ : opt_nls program opt_nls
+ ;
program
- : rule
- | program rule
- | error
- | program error
- | /* empty */
- ;
+ : rule
+ | program rule
+ | error
+ | program error
+ | /* empty */
+ ;
rule
- : LEX_BEGIN {} action
- | LEX_END {} action
- | LEX_BEGIN statement_term
- | LEX_END statement_term
- | pattern action
- | action
- | pattern statement_term
- | function_prologue function_body
- ;
+ : LEX_BEGIN {} action
+ | LEX_END {} action
+ | LEX_BEGIN statement_term
+ | LEX_END statement_term
+ | pattern action
+ | action
+ | pattern statement_term
+ | function_prologue function_body
+ ;
func_name
- : NAME
- | FUNC_CALL
- | lex_builtin
- ;
+ : NAME
+ | FUNC_CALL
+ | lex_builtin
+ ;
lex_builtin
- : LEX_BUILTIN
- | LEX_LENGTH
- ;
+ : LEX_BUILTIN
+ | LEX_LENGTH
+ ;
function_prologue
- : LEX_FUNCTION {} func_name '(' opt_param_list r_paren opt_nls
- ;
+ : LEX_FUNCTION {} func_name '(' opt_param_list r_paren opt_nls
+ ;
function_body
- : l_brace statements r_brace opt_semi opt_nls
- | l_brace r_brace opt_semi opt_nls
- ;
+ : l_brace statements r_brace opt_semi opt_nls
+ | l_brace r_brace opt_semi opt_nls
+ ;
pattern
- : exp
- | exp ',' exp
- ;
+ : exp
+ | exp ',' exp
+ ;
regexp
- /*
- * In this rule, want_regexp tells yylex that the next thing
- * is a regexp so it should read up to the closing slash.
- */
- : '/' {} REGEXP '/'
- ;
+ /*
+ * In this rule, want_regexp tells yylex that the next thing
+ * is a regexp so it should read up to the closing slash.
+ */
+ : '/' {} REGEXP '/'
+ ;
action
- : l_brace statements r_brace opt_semi opt_nls
- | l_brace r_brace opt_semi opt_nls
- ;
+ : l_brace statements r_brace opt_semi opt_nls
+ | l_brace r_brace opt_semi opt_nls
+ ;
statements
- : statement
- | statements statement
- | error
- | statements error
- ;
+ : statement
+ | statements statement
+ | error
+ | statements error
+ ;
statement_term
- : nls
- | semi opt_nls
- ;
+ : nls
+ | semi opt_nls
+ ;
statement
- : semi opt_nls
- | l_brace r_brace
- | l_brace statements r_brace
- | if_statement
- | LEX_WHILE '(' exp r_paren opt_nls statement
- | LEX_DO opt_nls statement LEX_WHILE '(' exp r_paren opt_nls
- | LEX_FOR '(' NAME LEX_IN NAME r_paren opt_nls statement
- | LEX_FOR '(' opt_exp semi opt_nls exp semi opt_nls opt_exp r_paren opt_nls statement
- | LEX_FOR '(' opt_exp semi opt_nls semi opt_nls opt_exp r_paren opt_nls statement
- | LEX_BREAK statement_term
- | LEX_CONTINUE statement_term
- | print '(' expression_list r_paren output_redir statement_term
- | print opt_rexpression_list output_redir statement_term
- | LEX_NEXT statement_term
- | LEX_NEXTFILE statement_term
- | LEX_EXIT opt_exp statement_term
- | LEX_RETURN {} opt_exp statement_term
- | LEX_DELETE NAME '[' expression_list ']' statement_term
- | LEX_DELETE NAME statement_term
- | exp statement_term
- ;
+ : semi opt_nls
+ | l_brace r_brace
+ | l_brace statements r_brace
+ | if_statement
+ | LEX_WHILE '(' exp r_paren opt_nls statement
+ | LEX_DO opt_nls statement LEX_WHILE '(' exp r_paren opt_nls
+ | LEX_FOR '(' NAME LEX_IN NAME r_paren opt_nls statement
+ | LEX_FOR '(' opt_exp semi opt_nls exp semi opt_nls opt_exp r_paren opt_nls statement
+ | LEX_FOR '(' opt_exp semi opt_nls semi opt_nls opt_exp r_paren opt_nls statement
+ | LEX_BREAK statement_term
+ | LEX_CONTINUE statement_term
+ | print '(' expression_list r_paren output_redir statement_term
+ | print opt_rexpression_list output_redir statement_term
+ | LEX_NEXT statement_term
+ | LEX_NEXTFILE statement_term
+ | LEX_EXIT opt_exp statement_term
+ | LEX_RETURN {} opt_exp statement_term
+ | LEX_DELETE NAME '[' expression_list ']' statement_term
+ | LEX_DELETE NAME statement_term
+ | exp statement_term
+ ;
print
- : LEX_PRINT
- | LEX_PRINTF
- ;
+ : LEX_PRINT
+ | LEX_PRINTF
+ ;
if_statement
- : LEX_IF '(' exp r_paren opt_nls statement
- | LEX_IF '(' exp r_paren opt_nls statement
- LEX_ELSE opt_nls statement
- ;
+ : LEX_IF '(' exp r_paren opt_nls statement
+ | LEX_IF '(' exp r_paren opt_nls statement
+ LEX_ELSE opt_nls statement
+ ;
nls
- : NEWLINE
- | nls NEWLINE
- ;
+ : NEWLINE
+ | nls NEWLINE
+ ;
opt_nls
- : /* empty */
- | nls
- ;
+ : /* empty */
+ | nls
+ ;
input_redir
- : /* empty */
- | '<' simp_exp
- ;
+ : /* empty */
+ | '<' simp_exp
+ ;
output_redir
- : /* empty */
- | '>' exp
- | APPEND_OP exp
- | '|' exp
- | TWOWAYIO exp
- ;
+ : /* empty */
+ | '>' exp
+ | APPEND_OP exp
+ | '|' exp
+ | TWOWAYIO exp
+ ;
opt_param_list
- : /* empty */
- | param_list
- ;
+ : /* empty */
+ | param_list
+ ;
param_list
- : NAME
- | param_list comma NAME
- | error
- | param_list error
- | param_list comma error
- ;
+ : NAME
+ | param_list comma NAME
+ | error
+ | param_list error
+ | param_list comma error
+ ;
/* optional expression, as in for loop */
opt_exp
- : /* empty */
- | exp
- ;
+ : /* empty */
+ | exp
+ ;
opt_rexpression_list
- : /* empty */
- | rexpression_list
- ;
+ : /* empty */
+ | rexpression_list
+ ;
rexpression_list
- : rexp
- | rexpression_list comma rexp
- | error
- | rexpression_list error
- | rexpression_list error rexp
- | rexpression_list comma error
- ;
+ : rexp
+ | rexpression_list comma rexp
+ | error
+ | rexpression_list error
+ | rexpression_list error rexp
+ | rexpression_list comma error
+ ;
opt_expression_list
- : /* empty */
- | expression_list
- ;
+ : /* empty */
+ | expression_list
+ ;
expression_list
- : exp
- | expression_list comma exp
- | error
- | expression_list error
- | expression_list error exp
- | expression_list comma error
- ;
+ : exp
+ | expression_list comma exp
+ | error
+ | expression_list error
+ | expression_list error exp
+ | expression_list comma error
+ ;
/* Expressions, not including the comma operator. */
-exp : variable ASSIGNOP {} exp
- | '(' expression_list r_paren LEX_IN NAME
- | exp '|' LEX_GETLINE opt_variable
- | exp TWOWAYIO LEX_GETLINE opt_variable
- | LEX_GETLINE opt_variable input_redir
- | exp LEX_AND exp
- | exp LEX_OR exp
- | exp MATCHOP exp
- | regexp
- | '!' regexp %prec UNARY
- | exp LEX_IN NAME
- | exp RELOP exp
- | exp '<' exp
- | exp '>' exp
- | exp '?' exp ':' exp
- | simp_exp
- | exp simp_exp %prec CONCAT_OP
- ;
+exp : variable ASSIGNOP {} exp
+ | '(' expression_list r_paren LEX_IN NAME
+ | exp '|' LEX_GETLINE opt_variable
+ | exp TWOWAYIO LEX_GETLINE opt_variable
+ | LEX_GETLINE opt_variable input_redir
+ | exp LEX_AND exp
+ | exp LEX_OR exp
+ | exp MATCHOP exp
+ | regexp
+ | '!' regexp %prec UNARY
+ | exp LEX_IN NAME
+ | exp RELOP exp
+ | exp '<' exp
+ | exp '>' exp
+ | exp '?' exp ':' exp
+ | simp_exp
+ | exp simp_exp %prec CONCAT_OP
+ ;
rexp
- : variable ASSIGNOP {} rexp
- | rexp LEX_AND rexp
- | rexp LEX_OR rexp
- | LEX_GETLINE opt_variable input_redir
- | regexp
- | '!' regexp %prec UNARY
- | rexp MATCHOP rexp
- | rexp LEX_IN NAME
- | rexp RELOP rexp
- | rexp '?' rexp ':' rexp
- | simp_exp
- | rexp simp_exp %prec CONCAT_OP
- ;
+ : variable ASSIGNOP {} rexp
+ | rexp LEX_AND rexp
+ | rexp LEX_OR rexp
+ | LEX_GETLINE opt_variable input_redir
+ | regexp
+ | '!' regexp %prec UNARY
+ | rexp MATCHOP rexp
+ | rexp LEX_IN NAME
+ | rexp RELOP rexp
+ | rexp '?' rexp ':' rexp
+ | simp_exp
+ | rexp simp_exp %prec CONCAT_OP
+ ;
simp_exp
- : non_post_simp_exp
- /* Binary operators in order of decreasing precedence. */
- | simp_exp '^' simp_exp
- | simp_exp '*' simp_exp
- | simp_exp '/' simp_exp
- | simp_exp '%' simp_exp
- | simp_exp '+' simp_exp
- | simp_exp '-' simp_exp
- | variable INCREMENT
- | variable DECREMENT
- ;
+ : non_post_simp_exp
+ /* Binary operators in order of decreasing precedence. */
+ | simp_exp '^' simp_exp
+ | simp_exp '*' simp_exp
+ | simp_exp '/' simp_exp
+ | simp_exp '%' simp_exp
+ | simp_exp '+' simp_exp
+ | simp_exp '-' simp_exp
+ | variable INCREMENT
+ | variable DECREMENT
+ ;
non_post_simp_exp
- : '!' simp_exp %prec UNARY
- | '(' exp r_paren
- | LEX_BUILTIN
- '(' opt_expression_list r_paren
- | LEX_LENGTH '(' opt_expression_list r_paren
- | LEX_LENGTH
- | FUNC_CALL '(' opt_expression_list r_paren
- | variable
- | INCREMENT variable
- | DECREMENT variable
- | YNUMBER
- | YSTRING
- | '-' simp_exp %prec UNARY
- | '+' simp_exp %prec UNARY
- ;
+ : '!' simp_exp %prec UNARY
+ | '(' exp r_paren
+ | LEX_BUILTIN
+ '(' opt_expression_list r_paren
+ | LEX_LENGTH '(' opt_expression_list r_paren
+ | LEX_LENGTH
+ | FUNC_CALL '(' opt_expression_list r_paren
+ | variable
+ | INCREMENT variable
+ | DECREMENT variable
+ | YNUMBER
+ | YSTRING
+ | '-' simp_exp %prec UNARY
+ | '+' simp_exp %prec UNARY
+ ;
opt_variable
- : /* empty */
- | variable
- ;
+ : /* empty */
+ | variable
+ ;
variable
- : NAME
- | NAME '[' expression_list ']'
- | '$' non_post_simp_exp
- ;
+ : NAME
+ | NAME '[' expression_list ']'
+ | '$' non_post_simp_exp
+ ;
l_brace
- : '{' opt_nls
- ;
+ : '{' opt_nls
+ ;
r_brace
- : '}' opt_nls
- ;
+ : '}' opt_nls
+ ;
r_paren
- : ')'
- ;
+ : ')'
+ ;
opt_semi
- : /* empty */
- | semi
- ;
+ : /* empty */
+ | semi
+ ;
semi
- : ';'
- ;
+ : ';'
+ ;
-comma : ',' opt_nls
- ;
+comma : ',' opt_nls
+ ;
]],
dnl INPUT
dnl BISON-STDERR
[AT_COND_CASE([[canonical LR]],
-[[input.y: conflicts: 265 shift/reduce]],
-[[input.y: conflicts: 65 shift/reduce]])[
+[[input.y: warning: 265 shift/reduce conflicts [-Wconflicts-sr]]],
+[[input.y: warning: 65 shift/reduce conflicts [-Wconflicts-sr]]])[
]],
dnl LAST-STATE
$default reduce using rule 45 (statement)
+
+
-+state 320
++State 320
+
+ 139 non_post_simp_exp: . '!' simp_exp
+ 140 | . '(' exp r_paren
+ variable go to state 63
+
+
-+state 321
++State 321
+
+ 146 non_post_simp_exp: INCREMENT . variable
+ 154 variable: . NAME
+ variable go to state 50
+
+
-+state 322
++State 322
+
+ 147 non_post_simp_exp: DECREMENT . variable
+ 154 variable: . NAME
+ variable go to state 51
+
+
-+state 323
++State 323
+
+ 130 simp_exp: . non_post_simp_exp
+ 131 | . simp_exp '^' simp_exp
+ variable go to state 57
+
+
-+state 324
++State 324
+
+ 130 simp_exp: . non_post_simp_exp
+ 131 | . simp_exp '^' simp_exp
+ variable go to state 57
+
+
-+state 325
++State 325
+
+ 130 simp_exp: . non_post_simp_exp
+ 131 | . simp_exp '^' simp_exp
+ variable go to state 57
+
+
-+state 326
++State 326
+
+ 131 simp_exp: simp_exp . '^' simp_exp
+ 132 | simp_exp . '*' simp_exp
+ Conflict between rule 151 and token '-' resolved as reduce ('-' < UNARY).
+
+
-+state 327
++State 327
+
+ 131 simp_exp: simp_exp . '^' simp_exp
+ 132 | simp_exp . '*' simp_exp
+ Conflict between rule 150 and token '-' resolved as reduce ('-' < UNARY).
+
+
-+state 328
++State 328
+
+ 131 simp_exp: simp_exp . '^' simp_exp
+ 132 | simp_exp . '*' simp_exp
# It reported 80 SR && 99 RR conflicts instead of 78/10!!!
AT_TEST_EXISTING_GRAMMAR([[GNU Cim Grammar]],
-[[%union {}
-
+[[
%token
- HACTIVATE HAFTER /*HAND*/ HARRAY HAT
- HBEFORE HBEGIN HBOOLEAN
- HCHARACTER HCLASS /*HCOMMENT*/ HCONC
- HDELAY HDO
- HELSE HEND HEQ /*HEQV*/ HEXTERNAL
- HFOR
- HGE HGO HGOTO HGT
- HHIDDEN
- HIF /*HIMP*/ HIN HINNER HINSPECT HINTEGER HIS
- HLABEL HLE HLONG HLT
- HNAME HNE HNEW HNONE /*HNOT*/ HNOTEXT
- /*HOR*/ HOTHERWISE
- HPRIOR HPROCEDURE HPROTECTED
- HQUA
- HREACTIVATE HREAL HREF
- HSHORT HSTEP HSWITCH
- HTEXT HTHEN HTHIS HTO
- HUNTIL
- HVALUE HVAR HVIRTUAL
- HWHEN HWHILE
-
- HASSIGNVALUE HASSIGNREF
- /*HDOT*/ HPAREXPSEPARATOR HLABELSEPARATOR HSTATEMENTSEPARATOR
- HBEGPAR HENDPAR
- HEQR HNER
- HADD HSUB HMUL HDIV HINTDIV HEXP
- HDOTDOTDOT
+ HACTIVATE HAFTER /*HAND*/ HARRAY HAT
+ HBEFORE HBEGIN HBOOLEAN
+ HCHARACTER HCLASS /*HCOMMENT*/ HCONC
+ HDELAY HDO
+ HELSE HEND HEQ /*HEQV*/ HEXTERNAL
+ HFOR
+ HGE HGO HGOTO HGT
+ HHIDDEN
+ HIF /*HIMP*/ HIN HINNER HINSPECT HINTEGER HIS
+ HLABEL HLE HLONG HLT
+ HNAME HNE HNEW HNONE /*HNOT*/ HNOTEXT
+ /*HOR*/ HOTHERWISE
+ HPRIOR HPROCEDURE HPROTECTED
+ HQUA
+ HREACTIVATE HREAL HREF
+ HSHORT HSTEP HSWITCH
+ HTEXT HTHEN HTHIS HTO
+ HUNTIL
+ HVALUE HVAR HVIRTUAL
+ HWHEN HWHILE
+
+ HASSIGNVALUE HASSIGNREF
+ /*HDOT*/ HPAREXPSEPARATOR HLABELSEPARATOR HSTATEMENTSEPARATOR
+ HBEGPAR HENDPAR
+ HEQR HNER
+ HADD HSUB HMUL HDIV HINTDIV HEXP
+ HDOTDOTDOT
%token HIDENTIFIER
%token HBOOLEANKONST HINTEGERKONST HCHARACTERKONST
%left HVALRELOPERATOR HREFRELOPERATOR HOBJRELOPERATOR
-%left HCONC
+%left HCONC
%left HTERMOPERATOR
%left UNEAR
[[
/* GRAMATIKK FOR PROGRAM MODULES */
MAIN_MODULE : {}
- MODULS
- | error HSTATEMENTSEPARATOR MBEE_DECLSTMS
- ;
-EXT_DECLARATION : HEXTERNAL
- MBEE_TYPE
- HPROCEDURE
- {}
- EXT_LIST
- |
- HEXTERNAL
- HIDENTIFIER
- HPROCEDURE
- {}
- HIDENTIFIER {}
- EXTERNAL_KIND_ITEM
- | HEXTERNAL
- HCLASS
- {}
- EXT_LIST
-
- ;
-EXTERNAL_KIND_ITEM: EXT_IDENT
- HOBJRELOPERATOR
- {}
- MBEE_TYPE HPROCEDURE
- HIDENTIFIER
- {}
- HEADING EMPTY_BLOCK
- {}
-/* |
- EXT_IDENT
- {}
- MBEE_REST_EXT_LIST
- ;
-MBEE_REST_EXT_LIST: /* EMPTY
- | HPAREXPSEPARATOR EXT_KIND_LIST
- ;
-EXT_KIND_LIST : EXT_KIND_ITEM
- | EXT_KIND_LIST HPAREXPSEPARATOR EXT_KIND_ITEM
- ;
-EXT_KIND_ITEM : HIDENTIFIER
- EXT_IDENT
- {}*/
- ;
-EMPTY_BLOCK : /*EMPT*/
- | HBEGIN HEND
- ;
-EXT_LIST : EXT_ITEM
- | EXT_LIST HPAREXPSEPARATOR EXT_ITEM
- ;
-EXT_ITEM : HIDENTIFIER
- EXT_IDENT
- ;
-EXT_IDENT : /* EMPTY */
- | HVALRELOPERATOR {}
- HTEXTKONST
- ;
+ MODULS
+ | error HSTATEMENTSEPARATOR MBEE_DECLSTMS
+ ;
+EXT_DECLARATION : HEXTERNAL
+ MBEE_TYPE
+ HPROCEDURE
+ {}
+ EXT_LIST
+ |
+ HEXTERNAL
+ HIDENTIFIER
+ HPROCEDURE
+ {}
+ HIDENTIFIER {}
+ EXTERNAL_KIND_ITEM
+ | HEXTERNAL
+ HCLASS
+ {}
+ EXT_LIST
+
+ ;
+EXTERNAL_KIND_ITEM: EXT_IDENT
+ HOBJRELOPERATOR
+ {}
+ MBEE_TYPE HPROCEDURE
+ HIDENTIFIER
+ {}
+ HEADING EMPTY_BLOCK
+ {}
+/* |
+ EXT_IDENT
+ {}
+ MBEE_REST_EXT_LIST
+ ;
+MBEE_REST_EXT_LIST: /* EMPTY
+ | HPAREXPSEPARATOR EXT_KIND_LIST
+ ;
+EXT_KIND_LIST : EXT_KIND_ITEM
+ | EXT_KIND_LIST HPAREXPSEPARATOR EXT_KIND_ITEM
+ ;
+EXT_KIND_ITEM : HIDENTIFIER
+ EXT_IDENT
+ {}*/
+ ;
+EMPTY_BLOCK : /*EMPT*/
+ | HBEGIN HEND
+ ;
+EXT_LIST : EXT_ITEM
+ | EXT_LIST HPAREXPSEPARATOR EXT_ITEM
+ ;
+EXT_ITEM : HIDENTIFIER
+ EXT_IDENT
+ ;
+EXT_IDENT : /* EMPTY */
+ | HVALRELOPERATOR {}
+ HTEXTKONST
+ ;
/* GRAMATIKK FOR TYPER */
NO_TYPE : /*EMPT*/
- ;
+ ;
MBEE_TYPE : NO_TYPE
- | TYPE
- ;
+ | TYPE
+ ;
TYPE : HREF HBEGPAR
- HIDENTIFIER
- {}
- HENDPAR
- | HTEXT
- | HBOOLEAN
- | HCHARACTER
- | HSHORT HINTEGER
- | HINTEGER
- | HREAL
- | HLONG HREAL
- ;
+ HIDENTIFIER
+ {}
+ HENDPAR
+ | HTEXT
+ | HBOOLEAN
+ | HCHARACTER
+ | HSHORT HINTEGER
+ | HINTEGER
+ | HREAL
+ | HLONG HREAL
+ ;
/* GRAMATIKK FOR DEL AV SETNINGER */
MBEE_ELSE_PART : /*EMPT*/
-/* | HELSE
- HIF
- EXPRESSION
- HTHEN {}
- BLOCK {}
- MBEE_ELSE_PART {}*/
- | HELSE {}
- BLOCK
- ;
+/* | HELSE
+ HIF
+ EXPRESSION
+ HTHEN {}
+ BLOCK {}
+ MBEE_ELSE_PART {}*/
+ | HELSE {}
+ BLOCK
+ ;
FOR_LIST : FOR_LIST_ELEMENT
- | FOR_LIST_ELEMENT
- HPAREXPSEPARATOR
- FOR_LIST
- ;
+ | FOR_LIST_ELEMENT
+ HPAREXPSEPARATOR
+ FOR_LIST
+ ;
FOR_LIST_ELEMENT: EXPRESSION
- MBEE_F_L_EL_R_PT
- ;
+ MBEE_F_L_EL_R_PT
+ ;
MBEE_F_L_EL_R_PT: /*EMPT*/
- | HWHILE
- EXPRESSION
- | HSTEP
- EXPRESSION
- HUNTIL
- EXPRESSION
- ;
+ | HWHILE
+ EXPRESSION
+ | HSTEP
+ EXPRESSION
+ HUNTIL
+ EXPRESSION
+ ;
GOTO : HGO
- HTO
- | HGOTO
- ;
+ HTO
+ | HGOTO
+ ;
CONN_STATE_R_PT : WHEN_CLAUSE_LIST
- | HDO {}
- BLOCK
- ;
+ | HDO {}
+ BLOCK
+ ;
WHEN_CLAUSE_LIST: HWHEN
- HIDENTIFIER
- HDO {}
- BLOCK
- | WHEN_CLAUSE_LIST
- HWHEN
- HIDENTIFIER
- HDO {}
- BLOCK
- ;
+ HIDENTIFIER
+ HDO {}
+ BLOCK
+ | WHEN_CLAUSE_LIST
+ HWHEN
+ HIDENTIFIER
+ HDO {}
+ BLOCK
+ ;
MBEE_OTWI_CLAUS : /*EMPT*/
- | HOTHERWISE {}
-
- BLOCK
- ;
-ACTIVATOR : HACTIVATE
- | HREACTIVATE
- ;
-SCHEDULE : /*EMPT*/
- | ATDELAY EXPRESSION {}
- PRIOR
- | BEFOREAFTER {}
- EXPRESSION
- ;
-ATDELAY : HAT
- | HDELAY
- ;
-BEFOREAFTER : HBEFORE
- | HAFTER
- ;
-PRIOR : /*EMPT*/
- | HPRIOR
- ;
+ | HOTHERWISE {}
+
+ BLOCK
+ ;
+ACTIVATOR : HACTIVATE
+ | HREACTIVATE
+ ;
+SCHEDULE : /*EMPT*/
+ | ATDELAY EXPRESSION {}
+ PRIOR
+ | BEFOREAFTER {}
+ EXPRESSION
+ ;
+ATDELAY : HAT
+ | HDELAY
+ ;
+BEFOREAFTER : HBEFORE
+ | HAFTER
+ ;
+PRIOR : /*EMPT*/
+ | HPRIOR
+ ;
/* GRAMATIKK FOR SETNINGER OG DEKLARASJONER */
MODULSTATEMENT : HWHILE
- EXPRESSION
- HDO {}
- BLOCK
- | HIF
- EXPRESSION
- HTHEN {}
- BLOCK {}
- MBEE_ELSE_PART
- | HFOR
- HIDENTIFIER
- HASSIGN {}
- FOR_LIST
- HDO {}
- BLOCK
- | GOTO
- EXPRESSION
- | HINSPECT
- EXPRESSION {}
- CONN_STATE_R_PT
- {}
- MBEE_OTWI_CLAUS
- | HINNER
- | HIDENTIFIER
- HLABELSEPARATOR
- {}
- DECLSTATEMENT
- | EXPRESSION_SIMP
- HBEGIN
- {}
- IMPORT_SPEC_MODULE
- {}
- MBEE_DECLSTMS
- HEND
- | EXPRESSION_SIMP HBEGIN error HSTATEMENTSEPARATOR
- MBEE_DECLSTMS HEND
- | EXPRESSION_SIMP HBEGIN error HEND
- | EXPRESSION_SIMP
- | ACTIVATOR EXPRESSION SCHEDULE
- | HBEGIN
- {}
- MBEE_DECLSTMS
- HEND
- | MBEE_TYPE HPROCEDURE
- HIDENTIFIER
- {}
- HEADING BLOCK
- | HIDENTIFIER
- HCLASS
- NO_TYPE
- {}
- IMPORT_SPEC_MODULE
- HIDENTIFIER
- {}
- HEADING
- BLOCK
- | HCLASS
- NO_TYPE
- HIDENTIFIER
- {}
- HEADING
- BLOCK
- | EXT_DECLARATION
- | /*EMPT*/
- ;
+ EXPRESSION
+ HDO {}
+ BLOCK
+ | HIF
+ EXPRESSION
+ HTHEN {}
+ BLOCK {}
+ MBEE_ELSE_PART
+ | HFOR
+ HIDENTIFIER
+ HASSIGN {}
+ FOR_LIST
+ HDO {}
+ BLOCK
+ | GOTO
+ EXPRESSION
+ | HINSPECT
+ EXPRESSION {}
+ CONN_STATE_R_PT
+ {}
+ MBEE_OTWI_CLAUS
+ | HINNER
+ | HIDENTIFIER
+ HLABELSEPARATOR
+ {}
+ DECLSTATEMENT
+ | EXPRESSION_SIMP
+ HBEGIN
+ {}
+ IMPORT_SPEC_MODULE
+ {}
+ MBEE_DECLSTMS
+ HEND
+ | EXPRESSION_SIMP HBEGIN error HSTATEMENTSEPARATOR
+ MBEE_DECLSTMS HEND
+ | EXPRESSION_SIMP HBEGIN error HEND
+ | EXPRESSION_SIMP
+ | ACTIVATOR EXPRESSION SCHEDULE
+ | HBEGIN
+ {}
+ MBEE_DECLSTMS
+ HEND
+ | MBEE_TYPE HPROCEDURE
+ HIDENTIFIER
+ {}
+ HEADING BLOCK
+ | HIDENTIFIER
+ HCLASS
+ NO_TYPE
+ {}
+ IMPORT_SPEC_MODULE
+ HIDENTIFIER
+ {}
+ HEADING
+ BLOCK
+ | HCLASS
+ NO_TYPE
+ HIDENTIFIER
+ {}
+ HEADING
+ BLOCK
+ | EXT_DECLARATION
+ | /*EMPT*/
+ ;
IMPORT_SPEC_MODULE:
- ;
-DECLSTATEMENT : MODULSTATEMENT
- | TYPE
- HIDENTIFIER
- MBEE_CONSTANT
- HPAREXPSEPARATOR
- {}
- IDENTIFIER_LISTC
- | TYPE
- HIDENTIFIER
- MBEE_CONSTANT
- | MBEE_TYPE
- HARRAY {}
- ARR_SEGMENT_LIST
- | HSWITCH
- HIDENTIFIER
- HASSIGN {}
- SWITCH_LIST
- ;
+ ;
+DECLSTATEMENT : MODULSTATEMENT
+ | TYPE
+ HIDENTIFIER
+ MBEE_CONSTANT
+ HPAREXPSEPARATOR
+ {}
+ IDENTIFIER_LISTC
+ | TYPE
+ HIDENTIFIER
+ MBEE_CONSTANT
+ | MBEE_TYPE
+ HARRAY {}
+ ARR_SEGMENT_LIST
+ | HSWITCH
+ HIDENTIFIER
+ HASSIGN {}
+ SWITCH_LIST
+ ;
BLOCK : DECLSTATEMENT
- | HBEGIN MBEE_DECLSTMS HEND
- | HBEGIN error HSTATEMENTSEPARATOR MBEE_DECLSTMS HEND
- | HBEGIN error HEND
- ;
+ | HBEGIN MBEE_DECLSTMS HEND
+ | HBEGIN error HSTATEMENTSEPARATOR MBEE_DECLSTMS HEND
+ | HBEGIN error HEND
+ ;
MBEE_DECLSTMS : MBEE_DECLSTMSU
- ;
+ ;
MBEE_DECLSTMSU : DECLSTATEMENT
- | MBEE_DECLSTMSU
- HSTATEMENTSEPARATOR
- DECLSTATEMENT
- ;
-MODULS : MODULSTATEMENT
- | MODULS HSTATEMENTSEPARATOR MODULSTATEMENT
- ;
+ | MBEE_DECLSTMSU
+ HSTATEMENTSEPARATOR
+ DECLSTATEMENT
+ ;
+MODULS : MODULSTATEMENT
+ | MODULS HSTATEMENTSEPARATOR MODULSTATEMENT
+ ;
/* GRAMATIKK FOR DEL AV DEKLARASJONER */
ARR_SEGMENT_LIST: ARR_SEGMENT
- | ARR_SEGMENT_LIST
- HPAREXPSEPARATOR
- ARR_SEGMENT
- ;
-ARR_SEGMENT : ARRAY_SEGMENT
- HBEGPAR
- BAUND_PAIR_LIST HENDPAR
- ;
+ | ARR_SEGMENT_LIST
+ HPAREXPSEPARATOR
+ ARR_SEGMENT
+ ;
+ARR_SEGMENT : ARRAY_SEGMENT
+ HBEGPAR
+ BAUND_PAIR_LIST HENDPAR
+ ;
ARRAY_SEGMENT : ARRAY_SEGMENT_EL {}
- | ARRAY_SEGMENT_EL
- HPAREXPSEPARATOR
- ARRAY_SEGMENT
- ;
+ | ARRAY_SEGMENT_EL
+ HPAREXPSEPARATOR
+ ARRAY_SEGMENT
+ ;
ARRAY_SEGMENT_EL: HIDENTIFIER
- ;
+ ;
BAUND_PAIR_LIST : BAUND_PAIR
- | BAUND_PAIR
- HPAREXPSEPARATOR
- BAUND_PAIR_LIST
- ;
+ | BAUND_PAIR
+ HPAREXPSEPARATOR
+ BAUND_PAIR_LIST
+ ;
BAUND_PAIR : EXPRESSION
- HLABELSEPARATOR
- EXPRESSION
- ;
+ HLABELSEPARATOR
+ EXPRESSION
+ ;
SWITCH_LIST : EXPRESSION
- | EXPRESSION
- HPAREXPSEPARATOR
- SWITCH_LIST
- ;
+ | EXPRESSION
+ HPAREXPSEPARATOR
+ SWITCH_LIST
+ ;
HEADING : MBEE_FMAL_PAR_P HSTATEMENTSEPARATOR {}
- MBEE_MODE_PART {}
- MBEE_SPEC_PART {}
- MBEE_PROT_PART {}
- MBEE_VIRT_PART
- ;
+ MBEE_MODE_PART {}
+ MBEE_SPEC_PART {}
+ MBEE_PROT_PART {}
+ MBEE_VIRT_PART
+ ;
MBEE_FMAL_PAR_P : /*EMPT*/
- | FMAL_PAR_PART
- ;
+ | FMAL_PAR_PART
+ ;
FMAL_PAR_PART : HBEGPAR NO_TYPE
- MBEE_LISTV HENDPAR
- ;
+ MBEE_LISTV HENDPAR
+ ;
MBEE_LISTV : /*EMPT*/
- | LISTV
- ;
+ | LISTV
+ ;
LISTV : HIDENTIFIER
- | FPP_CATEG HDOTDOTDOT
- | HIDENTIFIER {}
- HPAREXPSEPARATOR LISTV
- | FPP_SPEC
- | FPP_SPEC
- HPAREXPSEPARATOR LISTV
- ;
+ | FPP_CATEG HDOTDOTDOT
+ | HIDENTIFIER {}
+ HPAREXPSEPARATOR LISTV
+ | FPP_SPEC
+ | FPP_SPEC
+ HPAREXPSEPARATOR LISTV
+ ;
FPP_HEADING : HBEGPAR NO_TYPE
- FPP_MBEE_LISTV HENDPAR
- ;
+ FPP_MBEE_LISTV HENDPAR
+ ;
FPP_MBEE_LISTV : /*EMPT*/
- | FPP_LISTV
- ;
-FPP_LISTV : FPP_CATEG HDOTDOTDOT
- | FPP_SPEC
- | FPP_SPEC
- HPAREXPSEPARATOR LISTV
- ;
+ | FPP_LISTV
+ ;
+FPP_LISTV : FPP_CATEG HDOTDOTDOT
+ | FPP_SPEC
+ | FPP_SPEC
+ HPAREXPSEPARATOR LISTV
+ ;
FPP_SPEC : FPP_CATEG SPECIFIER HIDENTIFIER
- | FPP_CATEG FPP_PROC_DECL_IN_SPEC
- ;
+ | FPP_CATEG FPP_PROC_DECL_IN_SPEC
+ ;
FPP_CATEG : HNAME HLABELSEPARATOR
- | HVALUE HLABELSEPARATOR
- | HVAR HLABELSEPARATOR
- | /*EMPT*/
- ;
-FPP_PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE
- HIDENTIFIER
- {}
- FPP_HEADING {} { /* Yes, two "final" actions. */ }
- ;
+ | HVALUE HLABELSEPARATOR
+ | HVAR HLABELSEPARATOR
+ | /*EMPT*/
+ ;
+FPP_PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE
+ HIDENTIFIER
+ {}
+ FPP_HEADING {} { /* Yes, two "final" actions. */ }
+ ;
IDENTIFIER_LISTV: HIDENTIFIER
- | HDOTDOTDOT
- | HIDENTIFIER {}
- HPAREXPSEPARATOR IDENTIFIER_LISTV
- ;
+ | HDOTDOTDOT
+ | HIDENTIFIER {}
+ HPAREXPSEPARATOR IDENTIFIER_LISTV
+ ;
MBEE_MODE_PART : /*EMPT*/
- | MODE_PART
- ;
+ | MODE_PART
+ ;
MODE_PART : NAME_PART
- | VALUE_PART
- | VAR_PART
- | NAME_PART VALUE_PART
- | VALUE_PART NAME_PART
- | NAME_PART VAR_PART
- | VAR_PART NAME_PART
- | VALUE_PART VAR_PART
- | VAR_PART VALUE_PART
- | VAR_PART NAME_PART VALUE_PART
- | NAME_PART VAR_PART VALUE_PART
- | NAME_PART VALUE_PART VAR_PART
- | VAR_PART VALUE_PART NAME_PART
- | VALUE_PART VAR_PART NAME_PART
- | VALUE_PART NAME_PART VAR_PART
- ;
+ | VALUE_PART
+ | VAR_PART
+ | NAME_PART VALUE_PART
+ | VALUE_PART NAME_PART
+ | NAME_PART VAR_PART
+ | VAR_PART NAME_PART
+ | VALUE_PART VAR_PART
+ | VAR_PART VALUE_PART
+ | VAR_PART NAME_PART VALUE_PART
+ | NAME_PART VAR_PART VALUE_PART
+ | NAME_PART VALUE_PART VAR_PART
+ | VAR_PART VALUE_PART NAME_PART
+ | VALUE_PART VAR_PART NAME_PART
+ | VALUE_PART NAME_PART VAR_PART
+ ;
NAME_PART : HNAME {}
- IDENTIFIER_LISTV
- HSTATEMENTSEPARATOR
- ;
+ IDENTIFIER_LISTV
+ HSTATEMENTSEPARATOR
+ ;
VAR_PART : HVAR {}
- IDENTIFIER_LISTV
- HSTATEMENTSEPARATOR
- ;
+ IDENTIFIER_LISTV
+ HSTATEMENTSEPARATOR
+ ;
VALUE_PART : HVALUE {}
- IDENTIFIER_LISTV HSTATEMENTSEPARATOR
- ;
+ IDENTIFIER_LISTV HSTATEMENTSEPARATOR
+ ;
MBEE_SPEC_PART : /*EMPT*/
- | SPEC_PART
- ;
+ | SPEC_PART
+ ;
SPEC_PART : ONE_SPEC
- | SPEC_PART ONE_SPEC
- ;
-ONE_SPEC : SPECIFIER IDENTIFIER_LIST HSTATEMENTSEPARATOR
- | NO_TYPE HPROCEDURE HIDENTIFIER HOBJRELOPERATOR
- {}
- PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR
- | FPP_PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR
- | MBEE_TYPE HPROCEDURE HIDENTIFIER HSTATEMENTSEPARATOR
- | MBEE_TYPE HPROCEDURE HIDENTIFIER HPAREXPSEPARATOR
- IDENTIFIER_LIST HSTATEMENTSEPARATOR
- ;
+ | SPEC_PART ONE_SPEC
+ ;
+ONE_SPEC : SPECIFIER IDENTIFIER_LIST HSTATEMENTSEPARATOR
+ | NO_TYPE HPROCEDURE HIDENTIFIER HOBJRELOPERATOR
+ {}
+ PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR
+ | FPP_PROC_DECL_IN_SPEC HSTATEMENTSEPARATOR
+ | MBEE_TYPE HPROCEDURE HIDENTIFIER HSTATEMENTSEPARATOR
+ | MBEE_TYPE HPROCEDURE HIDENTIFIER HPAREXPSEPARATOR
+ IDENTIFIER_LIST HSTATEMENTSEPARATOR
+ ;
SPECIFIER : TYPE
- | MBEE_TYPE
- HARRAY
- | HLABEL
- | HSWITCH
- ;
-PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE
- HIDENTIFIER
- {}
- HEADING
- {}
- MBEE_BEGIN_END
- ;
-MBEE_BEGIN_END : /* EMPTY */
- | HBEGIN HEND
- ;
+ | MBEE_TYPE
+ HARRAY
+ | HLABEL
+ | HSWITCH
+ ;
+PROC_DECL_IN_SPEC: MBEE_TYPE HPROCEDURE
+ HIDENTIFIER
+ {}
+ HEADING
+ {}
+ MBEE_BEGIN_END
+ ;
+MBEE_BEGIN_END : /* EMPTY */
+ | HBEGIN HEND
+ ;
MBEE_PROT_PART : /*EMPT*/
- | PROTECTION_PART
- ;
+ | PROTECTION_PART
+ ;
PROTECTION_PART : PROT_SPECIFIER IDENTIFIER_LIST
- HSTATEMENTSEPARATOR
- | PROTECTION_PART PROT_SPECIFIER
- IDENTIFIER_LIST HSTATEMENTSEPARATOR
- ;
+ HSTATEMENTSEPARATOR
+ | PROTECTION_PART PROT_SPECIFIER
+ IDENTIFIER_LIST HSTATEMENTSEPARATOR
+ ;
PROT_SPECIFIER : HHIDDEN
- | HPROTECTED
- | HHIDDEN
- HPROTECTED
- | HPROTECTED
- HHIDDEN
- ;
+ | HPROTECTED
+ | HHIDDEN
+ HPROTECTED
+ | HPROTECTED
+ HHIDDEN
+ ;
MBEE_VIRT_PART : /*EMPT*/
- | VIRTUAL_PART
- ;
+ | VIRTUAL_PART
+ ;
VIRTUAL_PART : HVIRTUAL
- HLABELSEPARATOR
- MBEE_SPEC_PART
- ;
+ HLABELSEPARATOR
+ MBEE_SPEC_PART
+ ;
IDENTIFIER_LIST : HIDENTIFIER
- | IDENTIFIER_LIST HPAREXPSEPARATOR
- HIDENTIFIER
- ;
+ | IDENTIFIER_LIST HPAREXPSEPARATOR
+ HIDENTIFIER
+ ;
IDENTIFIER_LISTC: HIDENTIFIER
- MBEE_CONSTANT
- | IDENTIFIER_LISTC HPAREXPSEPARATOR
- HIDENTIFIER
- MBEE_CONSTANT
- ;
-MBEE_CONSTANT : /* EMPTY */
- | HVALRELOPERATOR
- {}
- EXPRESSION
- ;
+ MBEE_CONSTANT
+ | IDENTIFIER_LISTC HPAREXPSEPARATOR
+ HIDENTIFIER
+ MBEE_CONSTANT
+ ;
+MBEE_CONSTANT : /* EMPTY */
+ | HVALRELOPERATOR
+ {}
+ EXPRESSION
+ ;
/* GRAMATIKK FOR UTTRYKK */
EXPRESSION : EXPRESSION_SIMP
- | HIF
- EXPRESSION
- HTHEN
- EXPRESSION
- HELSE
- EXPRESSION
- ;
-EXPRESSION_SIMP : EXPRESSION_SIMP
- HASSIGN
- EXPRESSION
- |
-
- EXPRESSION_SIMP
- HCONC
- EXPRESSION_SIMP
- | EXPRESSION_SIMP HOR
- HELSE
- EXPRESSION_SIMP
- %prec HORELSE
- | EXPRESSION_SIMP HAND
- HTHEN
- EXPRESSION_SIMP
- %prec HANDTHEN
- | EXPRESSION_SIMP
- HEQV EXPRESSION_SIMP
- | EXPRESSION_SIMP
- HIMP EXPRESSION_SIMP
- | EXPRESSION_SIMP
- HOR EXPRESSION_SIMP
- | EXPRESSION_SIMP
- HAND EXPRESSION_SIMP
- | HNOT EXPRESSION_SIMP
- | EXPRESSION_SIMP
- HVALRELOPERATOR
- EXPRESSION_SIMP
- | EXPRESSION_SIMP
- HREFRELOPERATOR
- EXPRESSION_SIMP
- | EXPRESSION_SIMP
- HOBJRELOPERATOR
- EXPRESSION_SIMP
- | HTERMOPERATOR
- EXPRESSION_SIMP %prec UNEAR
- | EXPRESSION_SIMP
- HTERMOPERATOR
- EXPRESSION_SIMP
- | EXPRESSION_SIMP
- HFACTOROPERATOR
- EXPRESSION_SIMP
- | EXPRESSION_SIMP
- HPRIMARYOPERATOR
- EXPRESSION_SIMP
- | HBEGPAR
- EXPRESSION HENDPAR
- | HTEXTKONST
- | HCHARACTERKONST
- | HREALKONST
- | HINTEGERKONST
- | HBOOLEANKONST
- | HNONE
- | HIDENTIFIER
- {}
- MBEE_ARG_R_PT
- | HTHIS HIDENTIFIER
- | HNEW
- HIDENTIFIER
- ARG_R_PT
- | EXPRESSION_SIMP
- HDOT
- EXPRESSION_SIMP
- | EXPRESSION_SIMP
- HQUA HIDENTIFIER
- ;
+ | HIF
+ EXPRESSION
+ HTHEN
+ EXPRESSION
+ HELSE
+ EXPRESSION
+ ;
+EXPRESSION_SIMP : EXPRESSION_SIMP
+ HASSIGN
+ EXPRESSION
+ |
+
+ EXPRESSION_SIMP
+ HCONC
+ EXPRESSION_SIMP
+ | EXPRESSION_SIMP HOR
+ HELSE
+ EXPRESSION_SIMP
+ %prec HORELSE
+ | EXPRESSION_SIMP HAND
+ HTHEN
+ EXPRESSION_SIMP
+ %prec HANDTHEN
+ | EXPRESSION_SIMP
+ HEQV EXPRESSION_SIMP
+ | EXPRESSION_SIMP
+ HIMP EXPRESSION_SIMP
+ | EXPRESSION_SIMP
+ HOR EXPRESSION_SIMP
+ | EXPRESSION_SIMP
+ HAND EXPRESSION_SIMP
+ | HNOT EXPRESSION_SIMP
+ | EXPRESSION_SIMP
+ HVALRELOPERATOR
+ EXPRESSION_SIMP
+ | EXPRESSION_SIMP
+ HREFRELOPERATOR
+ EXPRESSION_SIMP
+ | EXPRESSION_SIMP
+ HOBJRELOPERATOR
+ EXPRESSION_SIMP
+ | HTERMOPERATOR
+ EXPRESSION_SIMP %prec UNEAR
+ | EXPRESSION_SIMP
+ HTERMOPERATOR
+ EXPRESSION_SIMP
+ | EXPRESSION_SIMP
+ HFACTOROPERATOR
+ EXPRESSION_SIMP
+ | EXPRESSION_SIMP
+ HPRIMARYOPERATOR
+ EXPRESSION_SIMP
+ | HBEGPAR
+ EXPRESSION HENDPAR
+ | HTEXTKONST
+ | HCHARACTERKONST
+ | HREALKONST
+ | HINTEGERKONST
+ | HBOOLEANKONST
+ | HNONE
+ | HIDENTIFIER
+ {}
+ MBEE_ARG_R_PT
+ | HTHIS HIDENTIFIER
+ | HNEW
+ HIDENTIFIER
+ ARG_R_PT
+ | EXPRESSION_SIMP
+ HDOT
+ EXPRESSION_SIMP
+ | EXPRESSION_SIMP
+ HQUA HIDENTIFIER
+ ;
ARG_R_PT : /*EMPTY*/
- | HBEGPAR
- ARGUMENT_LIST HENDPAR
- ;
+ | HBEGPAR
+ ARGUMENT_LIST HENDPAR
+ ;
MBEE_ARG_R_PT : /*EMPTY*/
- | HBEGPAR
- ARGUMENT_LIST HENDPAR
- ;
+ | HBEGPAR
+ ARGUMENT_LIST HENDPAR
+ ;
ARGUMENT_LIST : EXPRESSION
- | EXPRESSION
- HPAREXPSEPARATOR
- ARGUMENT_LIST
- ;
+ | EXPRESSION
+ HPAREXPSEPARATOR
+ ARGUMENT_LIST
+ ;
]],
dnl INPUT
dnl BISON-STDERR
[AT_COND_CASE([[canonical LR]],
-[[input.y: conflicts: 1876 shift/reduce, 144 reduce/reduce]],
-[[input.y: conflicts: 78 shift/reduce, 10 reduce/reduce]])[
+[[input.y: warning: 1876 shift/reduce conflicts [-Wconflicts-sr]
+input.y: warning: 144 reduce/reduce conflicts [-Wconflicts-rr]]],
+[[input.y: warning: 78 shift/reduce conflicts [-Wconflicts-sr]
+input.y: warning: 10 reduce/reduce conflicts [-Wconflicts-rr]]])[
]],
dnl LAST-STATE
AT_TEST_EXISTING_GRAMMAR([[GNU pic (Groff 1.18.1) Grammar]],
[[%error-verbose
-%union {}
%token LABEL
%token VARIABLE
%token RAND
%token SRAND
%token COPY
-%token THRU
+%token THROUGH
%token TOP
%token BOTTOM
%token UPPER
]],
[[
top:
- optional_separator
- | element_list
- ;
+ optional_separator
+ | element_list
+ ;
element_list:
- optional_separator middle_element_list optional_separator
- ;
+ optional_separator middle_element_list optional_separator
+ ;
middle_element_list:
- element
- | middle_element_list separator element
- ;
+ element
+ | middle_element_list separator element
+ ;
optional_separator:
- /* empty */
- | separator
- ;
+ /* empty */
+ | separator
+ ;
separator:
- ';'
- | separator ';'
- ;
+ ';'
+ | separator ';'
+ ;
placeless_element:
- VARIABLE '=' any_expr
- | VARIABLE ':' '=' any_expr
- | UP
- | DOWN
- | LEFT
- | RIGHT
- | COMMAND_LINE
- | COMMAND print_args
- | PRINT print_args
- | SH
- {}
- DELIMITED
- | COPY TEXT
- | COPY TEXT THRU
- {}
- DELIMITED
- {}
- until
- | COPY THRU
- {}
- DELIMITED
- {}
- until
- | FOR VARIABLE '=' expr TO expr optional_by DO
- {}
- DELIMITED
- | simple_if
- | simple_if ELSE
- {}
- DELIMITED
- | reset_variables
- | RESET
- ;
+ VARIABLE '=' any_expr
+ | VARIABLE ':' '=' any_expr
+ | UP
+ | DOWN
+ | LEFT
+ | RIGHT
+ | COMMAND_LINE
+ | COMMAND print_args
+ | PRINT print_args
+ | SH
+ {}
+ DELIMITED
+ | COPY TEXT
+ | COPY TEXT THROUGH
+ {}
+ DELIMITED
+ {}
+ until
+ | COPY THROUGH
+ {}
+ DELIMITED
+ {}
+ until
+ | FOR VARIABLE '=' expr TO expr optional_by DO
+ {}
+ DELIMITED
+ | simple_if
+ | simple_if ELSE
+ {}
+ DELIMITED
+ | reset_variables
+ | RESET
+ ;
reset_variables:
- RESET VARIABLE
- | reset_variables VARIABLE
- | reset_variables ',' VARIABLE
- ;
+ RESET VARIABLE
+ | reset_variables VARIABLE
+ | reset_variables ',' VARIABLE
+ ;
print_args:
- print_arg
- | print_args print_arg
- ;
+ print_arg
+ | print_args print_arg
+ ;
print_arg:
- expr %prec ','
- | text
- | position %prec ','
- ;
+ expr %prec ','
+ | text
+ | position %prec ','
+ ;
simple_if:
- IF any_expr THEN
- {}
- DELIMITED
- ;
+ IF any_expr THEN
+ {}
+ DELIMITED
+ ;
until:
- /* empty */
- | UNTIL TEXT
- ;
+ /* empty */
+ | UNTIL TEXT
+ ;
any_expr:
- expr
- | text_expr
- ;
+ expr
+ | text_expr
+ ;
text_expr:
- text EQUALEQUAL text
- | text NOTEQUAL text
- | text_expr ANDAND text_expr
- | text_expr ANDAND expr
- | expr ANDAND text_expr
- | text_expr OROR text_expr
- | text_expr OROR expr
- | expr OROR text_expr
- | '!' text_expr
- ;
+ text EQUALEQUAL text
+ | text NOTEQUAL text
+ | text_expr ANDAND text_expr
+ | text_expr ANDAND expr
+ | expr ANDAND text_expr
+ | text_expr OROR text_expr
+ | text_expr OROR expr
+ | expr OROR text_expr
+ | '!' text_expr
+ ;
optional_by:
- /* empty */
- | BY expr
- | BY '*' expr
- ;
+ /* empty */
+ | BY expr
+ | BY '*' expr
+ ;
element:
- object_spec
- | LABEL ':' optional_separator element
- | LABEL ':' optional_separator position_not_place
- | LABEL ':' optional_separator place
- | '{' {} element_list '}'
- {}
- optional_element
- | placeless_element
- ;
+ object_spec
+ | LABEL ':' optional_separator element
+ | LABEL ':' optional_separator position_not_place
+ | LABEL ':' optional_separator place
+ | '{' {} element_list '}'
+ {}
+ optional_element
+ | placeless_element
+ ;
optional_element:
- /* empty */
- | element
- ;
+ /* empty */
+ | element
+ ;
object_spec:
- BOX
- | CIRCLE
- | ELLIPSE
- | ARC
- | LINE
- | ARROW
- | MOVE
- | SPLINE
- | text %prec TEXT
- | PLOT expr
- | PLOT expr text
- | '['
- {}
- element_list ']'
- | object_spec HEIGHT expr
- | object_spec RADIUS expr
- | object_spec WIDTH expr
- | object_spec DIAMETER expr
- | object_spec expr %prec HEIGHT
- | object_spec UP
- | object_spec UP expr
- | object_spec DOWN
- | object_spec DOWN expr
- | object_spec RIGHT
- | object_spec RIGHT expr
- | object_spec LEFT
- | object_spec LEFT expr
- | object_spec FROM position
- | object_spec TO position
- | object_spec AT position
- | object_spec WITH path
- | object_spec WITH position %prec ','
- | object_spec BY expr_pair
- | object_spec THEN
- | object_spec SOLID
- | object_spec DOTTED
- | object_spec DOTTED expr
- | object_spec DASHED
- | object_spec DASHED expr
- | object_spec FILL
- | object_spec FILL expr
- | object_spec SHADED text
- | object_spec COLORED text
- | object_spec OUTLINED text
- | object_spec CHOP
- | object_spec CHOP expr
- | object_spec SAME
- | object_spec INVISIBLE
- | object_spec LEFT_ARROW_HEAD
- | object_spec RIGHT_ARROW_HEAD
- | object_spec DOUBLE_ARROW_HEAD
- | object_spec CW
- | object_spec CCW
- | object_spec text %prec TEXT
- | object_spec LJUST
- | object_spec RJUST
- | object_spec ABOVE
- | object_spec BELOW
- | object_spec THICKNESS expr
- | object_spec ALIGNED
- ;
+ BOX
+ | CIRCLE
+ | ELLIPSE
+ | ARC
+ | LINE
+ | ARROW
+ | MOVE
+ | SPLINE
+ | text %prec TEXT
+ | PLOT expr
+ | PLOT expr text
+ | '['
+ {}
+ element_list ']'
+ | object_spec HEIGHT expr
+ | object_spec RADIUS expr
+ | object_spec WIDTH expr
+ | object_spec DIAMETER expr
+ | object_spec expr %prec HEIGHT
+ | object_spec UP
+ | object_spec UP expr
+ | object_spec DOWN
+ | object_spec DOWN expr
+ | object_spec RIGHT
+ | object_spec RIGHT expr
+ | object_spec LEFT
+ | object_spec LEFT expr
+ | object_spec FROM position
+ | object_spec TO position
+ | object_spec AT position
+ | object_spec WITH path
+ | object_spec WITH position %prec ','
+ | object_spec BY expr_pair
+ | object_spec THEN
+ | object_spec SOLID
+ | object_spec DOTTED
+ | object_spec DOTTED expr
+ | object_spec DASHED
+ | object_spec DASHED expr
+ | object_spec FILL
+ | object_spec FILL expr
+ | object_spec SHADED text
+ | object_spec COLORED text
+ | object_spec OUTLINED text
+ | object_spec CHOP
+ | object_spec CHOP expr
+ | object_spec SAME
+ | object_spec INVISIBLE
+ | object_spec LEFT_ARROW_HEAD
+ | object_spec RIGHT_ARROW_HEAD
+ | object_spec DOUBLE_ARROW_HEAD
+ | object_spec CW
+ | object_spec CCW
+ | object_spec text %prec TEXT
+ | object_spec LJUST
+ | object_spec RJUST
+ | object_spec ABOVE
+ | object_spec BELOW
+ | object_spec THICKNESS expr
+ | object_spec ALIGNED
+ ;
text:
- TEXT
- | SPRINTF '(' TEXT sprintf_args ')'
- ;
+ TEXT
+ | SPRINTF '(' TEXT sprintf_args ')'
+ ;
sprintf_args:
- /* empty */
- | sprintf_args ',' expr
- ;
+ /* empty */
+ | sprintf_args ',' expr
+ ;
position:
- position_not_place
- | place
- ;
+ position_not_place
+ | place
+ ;
position_not_place:
- expr_pair
- | position '+' expr_pair
- | position '-' expr_pair
- | '(' position ',' position ')'
- | expr between position AND position
- | expr '<' position ',' position '>'
- ;
+ expr_pair
+ | position '+' expr_pair
+ | position '-' expr_pair
+ | '(' position ',' position ')'
+ | expr between position AND position
+ | expr '<' position ',' position '>'
+ ;
between:
- BETWEEN
- | OF THE WAY BETWEEN
- ;
+ BETWEEN
+ | OF THE WAY BETWEEN
+ ;
expr_pair:
- expr ',' expr
- | '(' expr_pair ')'
- ;
+ expr ',' expr
+ | '(' expr_pair ')'
+ ;
place:
- /* line at A left == line (at A) left */
- label %prec CHOP
- | label corner
- | corner label
- | corner OF label
- | HERE
- ;
+ /* line at A left == line (at A) left */
+ label %prec CHOP
+ | label corner
+ | corner label
+ | corner OF label
+ | HERE
+ ;
label:
- LABEL
- | nth_primitive
- | label '.' LABEL
- ;
+ LABEL
+ | nth_primitive
+ | label '.' LABEL
+ ;
ordinal:
- ORDINAL
- | '`' any_expr TH
- ;
+ ORDINAL
+ | '`' any_expr TH
+ ;
optional_ordinal_last:
- LAST
- | ordinal LAST
- ;
+ LAST
+ | ordinal LAST
+ ;
nth_primitive:
- ordinal object_type
- | optional_ordinal_last object_type
- ;
+ ordinal object_type
+ | optional_ordinal_last object_type
+ ;
object_type:
- BOX
- | CIRCLE
- | ELLIPSE
- | ARC
- | LINE
- | ARROW
- | SPLINE
- | '[' ']'
- | TEXT
- ;
+ BOX
+ | CIRCLE
+ | ELLIPSE
+ | ARC
+ | LINE
+ | ARROW
+ | SPLINE
+ | '[' ']'
+ | TEXT
+ ;
label_path:
- '.' LABEL
- | label_path '.' LABEL
- ;
+ '.' LABEL
+ | label_path '.' LABEL
+ ;
relative_path:
- corner %prec CHOP
- /* give this a lower precedence than LEFT and RIGHT so that
- [A: box] with .A left == [A: box] with (.A left) */
- | label_path %prec TEXT
- | label_path corner
- ;
+ corner %prec CHOP
+ /* give this a lower precedence than LEFT and RIGHT so that
+ [A: box] with .A left == [A: box] with (.A left) */
+ | label_path %prec TEXT
+ | label_path corner
+ ;
path:
- relative_path
- | '(' relative_path ',' relative_path ')'
- {}
- /* The rest of these rules are a compatibility sop. */
- | ORDINAL LAST object_type relative_path
- | LAST object_type relative_path
- | ORDINAL object_type relative_path
- | LABEL relative_path
- ;
+ relative_path
+ | '(' relative_path ',' relative_path ')'
+ {}
+ /* The rest of these rules are a compatibility sop. */
+ | ORDINAL LAST object_type relative_path
+ | LAST object_type relative_path
+ | ORDINAL object_type relative_path
+ | LABEL relative_path
+ ;
corner:
- DOT_N
- | DOT_E
- | DOT_W
- | DOT_S
- | DOT_NE
- | DOT_SE
- | DOT_NW
- | DOT_SW
- | DOT_C
- | DOT_START
- | DOT_END
- | TOP
- | BOTTOM
- | LEFT
- | RIGHT
- | UPPER LEFT
- | LOWER LEFT
- | UPPER RIGHT
- | LOWER RIGHT
- | LEFT_CORNER
- | RIGHT_CORNER
- | UPPER LEFT_CORNER
- | LOWER LEFT_CORNER
- | UPPER RIGHT_CORNER
- | LOWER RIGHT_CORNER
- | NORTH
- | SOUTH
- | EAST
- | WEST
- | CENTER
- | START
- | END
- ;
+ DOT_N
+ | DOT_E
+ | DOT_W
+ | DOT_S
+ | DOT_NE
+ | DOT_SE
+ | DOT_NW
+ | DOT_SW
+ | DOT_C
+ | DOT_START
+ | DOT_END
+ | TOP
+ | BOTTOM
+ | LEFT
+ | RIGHT
+ | UPPER LEFT
+ | LOWER LEFT
+ | UPPER RIGHT
+ | LOWER RIGHT
+ | LEFT_CORNER
+ | RIGHT_CORNER
+ | UPPER LEFT_CORNER
+ | LOWER LEFT_CORNER
+ | UPPER RIGHT_CORNER
+ | LOWER RIGHT_CORNER
+ | NORTH
+ | SOUTH
+ | EAST
+ | WEST
+ | CENTER
+ | START
+ | END
+ ;
expr:
- VARIABLE
- | NUMBER
- | place DOT_X
- | place DOT_Y
- | place DOT_HT
- | place DOT_WID
- | place DOT_RAD
- | expr '+' expr
- | expr '-' expr
- | expr '*' expr
- | expr '/' expr
- | expr '%' expr
- | expr '^' expr
- | '-' expr %prec '!'
- | '(' any_expr ')'
- | SIN '(' any_expr ')'
- | COS '(' any_expr ')'
- | ATAN2 '(' any_expr ',' any_expr ')'
- | LOG '(' any_expr ')'
- | EXP '(' any_expr ')'
- | SQRT '(' any_expr ')'
- | K_MAX '(' any_expr ',' any_expr ')'
- | K_MIN '(' any_expr ',' any_expr ')'
- | INT '(' any_expr ')'
- | RAND '(' any_expr ')'
- | RAND '(' ')'
- | SRAND '(' any_expr ')'
- | expr '<' expr
- | expr LESSEQUAL expr
- | expr '>' expr
- | expr GREATEREQUAL expr
- | expr EQUALEQUAL expr
- | expr NOTEQUAL expr
- | expr ANDAND expr
- | expr OROR expr
- | '!' expr
- ;
+ VARIABLE
+ | NUMBER
+ | place DOT_X
+ | place DOT_Y
+ | place DOT_HT
+ | place DOT_WID
+ | place DOT_RAD
+ | expr '+' expr
+ | expr '-' expr
+ | expr '*' expr
+ | expr '/' expr
+ | expr '%' expr
+ | expr '^' expr
+ | '-' expr %prec '!'
+ | '(' any_expr ')'
+ | SIN '(' any_expr ')'
+ | COS '(' any_expr ')'
+ | ATAN2 '(' any_expr ',' any_expr ')'
+ | LOG '(' any_expr ')'
+ | EXP '(' any_expr ')'
+ | SQRT '(' any_expr ')'
+ | K_MAX '(' any_expr ',' any_expr ')'
+ | K_MIN '(' any_expr ',' any_expr ')'
+ | INT '(' any_expr ')'
+ | RAND '(' any_expr ')'
+ | RAND '(' ')'
+ | SRAND '(' any_expr ')'
+ | expr '<' expr
+ | expr LESSEQUAL expr
+ | expr '>' expr
+ | expr GREATEREQUAL expr
+ | expr EQUALEQUAL expr
+ | expr NOTEQUAL expr
+ | expr ANDAND expr
+ | expr OROR expr
+ | '!' expr
+ ;
]],
dnl INPUT
[[VARIABLE, '=', LABEL, LEFT, DOT_X]],
dnl BISON-STDERR
-[[input.y:471.11-48: warning: rule useless in parser due to conflicts: path: ORDINAL LAST object_type relative_path
+[[input.y:470.11-48: warning: rule useless in parser due to conflicts: path: ORDINAL LAST object_type relative_path [-Wother]
]],
dnl LAST-STATE
nth_primitive go to state 105
@@ -3256,7 +3256,7 @@
- state 102
+ State 102
- 146 place: label . [$end, LABEL, VARIABLE, NUMBER, TEXT, ORDINAL, LEFT_ARROW_HEAD, RIGHT_ARROW_HEAD, DOUBLE_ARROW_HEAD, LAST, UP, DOWN, LEFT, RIGHT, HEIGHT, RADIUS, WIDTH, DIAMETER, FROM, TO, AT, WITH, BY, THEN, SOLID, DOTTED, DASHED, CHOP, SAME, INVISIBLE, LJUST, RJUST, ABOVE, BELOW, AND, HERE, DOT_X, DOT_Y, DOT_HT, DOT_WID, DOT_RAD, SIN, COS, ATAN2, LOG, EXP, SQRT, K_MAX, K_MIN, INT, RAND, SRAND, CW, CCW, THICKNESS, FILL, COLORED, OUTLINED, SHADED, ALIGNED, SPRINTF, '(', '`', ',', '>', '+', '-', '!', ';', '}', '@:>@', ')']
+ 146 place: label . [$end, LABEL, VARIABLE, NUMBER, TEXT, ORDINAL, LEFT_ARROW_HEAD, RIGHT_ARROW_HEAD, DOUBLE_ARROW_HEAD, LAST, UP, DOWN, LEFT, RIGHT, HEIGHT, RADIUS, WIDTH, DIAMETER, FROM, TO, AT, WITH, BY, THEN, SOLID, DOTTED, DASHED, CHOP, SAME, INVISIBLE, LJUST, RJUST, ABOVE, BELOW, HERE, DOT_X, DOT_Y, DOT_HT, DOT_WID, DOT_RAD, SIN, COS, ATAN2, LOG, EXP, SQRT, K_MAX, K_MIN, INT, RAND, SRAND, CW, CCW, THICKNESS, FILL, COLORED, OUTLINED, SHADED, ALIGNED, SPRINTF, '(', '`', '+', '-', '!', ';', '}', '@:>@']
+ expr go to state 424
- state 165
+ State 165
@@ -7987,7 +7987,7 @@
text_expr go to state 112
text go to state 113
+ between go to state 425
- state 193
+ State 193
@@ -10152,7 +10152,7 @@
expr_pair go to state 317
+ expr go to state 424
- state 238
+ State 238
@@ -12937,7 +12937,7 @@
'!' shift, and go to state 94
+ expr go to state 424
- state 315
+ State 315
@@ -16124,7 +16124,7 @@
$default reduce using rule 239 (expr)
+ expr go to state 424
- state 383
+ State 383
@@ -18071,7 +18071,7 @@
'!' shift, and go to state 94
$default reduce using rule 29 (placeless_element)
+
+
-+state 423
++State 423
+
+ 146 place: label . [$end, AND, DOT_X, DOT_Y, DOT_HT, DOT_WID, DOT_RAD, ',', '>', '+', '-', ';', '}', '@:>@', ')']
+ 147 | label . corner
+ corner go to state 205
+
+
-+state 424
++State 424
+
+ 140 position_not_place: expr . between position AND position
+ 141 | expr . '<' position ',' position '>'
+ between go to state 425
+
+
-+state 425
++State 425
+
+ 134 position: . position_not_place
+ 135 | . place
+ expr go to state 424
+
+
-+state 426
++State 426
+
+ 137 position_not_place: position . '+' expr_pair
+ 138 | position . '-' expr_pair
+ '-' shift, and go to state 198
+
+
-+state 427
++State 427
+
+ 134 position: . position_not_place
+ 135 | . place