Changes in src/Parser/parser.yy [61fc4f6:9a705dc8]
- File:
-
- 1 edited
-
src/Parser/parser.yy (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r61fc4f6 r9a705dc8 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Apr 29 14:20:17201813 // Update Count : 3 20612 // Last Modified On : Tue Apr 17 17:10:30 2018 13 // Update Count : 3144 14 14 // 15 15 … … 133 133 } // build_postfix_name 134 134 135 bool forall = false , xxx = false;// aggregate have one or more forall qualifiers ?135 bool forall = 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> DIRECTIVE211 210 // Floating point constant is broken into three kinds of tokens because of the ambiguity with tuple indexing and 212 211 // overloading constants 0/1, e.g., x.1 is lexed as (x)(.1), where (.1) is a factional constant, but is semantically … … 283 282 %type<decl> aggregate_type aggregate_type_nobody 284 283 285 %type<decl> assertion assertion_list assertion_list_opt284 %type<decl> assertion assertion_list_opt 286 285 287 286 %type<en> bit_subrange_size_opt bit_subrange_size … … 876 875 { SemanticError( yylloc, "enable/disable statement is currently unimplemented." ); $$ = nullptr; } 877 876 | asm_statement 878 | DIRECTIVE879 { $$ = new StatementNode( build_dirstmt( $1 ) ); }880 877 ; 881 878 … … 1869 1866 { 1870 1867 typedefTable.makeTypedef( *$3 ); 1871 if ( forall ) typedefTable.changeKind( *$3, TypedefTable::TG ); // possibly update1872 forall = false; // reset1873 1868 $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 ); 1874 1869 } … … 2240 2235 { $$ = DeclarationNode::newTypeParam( $1, $2 )->addTypeInitializer( $4 )->addAssertions( $5 ); } 2241 2236 | type_specifier identifier_parameter_declarator 2242 | assertion_list2243 { $$ = DeclarationNode::newTypeParam( DeclarationNode::Dtype, new string( DeclarationNode::anonymous.newName() ) )->addAssertions( $1 ); }2244 2237 ; 2245 2238 … … 2258 2251 // empty 2259 2252 { $$ = nullptr; } 2260 | assertion_list 2261 ; 2262 2263 assertion_list: // CFA 2264 assertion 2265 | assertion_list assertion 2253 | assertion_list_opt assertion 2266 2254 { $$ = $1 ? $1->appendList( $2 ) : $2; } 2267 2255 ; … … 2390 2378 external_definition_list: 2391 2379 external_definition 2392 | external_definition_list { forall = xxx; }push external_definition2393 { $$ = $1 ? $1->appendList( $ 4 ) : $4; }2380 | external_definition_list push external_definition 2381 { $$ = $1 ? $1->appendList( $3 ) : $3; } 2394 2382 ; 2395 2383 … … 2423 2411 $$ = $2; 2424 2412 } 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 } 2413 | type_qualifier_list '{' external_definition_list '}' // CFA, namespace 2466 2414 ; 2467 2415 … … 2489 2437 with_clause_opt: 2490 2438 // empty 2491 { $$ = nullptr; forall = false;}2439 { $$ = nullptr; } 2492 2440 | WITH '(' tuple_expression_list ')' 2493 { $$ = $3; forall = false;}2441 { $$ = $3; } 2494 2442 ; 2495 2443
Note:
See TracChangeset
for help on using the changeset viewer.