Changes in src/Parser/parser.yy [1e30df7:7cf8006]
- File:
-
- 1 edited
-
src/Parser/parser.yy (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r1e30df7 r7cf8006 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Oct 8 08:21:18202213 // Update Count : 5 70912 // Last Modified On : Wed Nov 2 21:31:21 2022 13 // Update Count : 5810 14 14 // 15 15 … … 278 278 279 279 // Types declaration for productions 280 280 281 %union { 281 282 Token tok; … … 290 291 CondCtl * ifctl; 291 292 ForCtrl * fctl; 292 enumOperKinds compop;293 OperKinds compop; 293 294 LabelNode * label; 294 295 InitializerNode * in; … … 296 297 std::string * str; 297 298 bool flag; 299 EnumHiding hide; 298 300 CatchStmt::Kind catch_kind; 299 301 GenericExpr * genexpr; … … 305 307 %token TYPEDEF 306 308 %token EXTERN STATIC AUTO REGISTER 307 %token THREADLOCALGCC THREADLOCALC11 // GCC, C11309 %token THREADLOCALGCC THREADLOCALC11 // GCC, C11 308 310 %token INLINE FORTRAN // C99, extension ISO/IEC 9899:1999 Section J.5.9(1) 309 311 %token NORETURN // C11 … … 318 320 %token DECIMAL32 DECIMAL64 DECIMAL128 // GCC 319 321 %token ZERO_T ONE_T // CFA 320 %token SIZEOF TYPEOF VA LIST AUTO_TYPE// GCC322 %token SIZEOF TYPEOF VA_LIST VA_ARG AUTO_TYPE // GCC 321 323 %token OFFSETOF BASETYPEOF TYPEID // CFA 322 324 %token ENUM STRUCT UNION … … 364 366 %type<constant> string_literal 365 367 %type<str> string_literal_list 368 369 %type<hide> hide_opt visible_hide_opt 366 370 367 371 // expressions … … 409 413 // declarations 410 414 %type<decl> abstract_declarator abstract_ptr abstract_array abstract_function array_dimension multi_array_dimension 411 %type<decl> abstract_parameter_declarator abstract_parameter_ptr abstract_parameter_array abstract_parameter_function array_parameter_dimension array_parameter_1st_dimension415 %type<decl> abstract_parameter_declarator_opt abstract_parameter_declarator abstract_parameter_ptr abstract_parameter_array abstract_parameter_function array_parameter_dimension array_parameter_1st_dimension 412 416 %type<decl> abstract_parameter_declaration 413 417 … … 698 702 primary_expression 699 703 | postfix_expression '[' assignment_expression ',' tuple_expression_list ']' 700 // Historic, transitional: Disallow commas in subscripts.701 // Switching to this behaviour may help check if a C compatibilty case uses comma-exprs in subscripts.702 // Current: Commas in subscripts make tuples.704 // Historic, transitional: Disallow commas in subscripts. 705 // Switching to this behaviour may help check if a C compatibilty case uses comma-exprs in subscripts. 706 // Current: Commas in subscripts make tuples. 703 707 { $$ = new ExpressionNode( build_binary_val( OperKinds::Index, $1, new ExpressionNode( build_tuple( (ExpressionNode *)($3->set_last( $5 ) ) )) ) ); } 704 708 | postfix_expression '[' assignment_expression ']' … … 720 724 | postfix_expression '(' argument_expression_list_opt ')' 721 725 { $$ = new ExpressionNode( build_func( $1, $3 ) ); } 726 | VA_ARG '(' primary_expression ',' declaration_specifier_nobody abstract_parameter_declarator_opt ')' 727 // { SemanticError( yylloc, "va_arg is currently unimplemented." ); $$ = nullptr; } 728 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_varref( new string( "__builtin_va_arg") ) ), 729 (ExpressionNode *)($3->set_last( (ExpressionNode *)($6 ? $6->addType( $5 ) : $5) )) ) ); } 722 730 | postfix_expression '`' identifier // CFA, postfix call 723 731 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_varref( build_postfix_name( $3 ) ) ), $1 ) ); } … … 2156 2164 | LONG 2157 2165 { $$ = DeclarationNode::newLength( DeclarationNode::Long ); } 2158 | VA LIST // GCC, __builtin_va_list2166 | VA_LIST // GCC, __builtin_va_list 2159 2167 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); } 2160 2168 | AUTO_TYPE … … 2549 2557 | ENUM attribute_list_opt identifier 2550 2558 { typedefTable.makeTypedef( *$3 ); } 2551 '{' enumerator_list comma_opt '}'2552 { $$ = DeclarationNode::newEnum( $3, $6, true, false )->addQualifiers( $2 ); }2559 hide_opt '{' enumerator_list comma_opt '}' 2560 { $$ = DeclarationNode::newEnum( $3, $7, true, false )->addQualifiers( $2 ); } 2553 2561 | ENUM attribute_list_opt typedef_name // unqualified type name 2554 '{' enumerator_list comma_opt '}'2555 { $$ = DeclarationNode::newEnum( $3->name, $ 5, true, false )->addQualifiers( $2 ); }2562 hide_opt '{' enumerator_list comma_opt '}' 2563 { $$ = DeclarationNode::newEnum( $3->name, $6, true, false )->addQualifiers( $2 ); } 2556 2564 | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt '{' enumerator_list comma_opt '}' 2557 2565 { … … 2570 2578 typedefTable.makeTypedef( *$6 ); 2571 2579 } 2572 '{' enumerator_list comma_opt '}'2573 { 2574 $$ = DeclarationNode::newEnum( $6, $1 0, true, true, $3 )->addQualifiers( $5 )->addQualifiers( $7 );2580 hide_opt '{' enumerator_list comma_opt '}' 2581 { 2582 $$ = DeclarationNode::newEnum( $6, $11, true, true, $3 )->addQualifiers( $5 )->addQualifiers( $7 ); 2575 2583 } 2576 2584 | ENUM '(' ')' attribute_list_opt identifier attribute_list_opt 2577 '{' enumerator_list comma_opt '}' 2578 { 2579 $$ = DeclarationNode::newEnum( $5, $8, true, true, nullptr )->addQualifiers( $4 )->addQualifiers( $6 ); 2580 } 2581 | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt typedef_name attribute_list_opt '{' enumerator_list comma_opt '}' 2582 { 2583 $$ = DeclarationNode::newEnum( $6->name, $9, true, true, $3 )->addQualifiers( $5 )->addQualifiers( $7 ); 2584 } 2585 | ENUM '(' ')' attribute_list_opt typedef_name attribute_list_opt '{' enumerator_list comma_opt '}' 2586 { 2587 $$ = DeclarationNode::newEnum( $5->name, $8, true, true, nullptr )->addQualifiers( $4 )->addQualifiers( $6 ); 2585 hide_opt '{' enumerator_list comma_opt '}' 2586 { 2587 $$ = DeclarationNode::newEnum( $5, $9, true, true, nullptr )->addQualifiers( $4 )->addQualifiers( $6 ); 2588 } 2589 | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt typedef_name attribute_list_opt 2590 hide_opt '{' enumerator_list comma_opt '}' 2591 { 2592 $$ = DeclarationNode::newEnum( $6->name, $10, true, true, $3 )->addQualifiers( $5 )->addQualifiers( $7 ); 2593 } 2594 | ENUM '(' ')' attribute_list_opt typedef_name attribute_list_opt 2595 hide_opt '{' enumerator_list comma_opt '}' 2596 { 2597 $$ = DeclarationNode::newEnum( $5->name, $9, true, true, nullptr )->addQualifiers( $4 )->addQualifiers( $6 ); 2588 2598 } 2589 2599 | enum_type_nobody 2600 ; 2601 2602 hide_opt: 2603 // empty 2604 { $$ = EnumHiding::Visible; } 2605 | '!' 2606 { $$ = EnumHiding::Hide; } 2590 2607 ; 2591 2608 … … 2598 2615 2599 2616 enumerator_list: 2600 identifier_or_type_name enumerator_value_opt2601 { $$ = DeclarationNode::newEnumValueGeneric( $ 1, $2); }2617 visible_hide_opt identifier_or_type_name enumerator_value_opt 2618 { $$ = DeclarationNode::newEnumValueGeneric( $2, $3 ); } 2602 2619 | INLINE type_name 2603 2620 { $$ = DeclarationNode::newEnumInLine( *$2->type->symbolic.name ); } 2604 | enumerator_list ',' identifier_or_type_name enumerator_value_opt2605 { $$ = $1->appendList( DeclarationNode::newEnumValueGeneric( $ 3, $4) ); }2621 | enumerator_list ',' visible_hide_opt identifier_or_type_name enumerator_value_opt 2622 { $$ = $1->appendList( DeclarationNode::newEnumValueGeneric( $4, $5 ) ); } 2606 2623 | enumerator_list ',' INLINE type_name enumerator_value_opt 2607 2624 { $$ = $1->appendList( DeclarationNode::newEnumValueGeneric( new string("inline"), nullptr ) ); } 2625 ; 2626 2627 visible_hide_opt: 2628 hide_opt 2629 | '^' 2630 { $$ = EnumHiding::Visible; } 2608 2631 ; 2609 2632 … … 3676 3699 // functions. 3677 3700 3701 abstract_parameter_declarator_opt: 3702 // empty 3703 { $$ = nullptr; } 3704 | abstract_parameter_declarator 3705 ; 3706 3678 3707 abstract_parameter_declarator: 3679 3708 abstract_parameter_ptr
Note:
See TracChangeset
for help on using the changeset viewer.