Ignore:
Timestamp:
Jun 9, 2023, 2:30:05 PM (11 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ast-experimental, master
Children:
37b2c2c
Parents:
01fac29
Message:

update comments for special invalid syntax rules

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r01fac29 r0442f93f  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jun  6 22:37:59 2023
    13 // Update Count     : 6340
     12// Last Modified On : Wed Jun  7 14:32:28 2023
     13// Update Count     : 6341
    1414//
    1515
     
    689689        // | RESUME '(' comma_expression ')' compound_statement
    690690        //      { SemanticError( yylloc, "Resume expression is currently unimplemented." ); $$ = nullptr; }
    691         | IDENTIFIER IDENTIFIER                                                         // syntax error
     691        | IDENTIFIER IDENTIFIER                                                         // invalid syntax rules
    692692                { IdentifierBeforeIdentifier( *$1.str, *$2.str, "n expression" ); $$ = nullptr; }
    693         | IDENTIFIER type_qualifier                                                     // syntax error
     693        | IDENTIFIER type_qualifier                                                     // invalid syntax rules
    694694                { IdentifierBeforeType( *$1.str, "type qualifier" ); $$ = nullptr; }
    695         | IDENTIFIER storage_class                                                      // syntax error
     695        | IDENTIFIER storage_class                                                      // invalid syntax rules
    696696                { IdentifierBeforeType( *$1.str, "storage class" ); $$ = nullptr; }
    697         | IDENTIFIER basic_type_name                                            // syntax error
     697        | IDENTIFIER basic_type_name                                            // invalid syntax rules
    698698                { IdentifierBeforeType( *$1.str, "type" ); $$ = nullptr; }
    699         | IDENTIFIER TYPEDEFname                                                        // syntax error
     699        | IDENTIFIER TYPEDEFname                                                        // invalid syntax rules
    700700                { IdentifierBeforeType( *$1.str, "type" ); $$ = nullptr; }
    701         | IDENTIFIER TYPEGENname                                                        // syntax error
     701        | IDENTIFIER TYPEGENname                                                        // invalid syntax rules
    702702                { IdentifierBeforeType( *$1.str, "type" ); $$ = nullptr; }
    703703        ;
     
    11521152        identifier_or_type_name ':' attribute_list_opt statement
    11531153                { $$ = $4->add_label( yylloc, $1, $3 ); }
    1154         | identifier_or_type_name ':' attribute_list_opt error // syntax error
     1154        | identifier_or_type_name ':' attribute_list_opt error // invalid syntax rule
    11551155                {
    11561156                        SemanticError( yylloc, ::toString( "syntx error, label \"", *$1.str, "\" must be associated with a statement, "
     
    11931193        | statement_list_nodecl statement
    11941194                { assert( $1 ); $1->set_last( $2 ); $$ = $1; }
    1195         | statement_list_nodecl error                                           // syntax error
     1195        | statement_list_nodecl error                                           // invalid syntax rule
    11961196                { SemanticError( yylloc, "syntax error, declarations only allowed at the start of the switch body, i.e., after the '{'." ); $$ = nullptr; }
    11971197        ;
     
    12191219                        $$ = $7 ? new StatementNode( build_compound( yylloc, (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw;
    12201220                }
    1221         | SWITCH '(' comma_expression ')' '{' error '}'         // CFA, syntax error
     1221        | SWITCH '(' comma_expression ')' '{' error '}'         // CFA, invalid syntax rule error
    12221222                { SemanticError( yylloc, "synatx error, declarations can only appear before the list of case clauses." ); $$ = nullptr; }
    12231223        | CHOOSE '(' comma_expression ')' case_clause           // CFA
     
    12281228                        $$ = $7 ? new StatementNode( build_compound( yylloc, (StatementNode *)((new StatementNode( $7 ))->set_last( sw )) ) ) : sw;
    12291229                }
    1230         | CHOOSE '(' comma_expression ')' '{' error '}'         // CFA, syntax error
     1230        | CHOOSE '(' comma_expression ')' '{' error '}'         // CFA, invalid syntax rule
    12311231                { SemanticError( yylloc, "syntax error, declarations can only appear before the list of case clauses." ); $$ = nullptr; }
    12321232        ;
     
    12681268
    12691269case_label:                                                                                             // CFA
    1270         CASE error                                                                                      // syntax error
     1270        CASE error                                                                                      // invalid syntax rule
    12711271                { SemanticError( yylloc, "syntax error, case list missing after case." ); $$ = nullptr; }
    12721272        | CASE case_value_list ':'                                      { $$ = $2; }
    1273         | CASE case_value_list error                                            // syntax error
     1273        | CASE case_value_list error                                            // invalid syntax rule
    12741274                { SemanticError( yylloc, "syntax error, colon missing after case list." ); $$ = nullptr; }
    12751275        | DEFAULT ':'                                                           { $$ = new ClauseNode( build_default( yylloc ) ); }
    12761276                // A semantic check is required to ensure only one default clause per switch/choose statement.
    1277         | DEFAULT error                                                                         //  syntax error
     1277        | DEFAULT error                                                                         //  invalid syntax rules
    12781278                { SemanticError( yylloc, "syntax error, colon missing after default." ); $$ = nullptr; }
    12791279        ;
     
    14051405                        else { SemanticError( yylloc, MISSING_HIGH ); $$ = nullptr; }
    14061406                }
    1407         | comma_expression updowneq comma_expression '~' '@' // CFA, error
     1407        | comma_expression updowneq comma_expression '~' '@' // CFA, invalid syntax rules
    14081408                { SemanticError( yylloc, MISSING_ANON_FIELD ); $$ = nullptr; }
    1409         | '@' updowneq '@'                                                                      // CFA, error
     1409        | '@' updowneq '@'                                                                      // CFA, invalid syntax rules
    14101410                { SemanticError( yylloc, MISSING_ANON_FIELD ); $$ = nullptr; }
    1411         | '@' updowneq comma_expression '~' '@'                         // CFA, error
     1411        | '@' updowneq comma_expression '~' '@'                         // CFA, invalid syntax rules
    14121412                { SemanticError( yylloc, MISSING_ANON_FIELD ); $$ = nullptr; }
    1413         | comma_expression updowneq '@' '~' '@'                         // CFA, error
     1413        | comma_expression updowneq '@' '~' '@'                         // CFA, invalid syntax rules
    14141414                { SemanticError( yylloc, MISSING_ANON_FIELD ); $$ = nullptr; }
    1415         | '@' updowneq '@' '~' '@'                                                      // CFA, error
     1415        | '@' updowneq '@' '~' '@'                                                      // CFA, invalid syntax rules
    14161416                { SemanticError( yylloc, MISSING_ANON_FIELD ); $$ = nullptr; }
    14171417
     
    14341434                        else $$ = forCtrl( yylloc, $3, $1, $3->clone(), $4, nullptr, NEW_ONE );
    14351435                }
    1436         | comma_expression ';' '@' updowneq '@'                         // CFA, error
     1436        | comma_expression ';' '@' updowneq '@'                         // CFA, invalid syntax rules
    14371437                { SemanticError( yylloc, "syntax error, missing low/high value for up/down-to range so index is uninitialized." ); $$ = nullptr; }
    14381438
    14391439        | comma_expression ';' comma_expression updowneq comma_expression '~' comma_expression // CFA
    14401440                { $$ = forCtrl( yylloc, $3, $1, UPDOWN( $4, $3->clone(), $5 ), $4, UPDOWN( $4, $5->clone(), $3->clone() ), $7 ); }
    1441         | comma_expression ';' '@' updowneq comma_expression '~' comma_expression // CFA, error
     1441        | comma_expression ';' '@' updowneq comma_expression '~' comma_expression // CFA, invalid syntax rules
    14421442                {
    14431443                        if ( $4 == OperKinds::LThan || $4 == OperKinds::LEThan ) { SemanticError( yylloc, MISSING_LOW ); $$ = nullptr; }
     
    14521452        | comma_expression ';' comma_expression updowneq comma_expression '~' '@' // CFA
    14531453                { $$ = forCtrl( yylloc, $3, $1, UPDOWN( $4, $3->clone(), $5 ), $4, UPDOWN( $4, $5->clone(), $3->clone() ), nullptr ); }
    1454         | comma_expression ';' '@' updowneq comma_expression '~' '@' // CFA, error
     1454        | comma_expression ';' '@' updowneq comma_expression '~' '@' // CFA, invalid syntax rules
    14551455                {
    14561456                        if ( $4 == OperKinds::LThan || $4 == OperKinds::LEThan ) { SemanticError( yylloc, MISSING_LOW ); $$ = nullptr; }
     
    15111511                        else $$ = forCtrl( yylloc, $1, $2, $3, nullptr, nullptr );
    15121512                }
    1513         | declaration '@' updowneq '@' '~' '@'                          // CFA, error
     1513        | declaration '@' updowneq '@' '~' '@'                          // CFA, invalid syntax rules
    15141514                { SemanticError( yylloc, "syntax error, missing low/high value for up/down-to range so index is uninitialized." ); $$ = nullptr; }
    15151515
     
    15221522                {
    15231523                        if ( $3 == OperKinds::LEThan || $3 == OperKinds::GEThan ) {
    1524                                 SemanticError( yylloc, "All enumeration ranges are equal (all values). Remove \"=~\"." ); $$ = nullptr;
     1524                                SemanticError( yylloc, "syntax error, all enumeration ranges are equal (all values). Remove \"=~\"." ); $$ = nullptr;
    15251525                        }
    15261526                        SemanticError( yylloc, "Type iterator is currently unimplemented." ); $$ = nullptr;
     
    16661666                { $$ = build_waitfor_timeout( yylloc, $1, $3, $4, maybe_build_compound( yylloc, $5 ) ); }
    16671667        // "else" must be conditional after timeout or timeout is never triggered (i.e., it is meaningless)
    1668         | wor_waitfor_clause wor when_clause_opt timeout statement wor ELSE statement // syntax error
     1668        | wor_waitfor_clause wor when_clause_opt timeout statement wor ELSE statement // invalid syntax rules
    16691669                { SemanticError( yylloc, "syntax error, else clause must be conditional after timeout or timeout never triggered." ); $$ = nullptr; }
    16701670        | wor_waitfor_clause wor when_clause_opt timeout statement wor when_clause ELSE statement
     
    17111711                { $$ = new ast::WaitUntilStmt::ClauseNode( ast::WaitUntilStmt::ClauseNode::Op::LEFT_OR, $1, build_waituntil_timeout( yylloc, $3, $4, maybe_build_compound( yylloc, $5 ) ) ); }
    17121712        // "else" must be conditional after timeout or timeout is never triggered (i.e., it is meaningless)
    1713         | wor_waituntil_clause wor when_clause_opt timeout statement wor ELSE statement // syntax error
     1713        | wor_waituntil_clause wor when_clause_opt timeout statement wor ELSE statement // invalid syntax rules
    17141714                { SemanticError( yylloc, "syntax error, else clause must be conditional after timeout or timeout never triggered." ); $$ = nullptr; }
    17151715        | wor_waituntil_clause wor when_clause_opt timeout statement wor when_clause ELSE statement
     
    21022102        | type_declaration_specifier
    21032103        | sue_declaration_specifier
    2104         | sue_declaration_specifier invalid_types
     2104        | sue_declaration_specifier invalid_types                       // invalid syntax rule
    21052105                {
    21062106                        SemanticError( yylloc, ::toString( "syntax error, expecting ';' at end of ",
     
    25862586                        // } // for
    25872587                }
    2588         | type_specifier field_declaring_list_opt '}'
     2588        | type_specifier field_declaring_list_opt '}'           // invalid syntax rule
    25892589                {
    25902590                        SemanticError( yylloc, ::toString( "syntax error, expecting ';' at end of previous declaration." ) );
     
    31753175        | IDENTIFIER IDENTIFIER
    31763176                { IdentifierBeforeIdentifier( *$1.str, *$2.str, " declaration" ); $$ = nullptr; }
    3177         | IDENTIFIER type_qualifier                                                     // syntax error
     3177        | IDENTIFIER type_qualifier                                                     // invalid syntax rules
    31783178                { IdentifierBeforeType( *$1.str, "type qualifier" ); $$ = nullptr; }
    3179         | IDENTIFIER storage_class                                                      // syntax error
     3179        | IDENTIFIER storage_class                                                      // invalid syntax rules
    31803180                { IdentifierBeforeType( *$1.str, "storage class" ); $$ = nullptr; }
    3181         | IDENTIFIER basic_type_name                                            // syntax error
     3181        | IDENTIFIER basic_type_name                                            // invalid syntax rules
    31823182                { IdentifierBeforeType( *$1.str, "type" ); $$ = nullptr; }
    3183         | IDENTIFIER TYPEDEFname                                                        // syntax error
     3183        | IDENTIFIER TYPEDEFname                                                        // invalid syntax rules
    31843184                { IdentifierBeforeType( *$1.str, "type" ); $$ = nullptr; }
    3185         | IDENTIFIER TYPEGENname                                                        // syntax error
     3185        | IDENTIFIER TYPEGENname                                                        // invalid syntax rules
    31863186                { IdentifierBeforeType( *$1.str, "type" ); $$ = nullptr; }
    31873187        | external_function_definition
Note: See TracChangeset for help on using the changeset viewer.