Ignore:
Timestamp:
Oct 28, 2015, 3:47:29 PM (10 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
37a3b8f9, 4673385, e56cfdb0
Parents:
698664b3 (diff), 097e2b0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge changes into current branch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r698664b3 rd2ded3e7  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Aug 11 16:01:49 2015
    13 // Update Count     : 1350
     12// Last Modified On : Thu Oct  8 17:17:54 2015
     13// Update Count     : 1473
    1414//
    1515
     
    8181%token ATTRIBUTE EXTENSION                                                              // GCC
    8282%token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN
    83 %token CHOOSE FALLTHRU TRY CATCH FINALLY THROW                  // CFA
     83%token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT        // 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                                                                                 // @=
    105107
    106108// Types declaration
     
    120122}
    121123
    122 %type<tok> zero_one  identifier  no_attr_identifier  no_01_identifier
     124%type<tok> identifier  no_01_identifier  no_attr_identifier zero_one
    123125%type<tok> identifier_or_type_name  no_attr_identifier_or_type_name  no_01_identifier_or_type_name
    124126%type<constant> string_literal_list
     
    317319        ;
    318320
     321// no zero_one because ambiguity with 0.0 : double constant or field selection
    319322no_attr_identifier:
    320323        IDENTIFIER
     
    364367        | postfix_expression DECR
    365368                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::DecrPost ), $1 ); }
    366                 // GCC has priority: cast_expression
    367369        | '(' type_name_no_function ')' '{' initializer_list comma_opt '}' // C99
    368370                { $$ = 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                }
    369376        ;
    370377
     
    445452                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), $2 ); }
    446453        | ALIGNOF '(' type_name_no_function ')'                         // GCC, type alignment
    447                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), new TypeValueNode( $3 )); }
     454                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), new TypeValueNode( $3 ) ); }
    448455        | ANDAND no_attr_identifier                                                     // GCC, address of label
    449                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::LabelAddress ), new VarRefNode( $2, true )); }
     456                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::LabelAddress ), new VarRefNode( $2, true ) ); }
    450457        ;
    451458
     
    627634        | exception_statement
    628635        | 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                }
    629642        ;
    630643
     
    805818        | RETURN comma_expression_opt ';'
    806819                { $$ = new StatementNode( StatementNode::Return, $2, 0 ); }
    807         | THROW assignment_expression ';'
     820        | THROW assignment_expression_opt ';'
    808821                { $$ = new StatementNode( StatementNode::Throw, $2, 0 ); }
    809         | THROW ';'
    810                 { $$ = new StatementNode( StatementNode::Throw ); }
     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 ); }
    811830        ;
    812831
     
    831850        | handler_clause CATCH '(' ELLIPSIS ')' compound_statement
    832851                { $$ = $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 ) ); }
    833856        ;
    834857
     
    837860                { $$ = StatementNode::newCatchStmt( $5, $8 ); }
    838861        | 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
    839866                { $$ = $1->set_link( StatementNode::newCatchStmt( $6, $9 ) ); }
    840867        ;
     
    16541681        | '=' initializer
    16551682                { $$ = $2; }
     1683        | ATassign initializer
     1684                { $$ = $2; }
    16561685        ;
    16571686
     
    16621691
    16631692initializer_list:
    1664         initializer
     1693        // empty
     1694                { $$ = 0; }
     1695        | initializer
    16651696        | designation initializer                                       { $$ = $2->set_designators( $1 ); }
    16661697        | initializer_list ',' initializer                      { $$ = (InitializerNode *)( $1->set_link( $3 ) ); }
     
    16931724
    16941725designator:
     1726        // lexer ambiguity: designator ".0" is floating-point constant or designator for name 0
    16951727        // only ".0" and ".1" allowed => semantic check
    16961728        FLOATINGconstant
Note: See TracChangeset for help on using the changeset viewer.