Changes in src/Parser/parser.yy [974906e2:bd85400]
- File:
-
- 1 edited
-
src/Parser/parser.yy (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r974906e2 rbd85400 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // cfa.y -- 8 // 7 // cfa.y -- 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Oct 8 17:17:54 201513 // Update Count : 14 7314 // 12 // Last Modified On : Mon Feb 1 18:22:42 2016 13 // Update Count : 1483 14 // 15 15 16 16 // This grammar is based on the ANSI99/11 C grammar, specifically parts of EXPRESSION and STATEMENTS, and on the C … … 78 78 %token ENUM STRUCT UNION 79 79 %token TYPE FTYPE DTYPE CONTEXT // CFA 80 %token SIZEOF 80 %token SIZEOF OFFSETOF 81 81 %token ATTRIBUTE EXTENSION // GCC 82 82 %token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN … … 319 319 ; 320 320 321 // no zero_one because ambiguity with 0.0 : double constant or field selection322 321 no_attr_identifier: 323 322 IDENTIFIER 323 | zero_one // CFA 324 324 ; 325 325 … … 357 357 | postfix_expression '(' argument_expression_list ')' 358 358 { $$ = new CompositeExprNode( $1, $3 ); } 359 // ambiguity with .0 so space required after field-selection, e.g. 360 // struct S { int 0, 1; } s; s. 0 = 0; s. 1 = 1; 359 361 | postfix_expression '.' no_attr_identifier 360 362 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::FieldSel ), $1, new VarRefNode( $3 )); } … … 405 407 no_attr_identifier 406 408 { $$ = new VarRefNode( $1 ); } 409 // ambiguity with .0 so space required after field-selection, e.g. 410 // struct S { int 0, 1; } s; s. 0 = 0; s. 1 = 1; 407 411 | no_attr_identifier '.' field 408 412 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::FieldSel ), new VarRefNode( $1 ), $3 ); } … … 443 447 | SIZEOF '(' type_name_no_function ')' 444 448 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::SizeOf ), new TypeValueNode( $3 )); } 449 | OFFSETOF '(' type_name_no_function ',' no_attr_identifier ')' 450 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::OffsetOf ), new TypeValueNode( $3 ), new VarRefNode( $5 )); } 445 451 | ATTR_IDENTIFIER 446 452 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( $1 )); } … … 1682 1688 { $$ = $2; } 1683 1689 | ATassign initializer 1684 { $$ = $2 ->set_maybeConstructed( false ); }1690 { $$ = $2; } 1685 1691 ; 1686 1692
Note:
See TracChangeset
for help on using the changeset viewer.