Changes in src/Parser/parser.yy [3ed994e:3d26610]
- File:
-
- 1 edited
-
src/Parser/parser.yy (modified) (53 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r3ed994e r3d26610 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue May 22 08:41:57201813 // Update Count : 3 35312 // Last Modified On : Thu May 31 15:11:40 2018 13 // Update Count : 3444 14 14 // 15 15 … … 265 265 %type<sn> statement labeled_statement compound_statement 266 266 %type<sn> statement_decl statement_decl_list statement_list_nodecl 267 %type<sn> selection_statement 267 %type<sn> selection_statement if_statement 268 268 %type<sn> switch_clause_list_opt switch_clause_list 269 269 %type<en> case_value … … 326 326 %type<decl> cfa_identifier_parameter_declarator_tuple cfa_identifier_parameter_ptr 327 327 328 %type<decl> cfa_parameter_declaration cfa_parameter_list cfa_parameter_ type_list_opt328 %type<decl> cfa_parameter_declaration cfa_parameter_list cfa_parameter_ellipsis_list_opt 329 329 330 330 %type<decl> cfa_typedef_declaration cfa_variable_declaration cfa_variable_specifier … … 332 332 %type<decl> c_declaration static_assert 333 333 %type<decl> KR_function_declarator KR_function_no_ptr KR_function_ptr KR_function_array 334 %type<decl> KR_ declaration_list KR_declaration_list_opt334 %type<decl> KR_parameter_list KR_parameter_list_opt 335 335 336 336 %type<decl> parameter_declaration parameter_list parameter_type_list_opt … … 404 404 //************************* Namespace Management ******************************** 405 405 406 // The grammar in the ANSI C standard is not strictly context-free, since it relies upon the distinct terminal symbols 407 // "identifier", "TYPEDEFname", and "TYPEGENname" that are lexically identical. While it is possible to write a purely 408 // context-free grammar, such a grammar would obscure the relationship between syntactic and semantic constructs. 409 // Hence, this grammar uses the ANSI style. 410 // 411 // Cforall compounds this problem by introducing type names local to the scope of a declaration (for instance, those 412 // introduced through "forall" qualifiers), and by introducing "type generators" -- parameterized types. This latter 413 // type name creates a third class of identifiers that must be distinguished by the scanner. 414 // 415 // Since the scanner cannot distinguish among the different classes of identifiers without some context information, it 416 // accesses a data structure (TypedefTable) to allow classification of an identifier that it has just read. Semantic 417 // actions during the parser update this data structure when the class of identifiers change. 418 // 419 // Because the Cforall language is block-scoped, an identifier can change its class in a local scope; it must revert to 420 // its original class at the end of the block. Since type names can be local to a particular declaration, each 421 // declaration is itself a scope. This requires distinguishing between type names that are local to the current 422 // declaration scope and those that persist past the end of the declaration (i.e., names defined in "typedef" or "otype" 423 // declarations). 424 // 425 // The non-terminals "push" and "pop" denote the opening and closing of scopes. Every push must have a matching pop, 426 // although it is regrettable the matching pairs do not always occur within the same rule. These non-terminals may 427 // appear in more contexts than strictly necessary from a semantic point of view. 406 // The C grammar is not context free because it relies on the distinct terminal symbols "identifier" and "TYPEDEFname", 407 // which are lexically identical. 408 // 409 // typedef int foo; // identifier foo must now be scanned as TYPEDEFname 410 // foo f; // to allow it to appear in this context 411 // 412 // While it may be possible to write a purely context-free grammar, such a grammar would obscure the relationship 413 // between syntactic and semantic constructs. Cforall compounds this problem by introducing type names local to the 414 // scope of a declaration (for instance, those introduced through "forall" qualifiers), and by introducing "type 415 // generators" -- parameterized types. This latter type name creates a third class of identifiers, "TYPEGENname", which 416 // must be distinguished by the lexical scanner. 417 // 418 // Since the scanner cannot distinguish among the different classes of identifiers without some context information, 419 // there is a type table (typedefTable), which holds type names and identifiers that override type names, for each named 420 // scope. During parsing, semantic actions update the type table by adding new identifiers in the current scope. For 421 // each context that introduces a name scope, a new level is created in the type table and that level is popped on 422 // exiting the scope. Since type names can be local to a particular declaration, each declaration is itself a scope. 423 // This requires distinguishing between type names that are local to the current declaration scope and those that 424 // persist past the end of the declaration (i.e., names defined in "typedef" or "otype" declarations). 425 // 426 // The non-terminals "push" and "pop" denote the opening and closing of named scopes. Every push has a matching pop in 427 // the production rule. There are multiple lists of declarations, where each declaration is a named scope, so pop/push 428 // around the list separator. 429 // 430 // int f( forall(T) T (*f1) T , forall( S ) S (*f2)( S ) ); 431 // push pop push pop 428 432 429 433 push: … … 852 856 // '[' ']' 853 857 // { $$ = new ExpressionNode( build_tuple() ); } 854 // '[' push assignment_expression pop ']'858 // | '[' push assignment_expression pop ']' 855 859 // { $$ = new ExpressionNode( build_tuple( $3 ) ); } 856 860 '[' ',' tuple_expression_list ']' 857 861 { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( $3 ) ) ); } 858 | '[' assignment_expression',' tuple_expression_list ']'859 { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)$ 2->set_last( $4) ) ); }862 | '[' push assignment_expression pop ',' tuple_expression_list ']' 863 { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)$3->set_last( $6 ) ) ); } 860 864 ; 861 865 … … 883 887 labeled_statement 884 888 | compound_statement 885 | expression_statement { $$ = $1; }889 | expression_statement 886 890 | selection_statement 887 891 | iteration_statement … … 909 913 '{' '}' 910 914 { $$ = new StatementNode( build_compound( (StatementNode *)0 ) ); } 911 | '{' 912 // Two scopes are necessary because the block itself has a scope, but every declaration within the block also 913 // requires its own scope. 914 push push 915 | '{' push 915 916 local_label_declaration_opt // GCC, local labels 916 917 statement_decl_list // C99, intermix declarations and statements 917 918 pop '}' 918 { $$ = new StatementNode( build_compound( $ 5) ); }919 { $$ = new StatementNode( build_compound( $4 ) ); } 919 920 ; 920 921 921 922 statement_decl_list: // C99 922 923 statement_decl 923 | statement_decl_list pushstatement_decl924 { if ( $1 != 0 ) { $1->set_last( $ 3); $$ = $1; } }924 | statement_decl_list statement_decl 925 { if ( $1 != 0 ) { $1->set_last( $2 ); $$ = $1; } } 925 926 ; 926 927 … … 940 941 $$ = new StatementNode( $2 ); 941 942 } 942 | statement pop943 | statement 943 944 ; 944 945 … … 955 956 956 957 selection_statement: 957 IF '(' push if_control_expression ')' statement %prec THEN 958 // explicitly deal with the shift/reduce conflict on if/else 959 { $$ = new StatementNode( build_if( $4, $6, nullptr ) ); } 960 | IF '(' push if_control_expression ')' statement ELSE statement 961 { $$ = new StatementNode( build_if( $4, $6, $8 ) ); } 958 // pop causes a S/R conflict without separating the IF statement into a non-terminal even after resolving 959 // the inherent S/R conflict with THEN/ELSE. 960 push if_statement pop 961 { $$ = $2; } 962 962 | SWITCH '(' comma_expression ')' case_clause 963 963 { $$ = new StatementNode( build_switch( true, $3, $5 ) ); } 964 | SWITCH '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt '}' // CFA964 | SWITCH '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt pop '}' // CFA 965 965 { 966 966 StatementNode *sw = new StatementNode( build_switch( true, $3, $8 ) ); … … 974 974 | CHOOSE '(' comma_expression ')' case_clause // CFA 975 975 { $$ = new StatementNode( build_switch( false, $3, $5 ) ); } 976 | CHOOSE '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt '}' // CFA976 | CHOOSE '(' comma_expression ')' '{' push declaration_list_opt switch_clause_list_opt pop '}' // CFA 977 977 { 978 978 StatementNode *sw = new StatementNode( build_switch( false, $3, $8 ) ); … … 981 981 ; 982 982 983 if_statement: 984 IF '(' if_control_expression ')' statement %prec THEN 985 // explicitly deal with the shift/reduce conflict on if/else 986 { $$ = new StatementNode( build_if( $3, $5, nullptr ) ); } 987 | IF '(' if_control_expression ')' statement ELSE statement 988 { $$ = new StatementNode( build_if( $3, $5, $7 ) ); } 989 ; 990 991 983 992 if_control_expression: 984 comma_expression pop993 comma_expression 985 994 { $$ = new IfCtl( nullptr, $1 ); } 986 | c_declaration pop// no semi-colon995 | c_declaration // no semi-colon 987 996 { $$ = new IfCtl( $1, nullptr ); } 988 | cfa_declaration pop// no semi-colon997 | cfa_declaration // no semi-colon 989 998 { $$ = new IfCtl( $1, nullptr ); } 990 999 | declaration comma_expression // semi-colon separated … … 1047 1056 | DO statement WHILE '(' comma_expression ')' ';' 1048 1057 { $$ = new StatementNode( build_while( $5, $2, true ) ); } 1049 | FOR '(' push for_control_expression ')' statement 1058 | FOR '(' push for_control_expression ')' statement pop 1050 1059 { $$ = new StatementNode( build_for( $4, $6 ) ); } 1051 1060 ; 1052 1061 1053 1062 for_control_expression: 1054 comma_expression_opt pop';' comma_expression_opt ';' comma_expression_opt1055 { $$ = new ForCtl( $1, $ 4, $6); }1063 comma_expression_opt ';' comma_expression_opt ';' comma_expression_opt 1064 { $$ = new ForCtl( $1, $3, $5 ); } 1056 1065 | declaration comma_expression_opt ';' comma_expression_opt // C99 1057 1066 { $$ = new ForCtl( $1, $2, $4 ); } … … 1175 1184 1176 1185 handler_clause: 1177 handler_key '(' push pushexception_declaration pop handler_predicate_opt ')' compound_statement pop1178 { $$ = new StatementNode( build_catch( $1, $ 5, $7, $9) ); }1179 | handler_clause handler_key '(' push pushexception_declaration pop handler_predicate_opt ')' compound_statement pop1180 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, $ 6, $8, $10) ) ); }1186 handler_key '(' push exception_declaration pop handler_predicate_opt ')' compound_statement pop 1187 { $$ = new StatementNode( build_catch( $1, $4, $6, $8 ) ); } 1188 | handler_clause handler_key '(' push exception_declaration pop handler_predicate_opt ')' compound_statement pop 1189 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, $5, $7, $9 ) ) ); } 1181 1190 ; 1182 1191 … … 1200 1209 type_specifier_nobody 1201 1210 | type_specifier_nobody declarator 1202 { 1203 $$ = $2->addType( $1 ); 1204 } 1211 { $$ = $2->addType( $1 ); } 1205 1212 | type_specifier_nobody variable_abstract_declarator 1206 1213 { $$ = $2->addType( $1 ); } 1207 1214 | cfa_abstract_declarator_tuple no_attr_identifier // CFA 1208 { 1209 $$ = $1->addName( $2 ); 1210 } 1215 { $$ = $1->addName( $2 ); } 1211 1216 | cfa_abstract_declarator_tuple // CFA 1212 1217 ; … … 1286 1291 1287 1292 declaration_list_opt: // used at beginning of switch statement 1288 pop1293 // empty 1289 1294 { $$ = nullptr; } 1290 1295 | declaration_list … … 1293 1298 declaration_list: 1294 1299 declaration 1295 | declaration_list pushdeclaration1296 { $$ = $1->appendList( $ 3); }1297 ; 1298 1299 KR_ declaration_list_opt: // used to declare parameter types in K&R style functions1300 | declaration_list declaration 1301 { $$ = $1->appendList( $2 ); } 1302 ; 1303 1304 KR_parameter_list_opt: // used to declare parameter types in K&R style functions 1300 1305 // empty 1301 1306 { $$ = nullptr; } 1302 | KR_ declaration_list1303 ; 1304 1305 KR_ declaration_list:1307 | KR_parameter_list 1308 ; 1309 1310 KR_parameter_list: 1306 1311 push c_declaration pop ';' 1307 1312 { $$ = $2; } 1308 | KR_ declaration_list push c_declaration pop ';'1313 | KR_parameter_list push c_declaration pop ';' 1309 1314 { $$ = $1->appendList( $3 ); } 1310 1315 ; … … 1321 1326 1322 1327 local_label_list: // GCC, local label 1323 no_attr_identifier_or_type_name {}1324 | local_label_list ',' no_attr_identifier_or_type_name {}1328 no_attr_identifier_or_type_name 1329 | local_label_list ',' no_attr_identifier_or_type_name 1325 1330 ; 1326 1331 1327 1332 declaration: // old & new style declarations 1328 c_declaration pop';'1329 | cfa_declaration pop ';'// CFA1333 c_declaration ';' 1334 | cfa_declaration ';' // CFA 1330 1335 | static_assert 1331 1336 ; … … 1385 1390 | declaration_qualifier_list type_qualifier_list cfa_function_specifier 1386 1391 { $$ = $3->addQualifiers( $1 )->addQualifiers( $2 ); } 1387 | cfa_function_declaration ',' identifier_or_type_name '(' cfa_parameter_type_list_opt')'1392 | cfa_function_declaration ',' identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')' 1388 1393 { 1389 1394 // Append the return type at the start (left-hand-side) to each identifier in the list. 1390 1395 DeclarationNode * ret = new DeclarationNode; 1391 1396 ret->type = maybeClone( $1->type->base ); 1392 $$ = $1->appendList( DeclarationNode::newFunction( $3, ret, $ 5, nullptr ) );1397 $$ = $1->appendList( DeclarationNode::newFunction( $3, ret, $6, nullptr ) ); 1393 1398 } 1394 1399 ; 1395 1400 1396 1401 cfa_function_specifier: // CFA 1397 // '[' ']' identifier_or_type_name '(' push cfa_parameter_ type_list_opt pop ')' // S/R conflict1402 // '[' ']' identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')' // S/R conflict 1398 1403 // { 1399 1404 // $$ = DeclarationNode::newFunction( $3, DeclarationNode::newTuple( 0 ), $6, 0, true ); 1400 1405 // } 1401 // '[' ']' identifier '(' push cfa_parameter_ type_list_opt pop ')'1406 // '[' ']' identifier '(' push cfa_parameter_ellipsis_list_opt pop ')' 1402 1407 // { 1403 1408 // typedefTable.setNextIdentifier( *$5 ); 1404 1409 // $$ = DeclarationNode::newFunction( $5, DeclarationNode::newTuple( 0 ), $8, 0, true ); 1405 1410 // } 1406 // | '[' ']' TYPEDEFname '(' push cfa_parameter_ type_list_opt pop ')'1411 // | '[' ']' TYPEDEFname '(' push cfa_parameter_ellipsis_list_opt pop ')' 1407 1412 // { 1408 1413 // typedefTable.setNextIdentifier( *$5 ); … … 1412 1417 // identifier_or_type_name must be broken apart because of the sequence: 1413 1418 // 1414 // '[' ']' identifier_or_type_name '(' cfa_parameter_ type_list_opt ')'1419 // '[' ']' identifier_or_type_name '(' cfa_parameter_ellipsis_list_opt ')' 1415 1420 // '[' ']' type_specifier 1416 1421 // 1417 1422 // type_specifier can resolve to just TYPEDEFname (e.g., typedef int T; int f( T );). Therefore this must be 1418 1423 // flattened to allow lookahead to the '(' without having to reduce identifier_or_type_name. 1419 cfa_abstract_tuple identifier_or_type_name '(' cfa_parameter_type_list_opt')'1424 cfa_abstract_tuple identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')' 1420 1425 // To obtain LR(1 ), this rule must be factored out from function return type (see cfa_abstract_declarator). 1421 { $$ = DeclarationNode::newFunction( $2, $1, $ 4, 0 ); }1422 | cfa_function_return identifier_or_type_name '(' cfa_parameter_type_list_opt')'1423 { $$ = DeclarationNode::newFunction( $2, $1, $ 4, 0 ); }1426 { $$ = DeclarationNode::newFunction( $2, $1, $5, 0 ); } 1427 | cfa_function_return identifier_or_type_name '(' push cfa_parameter_ellipsis_list_opt pop ')' 1428 { $$ = DeclarationNode::newFunction( $2, $1, $5, 0 ); } 1424 1429 ; 1425 1430 1426 1431 cfa_function_return: // CFA 1427 '[' cfa_parameter_list ']' 1428 { $$ = DeclarationNode::newTuple( $2 ); } 1429 | '[' cfa_parameter_list ',' cfa_abstract_parameter_list ']' 1430 // To obtain LR(1 ), the last cfa_abstract_parameter_list is added into this flattened rule to lookahead to the 1431 // ']'. 1432 { $$ = DeclarationNode::newTuple( $2->appendList( $4 ) ); } 1432 '[' push cfa_parameter_list pop ']' 1433 { $$ = DeclarationNode::newTuple( $3 ); } 1434 | '[' push cfa_parameter_list pop ',' push cfa_abstract_parameter_list pop ']' 1435 // To obtain LR(1 ), the last cfa_abstract_parameter_list is added into this flattened rule to lookahead to the ']'. 1436 { $$ = DeclarationNode::newTuple( $3->appendList( $7 ) ); } 1433 1437 ; 1434 1438 … … 1436 1440 TYPEDEF cfa_variable_specifier 1437 1441 { 1438 typedefTable.addToEnclosingScope( *$2->name, TYPEDEFname );1442 typedefTable.addToEnclosingScope( *$2->name, TYPEDEFname /*, "1"*/ ); 1439 1443 $$ = $2->addTypedef(); 1440 1444 } 1441 1445 | TYPEDEF cfa_function_specifier 1442 1446 { 1443 typedefTable.addToEnclosingScope( *$2->name, TYPEDEFname );1447 typedefTable.addToEnclosingScope( *$2->name, TYPEDEFname /*, "2"*/ ); 1444 1448 $$ = $2->addTypedef(); 1445 1449 } 1446 1450 | cfa_typedef_declaration pop ',' push no_attr_identifier 1447 1451 { 1448 typedefTable.addToEnclosingScope( *$5, TYPEDEFname );1452 typedefTable.addToEnclosingScope( *$5, TYPEDEFname /*, "3"*/ ); 1449 1453 $$ = $1->appendList( $1->cloneType( $5 ) ); 1450 1454 } … … 1457 1461 TYPEDEF type_specifier declarator 1458 1462 { 1459 typedefTable.addToEnclosingScope( *$3->name, TYPEDEFname );1463 typedefTable.addToEnclosingScope( *$3->name, TYPEDEFname /*, "4"*/ ); 1460 1464 $$ = $3->addType( $2 )->addTypedef(); 1461 1465 } 1462 1466 | typedef_declaration pop ',' push declarator 1463 1467 { 1464 typedefTable.addToEnclosingScope( *$5->name, TYPEDEFname );1468 typedefTable.addToEnclosingScope( *$5->name, TYPEDEFname /*, "5"*/ ); 1465 1469 $$ = $1->appendList( $1->cloneBaseType( $5 )->addTypedef() ); 1466 1470 } 1467 1471 | type_qualifier_list TYPEDEF type_specifier declarator // remaining OBSOLESCENT (see 2 ) 1468 1472 { 1469 typedefTable.addToEnclosingScope( *$4->name, TYPEDEFname );1473 typedefTable.addToEnclosingScope( *$4->name, TYPEDEFname /*, "6"*/ ); 1470 1474 $$ = $4->addType( $3 )->addQualifiers( $1 )->addTypedef(); 1471 1475 } 1472 1476 | type_specifier TYPEDEF declarator 1473 1477 { 1474 typedefTable.addToEnclosingScope( *$3->name, TYPEDEFname );1478 typedefTable.addToEnclosingScope( *$3->name, TYPEDEFname /*, "7"*/ ); 1475 1479 $$ = $3->addType( $1 )->addTypedef(); 1476 1480 } 1477 1481 | type_specifier TYPEDEF type_qualifier_list declarator 1478 1482 { 1479 typedefTable.addToEnclosingScope( *$4->name, TYPEDEFname );1483 typedefTable.addToEnclosingScope( *$4->name, TYPEDEFname /*, "8"*/ ); 1480 1484 $$ = $4->addQualifiers( $1 )->addTypedef()->addType( $1 ); 1481 1485 } … … 1604 1608 1605 1609 forall: 1606 FORALL '(' 1607 { 1608 typedefTable.enterScope(); 1609 } 1610 type_parameter_list ')' // CFA 1611 { 1612 typedefTable.leaveScope(); 1613 $$ = DeclarationNode::newForall( $4 ); 1614 } 1610 FORALL '(' type_parameter_list ')' // CFA 1611 { $$ = DeclarationNode::newForall( $3 ); } 1615 1612 ; 1616 1613 … … 1980 1977 ; 1981 1978 1982 cfa_parameter_ type_list_opt: // CFA, abstract + real1979 cfa_parameter_ellipsis_list_opt: // CFA, abstract + real 1983 1980 // empty 1984 1981 { $$ = DeclarationNode::newBasicType( DeclarationNode::Void ); } … … 1987 1984 | cfa_abstract_parameter_list 1988 1985 | cfa_parameter_list 1989 | cfa_parameter_list ','cfa_abstract_parameter_list1990 { $$ = $1->appendList( $ 3); }1991 | cfa_abstract_parameter_list ','ELLIPSIS1986 | cfa_parameter_list pop ',' push cfa_abstract_parameter_list 1987 { $$ = $1->appendList( $5 ); } 1988 | cfa_abstract_parameter_list pop ',' push ELLIPSIS 1992 1989 { $$ = $1->addVarArgs(); } 1993 | cfa_parameter_list ','ELLIPSIS1990 | cfa_parameter_list pop ',' push ELLIPSIS 1994 1991 { $$ = $1->addVarArgs(); } 1995 1992 ; … … 1999 1996 // factored out from cfa_parameter_list, flattening the rules to get lookahead to the ']'. 2000 1997 cfa_parameter_declaration 2001 | cfa_abstract_parameter_list ','cfa_parameter_declaration2002 { $$ = $1->appendList( $ 3); }2003 | cfa_parameter_list ','cfa_parameter_declaration2004 { $$ = $1->appendList( $ 3); }2005 | cfa_parameter_list ',' cfa_abstract_parameter_list ','cfa_parameter_declaration2006 { $$ = $1->appendList( $ 3 )->appendList( $5); }1998 | cfa_abstract_parameter_list pop ',' push cfa_parameter_declaration 1999 { $$ = $1->appendList( $5 ); } 2000 | cfa_parameter_list pop ',' push cfa_parameter_declaration 2001 { $$ = $1->appendList( $5 ); } 2002 | cfa_parameter_list pop ',' push cfa_abstract_parameter_list pop ',' push cfa_parameter_declaration 2003 { $$ = $1->appendList( $5 )->appendList( $9 ); } 2007 2004 ; 2008 2005 2009 2006 cfa_abstract_parameter_list: // CFA, new & old style abstract 2010 2007 cfa_abstract_parameter_declaration 2011 | cfa_abstract_parameter_list ','cfa_abstract_parameter_declaration2012 { $$ = $1->appendList( $ 3); }2008 | cfa_abstract_parameter_list pop ',' push cfa_abstract_parameter_declaration 2009 { $$ = $1->appendList( $5 ); } 2013 2010 ; 2014 2011 … … 2159 2156 '.' no_attr_identifier // C99, field name 2160 2157 { $$ = new ExpressionNode( build_varref( $2 ) ); } 2161 | '[' assignment_expression ']'// C99, single array element2158 | '[' push assignment_expression pop ']' // C99, single array element 2162 2159 // assignment_expression used instead of constant_expression because of shift/reduce conflicts with tuple. 2163 { $$ = $2; }2164 | '[' subrange ']' // CFA, multiple array elements2165 { $$ = $2; }2166 | '[' constant_expression ELLIPSIS constant_expression ']' // GCC, multiple array elements2167 { $$ = new ExpressionNode( new RangeExpr( maybeMoveBuild< Expression >( $2 ), maybeMoveBuild< Expression >( $4 ) ) ); }2168 | '.' '[' field_list ']' // CFA, tuple field selector2169 2160 { $$ = $3; } 2161 | '[' push subrange pop ']' // CFA, multiple array elements 2162 { $$ = $3; } 2163 | '[' push constant_expression ELLIPSIS constant_expression pop ']' // GCC, multiple array elements 2164 { $$ = new ExpressionNode( new RangeExpr( maybeMoveBuild< Expression >( $3 ), maybeMoveBuild< Expression >( $5 ) ) ); } 2165 | '.' '[' push field_list pop ']' // CFA, tuple field selector 2166 { $$ = $4; } 2170 2167 ; 2171 2168 … … 2204 2201 type_parameter: // CFA 2205 2202 type_class no_attr_identifier_or_type_name 2206 { typedefTable.addTo EnclosingScope( *$2, TYPEDEFname); }2203 { typedefTable.addToScope( *$2, TYPEDEFname /*, "9"*/ ); } 2207 2204 type_initializer_opt assertion_list_opt 2208 2205 { $$ = DeclarationNode::newTypeParam( $1, $2 )->addTypeInitializer( $4 )->addAssertions( $5 ); } … … 2238 2235 '|' no_attr_identifier_or_type_name '(' type_list ')' 2239 2236 { $$ = DeclarationNode::newTraitUse( $2, $4 ); } 2240 | '|' '{' push trait_declaration_list '}'2237 | '|' '{' push trait_declaration_list pop '}' 2241 2238 { $$ = $4; } 2242 | '|' '(' push type_parameter_list pop ')' '{' push trait_declaration_list'}' '(' type_list ')'2243 { SemanticError( yylloc, "Generic data-type assertion is currently unimplemented." ); $$ = nullptr; }2239 // | '|' '(' push type_parameter_list pop ')' '{' push trait_declaration_list pop '}' '(' type_list ')' 2240 // { SemanticError( yylloc, "Generic data-type assertion is currently unimplemented." ); $$ = nullptr; } 2244 2241 ; 2245 2242 … … 2273 2270 no_attr_identifier_or_type_name 2274 2271 { 2275 typedefTable.addToEnclosingScope( *$1, TYPEDEFname );2272 typedefTable.addToEnclosingScope( *$1, TYPEDEFname /*, "10"*/ ); 2276 2273 $$ = DeclarationNode::newTypeDecl( $1, 0 ); 2277 2274 } 2278 | no_attr_identifier_or_type_name '(' push type_parameter_list pop')'2279 { 2280 typedefTable.addToEnclosingScope( *$1, TYPEGENname );2281 $$ = DeclarationNode::newTypeDecl( $1, $ 4);2275 | no_attr_identifier_or_type_name '(' type_parameter_list ')' 2276 { 2277 typedefTable.addToEnclosingScope( *$1, TYPEGENname /*, "11"*/ ); 2278 $$ = DeclarationNode::newTypeDecl( $1, $3 ); 2282 2279 } 2283 2280 ; 2284 2281 2285 2282 trait_specifier: // CFA 2286 TRAIT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{' '}' 2287 { $$ = DeclarationNode::newTrait( $2, $5, 0 ); } 2288 | TRAIT no_attr_identifier_or_type_name '(' push type_parameter_list pop ')' '{' 2289 { typedefTable.enterScope(); } 2290 trait_declaration_list '}' 2291 { $$ = DeclarationNode::newTrait( $2, $5, $10 ); } 2283 TRAIT no_attr_identifier_or_type_name '(' type_parameter_list ')' '{' '}' 2284 { $$ = DeclarationNode::newTrait( $2, $4, 0 ); } 2285 | TRAIT no_attr_identifier_or_type_name '(' type_parameter_list ')' '{' push trait_declaration_list pop '}' 2286 { $$ = DeclarationNode::newTrait( $2, $4, $8 ); } 2292 2287 ; 2293 2288 2294 2289 trait_declaration_list: // CFA 2295 2290 trait_declaration 2296 | trait_declaration_list p ush trait_declaration2297 { $$ = $1->appendList( $ 3); }2291 | trait_declaration_list pop push trait_declaration 2292 { $$ = $1->appendList( $4 ); } 2298 2293 ; 2299 2294 2300 2295 trait_declaration: // CFA 2301 cfa_trait_declaring_list pop';'2302 | trait_declaring_list pop';'2296 cfa_trait_declaring_list ';' 2297 | trait_declaring_list ';' 2303 2298 ; 2304 2299 2305 2300 cfa_trait_declaring_list: // CFA 2306 2301 cfa_variable_specifier 2307 { $$ = $1; }2308 2302 | cfa_function_specifier 2309 { $$ = $1; }2310 2303 | cfa_trait_declaring_list pop ',' push identifier_or_type_name 2311 2304 { $$ = $1->appendList( $1->cloneType( $5 ) ); } … … 2329 2322 2330 2323 external_definition_list: 2331 external_definition 2324 push external_definition pop 2325 { $$ = $2; } 2332 2326 | external_definition_list 2333 2327 { forall = xxx; } 2334 push external_definition 2328 push external_definition pop 2335 2329 { $$ = $1 ? $1->appendList( $4 ) : $4; } 2336 2330 ; … … 2354 2348 linkage = LinkageSpec::linkageUpdate( yylloc, linkage, $2 ); 2355 2349 } 2356 '{' external_definition_list_opt '}' 2350 // SKULLDUGGERY: Declarations in extern "X" need to be added to the current lexical scope. However, 2351 // external_definition_list_opt creates a new scope that loses the types at the end of the extern block. The 2352 // correction is a pop/push (reverse order) to undo the push/pop from external_definition_list_opt. This 2353 // trick works for nested extern "X"s, as each one undoes itself in the nesting. 2354 '{' pop external_definition_list_opt push '}' 2357 2355 { 2358 2356 linkage = linkageStack.top(); 2359 2357 linkageStack.pop(); 2360 $$ = $ 5;2358 $$ = $6; 2361 2359 } 2362 2360 | EXTENSION external_definition // GCC, multiple __extension__ allowed, meaning unknown … … 2366 2364 } 2367 2365 | type_qualifier_list 2368 { 2369 if ( $1->type->forall ) xxx = forall = true; // remember generic type 2370 } 2371 push '{' external_definition_list '}' // CFA, namespace 2372 { 2373 for ( DeclarationNode * iter = $5; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) { 2366 { if ( $1->type->forall ) xxx = forall = true; } // remember generic type 2367 '{' external_definition_list push '}' // CFA, namespace 2368 { 2369 for ( DeclarationNode * iter = $4; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) { 2374 2370 if ( isMangled( iter->linkage ) ) { // ignore extern "C" 2375 2371 iter->addQualifiers( $1->clone() ); … … 2378 2374 xxx = false; 2379 2375 delete $1; 2380 $$ = $ 5;2376 $$ = $4; 2381 2377 } 2382 2378 | declaration_qualifier_list 2383 { 2384 if ( $1->type->forall ) xxx = forall = true; // remember generic type 2385 } 2386 push '{' external_definition_list '}' // CFA, namespace 2387 { 2388 for ( DeclarationNode * iter = $5; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) { 2379 { if ( $1->type->forall ) xxx = forall = true; } // remember generic type 2380 '{' external_definition_list '}' // CFA, namespace 2381 { 2382 for ( DeclarationNode * iter = $4; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) { 2389 2383 if ( isMangled( iter->linkage ) ) { // ignore extern "C" 2390 2384 iter->addQualifiers( $1->clone() ); … … 2393 2387 xxx = false; 2394 2388 delete $1; 2395 $$ = $ 5;2389 $$ = $4; 2396 2390 } 2397 2391 | declaration_qualifier_list type_qualifier_list … … 2400 2394 if ( $2->type->forall ) xxx = forall = true; // remember generic type 2401 2395 } 2402 push '{' external_definition_list '}'// CFA, namespace2403 { 2404 for ( DeclarationNode * iter = $ 6; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) {2396 '{' external_definition_list '}' // CFA, namespace 2397 { 2398 for ( DeclarationNode * iter = $5; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) { 2405 2399 if ( isMangled( iter->linkage ) && isMangled( $2->linkage ) ) { // ignore extern "C" 2406 2400 iter->addQualifiers( $1->clone() ); … … 2411 2405 delete $1; 2412 2406 delete $2; 2413 $$ = $ 6;2407 $$ = $5; 2414 2408 } 2415 2409 ; … … 2423 2417 // declaration must still have a type_specifier. OBSOLESCENT (see 1) 2424 2418 | function_declarator compound_statement 2425 { 2426 typedefTable.leaveScope(); 2427 $$ = $1->addFunctionBody( $2 ); 2428 } 2429 | KR_function_declarator KR_declaration_list_opt compound_statement 2430 { 2431 typedefTable.leaveScope(); 2432 $$ = $1->addOldDeclList( $2 )->addFunctionBody( $3 ); 2433 } 2419 { $$ = $1->addFunctionBody( $2 ); } 2420 | KR_function_declarator KR_parameter_list_opt compound_statement 2421 { $$ = $1->addOldDeclList( $2 )->addFunctionBody( $3 ); } 2434 2422 ; 2435 2423 … … 2444 2432 cfa_function_declaration with_clause_opt compound_statement // CFA 2445 2433 { 2446 typedefTable.leaveScope();2447 2434 // Add the function body to the last identifier in the function definition list, i.e., foo3: 2448 2435 // [const double] foo1(), foo2( int ), foo3( double ) { return 3.0; } … … 2453 2440 { 2454 2441 rebindForall( $1, $2 ); 2455 typedefTable.leaveScope();2456 2442 $$ = $2->addFunctionBody( $4, $3 )->addType( $1 ); 2457 2443 } … … 2459 2445 { 2460 2446 rebindForall( $1, $2 ); 2461 typedefTable.leaveScope();2462 2447 $$ = $2->addFunctionBody( $4, $3 )->addType( $1 ); 2463 2448 } 2464 2449 // handles default int return type, OBSOLESCENT (see 1) 2465 2450 | type_qualifier_list function_declarator with_clause_opt compound_statement 2466 { 2467 typedefTable.leaveScope(); 2468 $$ = $2->addFunctionBody( $4, $3 )->addQualifiers( $1 ); 2469 } 2451 { $$ = $2->addFunctionBody( $4, $3 )->addQualifiers( $1 ); } 2470 2452 // handles default int return type, OBSOLESCENT (see 1) 2471 2453 | declaration_qualifier_list function_declarator with_clause_opt compound_statement 2472 { 2473 typedefTable.leaveScope(); 2474 $$ = $2->addFunctionBody( $4, $3 )->addQualifiers( $1 ); 2475 } 2454 { $$ = $2->addFunctionBody( $4, $3 )->addQualifiers( $1 ); } 2476 2455 // handles default int return type, OBSOLESCENT (see 1) 2477 2456 | declaration_qualifier_list type_qualifier_list function_declarator with_clause_opt compound_statement 2478 { 2479 typedefTable.leaveScope(); 2480 $$ = $3->addFunctionBody( $5, $4 )->addQualifiers( $2 )->addQualifiers( $1 ); 2481 } 2457 { $$ = $3->addFunctionBody( $5, $4 )->addQualifiers( $2 )->addQualifiers( $1 ); } 2482 2458 2483 2459 // Old-style K&R function definition, OBSOLESCENT (see 4) 2484 | declaration_specifier KR_function_declarator KR_ declaration_list_opt with_clause_opt compound_statement2460 | declaration_specifier KR_function_declarator KR_parameter_list_opt with_clause_opt compound_statement 2485 2461 { 2486 2462 rebindForall( $1, $2 ); 2487 typedefTable.leaveScope();2488 2463 $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addType( $1 ); 2489 2464 } 2490 2465 // handles default int return type, OBSOLESCENT (see 1) 2491 | type_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement 2492 { 2493 typedefTable.leaveScope(); 2494 $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addQualifiers( $1 ); 2495 } 2466 | type_qualifier_list KR_function_declarator KR_parameter_list_opt with_clause_opt compound_statement 2467 { $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addQualifiers( $1 ); } 2496 2468 // handles default int return type, OBSOLESCENT (see 1) 2497 | declaration_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement 2498 { 2499 typedefTable.leaveScope(); 2500 $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addQualifiers( $1 ); 2501 } 2469 | declaration_qualifier_list KR_function_declarator KR_parameter_list_opt with_clause_opt compound_statement 2470 { $$ = $2->addOldDeclList( $3 )->addFunctionBody( $5, $4 )->addQualifiers( $1 ); } 2502 2471 // handles default int return type, OBSOLESCENT (see 1) 2503 | declaration_qualifier_list type_qualifier_list KR_function_declarator KR_declaration_list_opt with_clause_opt compound_statement 2504 { 2505 typedefTable.leaveScope(); 2506 $$ = $3->addOldDeclList( $4 )->addFunctionBody( $6, $5 )->addQualifiers( $2 )->addQualifiers( $1 ); 2507 } 2472 | declaration_qualifier_list type_qualifier_list KR_function_declarator KR_parameter_list_opt with_clause_opt compound_statement 2473 { $$ = $3->addOldDeclList( $4 )->addFunctionBody( $6, $5 )->addQualifiers( $2 )->addQualifiers( $1 ); } 2508 2474 ; 2509 2475 … … 2702 2668 paren_identifier '(' identifier_list ')' // function_declarator handles empty parameter 2703 2669 { $$ = $1->addIdList( $3 ); } 2704 | '(' KR_function_ptr ')' '(' p arameter_type_list_opt')'2705 { $$ = $2->addParamList( $ 5); }2670 | '(' KR_function_ptr ')' '(' push parameter_type_list_opt pop ')' 2671 { $$ = $2->addParamList( $6 ); } 2706 2672 | '(' KR_function_no_ptr ')' // redundant parenthesis 2707 2673 { $$ = $2; } … … 2749 2715 typedef 2750 2716 // hide type name in enclosing scope by variable name 2751 { typedefTable.addToEnclosingScope( *$1->name, IDENTIFIER ); }2717 { typedefTable.addToEnclosingScope( *$1->name, IDENTIFIER /*, "ID"*/ ); } 2752 2718 | '(' paren_type ')' 2753 2719 { $$ = $2; } … … 2821 2787 2822 2788 identifier_parameter_function: 2823 paren_identifier '(' p arameter_type_list_opt ')'// empty parameter list OBSOLESCENT (see 3)2824 { $$ = $1->addParamList( $ 3); }2825 | '(' identifier_parameter_ptr ')' '(' p arameter_type_list_opt')' // empty parameter list OBSOLESCENT (see 3)2826 { $$ = $2->addParamList( $ 5); }2789 paren_identifier '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 2790 { $$ = $1->addParamList( $4 ); } 2791 | '(' identifier_parameter_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 2792 { $$ = $2->addParamList( $6 ); } 2827 2793 | '(' identifier_parameter_function ')' // redundant parenthesis 2828 2794 { $$ = $2; } … … 2874 2840 2875 2841 type_parameter_function: 2876 typedef '(' p arameter_type_list_opt ')'// empty parameter list OBSOLESCENT (see 3)2877 { $$ = $1->addParamList( $ 3); }2878 | '(' type_parameter_ptr ')' '(' p arameter_type_list_opt')' // empty parameter list OBSOLESCENT (see 3)2879 { $$ = $2->addParamList( $ 5); }2842 typedef '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 2843 { $$ = $1->addParamList( $4 ); } 2844 | '(' type_parameter_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 2845 { $$ = $2->addParamList( $6 ); } 2880 2846 ; 2881 2847 … … 2924 2890 2925 2891 abstract_function: 2926 '(' p arameter_type_list_opt ')'// empty parameter list OBSOLESCENT (see 3)2927 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $ 2, nullptr ); }2928 | '(' abstract_ptr ')' '(' p arameter_type_list_opt')' // empty parameter list OBSOLESCENT (see 3)2929 { $$ = $2->addParamList( $ 5); }2892 '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 2893 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $3, nullptr ); } 2894 | '(' abstract_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 2895 { $$ = $2->addParamList( $6 ); } 2930 2896 | '(' abstract_function ')' // redundant parenthesis 2931 2897 { $$ = $2; } … … 2942 2908 2943 2909 multi_array_dimension: 2944 '[' assignment_expression']'2945 { $$ = DeclarationNode::newArray( $ 2, 0, false ); }2946 | '[' '*' ']'// C992910 '[' push assignment_expression pop ']' 2911 { $$ = DeclarationNode::newArray( $3, 0, false ); } 2912 | '[' push '*' pop ']' // C99 2947 2913 { $$ = DeclarationNode::newVarArray( 0 ); } 2948 | multi_array_dimension '[' assignment_expression']'2949 { $$ = $1->addArray( DeclarationNode::newArray( $ 3, 0, false ) ); }2950 | multi_array_dimension '[' '*' ']'// C992914 | multi_array_dimension '[' push assignment_expression pop ']' 2915 { $$ = $1->addArray( DeclarationNode::newArray( $4, 0, false ) ); } 2916 | multi_array_dimension '[' push '*' pop ']' // C99 2951 2917 { $$ = $1->addArray( DeclarationNode::newVarArray( 0 ) ); } 2952 2918 ; … … 3015 2981 3016 2982 abstract_parameter_function: 3017 '(' p arameter_type_list_opt ')'// empty parameter list OBSOLESCENT (see 3)3018 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $ 2, nullptr ); }3019 | '(' abstract_parameter_ptr ')' '(' p arameter_type_list_opt')' // empty parameter list OBSOLESCENT (see 3)3020 { $$ = $2->addParamList( $ 5); }2983 '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 2984 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $3, nullptr ); } 2985 | '(' abstract_parameter_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 2986 { $$ = $2->addParamList( $6 ); } 3021 2987 | '(' abstract_parameter_function ')' // redundant parenthesis 3022 2988 { $$ = $2; } … … 3039 3005 '[' ']' 3040 3006 { $$ = DeclarationNode::newArray( 0, 0, false ); } 3041 // multi_array_dimension handles the '[' '*' ']' case3042 | '[' type_qualifier_list '*' ']'// remaining C993043 { $$ = DeclarationNode::newVarArray( $ 2); }3044 | '[' type_qualifier_list']'3045 { $$ = DeclarationNode::newArray( 0, $ 2, false ); }3046 // multi_array_dimension handles the '[' assignment_expression ']' case3047 | '[' type_qualifier_list assignment_expression']'3048 { $$ = DeclarationNode::newArray( $ 3, $2, false ); }3049 | '[' STATIC type_qualifier_list_opt assignment_expression']'3050 { $$ = DeclarationNode::newArray( $ 4, $3, true ); }3051 | '[' type_qualifier_list STATIC assignment_expression']'3052 { $$ = DeclarationNode::newArray( $ 4, $2, true ); }3007 // multi_array_dimension handles the '[' '*' ']' case 3008 | '[' push type_qualifier_list '*' pop ']' // remaining C99 3009 { $$ = DeclarationNode::newVarArray( $3 ); } 3010 | '[' push type_qualifier_list pop ']' 3011 { $$ = DeclarationNode::newArray( 0, $3, false ); } 3012 // multi_array_dimension handles the '[' assignment_expression ']' case 3013 | '[' push type_qualifier_list assignment_expression pop ']' 3014 { $$ = DeclarationNode::newArray( $4, $3, false ); } 3015 | '[' push STATIC type_qualifier_list_opt assignment_expression pop ']' 3016 { $$ = DeclarationNode::newArray( $5, $4, true ); } 3017 | '[' push type_qualifier_list STATIC assignment_expression pop ']' 3018 { $$ = DeclarationNode::newArray( $5, $3, true ); } 3053 3019 ; 3054 3020 … … 3094 3060 3095 3061 variable_abstract_function: 3096 '(' variable_abstract_ptr ')' '(' p arameter_type_list_opt')' // empty parameter list OBSOLESCENT (see 3)3097 { $$ = $2->addParamList( $ 5); }3062 '(' variable_abstract_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 3063 { $$ = $2->addParamList( $6 ); } 3098 3064 | '(' variable_abstract_function ')' // redundant parenthesis 3099 3065 { $$ = $2; } … … 3158 3124 3159 3125 cfa_array_parameter_1st_dimension: 3160 '[' type_qualifier_list '*' ']'// remaining C993161 { $$ = DeclarationNode::newVarArray( $ 2); }3162 | '[' type_qualifier_list assignment_expression']'3163 { $$ = DeclarationNode::newArray( $ 3, $2, false ); }3164 | '[' declaration_qualifier_list assignment_expression']'3126 '[' push type_qualifier_list '*' pop ']' // remaining C99 3127 { $$ = DeclarationNode::newVarArray( $3 ); } 3128 | '[' push type_qualifier_list assignment_expression pop ']' 3129 { $$ = DeclarationNode::newArray( $4, $3, false ); } 3130 | '[' push declaration_qualifier_list assignment_expression pop ']' 3165 3131 // declaration_qualifier_list must be used because of shift/reduce conflict with 3166 3132 // assignment_expression, so a semantic check is necessary to preclude them as a type_qualifier cannot 3167 3133 // appear in this context. 3168 { $$ = DeclarationNode::newArray( $ 3, $2, true ); }3169 | '[' declaration_qualifier_list type_qualifier_list assignment_expression']'3170 { $$ = DeclarationNode::newArray( $ 4, $3->addQualifiers( $3 ), true ); }3134 { $$ = DeclarationNode::newArray( $4, $3, true ); } 3135 | '[' push declaration_qualifier_list type_qualifier_list assignment_expression pop ']' 3136 { $$ = DeclarationNode::newArray( $5, $4->addQualifiers( $3 ), true ); } 3171 3137 ; 3172 3138 … … 3180 3146 // 3181 3147 // cfa_abstract_tuple identifier_or_type_name 3182 // '[' cfa_parameter_list ']' identifier_or_type_name '(' cfa_parameter_ type_list_opt ')'3148 // '[' cfa_parameter_list ']' identifier_or_type_name '(' cfa_parameter_ellipsis_list_opt ')' 3183 3149 // 3184 3150 // since a function return type can be syntactically identical to a tuple type: … … 3237 3203 3238 3204 cfa_abstract_tuple: // CFA 3239 '[' cfa_abstract_parameter_list ']' 3240 { $$ = DeclarationNode::newTuple( $2 ); } 3205 '[' push cfa_abstract_parameter_list pop ']' 3206 { $$ = DeclarationNode::newTuple( $3 ); } 3207 | '[' push type_specifier_nobody ELLIPSIS pop ']' 3208 { SemanticError( yylloc, "Tuple array currently unimplemented." ); $$ = nullptr; } 3209 | '[' push type_specifier_nobody ELLIPSIS constant_expression pop ']' 3210 { SemanticError( yylloc, "Tuple array currently unimplemented." ); $$ = nullptr; } 3241 3211 ; 3242 3212 3243 3213 cfa_abstract_function: // CFA 3244 // '[' ']' '(' cfa_parameter_ type_list_opt ')'3214 // '[' ']' '(' cfa_parameter_ellipsis_list_opt ')' 3245 3215 // { $$ = DeclarationNode::newFunction( nullptr, DeclarationNode::newTuple( nullptr ), $4, nullptr ); } 3246 cfa_abstract_tuple '(' cfa_parameter_type_list_opt')'3247 { $$ = DeclarationNode::newFunction( nullptr, $1, $ 3, nullptr ); }3248 | cfa_function_return '(' cfa_parameter_type_list_opt')'3249 { $$ = DeclarationNode::newFunction( nullptr, $1, $ 3, nullptr ); }3216 cfa_abstract_tuple '(' push cfa_parameter_ellipsis_list_opt pop ')' 3217 { $$ = DeclarationNode::newFunction( nullptr, $1, $4, nullptr ); } 3218 | cfa_function_return '(' push cfa_parameter_ellipsis_list_opt pop ')' 3219 { $$ = DeclarationNode::newFunction( nullptr, $1, $4, nullptr ); } 3250 3220 ; 3251 3221
Note:
See TracChangeset
for help on using the changeset viewer.