From abf35973bb7128689b94a0e518cc50d26c4d5e10 Mon Sep 17 00:00:00 2001 From: François Pottier Date: Fri, 23 Oct 2015 11:44:52 +0200 Subject: Remove all productions that involve the [error] token. These productions were used to give better error messages in some situations. They are no longer useful, since we are building a whole new system for reporting errors. --- cparser/pre_parser.mly | 34 ---------------------------------- 1 file changed, 34 deletions(-) (limited to 'cparser/pre_parser.mly') diff --git a/cparser/pre_parser.mly b/cparser/pre_parser.mly index 52a94078..23ef1bc5 100644 --- a/cparser/pre_parser.mly +++ b/cparser/pre_parser.mly @@ -25,16 +25,6 @@ let declare_typename (i,_,_) = !declare_typename i - let syntax_error pos = - Cerrors.fatal_error "%s:%d: syntax error" - pos.Lexing.pos_fname pos.Lexing.pos_lnum - - let unclosed opening closing pos1 pos2 = - Cerrors.info "%s:%d: syntax error: expecting '%s'" - pos2.Lexing.pos_fname pos2.Lexing.pos_lnum closing; - Cerrors.fatal_error "%s:%d: this is the location of the unclosed '%s'" - pos1.Lexing.pos_fname pos1.Lexing.pos_lnum opening - %} %token @@ -163,30 +153,18 @@ primary_expression: | string_literals_list | LPAREN expression RPAREN {} -| LPAREN expression error - { unclosed "(" ")" $startpos($1) $endpos } postfix_expression: | primary_expression | postfix_expression LBRACK expression RBRACK | postfix_expression LPAREN argument_expression_list? RPAREN - {} -| postfix_expression LPAREN argument_expression_list? error - { unclosed "(" ")" $startpos($2) $endpos } | BUILTIN_VA_ARG LPAREN assignment_expression COMMA type_name RPAREN - {} -| BUILTIN_VA_ARG LPAREN assignment_expression COMMA type_name error - { unclosed "(" ")" $startpos($2) $endpos } | postfix_expression DOT other_identifier | postfix_expression PTR other_identifier | postfix_expression INC | postfix_expression DEC | LPAREN type_name RPAREN LBRACE initializer_list COMMA? RBRACE {} -| LPAREN type_name error - { unclosed "(" ")" $startpos($1) $endpos } -| LPAREN type_name RPAREN LBRACE initializer_list COMMA? error - { unclosed "{" "}" $startpos($4) $endpos } argument_expression_list: | assignment_expression @@ -425,8 +403,6 @@ struct_or_union_specifier: | struct_or_union attribute_specifier_list other_identifier? LBRACE struct_declaration_list RBRACE | struct_or_union attribute_specifier_list other_identifier {} -| struct_or_union attribute_specifier_list other_identifier? LBRACE struct_declaration_list error - { unclosed "{" "}" $startpos($4) $endpos } struct_or_union: | STRUCT @@ -468,8 +444,6 @@ enum_specifier: | ENUM attribute_specifier_list other_identifier? LBRACE enumerator_list COMMA? RBRACE | ENUM attribute_specifier_list other_identifier {} -| ENUM attribute_specifier_list other_identifier? LBRACE enumerator_list COMMA? error - { unclosed "{" "}" $startpos($4) $endpos } enumerator_list: | declare_varname(enumerator) @@ -598,8 +572,6 @@ c_initializer: | assignment_expression | LBRACE initializer_list COMMA? RBRACE {} -| LBRACE initializer_list COMMA? error - { unclosed "{" "}" $startpos($1) $endpos } initializer_list: | designation? c_initializer @@ -677,8 +649,6 @@ labeled_statement(last_statement): compound_statement(openc): | LBRACE openc block_item_list? close_context RBRACE {} -| LBRACE openc block_item_list? close_context error - { unclosed "{" "}" $startpos($1) $endpos } block_item_list: | block_item_list? block_item @@ -820,8 +790,6 @@ translation_unit_file: | translation_unit EOF | EOF {} -| error - { syntax_error $endpos } translation_unit: | external_declaration @@ -866,5 +834,3 @@ declaration_list: function_definition: | function_definition_begin LBRACE block_item_list? close_context RBRACE {} -| function_definition_begin LBRACE block_item_list? close_context error - { unclosed "{" "}" $startpos($2) $endpos } -- cgit