Changes in src/Parser/parser.yy [9a705dc8:61fc4f6]
- File:
-
- 1 edited
-
src/Parser/parser.yy (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r9a705dc8 r61fc4f6 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Apr 17 17:10:30201813 // Update Count : 3 14412 // Last Modified On : Sun Apr 29 14:20:17 2018 13 // Update Count : 3206 14 14 // 15 15 … … 133 133 } // build_postfix_name 134 134 135 bool forall = false ;// aggregate have one or more forall qualifiers ?135 bool forall = false, xxx = false; // aggregate have one or more forall qualifiers ? 136 136 137 137 // https://www.gnu.org/software/bison/manual/bison.html#Location-Type … … 208 208 %token<tok> ATTR_IDENTIFIER ATTR_TYPEDEFname ATTR_TYPEGENname 209 209 %token<tok> INTEGERconstant CHARACTERconstant STRINGliteral 210 %token<tok> DIRECTIVE 210 211 // Floating point constant is broken into three kinds of tokens because of the ambiguity with tuple indexing and 211 212 // overloading constants 0/1, e.g., x.1 is lexed as (x)(.1), where (.1) is a factional constant, but is semantically … … 282 283 %type<decl> aggregate_type aggregate_type_nobody 283 284 284 %type<decl> assertion assertion_list _opt285 %type<decl> assertion assertion_list assertion_list_opt 285 286 286 287 %type<en> bit_subrange_size_opt bit_subrange_size … … 875 876 { SemanticError( yylloc, "enable/disable statement is currently unimplemented." ); $$ = nullptr; } 876 877 | asm_statement 878 | DIRECTIVE 879 { $$ = new StatementNode( build_dirstmt( $1 ) ); } 877 880 ; 878 881 … … 1866 1869 { 1867 1870 typedefTable.makeTypedef( *$3 ); 1871 if ( forall ) typedefTable.changeKind( *$3, TypedefTable::TG ); // possibly update 1872 forall = false; // reset 1868 1873 $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 ); 1869 1874 } … … 2235 2240 { $$ = DeclarationNode::newTypeParam( $1, $2 )->addTypeInitializer( $4 )->addAssertions( $5 ); } 2236 2241 | type_specifier identifier_parameter_declarator 2242 | assertion_list 2243 { $$ = DeclarationNode::newTypeParam( DeclarationNode::Dtype, new string( DeclarationNode::anonymous.newName() ) )->addAssertions( $1 ); } 2237 2244 ; 2238 2245 … … 2251 2258 // empty 2252 2259 { $$ = nullptr; } 2253 | assertion_list_opt assertion 2260 | assertion_list 2261 ; 2262 2263 assertion_list: // CFA 2264 assertion 2265 | assertion_list assertion 2254 2266 { $$ = $1 ? $1->appendList( $2 ) : $2; } 2255 2267 ; … … 2378 2390 external_definition_list: 2379 2391 external_definition 2380 | external_definition_list push external_definition2381 { $$ = $1 ? $1->appendList( $ 3 ) : $3; }2392 | external_definition_list { forall = xxx; } push external_definition 2393 { $$ = $1 ? $1->appendList( $4 ) : $4; } 2382 2394 ; 2383 2395 … … 2411 2423 $$ = $2; 2412 2424 } 2413 | type_qualifier_list '{' external_definition_list '}' // CFA, namespace 2425 | type_qualifier_list 2426 { 2427 if ( $1->type->forall ) xxx = forall = true; // remember generic type 2428 } 2429 push '{' external_definition_list '}' // CFA, namespace 2430 { 2431 for ( DeclarationNode * iter = $5; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) { 2432 iter->addQualifiers( $1->clone() ); 2433 } // for 2434 xxx = false; 2435 delete $1; 2436 $$ = $5; 2437 } 2438 | declaration_qualifier_list 2439 { 2440 if ( $1->type->forall ) xxx = forall = true; // remember generic type 2441 } 2442 push '{' external_definition_list '}' // CFA, namespace 2443 { 2444 for ( DeclarationNode * iter = $5; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) { 2445 iter->addQualifiers( $1->clone() ); 2446 } // for 2447 xxx = false; 2448 delete $1; 2449 $$ = $5; 2450 } 2451 | declaration_qualifier_list type_qualifier_list 2452 { 2453 if ( $1->type->forall ) xxx = forall = true; // remember generic type 2454 } 2455 push '{' external_definition_list '}' // CFA, namespace 2456 { 2457 for ( DeclarationNode * iter = $6; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) { 2458 iter->addQualifiers( $1->clone() ); 2459 iter->addQualifiers( $2->clone() ); 2460 } // for 2461 xxx = false; 2462 delete $1; 2463 delete $2; 2464 $$ = $6; 2465 } 2414 2466 ; 2415 2467 … … 2437 2489 with_clause_opt: 2438 2490 // empty 2439 { $$ = nullptr; }2491 { $$ = nullptr; forall = false; } 2440 2492 | WITH '(' tuple_expression_list ')' 2441 { $$ = $3; }2493 { $$ = $3; forall = false; } 2442 2494 ; 2443 2495
Note:
See TracChangeset
for help on using the changeset viewer.