Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    recf3812 r1a8b17a  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Nov 15 15:01:33 2024
    13 // Update Count     : 6915
     12// Last Modified On : Sun Oct 13 12:18:15 2024
     13// Update Count     : 6845
    1414//
    1515
     
    2424// the grammar.
    2525
    26 // The root language for this grammar is ANSI99/11 C. All of ANSI99/11 is parsed.  Most of the syntactic extensions from
    27 // ANSI90 to ANSI11 C are marked with the comment "C99/C11".
     26// The root language for this grammar is ANSI99/11 C. All of ANSI99/11 is parsed, except for:
     27//
     28//   designation with '=' (use ':' instead)
     29//
     30// This incompatibility is discussed in detail before the "designation" grammar rule.  Most of the syntactic extensions
     31// from ANSI90 to ANSI11 C are marked with the comment "C99/C11".
    2832
    2933// This grammar also has two levels of extensions. The first extensions cover most of the GCC C extensions. All of the
     
    979983                { $$ = new ExpressionNode( new ast::VirtualCastExpr( yylloc, maybeMoveBuild( $5 ), maybeMoveBuildType( $3 ) ) ); }
    980984        | '(' RETURN type_no_function ')' cast_expression       // CFA
    981                 { $$ = new ExpressionNode( build_cast( yylloc, $3, $5, ast::ReturnCast ) ); }
     985                { $$ = new ExpressionNode( build_cast( yylloc, $3, $5, ast::CastExpr::Return ) ); }
    982986        | '(' COERCE type_no_function ')' cast_expression       // CFA
    983987                { SemanticError( yylloc, "Coerce cast is currently unimplemented." ); $$ = nullptr; }
     
    11661170                // comma_expression in cfa_identifier_parameter_array and cfa_abstract_array
    11671171        '[' ',' ']'
    1168                 // { $$ = new ExpressionNode( build_tuple( yylloc, nullptr ) ); }
    1169                 { SemanticError( yylloc, "Empty tuple is meaningless." ); $$ = nullptr; }
     1172                { $$ = new ExpressionNode( build_tuple( yylloc, nullptr ) ); }
    11701173        | '[' assignment_expression ',' ']'
    11711174                { $$ = new ExpressionNode( build_tuple( yylloc, $2 ) ); }
     
    12211224        | DIRECTIVE
    12221225                { $$ = new StatementNode( build_directive( yylloc, $1 ) ); }
    1223 //      | attribute ';'
    1224 //              { $$ = new StatementNode( $1 ); }
    12251226        ;
    12261227
     
    20562057        | cfa_abstract_tuple identifier_or_type_name asm_name_opt
    20572058                { $$ = $1->addName( $2 )->addAsmName( $3 ); }
    2058         | multi_array_dimension cfa_abstract_tuple identifier_or_type_name asm_name_opt
    2059                 { $$ = $2->addNewArray( $1 )->addName( $3 )->addAsmName( $4 ); }
    2060         | multi_array_dimension type_qualifier_list cfa_abstract_tuple identifier_or_type_name asm_name_opt
    2061                 { $$ = $3->addNewArray( $1 )->addQualifiers( $2 )->addName( $4 )->addAsmName( $5 ); }
     2059        | type_qualifier_list cfa_abstract_tuple identifier_or_type_name asm_name_opt
     2060                { $$ = $2->addQualifiers( $1 )->addName( $3 )->addAsmName( $4 ); }
    20622061
    20632062                // [ int s, int t ];                    // declare s and t
     
    42244223        cfa_identifier_parameter_ptr
    42254224        | cfa_identifier_parameter_array
    4226         | type_qualifier_list cfa_identifier_parameter_array
    4227                 { $$ = $2->addQualifiers( $1 ); }
    42284225        ;
    42294226
     
    42494246        '[' ']' type_specifier_nobody
    42504247                { $$ = $3->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); }
    4251         | '[' ']' cfa_abstract_tuple
    4252                 { $$ = $3->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); }
    42534248        | cfa_array_parameter_1st_dimension type_specifier_nobody
    4254                 { $$ = $2->addNewArray( $1 ); }
    4255         | cfa_array_parameter_1st_dimension cfa_abstract_tuple
    42564249                { $$ = $2->addNewArray( $1 ); }
    42574250        | '[' ']' multi_array_dimension type_specifier_nobody
    42584251                { $$ = $4->addNewArray( $3 )->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); }
    4259         | '[' ']' multi_array_dimension cfa_abstract_tuple
    4260                 { $$ = $4->addNewArray( $3 )->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); }
    42614252        | cfa_array_parameter_1st_dimension multi_array_dimension type_specifier_nobody
    42624253                { $$ = $3->addNewArray( $2 )->addNewArray( $1 ); }
    4263         | cfa_array_parameter_1st_dimension multi_array_dimension cfa_abstract_tuple
    4264                 { $$ = $3->addNewArray( $2 )->addNewArray( $1 ); }
    42654254        | multi_array_dimension type_specifier_nobody
    4266                 { $$ = $2->addNewArray( $1 ); }
    4267         | multi_array_dimension cfa_abstract_tuple
    42684255                { $$ = $2->addNewArray( $1 ); }
    42694256
Note: See TracChangeset for help on using the changeset viewer.