diff --git a/src/parse-gram.c b/src/parse-gram.c index 4faf9772..26a4ee98 100644 --- a/src/parse-gram.c +++ b/src/parse-gram.c @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.0.4.38-1047-dirty. */ +/* A Bison parser, made by GNU Bison 3.0.5.23-f58b-dirty. */ /* Bison implementation for Yacc-like parsers in C @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "3.0.4.38-1047-dirty" +#define YYBISON_VERSION "3.0.5.23-f58b-dirty" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -2608,13 +2608,13 @@ yyreduce: case 89: #line 617 "src/parse-gram.y" /* yacc.c:1648 */ - { grammar_current_rule_action_append ((yyvsp[-1].code), (yylsp[-1]), (yyvsp[0].named_ref), false); } + { grammar_current_rule_action_append ((yyvsp[-1].code), (yylsp[-1]), (yyvsp[0].named_ref)); } #line 2613 "src/parse-gram.c" /* yacc.c:1648 */ break; case 90: #line 619 "src/parse-gram.y" /* yacc.c:1648 */ - { grammar_current_rule_action_append ((yyvsp[0].code), (yylsp[0]), NULL, true); } + { grammar_current_rule_predicate_append ((yyvsp[0].code), (yylsp[0])); } #line 2619 "src/parse-gram.c" /* yacc.c:1648 */ break; diff --git a/src/parse-gram.h b/src/parse-gram.h index 450a7682..b41e3a7b 100644 --- a/src/parse-gram.h +++ b/src/parse-gram.h @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.0.4.38-1047-dirty. */ +/* A Bison parser, made by GNU Bison 3.0.5.23-f58b-dirty. */ /* Bison interface for Yacc-like parsers in C diff --git a/src/parse-gram.y b/src/parse-gram.y index 39088cb0..be597ae2 100644 --- a/src/parse-gram.y +++ b/src/parse-gram.y @@ -614,9 +614,9 @@ rhs: | rhs symbol named_ref.opt { grammar_current_rule_symbol_append ($2, @2, $3); } | rhs "{...}" named_ref.opt - { grammar_current_rule_action_append ($2, @2, $3, false); } + { grammar_current_rule_action_append ($2, @2, $3); } | rhs "%?{...}" - { grammar_current_rule_action_append ($2, @2, NULL, true); } + { grammar_current_rule_predicate_append ($2, @2); } | rhs "%empty" { grammar_current_rule_empty_set (@2); } | rhs "%prec" symbol diff --git a/src/reader.c b/src/reader.c index c220d707..9a306142 100644 --- a/src/reader.c +++ b/src/reader.c @@ -522,18 +522,27 @@ grammar_current_rule_symbol_append (symbol *sym, location loc, sym->content->status = needed; } -/* Attach an ACTION to the current rule. */ - void grammar_current_rule_action_append (const char *action, location loc, - named_ref *name, bool is_predicate) + named_ref *name) { if (current_rule->action_props.code) grammar_midrule_action (); /* After all symbol declarations have been parsed, packgram invokes code_props_translate_code. */ code_props_rule_action_init (¤t_rule->action_props, action, loc, - current_rule, name, is_predicate); + current_rule, name, + /* is_predicate */ false); +} + +void +grammar_current_rule_predicate_append (const char *pred, location loc) +{ + if (current_rule->action_props.code) + grammar_midrule_action (); + code_props_rule_action_init (¤t_rule->action_props, pred, loc, + current_rule, NULL, + /* is_predicate */ true); } diff --git a/src/reader.h b/src/reader.h index 14e35a94..404262ac 100644 --- a/src/reader.h +++ b/src/reader.h @@ -54,8 +54,11 @@ void grammar_current_rule_dprec_set (int dprec, location loc); void grammar_current_rule_merge_set (uniqstr name, location loc); void grammar_current_rule_symbol_append (symbol *sym, location loc, named_ref *nref); +/* Attach an ACTION to the current rule. */ void grammar_current_rule_action_append (const char *action, location loc, - named_ref *nref, bool); + named_ref *nref); +/* Attach a PREDICATE to the current rule. */ +void grammar_current_rule_predicate_append (const char *predicate, location loc); void reader (void); void free_merger_functions (void);