Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r097e2b0 r51b1202  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Oct  8 17:17:54 2015
    13 // Update Count     : 1473
     12// Last Modified On : Tue Aug 11 16:01:49 2015
     13// Update Count     : 1350
    1414//
    1515
     
    8181%token ATTRIBUTE EXTENSION                                                              // GCC
    8282%token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN
    83 %token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT        // CFA
     83%token CHOOSE FALLTHRU TRY CATCH FINALLY THROW                  // CFA
    8484%token ASM                                                                                              // C99, extension ISO/IEC 9899:1999 Section J.5.10(1)
    8585%token ALIGNAS ALIGNOF ATOMIC GENERIC NORETURN STATICASSERT THREADLOCAL // C11
     
    103103%token LSassign         RSassign                                                        // <<=  >>=
    104104%token ANDassign        ERassign        ORassign                                // &=   ^=      |=
    105 
    106 %token ATassign                                                                                 // @=
    107105
    108106// Types declaration
     
    122120}
    123121
    124 %type<tok> identifier  no_01_identifier  no_attr_identifier zero_one
     122%type<tok> zero_one  identifier  no_attr_identifier  no_01_identifier
    125123%type<tok> identifier_or_type_name  no_attr_identifier_or_type_name  no_01_identifier_or_type_name
    126124%type<constant> string_literal_list
     
    319317        ;
    320318
    321 // no zero_one because ambiguity with 0.0 : double constant or field selection
    322319no_attr_identifier:
    323320        IDENTIFIER
     
    367364        | postfix_expression DECR
    368365                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::DecrPost ), $1 ); }
     366                // GCC has priority: cast_expression
    369367        | '(' type_name_no_function ')' '{' initializer_list comma_opt '}' // C99
    370368                { $$ = 0; }
    371         | postfix_expression '{' argument_expression_list '}' // CFA
    372                 {
    373                         Token fn; fn.str = new std::string( "?{}" ); // location undefined
    374                         $$ = new CompositeExprNode( new VarRefNode( fn ), (ExpressionNode *)( $1 )->set_link( $3 ) );
    375                 }
    376369        ;
    377370
     
    452445                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), $2 ); }
    453446        | ALIGNOF '(' type_name_no_function ')'                         // GCC, type alignment
    454                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), new TypeValueNode( $3 ) ); }
     447                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), new TypeValueNode( $3 )); }
    455448        | ANDAND no_attr_identifier                                                     // GCC, address of label
    456                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::LabelAddress ), new VarRefNode( $2, true ) ); }
     449                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::LabelAddress ), new VarRefNode( $2, true )); }
    457450        ;
    458451
     
    634627        | exception_statement
    635628        | asm_statement
    636         | '^' postfix_expression '{' argument_expression_list '}' ';' // CFA
    637                 {
    638                         Token fn; fn.str = new std::string( "^?{}" ); // location undefined
    639                         $$ = new StatementNode( StatementNode::Exp, new CompositeExprNode( new VarRefNode( fn ),
    640                                 (ExpressionNode *)(new CompositeExprNode( new OperatorNode( OperatorNode::AddressOf ), $2 ))->set_link( $4 ) ), 0 );
    641                 }
    642629        ;
    643630
     
    818805        | RETURN comma_expression_opt ';'
    819806                { $$ = new StatementNode( StatementNode::Return, $2, 0 ); }
    820         | THROW assignment_expression_opt ';'
     807        | THROW assignment_expression ';'
    821808                { $$ = new StatementNode( StatementNode::Throw, $2, 0 ); }
    822 //      | THROW ';'
    823 //              { $$ = new StatementNode( StatementNode::Throw ); }
    824         | THROWRESUME assignment_expression_opt ';'
    825                 { $$ = new StatementNode( StatementNode::Throw, $2, 0 ); }
    826         | THROWRESUME assignment_expression_opt AT assignment_expression ';'
    827                 { $$ = new StatementNode( StatementNode::Throw, $2, 0 ); }
    828 //      | THROWRESUME ';'
    829 //              { $$ = new StatementNode( StatementNode::Throw ); }
     809        | THROW ';'
     810                { $$ = new StatementNode( StatementNode::Throw ); }
    830811        ;
    831812
     
    850831        | handler_clause CATCH '(' ELLIPSIS ')' compound_statement
    851832                { $$ = $1->set_link( StatementNode::newCatchStmt( 0, $6, true ) ); }
    852         | CATCHRESUME '(' ELLIPSIS ')' compound_statement
    853                 { $$ = StatementNode::newCatchStmt( 0, $5, true ); }
    854         | handler_clause CATCHRESUME '(' ELLIPSIS ')' compound_statement
    855                 { $$ = $1->set_link( StatementNode::newCatchStmt( 0, $6, true ) ); }
    856833        ;
    857834
     
    860837                { $$ = StatementNode::newCatchStmt( $5, $8 ); }
    861838        | handler_clause CATCH '(' push push exception_declaration pop ')' compound_statement pop
    862                 { $$ = $1->set_link( StatementNode::newCatchStmt( $6, $9 ) ); }
    863         | CATCHRESUME '(' push push exception_declaration pop ')' compound_statement pop
    864                 { $$ = StatementNode::newCatchStmt( $5, $8 ); }
    865         | handler_clause CATCHRESUME '(' push push exception_declaration pop ')' compound_statement pop
    866839                { $$ = $1->set_link( StatementNode::newCatchStmt( $6, $9 ) ); }
    867840        ;
     
    16811654        | '=' initializer
    16821655                { $$ = $2; }
    1683         | ATassign initializer
    1684                 { $$ = $2; }
    16851656        ;
    16861657
     
    16911662
    16921663initializer_list:
    1693         // empty
    1694                 { $$ = 0; }
    1695         | initializer
     1664        initializer
    16961665        | designation initializer                                       { $$ = $2->set_designators( $1 ); }
    16971666        | initializer_list ',' initializer                      { $$ = (InitializerNode *)( $1->set_link( $3 ) ); }
     
    17241693
    17251694designator:
    1726         // lexer ambiguity: designator ".0" is floating-point constant or designator for name 0
    17271695        // only ".0" and ".1" allowed => semantic check
    17281696        FLOATINGconstant
Note: See TracChangeset for help on using the changeset viewer.