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