Changes in src/Parser/parser.yy [7cf8006:1e30df7]
- File:
-
- 1 edited
-
src/Parser/parser.yy (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/parser.yy
r7cf8006 r1e30df7 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Nov 2 21:31:21202213 // Update Count : 5 81012 // Last Modified On : Sat Oct 8 08:21:18 2022 13 // Update Count : 5709 14 14 // 15 15 … … 278 278 279 279 // Types declaration for productions 280 281 280 %union { 282 281 Token tok; … … 291 290 CondCtl * ifctl; 292 291 ForCtrl * fctl; 293 OperKinds compop;292 enum OperKinds compop; 294 293 LabelNode * label; 295 294 InitializerNode * in; … … 297 296 std::string * str; 298 297 bool flag; 299 EnumHiding hide;300 298 CatchStmt::Kind catch_kind; 301 299 GenericExpr * genexpr; … … 307 305 %token TYPEDEF 308 306 %token EXTERN STATIC AUTO REGISTER 309 %token THREADLOCALGCC THREADLOCALC11 // GCC, C11307 %token THREADLOCALGCC THREADLOCALC11 // GCC, C11 310 308 %token INLINE FORTRAN // C99, extension ISO/IEC 9899:1999 Section J.5.9(1) 311 309 %token NORETURN // C11 … … 320 318 %token DECIMAL32 DECIMAL64 DECIMAL128 // GCC 321 319 %token ZERO_T ONE_T // CFA 322 %token SIZEOF TYPEOF VA _LIST VA_ARG AUTO_TYPE// GCC320 %token SIZEOF TYPEOF VALIST AUTO_TYPE // GCC 323 321 %token OFFSETOF BASETYPEOF TYPEID // CFA 324 322 %token ENUM STRUCT UNION … … 366 364 %type<constant> string_literal 367 365 %type<str> string_literal_list 368 369 %type<hide> hide_opt visible_hide_opt370 366 371 367 // expressions … … 413 409 // declarations 414 410 %type<decl> abstract_declarator abstract_ptr abstract_array abstract_function array_dimension multi_array_dimension 415 %type<decl> abstract_parameter_declarator _opt abstract_parameter_declaratorabstract_parameter_ptr abstract_parameter_array abstract_parameter_function array_parameter_dimension array_parameter_1st_dimension411 %type<decl> abstract_parameter_declarator abstract_parameter_ptr abstract_parameter_array abstract_parameter_function array_parameter_dimension array_parameter_1st_dimension 416 412 %type<decl> abstract_parameter_declaration 417 413 … … 702 698 primary_expression 703 699 | postfix_expression '[' assignment_expression ',' tuple_expression_list ']' 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.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. 707 703 { $$ = new ExpressionNode( build_binary_val( OperKinds::Index, $1, new ExpressionNode( build_tuple( (ExpressionNode *)($3->set_last( $5 ) ) )) ) ); } 708 704 | postfix_expression '[' assignment_expression ']' … … 724 720 | postfix_expression '(' argument_expression_list_opt ')' 725 721 { $$ = 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) )) ) ); }730 722 | postfix_expression '`' identifier // CFA, postfix call 731 723 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_varref( build_postfix_name( $3 ) ) ), $1 ) ); } … … 2164 2156 | LONG 2165 2157 { $$ = DeclarationNode::newLength( DeclarationNode::Long ); } 2166 | VA _LIST // GCC, __builtin_va_list2158 | VALIST // GCC, __builtin_va_list 2167 2159 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); } 2168 2160 | AUTO_TYPE … … 2557 2549 | ENUM attribute_list_opt identifier 2558 2550 { typedefTable.makeTypedef( *$3 ); } 2559 hide_opt'{' enumerator_list comma_opt '}'2560 { $$ = DeclarationNode::newEnum( $3, $7, true, false )->addQualifiers( $2 ); }2551 '{' enumerator_list comma_opt '}' 2552 { $$ = DeclarationNode::newEnum( $3, $6, true, false )->addQualifiers( $2 ); } 2561 2553 | ENUM attribute_list_opt typedef_name // unqualified type name 2562 hide_opt'{' enumerator_list comma_opt '}'2563 { $$ = DeclarationNode::newEnum( $3->name, $ 6, true, false )->addQualifiers( $2 ); }2554 '{' enumerator_list comma_opt '}' 2555 { $$ = DeclarationNode::newEnum( $3->name, $5, true, false )->addQualifiers( $2 ); } 2564 2556 | ENUM '(' cfa_abstract_parameter_declaration ')' attribute_list_opt '{' enumerator_list comma_opt '}' 2565 2557 { … … 2578 2570 typedefTable.makeTypedef( *$6 ); 2579 2571 } 2580 hide_opt'{' enumerator_list comma_opt '}'2581 { 2582 $$ = DeclarationNode::newEnum( $6, $1 1, true, true, $3 )->addQualifiers( $5 )->addQualifiers( $7 );2572 '{' enumerator_list comma_opt '}' 2573 { 2574 $$ = DeclarationNode::newEnum( $6, $10, true, true, $3 )->addQualifiers( $5 )->addQualifiers( $7 ); 2583 2575 } 2584 2576 | ENUM '(' ')' attribute_list_opt identifier attribute_list_opt 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 ); 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 ); 2598 2588 } 2599 2589 | enum_type_nobody 2600 ;2601 2602 hide_opt:2603 // empty2604 { $$ = EnumHiding::Visible; }2605 | '!'2606 { $$ = EnumHiding::Hide; }2607 2590 ; 2608 2591 … … 2615 2598 2616 2599 enumerator_list: 2617 visible_hide_optidentifier_or_type_name enumerator_value_opt2618 { $$ = DeclarationNode::newEnumValueGeneric( $ 2, $3); }2600 identifier_or_type_name enumerator_value_opt 2601 { $$ = DeclarationNode::newEnumValueGeneric( $1, $2 ); } 2619 2602 | INLINE type_name 2620 2603 { $$ = DeclarationNode::newEnumInLine( *$2->type->symbolic.name ); } 2621 | enumerator_list ',' visible_hide_optidentifier_or_type_name enumerator_value_opt2622 { $$ = $1->appendList( DeclarationNode::newEnumValueGeneric( $ 4, $5) ); }2604 | enumerator_list ',' identifier_or_type_name enumerator_value_opt 2605 { $$ = $1->appendList( DeclarationNode::newEnumValueGeneric( $3, $4 ) ); } 2623 2606 | enumerator_list ',' INLINE type_name enumerator_value_opt 2624 2607 { $$ = $1->appendList( DeclarationNode::newEnumValueGeneric( new string("inline"), nullptr ) ); } 2625 ;2626 2627 visible_hide_opt:2628 hide_opt2629 | '^'2630 { $$ = EnumHiding::Visible; }2631 2608 ; 2632 2609 … … 3699 3676 // functions. 3700 3677 3701 abstract_parameter_declarator_opt:3702 // empty3703 { $$ = nullptr; }3704 | abstract_parameter_declarator3705 ;3706 3707 3678 abstract_parameter_declarator: 3708 3679 abstract_parameter_ptr
Note:
See TracChangeset
for help on using the changeset viewer.