Changes in src/Parser/parser.yy [3a2128f:8780e30]
- File:
-
- 1 edited
-
src/Parser/parser.yy (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r3a2128f r8780e30 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Nov 29 11:35:52201613 // Update Count : 206 912 // Last Modified On : Wed Oct 26 17:35:53 2016 13 // Update Count : 2066 14 14 // 15 15 … … 78 78 %token RESTRICT // C99 79 79 %token FORALL LVALUE // CFA 80 %token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED ZERO_T ONE_T80 %token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED 81 81 %token VALIST // GCC 82 82 %token BOOL COMPLEX IMAGINARY // C99 … … 199 199 200 200 %type<decl> field_declaration field_declaration_list field_declarator field_declaring_list 201 %type<en> field field_list 202 %type<tok> field_name 201 %type<en> field field_list field_name fraction_constants 203 202 204 203 %type<decl> external_function_definition function_definition function_array function_declarator function_no_ptr function_ptr … … 384 383 { $$ = new ExpressionNode( build_fieldSel( $1, build_varref( $3 ) ) ); } 385 384 | postfix_expression '.' '[' push field_list pop ']' // CFA, tuple field selector 385 { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $5 ) ) ); } 386 386 | postfix_expression REALFRACTIONconstant // CFA, tuple index 387 { $$ = new ExpressionNode( build_fieldSel( $1, build_field_name_REALFRACTIONconstant( *$2 ) ) ); } 387 388 | postfix_expression ARROW no_attr_identifier 388 389 { $$ = new ExpressionNode( build_pfieldSel( $1, build_varref( $3 ) ) ); } 389 390 | postfix_expression ARROW '[' push field_list pop ']' // CFA, tuple field selector 391 { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $5 ) ) ); } 390 392 | postfix_expression ICR 391 393 { $$ = new ExpressionNode( build_unary_ptr( OperKinds::IncrPost, $1 ) ); } … … 421 423 field: // CFA, tuple field selector 422 424 field_name 423 { $$ = new ExpressionNode( build_varref( $1 ) ); }424 425 | REALDECIMALconstant field 425 { $$ = new ExpressionNode( build_fieldSel( $2, build_varref( $1) ) ); }426 { $$ = new ExpressionNode( build_fieldSel( new ExpressionNode( build_field_name_REALDECIMALconstant( *$1 ) ), maybeMoveBuild<Expression>( $2 ) ) ); } 426 427 | REALDECIMALconstant '[' push field_list pop ']' 427 { $$ = new ExpressionNode( build_fieldSel( $4, build_varref( $1) ) ); }428 { $$ = new ExpressionNode( build_fieldSel( new ExpressionNode( build_field_name_REALDECIMALconstant( *$1 ) ), build_tuple( $4 ) ) ); } 428 429 | field_name '.' field 429 { $$ = new ExpressionNode( build_fieldSel( $ 3, build_varref( $1) ) ); }430 { $$ = new ExpressionNode( build_fieldSel( $1, maybeMoveBuild<Expression>( $3 ) ) ); } 430 431 | field_name '.' '[' push field_list pop ']' 431 { $$ = new ExpressionNode( build_fieldSel( $ 5, build_varref( $1) ) ); }432 { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $5 ) ) ); } 432 433 | field_name ARROW field 433 { $$ = new ExpressionNode( build_pfieldSel( $ 3, build_varref( $1) ) ); }434 { $$ = new ExpressionNode( build_pfieldSel( $1, maybeMoveBuild<Expression>( $3 ) ) ); } 434 435 | field_name ARROW '[' push field_list pop ']' 435 { $$ = new ExpressionNode( build_pfieldSel( $ 5, build_varref( $1) ) ); }436 { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $5 ) ) ); } 436 437 ; 437 438 438 439 field_name: 439 440 INTEGERconstant fraction_constants 440 { $$ = $1; }441 { $$ = new ExpressionNode( build_field_name_fraction_constants( build_constantInteger( *$1 ), $2 ) ); } 441 442 | FLOATINGconstant fraction_constants 442 { $$ = $1; }443 { $$ = new ExpressionNode( build_field_name_fraction_constants( build_field_name_FLOATINGconstant( *$1 ), $2 ) ); } 443 444 | no_attr_identifier fraction_constants 444 { $$ = $1; }445 { $$ = new ExpressionNode( build_field_name_fraction_constants( build_varref( $1 ), $2 ) ); } 445 446 ; 446 447 447 448 fraction_constants: 448 449 // empty 450 { $$ = nullptr; } 449 451 | fraction_constants REALFRACTIONconstant 452 { 453 Expression * constant = build_field_name_REALFRACTIONconstant( *$2 ); 454 $$ = $1 != nullptr ? new ExpressionNode( build_fieldSel( $1, constant ) ) : new ExpressionNode( constant ); 455 } 450 456 ; 451 457 … … 708 714 | '{' 709 715 // Two scopes are necessary because the block itself has a scope, but every declaration within the block also 710 // requires its own scope .716 // requires its own scope 711 717 push push 712 718 local_label_declaration_opt // GCC, local labels … … 1404 1410 | VALIST // GCC, __builtin_va_list 1405 1411 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); } 1406 | ZERO_T1407 { $$ = DeclarationNode::newBasicType( DeclarationNode::Char ); }1408 | ONE_T1409 { $$ = DeclarationNode::newBasicType( DeclarationNode::Char ); }1410 1412 ; 1411 1413
Note:
See TracChangeset
for help on using the changeset viewer.