diff options
author | François Pottier <francois.pottier@inria.fr> | 2015-10-23 13:04:34 +0200 |
---|---|---|
committer | François Pottier <francois.pottier@inria.fr> | 2015-10-23 13:04:34 +0200 |
commit | 883ebf950a4ef38788792cb1129fb9c408225ad3 (patch) | |
tree | 118872ed934832bd4f11f7f34b430993c5af9765 | |
parent | 073e50a2b795f68e59075d6e365e72b4bd2417c1 (diff) | |
download | compcert-883ebf950a4ef38788792cb1129fb9c408225ad3.tar.gz compcert-883ebf950a4ef38788792cb1129fb9c408225ad3.zip |
Added an %on_error_reduce declaration.
This affects in which states errors are detected,
but does not change the language that is accepted.
-rw-r--r-- | cparser/pre_parser.mly | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/cparser/pre_parser.mly b/cparser/pre_parser.mly index e55389ba..1de726be 100644 --- a/cparser/pre_parser.mly +++ b/cparser/pre_parser.mly @@ -60,6 +60,48 @@ %nonassoc highPrec %start<unit> translation_unit_file + +(* The following declarations cause certain nonterminal symbols to be + reduced when an error is detected. This replaces error actions in + the automaton with reduction actions. So, if the input is correct, + this makes no difference, and if the input is incorrect, this only + forces a few more reductions to take place before the error is + detected and reported. If used properly, this facilitates error + reports. *) + +%on_error_reduce + primary_expression + postfix_expression + unary_expression + cast_expression + multiplicative_expression + additive_expression + shift_expression + relational_expression + equality_expression + and_expression + exclusive_or_expression + inclusive_or_expression + logical_and_expression + logical_or_expression + conditional_expression + assignment_expression + expression + attribute_specifier_list + declarator + statement_finish_close + iteration_statement(nop,statement_finish_close) + enum_specifier + struct_or_union_specifier + specifier_qualifier_list(struct_declaration) + specifier_qualifier_list(type_name) + option(abstract_declarator(type_name)) + abstract_declarator(type_name) + abstract_declarator(parameter_declaration) + asm_flags + asm_operands + init_declarator + %% (* Helpers *) |