Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    rafe9e45 r5c216b4  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Feb 25 17:54:56 2022
    13 // Update Count     : 5262
     12// Last Modified On : Sat Feb 19 09:47:20 2022
     13// Update Count     : 5218
    1414//
    1515
     
    610610        // | RESUME '(' comma_expression ')' compound_statement
    611611        //      { SemanticError( yylloc, "Resume expression is currently unimplemented." ); $$ = nullptr; }
    612         | IDENTIFIER IDENTIFIER                                                         // syntax error
    613                 {
    614                         SemanticError( yylloc, ::toString( "Adjacent identifiers are not meaningful in an expression. "
    615                                                                                            "Possible problem is identifier \"", *$1.str,
    616                                                                                            "\" is a misspelled typename or an incorrectly specified type name, "
    617                                                                                            "e.g., missing generic parameter or missing struct/union/enum before typename." ) );
    618                         $$ = nullptr;
    619                 }
    620         | IDENTIFIER direct_type                                                        // syntax error
    621                 {
    622                         SemanticError( yylloc, ::toString( "Identifier \"", *$1.str, "\" cannot appear before a type. "
    623                                                                                            "Possible problem is misspelled storage or CV qualifier." ) );
    624                         $$ = nullptr;
    625                 }
    626612        ;
    627613
     
    10661052        identifier_or_type_name ':' attribute_list_opt statement
    10671053                { $$ = $4->add_label( $1, $3 ); }
    1068         | identifier_or_type_name ':' attribute_list_opt error // syntax error
    1069                 {
    1070                         SemanticError( yylloc, ::toString( "Label \"", *$1.str, "\" must be associated with a statement, "
    1071                                                                                            "where a declaration, case, or default is not a statement. "
    1072                                                                                            "Move the label or terminate with a semi-colon." ) );
    1073                         $$ = nullptr;
    1074                 }
     1054        | identifier_or_type_name ':' attribute_list_opt error
     1055                { SemanticError( yylloc, "previous label must be associated with a statement (where a declaration is not a statement). Move the label or terminate with a semi-colon." ); $$ = nullptr; }
    10751056        ;
    10761057
     
    11071088        | statement_list_nodecl statement
    11081089                { assert( $1 ); $1->set_last( $2 ); $$ = $1; }
    1109         | statement_list_nodecl error                                           // syntax error
    1110                 { SemanticError( yylloc, "Declarations only allowed at the start of the switch body, i.e., after the '{'." ); $$ = nullptr; }
     1090        | statement_list_nodecl error
     1091                { SemanticError( yylloc, "declarations only allowed at the start of the switch body, i.e., after the '{'." ); $$ = nullptr; }
    11111092        ;
    11121093
     
    11351116                        $$ = $7 ? new StatementNode( build_compound( (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw;
    11361117                }
    1137         | SWITCH '(' comma_expression ')' '{' error '}'         // CFA, syntax error
    1138                 { SemanticError( yylloc, "Only declarations can appear before the list of case clauses." ); $$ = nullptr; }
     1118        | SWITCH '(' comma_expression ')' '{' error '}'         // CFA
     1119                { SemanticError( yylloc, "only declarations can appear before the list of case clauses." ); $$ = nullptr; }
    11391120        | CHOOSE '(' comma_expression ')' case_clause           // CFA
    11401121                { $$ = new StatementNode( build_switch( false, $3, $5 ) ); }
     
    11441125                        $$ = $7 ? new StatementNode( build_compound( (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw;
    11451126                }
    1146         | CHOOSE '(' comma_expression ')' '{' error '}'         // CFA, syntax error
    1147                 { SemanticError( yylloc, "Only declarations can appear before the list of case clauses." ); $$ = nullptr; }
     1127        | CHOOSE '(' comma_expression ')' '{' error '}'         // CFA
     1128                { SemanticError( yylloc, "only declarations can appear before the list of case clauses." ); $$ = nullptr; }
    11481129        ;
    11491130
     
    11841165
    11851166case_label:                                                                                             // CFA
    1186         CASE error                                                                                      // syntax error
    1187                 { SemanticError( yylloc, "Missing case list after case." ); $$ = nullptr; }
     1167        CASE error
     1168                { SemanticError( yylloc, "missing case list after case." ); $$ = nullptr; }
    11881169        | CASE case_value_list ':'                                      { $$ = $2; }
    1189         | CASE case_value_list error                                            // syntax error
    1190                 { SemanticError( yylloc, "Missing colon after case list." ); $$ = nullptr; }
     1170        | CASE case_value_list error
     1171                { SemanticError( yylloc, "missing colon after case list." ); $$ = nullptr; }
    11911172        | DEFAULT ':'                                                           { $$ = new StatementNode( build_default() ); }
    11921173                // A semantic check is required to ensure only one default clause per switch/choose statement.
    1193         | DEFAULT error                                                                         //  syntax error
    1194                 { SemanticError( yylloc, "Missing colon after default." ); $$ = nullptr; }
     1174        | DEFAULT error
     1175                { SemanticError( yylloc, "missing colon after default." ); $$ = nullptr; }
    11951176        ;
    11961177
     
    14291410        | when_clause_opt ELSE statement
    14301411                { $$ = build_waitfor_timeout( nullptr, maybe_build_compound( $3 ), $1 ); }
    1431         // "else" must be conditional after timeout or timeout is never triggered (i.e., it is meaningless)
    1432         | when_clause_opt timeout statement WOR ELSE statement // syntax error
     1412                // "else" must be conditional after timeout or timeout is never triggered (i.e., it is meaningless)
     1413        | when_clause_opt timeout statement WOR ELSE statement
    14331414                { SemanticError( yylloc, "else clause must be conditional after timeout or timeout never triggered." ); $$ = nullptr; }
    14341415        | when_clause_opt timeout statement WOR when_clause ELSE statement
Note: See TracChangeset for help on using the changeset viewer.