Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r9bd6105 r1efa1e1  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug 26 17:50:19 2017
    13 // Update Count     : 2712
     12// Last Modified On : Wed Aug 23 21:08:08 2017
     13// Update Count     : 2704
    1414//
    1515
     
    9797        DeclarationNode::TypeClass tclass;
    9898        StatementNode * sn;
    99         WaitForStmt * wfs;
    10099        ConstantExpr * constant;
    101100        IfCtl * ifctl;
     
    120119%token RESTRICT                                                                                 // C99
    121120%token ATOMIC                                                                                   // C11
    122 %token FORALL MUTEX VIRTUAL                                                             // CFA
     121%token FORALL MUTEX VIRTUAL                                             // CFA
    123122%token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED
    124123%token BOOL COMPLEX IMAGINARY                                                   // C99
     
    190189
    191190// statements
    192 %type<sn> statement                                             labeled_statement                       compound_statement
    193 %type<sn> statement_decl                                statement_decl_list                     statement_list_nodecl
    194 %type<sn> selection_statement
    195 %type<sn> switch_clause_list_opt                switch_clause_list                      choose_clause_list_opt          choose_clause_list
     191%type<sn> labeled_statement                             compound_statement                      expression_statement            selection_statement
     192%type<sn> iteration_statement                   jump_statement
     193%type<sn> with_statement                                exception_statement                     asm_statement
     194%type<sn> when_clause_opt                               waitfor_statement                       waitfor_clause                          waitfor                         timeout
     195%type<sn> fall_through_opt                              fall_through
     196%type<sn> statement                                             statement_list
     197%type<sn> block_item_list                               block_item
     198%type<sn> with_clause_opt
    196199%type<en> case_value
    197200%type<sn> case_clause                                   case_value_list                         case_label                                      case_label_list
    198 %type<sn> fall_through                                  fall_through_opt
    199 %type<sn> iteration_statement                   jump_statement
    200 %type<sn> expression_statement                  asm_statement
    201 %type<sn> with_statement                                with_clause_opt
    202 %type<sn> exception_statement                   handler_clause                          finally_clause
     201%type<sn> switch_clause_list_opt                switch_clause_list                      choose_clause_list_opt          choose_clause_list
     202%type<sn> handler_clause                                finally_clause
    203203%type<catch_kind> handler_key
    204 %type<en> when_clause                                   when_clause_opt                         waitfor                                         timeout
    205 %type<sn> waitfor_statement
    206 %type<wfs> waitfor_clause
    207204
    208205// declarations
     
    776773          push push
    777774          local_label_declaration_opt                                           // GCC, local labels
    778           statement_decl_list                                                           // C99, intermix declarations and statements
     775          block_item_list                                                                       // C99, intermix declarations and statements
    779776          pop '}'
    780777                { $$ = new StatementNode( build_compound( $5 ) ); }
    781778        ;
    782779
    783 statement_decl_list:                                                                    // C99
    784         statement_decl
    785         | statement_decl_list push statement_decl
     780block_item_list:                                                                                // C99
     781        block_item
     782        | block_item_list push block_item
    786783                { if ( $1 != 0 ) { $1->set_last( $3 ); $$ = $1; } }
    787784        ;
    788785
    789 statement_decl:
     786block_item:
    790787        declaration                                                                                     // CFA, new & old style declarations
    791788                { $$ = new StatementNode( $1 ); }
     
    805802        ;
    806803
    807 statement_list_nodecl:
     804statement_list:
    808805        statement
    809         | statement_list_nodecl statement
     806        | statement_list statement
    810807                { if ( $1 != 0 ) { $1->set_last( $2 ); $$ = $1; } }
    811808        ;
     
    817814
    818815selection_statement:
    819         IF '(' push if_control_expression ')' statement         %prec THEN
     816        IF '(' push if_control_expression ')' statement                         %prec THEN
    820817                // explicitly deal with the shift/reduce conflict on if/else
    821818                { $$ = new StatementNode( build_if( $4, $6, nullptr ) ); }
     
    892889
    893890switch_clause_list:                                                                             // CFA
    894         case_label_list statement_list_nodecl
     891        case_label_list statement_list
    895892                { $$ = $1->append_last_case( new StatementNode( build_compound( $2 ) ) ); }
    896         | switch_clause_list case_label_list statement_list_nodecl
     893        | switch_clause_list case_label_list statement_list
    897894                { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( new StatementNode( build_compound( $3 ) ) ) ) ); }
    898895        ;
     
    907904        case_label_list fall_through
    908905                { $$ = $1->append_last_case( $2 ); }
    909         | case_label_list statement_list_nodecl fall_through_opt
     906        | case_label_list statement_list fall_through_opt
    910907                { $$ = $1->append_last_case( new StatementNode( build_compound( (StatementNode *)$2->set_last( $3 ) ) ) ); }
    911908        | choose_clause_list case_label_list fall_through
    912909                { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( $3 ))); }
    913         | choose_clause_list case_label_list statement_list_nodecl fall_through_opt
     910        | choose_clause_list case_label_list statement_list fall_through_opt
    914911                { $$ = (StatementNode *)( $1->set_last( $2->append_last_case( new StatementNode( build_compound( (StatementNode *)$3->set_last( $4 ) ) ) ) ) ); }
    915912        ;
     
    980977        ;
    981978
    982 when_clause:
    983         WHEN '(' comma_expression ')'
    984                 { $$ = $3; }
    985         ;
    986 
    987979when_clause_opt:
    988980        // empty
    989                 { $$ = nullptr; }
    990         | when_clause
     981                { $$ = nullptr; }                                                               // FIX ME
     982        | WHEN '(' comma_expression ')'
     983                { $$ = nullptr; }                                                               // FIX ME
    991984        ;
    992985
    993986waitfor:
    994987        WAITFOR '(' identifier ')'
    995                 {
    996                         $$ = new ExpressionNode( new NameExpr( *$3 ) );
    997                         delete $3;
    998                 }
     988                { $$ = nullptr; }                                                               // FIX ME
    999989        | WAITFOR '(' identifier ',' argument_expression_list ')'
    1000                 {
    1001                         $$ = new ExpressionNode( new NameExpr( *$3 ) );
    1002                         $$->set_last( $5 );
    1003                         delete $3;
    1004                 }
     990                { $$ = nullptr; }                                                               // FIX ME
    1005991        ;
    1006992
    1007993timeout:
    1008994        TIMEOUT '(' comma_expression ')'
    1009                 { $$ = $3; }
     995                { $$ = nullptr; }                                                               // FIX ME
    1010996        ;
    1011997
    1012998waitfor_clause:
    1013         when_clause_opt waitfor statement                                       %prec THEN
    1014                 { $$ = build_waitfor( $2, $3, $1 ); }
     999        when_clause_opt waitfor statement %prec THEN
     1000                { $$ = nullptr; }                                                               // FIX ME
    10151001        | when_clause_opt waitfor statement WOR waitfor_clause
    1016                 { $$ = build_waitfor( $2, $3, $1, $5 ); }
    1017         | when_clause_opt timeout statement                                     %prec THEN
    1018                 { $$ = build_waitfor_timeout( $2, $3, $1 ); }
     1002                { $$ = nullptr; }                                                               // FIX ME
     1003        | when_clause_opt timeout statement %prec THEN
     1004                { $$ = nullptr; }                                                               // FIX ME
    10191005        | when_clause_opt ELSE statement
    1020                 { $$ = build_waitfor_timeout( nullptr, $3, $1 ); }
    1021                 // "else" must be conditional after timeout or timeout is never triggered (i.e., it is meaningless)
    1022         | when_clause_opt timeout statement WOR when_clause ELSE statement
    1023                 { $$ = build_waitfor_timeout( $2, $3, $1, $7, $5 ); }
     1006                { $$ = nullptr; }                                                               // FIX ME
     1007        | when_clause_opt timeout statement WOR when_clause_opt ELSE statement
     1008                { $$ = nullptr; }                                                               // FIX ME
    10241009        ;
    10251010
    10261011waitfor_statement:
    1027         when_clause_opt waitfor statement                                       %prec THEN
    1028                 { $$ = new StatementNode( build_waitfor( $2, $3, $1 ) ); }
     1012        when_clause_opt waitfor statement %prec THEN
     1013                { $$ = nullptr; }                                                               // FIX ME
    10291014        | when_clause_opt waitfor statement WOR waitfor_clause
    1030                 { $$ = new StatementNode( build_waitfor( $2, $3, $1, $5 ) ); }
     1015                { $$ = nullptr; }                                                               // FIX ME
    10311016        ;
    10321017
Note: See TracChangeset for help on using the changeset viewer.