Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r02e5ab6 r51b1202  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 28 18:18:32 2015
    13 // Update Count     : 1402
     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
     
    120120}
    121121
    122 %type<tok> identifier  no_01_identifier  no_attr_identifier no_attr_identifier_01  zero_one
     122%type<tok> zero_one  identifier  no_attr_identifier  no_01_identifier
    123123%type<tok> identifier_or_type_name  no_attr_identifier_or_type_name  no_01_identifier_or_type_name
    124124%type<constant> string_literal_list
     
    143143// statements
    144144%type<sn> labeled_statement                             compound_statement                      expression_statement            selection_statement
    145 %type<sn> iteration_statement                   jump_statement                          exception_statement                     asm_statement                   ctor_dtor
     145%type<sn> iteration_statement                   jump_statement                          exception_statement                     asm_statement
    146146%type<sn> fall_through_opt                              fall_through
    147147%type<sn> statement                                             statement_list
     
    319319no_attr_identifier:
    320320        IDENTIFIER
    321         ;
    322 
    323 no_attr_identifier_01:
    324         IDENTIFIER
    325         | zero_one
    326321        ;
    327322
     
    450445                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), $2 ); }
    451446        | ALIGNOF '(' type_name_no_function ')'                         // GCC, type alignment
    452                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), new TypeValueNode( $3 ) ); }
     447                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), new TypeValueNode( $3 )); }
    453448        | ANDAND no_attr_identifier                                                     // GCC, address of label
    454                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::LabelAddress ), new VarRefNode( $2, true ) ); }
     449                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::LabelAddress ), new VarRefNode( $2, true )); }
    455450        ;
    456451
     
    632627        | exception_statement
    633628        | asm_statement
    634         | ctor_dtor
    635629        ;
    636630
     
    811805        | RETURN comma_expression_opt ';'
    812806                { $$ = new StatementNode( StatementNode::Return, $2, 0 ); }
    813         | THROW assignment_expression_opt ';'
     807        | THROW assignment_expression ';'
    814808                { $$ = new StatementNode( StatementNode::Throw, $2, 0 ); }
    815 //      | THROW ';'
    816 //              { $$ = new StatementNode( StatementNode::Throw ); }
    817         | THROWRESUME assignment_expression_opt ';'
    818                 { $$ = new StatementNode( StatementNode::Throw, $2, 0 ); }
    819         | THROWRESUME assignment_expression_opt AT assignment_expression ';'
    820                 { $$ = new StatementNode( StatementNode::Throw, $2, 0 ); }
    821 //      | THROWRESUME ';'
    822 //              { $$ = new StatementNode( StatementNode::Throw ); }
     809        | THROW ';'
     810                { $$ = new StatementNode( StatementNode::Throw ); }
    823811        ;
    824812
     
    843831        | handler_clause CATCH '(' ELLIPSIS ')' compound_statement
    844832                { $$ = $1->set_link( StatementNode::newCatchStmt( 0, $6, true ) ); }
    845         | CATCHRESUME '(' ELLIPSIS ')' compound_statement
    846                 { $$ = StatementNode::newCatchStmt( 0, $5, true ); }
    847         | handler_clause CATCHRESUME '(' ELLIPSIS ')' compound_statement
    848                 { $$ = $1->set_link( StatementNode::newCatchStmt( 0, $6, true ) ); }
    849833        ;
    850834
     
    853837                { $$ = StatementNode::newCatchStmt( $5, $8 ); }
    854838        | handler_clause CATCH '(' push push exception_declaration pop ')' compound_statement pop
    855                 { $$ = $1->set_link( StatementNode::newCatchStmt( $6, $9 ) ); }
    856         | CATCHRESUME '(' push push exception_declaration pop ')' compound_statement pop
    857                 { $$ = StatementNode::newCatchStmt( $5, $8 ); }
    858         | handler_clause CATCHRESUME '(' push push exception_declaration pop ')' compound_statement pop
    859839                { $$ = $1->set_link( StatementNode::newCatchStmt( $6, $9 ) ); }
    860840        ;
     
    943923        | label_list ',' no_attr_identifier
    944924                { $$ = $1; $1->append_label( $3 ); }
    945         ;
    946 
    947 ctor_dtor:                                                                                              // CFA, constructor/destructor
    948         no_attr_identifier_01 '{' argument_expression_list '}' ';'
    949                 {
    950                         Token fn; fn.str = new std::string( "?{}" ); fn.loc = $1.loc;
    951                         $$ = new StatementNode( StatementNode::Exp, new CompositeExprNode( new VarRefNode( fn ),
    952                                    (ExpressionNode *)((new CompositeExprNode( new OperatorNode( OperatorNode::AddressOf ), new VarRefNode( $1 ) ))->set_link( $3 )) ), 0 );
    953                 }
    954         | '^' no_attr_identifier_01 '{' '}' ';'
    955                 {
    956                         Token fn; fn.str = new std::string( "^?{}" ); fn.loc = $2.loc;
    957                         $$ = new StatementNode( StatementNode::Exp, new CompositeExprNode( new VarRefNode( fn ),
    958                                    new CompositeExprNode( new OperatorNode( OperatorNode::AddressOf ), new VarRefNode( $2 ) ) ), 0 );
    959                 }
    960925        ;
    961926
     
    17281693
    17291694designator:
    1730         // lexer ambiguity: designator ".0" is floating-point constant or designator for name 0
    17311695        // only ".0" and ".1" allowed => semantic check
    17321696        FLOATINGconstant
Note: See TracChangeset for help on using the changeset viewer.