Changes in / [ed274fe:1d9dc9c]
- Location:
- src/Parser
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/TypedefTable.cc
red274fe r1d9dc9c 10 10 // Created On : Sat May 16 15:20:13 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 15 08:27:24 202213 // Update Count : 27 512 // Last Modified On : Wed Jul 12 06:11:28 2023 13 // Update Count : 276 14 14 // 15 15 … … 17 17 #include "TypedefTable.h" 18 18 19 #include <cassert> 20 #include <string> 21 #include <iostream> 19 #include <cassert> // for assert 20 #include <string> // for string 21 #include <iostream> // for iostream 22 22 23 #include "ExpressionNode.h" 24 #include "ParserTypes.h" 25 #include "StatementNode.h" 23 #include "ExpressionNode.h" // for LabelNode 24 #include "ParserTypes.h" // for Token 25 #include "StatementNode.h" // for CondCtl, ForCtrl 26 26 // This (generated) header must come late as it is missing includes. 27 #include "parser.hh" 27 #include "parser.hh" // for IDENTIFIER, TYPEDEFname, TYPEGENname 28 28 29 29 using namespace std; … … 72 72 // "struct". Only generate the typedef, if the name is not in use. The typedef is implicitly (silently) removed if the 73 73 // name is explicitly used. 74 void TypedefTable::makeTypedef( const string & name, int kind ) {74 void TypedefTable::makeTypedef( const string & name, int kind, const char * locn __attribute__((unused)) ) { 75 75 // Check for existence is necessary to handle: 76 76 // struct Fred {}; … … 80 80 // Fred(); 81 81 // } 82 debugPrint( cerr << "Make typedef at " << locn << " \"" << name << "\" as " << kindName( kind ) << " scope " << kindTable.currentScope() << endl ); 82 83 if ( ! typedefTable.exists( name ) ) { 83 84 typedefTable.addToEnclosingScope( name, kind, "MTD" ); … … 85 86 } // TypedefTable::makeTypedef 86 87 87 void TypedefTable::makeTypedef( const string & name ) { 88 return makeTypedef( name, TYPEDEFname ); 88 void TypedefTable::makeTypedef( const string & name, const char * locn __attribute__((unused)) ) { 89 debugPrint( cerr << "Make typedef at " << locn << " \"" << name << " scope " << kindTable.currentScope() << endl ); 90 return makeTypedef( name, TYPEDEFname, "makeTypede" ); 89 91 } // TypedefTable::makeTypedef 90 92 91 93 void TypedefTable::addToScope( const string & identifier, int kind, const char * locn __attribute__((unused)) ) { 92 94 KindTable::size_type scope = kindTable.currentScope(); 93 debugPrint( cerr << "Adding current at " << locn << " " << identifier <<" as " << kindName( kind ) << " scope " << scope << endl );95 debugPrint( cerr << "Adding current at " << locn << " \"" << identifier << "\" as " << kindName( kind ) << " scope " << scope << endl ); 94 96 kindTable.insertAt( scope, identifier, kind ); 95 97 } // TypedefTable::addToScope … … 98 100 KindTable::size_type scope = kindTable.currentScope() - 1 - kindTable.getNote( kindTable.currentScope() - 1 ).level; 99 101 // size_type scope = level - kindTable.getNote( kindTable.currentScope() - 1 ).level; 100 debugPrint( cerr << "Adding enclosing at " << locn << " " << identifier <<" as " << kindName( kind ) << " scope " << scope << " level " << level << " note " << kindTable.getNote( kindTable.currentScope() - 1 ).level << endl );102 debugPrint( cerr << "Adding enclosing at " << locn << " \"" << identifier << "\" as " << kindName( kind ) << " scope " << scope << " level " << level << " note " << kindTable.getNote( kindTable.currentScope() - 1 ).level << endl ); 101 103 pair< KindTable::iterator, bool > ret = kindTable.insertAt( scope, identifier, kind ); 102 104 if ( ! ret.second ) ret.first->second = kind; // exists => update -
src/Parser/TypedefTable.h
red274fe r1d9dc9c 10 10 // Created On : Sat May 16 15:24:36 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Feb 15 08:06:37 202013 // Update Count : 11 712 // Last Modified On : Wed Jul 12 06:09:37 2023 13 // Update Count : 118 14 14 // 15 15 … … 21 21 22 22 class TypedefTable { 23 struct Note { size_t level; bool forall; }; 23 struct Note { 24 size_t level; 25 bool forall; 26 }; 24 27 typedef ScopedMap< std::string, int, Note > KindTable; 25 28 KindTable kindTable; … … 31 34 bool existsCurr( const std::string & identifier ) const; 32 35 int isKind( const std::string & identifier ) const; 33 void makeTypedef( const std::string & name, int kind );34 void makeTypedef( const std::string & name );36 void makeTypedef( const std::string & name, int kind, const char * ); 37 void makeTypedef( const std::string & name, const char * ); 35 38 void addToScope( const std::string & identifier, int kind, const char * ); 36 39 void addToEnclosingScope( const std::string & identifier, int kind, const char * ); -
src/Parser/parser.yy
red274fe r1d9dc9c 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jun 30 12:32:36 202313 // Update Count : 63 6412 // Last Modified On : Wed Jul 12 06:14:16 2023 13 // Update Count : 6382 14 14 // 15 15 … … 385 385 %type<str> string_literal_list 386 386 387 %type<enum_hiding> hide_opt 387 %type<enum_hiding> hide_opt visible_hide_opt 388 388 389 389 // expressions 390 390 %type<expr> constant 391 %type<expr> tuple 391 %type<expr> tuple tuple_expression_list 392 392 %type<oper> ptrref_operator unary_operator assignment_operator simple_assignment_operator compound_assignment_operator 393 393 %type<expr> primary_expression postfix_expression unary_expression 394 %type<expr> cast_expression_list 395 %type<expr> shift_expression 394 %type<expr> cast_expression_list cast_expression exponential_expression multiplicative_expression additive_expression 395 %type<expr> shift_expression relational_expression equality_expression 396 396 %type<expr> AND_expression exclusive_OR_expression inclusive_OR_expression 397 397 %type<expr> logical_AND_expression logical_OR_expression 398 398 %type<expr> conditional_expression constant_expression assignment_expression assignment_expression_opt 399 %type<expr> comma_expression 400 %type<expr> argument_expression_list_opt 399 %type<expr> comma_expression comma_expression_opt 400 %type<expr> argument_expression_list_opt argument_expression_list argument_expression default_initializer_opt 401 401 %type<ifctl> conditional_declaration 402 %type<forctl> for_control_expression 402 %type<forctl> for_control_expression for_control_expression_list 403 403 %type<oper> upupeq updown updowneq downupdowneq 404 404 %type<expr> subrange 405 405 %type<decl> asm_name_opt 406 %type<expr> asm_operands_opt 406 %type<expr> asm_operands_opt asm_operands_list asm_operand 407 407 %type<labels> label_list 408 408 %type<expr> asm_clobbers_list_opt … … 412 412 413 413 // statements 414 %type<stmt> statement 414 %type<stmt> statement labeled_statement compound_statement 415 415 %type<stmt> statement_decl statement_decl_list statement_list_nodecl 416 416 %type<stmt> selection_statement if_statement 417 %type<clause> switch_clause_list_opt 417 %type<clause> switch_clause_list_opt switch_clause_list 418 418 %type<expr> case_value 419 %type<clause> case_clause case_value_list case_label 419 %type<clause> case_clause case_value_list case_label case_label_list 420 420 %type<stmt> iteration_statement jump_statement 421 %type<stmt> expression_statement 421 %type<stmt> expression_statement asm_statement 422 422 %type<stmt> with_statement 423 423 %type<expr> with_clause_opt … … 427 427 %type<stmt> mutex_statement 428 428 %type<expr> when_clause when_clause_opt waitfor waituntil timeout 429 %type<stmt> waitfor_statement 429 %type<stmt> waitfor_statement waituntil_statement 430 430 %type<wfs> wor_waitfor_clause 431 431 %type<wucn> waituntil_clause wand_waituntil_clause wor_waituntil_clause … … 601 601 // around the list separator. 602 602 // 603 // int f( forall(T) T (*f1) T , forall( S ) S (*f2)( S ) );603 // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 604 604 // push pop push pop 605 605 … … 1715 1715 | wor_waituntil_clause wor when_clause_opt timeout statement wor when_clause ELSE statement 1716 1716 { $$ = new ast::WaitUntilStmt::ClauseNode( ast::WaitUntilStmt::ClauseNode::Op::LEFT_OR, $1, 1717 1718 1719 1717 new ast::WaitUntilStmt::ClauseNode( ast::WaitUntilStmt::ClauseNode::Op::OR, 1718 build_waituntil_timeout( yylloc, $3, $4, maybe_build_compound( yylloc, $5 ) ), 1719 build_waituntil_else( yylloc, $7, maybe_build_compound( yylloc, $9 ) ) ) ); } 1720 1720 ; 1721 1721 … … 1724 1724 // SKULLDUGGERY: create an empty compound statement to test parsing of waituntil statement. 1725 1725 { 1726 1727 1728 1726 $$ = new StatementNode( build_waituntil_stmt( yylloc, $1 ) ); 1727 // $$ = new StatementNode( build_compound( yylloc, nullptr ) ); 1728 } 1729 1729 ; 1730 1730 … … 2007 2007 TYPEDEF cfa_variable_specifier 2008 2008 { 2009 typedefTable.addToEnclosingScope( *$2->name, TYPEDEFname, " 1" );2009 typedefTable.addToEnclosingScope( *$2->name, TYPEDEFname, "cfa_typedef_declaration 1" ); 2010 2010 $$ = $2->addTypedef(); 2011 2011 } 2012 2012 | TYPEDEF cfa_function_specifier 2013 2013 { 2014 typedefTable.addToEnclosingScope( *$2->name, TYPEDEFname, " 2" );2014 typedefTable.addToEnclosingScope( *$2->name, TYPEDEFname, "cfa_typedef_declaration 2" ); 2015 2015 $$ = $2->addTypedef(); 2016 2016 } 2017 2017 | cfa_typedef_declaration pop ',' push identifier 2018 2018 { 2019 typedefTable.addToEnclosingScope( *$5, TYPEDEFname, " 3" );2019 typedefTable.addToEnclosingScope( *$5, TYPEDEFname, "cfa_typedef_declaration 3" ); 2020 2020 $$ = $1->appendList( $1->cloneType( $5 ) ); 2021 2021 } … … 2028 2028 TYPEDEF type_specifier declarator 2029 2029 { 2030 typedefTable.addToEnclosingScope( *$3->name, TYPEDEFname, " 4" );2030 typedefTable.addToEnclosingScope( *$3->name, TYPEDEFname, "typedef_declaration 1" ); 2031 2031 if ( $2->type->forall || ($2->type->kind == TypeData::Aggregate && $2->type->aggregate.params) ) { 2032 2032 SemanticError( yylloc, "forall qualifier in typedef is currently unimplemented." ); $$ = nullptr; … … 2035 2035 | typedef_declaration pop ',' push declarator 2036 2036 { 2037 typedefTable.addToEnclosingScope( *$5->name, TYPEDEFname, " 5" );2037 typedefTable.addToEnclosingScope( *$5->name, TYPEDEFname, "typedef_declaration 2" ); 2038 2038 $$ = $1->appendList( $1->cloneBaseType( $5 )->addTypedef() ); 2039 2039 } … … 2465 2465 | aggregate_key attribute_list_opt identifier 2466 2466 { 2467 typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef2467 typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname, "aggregate_type: 1" ); 2468 2468 forall = false; // reset 2469 2469 } … … 2474 2474 | aggregate_key attribute_list_opt TYPEDEFname // unqualified type name 2475 2475 { 2476 typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef2476 typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname, "aggregate_type: 2" ); 2477 2477 forall = false; // reset 2478 2478 } … … 2484 2484 | aggregate_key attribute_list_opt TYPEGENname // unqualified type name 2485 2485 { 2486 typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef2486 typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname, "aggregate_type: 3" ); 2487 2487 forall = false; // reset 2488 2488 } … … 2505 2505 aggregate_key attribute_list_opt identifier 2506 2506 { 2507 typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname );2507 typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname, "aggregate_type_nobody" ); 2508 2508 forall = false; // reset 2509 2509 $$ = DeclarationNode::newAggregate( $1, $3, nullptr, nullptr, false )->addQualifiers( $2 ); … … 2683 2683 { SemanticError( yylloc, "syntax error, hiding '!' the enumerator names of an anonymous enumeration means the names are inaccessible." ); $$ = nullptr; } 2684 2684 | ENUM attribute_list_opt identifier 2685 { typedefTable.makeTypedef( *$3 ); }2685 { typedefTable.makeTypedef( *$3, "enum_type 1" ); } 2686 2686 hide_opt '{' enumerator_list comma_opt '}' 2687 2687 { $$ = DeclarationNode::newEnum( $3, $7, true, false, nullptr, $5 )->addQualifiers( $2 ); } … … 2708 2708 SemanticError( yylloc, "syntax error, storage-class and CV qualifiers are not meaningful for enumeration constants, which are const." ); 2709 2709 } 2710 typedefTable.makeTypedef( *$6 );2710 typedefTable.makeTypedef( *$6, "enum_type 2" ); 2711 2711 } 2712 2712 hide_opt '{' enumerator_list comma_opt '}' … … 2738 2738 enum_type_nobody: // enum - {...} 2739 2739 ENUM attribute_list_opt identifier 2740 { typedefTable.makeTypedef( *$3 ); $$ = DeclarationNode::newEnum( $3, nullptr, false, false )->addQualifiers( $2 ); } 2740 { 2741 typedefTable.makeTypedef( *$3, "enum_type_nobody 1" ); 2742 $$ = DeclarationNode::newEnum( $3, nullptr, false, false )->addQualifiers( $2 ); 2743 } 2741 2744 | ENUM attribute_list_opt type_name 2742 { typedefTable.makeTypedef( *$3->type->symbolic.name ); $$ = DeclarationNode::newEnum( $3->type->symbolic.name, nullptr, false, false )->addQualifiers( $2 ); } 2745 { 2746 typedefTable.makeTypedef( *$3->type->symbolic.name, "enum_type_nobody 2" ); 2747 $$ = DeclarationNode::newEnum( $3->type->symbolic.name, nullptr, false, false )->addQualifiers( $2 ); 2748 } 2743 2749 ; 2744 2750 … … 2808 2814 { $$ = nullptr; } 2809 2815 | parameter_list 2810 | parameter_list pop ',' pushELLIPSIS2816 | parameter_list ',' ELLIPSIS 2811 2817 { $$ = $1->addVarArgs(); } 2812 2818 ; … … 2815 2821 abstract_parameter_declaration 2816 2822 | parameter_declaration 2817 | parameter_list pop ',' pushabstract_parameter_declaration2818 { $$ = $1->appendList( $ 5); }2819 | parameter_list pop ',' pushparameter_declaration2820 { $$ = $1->appendList( $ 5); }2823 | parameter_list ',' abstract_parameter_declaration 2824 { $$ = $1->appendList( $3 ); } 2825 | parameter_list ',' parameter_declaration 2826 { $$ = $1->appendList( $3 ); } 2821 2827 ; 2822 2828 … … 2983 2989 type_class identifier_or_type_name 2984 2990 { 2985 typedefTable.addToScope( *$2, TYPEDEFname, " 9" );2991 typedefTable.addToScope( *$2, TYPEDEFname, "type_parameter 1" ); 2986 2992 if ( $1 == ast::TypeDecl::Otype ) { SemanticError( yylloc, "otype keyword is deprecated, use T " ); } 2987 2993 if ( $1 == ast::TypeDecl::Dtype ) { SemanticError( yylloc, "dtype keyword is deprecated, use T &" ); } … … 2991 2997 { $$ = DeclarationNode::newTypeParam( $1, $2 )->addTypeInitializer( $4 )->addAssertions( $5 ); } 2992 2998 | identifier_or_type_name new_type_class 2993 { typedefTable.addToScope( *$1, TYPEDEFname, " 9" ); }2999 { typedefTable.addToScope( *$1, TYPEDEFname, "type_parameter 2" ); } 2994 3000 type_initializer_opt assertion_list_opt 2995 3001 { $$ = DeclarationNode::newTypeParam( $2, $1 )->addTypeInitializer( $4 )->addAssertions( $5 ); } 2996 3002 | '[' identifier_or_type_name ']' 2997 3003 { 2998 typedefTable.addToScope( *$2, TYPEDIMname, " 9" );3004 typedefTable.addToScope( *$2, TYPEDIMname, "type_parameter 3" ); 2999 3005 $$ = DeclarationNode::newTypeParam( ast::TypeDecl::Dimension, $2 ); 3000 3006 } … … 3078 3084 identifier_or_type_name 3079 3085 { 3080 typedefTable.addToEnclosingScope( *$1, TYPEDEFname, " 10" );3086 typedefTable.addToEnclosingScope( *$1, TYPEDEFname, "type_declarator_name 1" ); 3081 3087 $$ = DeclarationNode::newTypeDecl( $1, nullptr ); 3082 3088 } 3083 3089 | identifier_or_type_name '(' type_parameter_list ')' 3084 3090 { 3085 typedefTable.addToEnclosingScope( *$1, TYPEGENname, " 11" );3091 typedefTable.addToEnclosingScope( *$1, TYPEGENname, "type_declarator_name 2" ); 3086 3092 $$ = DeclarationNode::newTypeDecl( $1, $3 ); 3087 3093 } … … 3472 3478 3473 3479 variable_function: 3474 '(' variable_ptr ')' '(' p ush parameter_type_list_opt pop')' // empty parameter list OBSOLESCENT (see 3)3475 { $$ = $2->addParamList( $ 6); }3476 | '(' attribute_list variable_ptr ')' '(' p ush parameter_type_list_opt pop')' // empty parameter list OBSOLESCENT (see 3)3477 { $$ = $3->addQualifiers( $2 )->addParamList( $ 7); }3480 '(' variable_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3) 3481 { $$ = $2->addParamList( $5 ); } 3482 | '(' attribute_list variable_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3) 3483 { $$ = $3->addQualifiers( $2 )->addParamList( $6 ); } 3478 3484 | '(' variable_function ')' // redundant parenthesis 3479 3485 { $$ = $2; } … … 3495 3501 3496 3502 function_no_ptr: 3497 paren_identifier '(' p ush parameter_type_list_opt pop')' // empty parameter list OBSOLESCENT (see 3)3498 { $$ = $1->addParamList( $ 4); }3499 | '(' function_ptr ')' '(' p ush parameter_type_list_opt pop')'3500 { $$ = $2->addParamList( $ 6); }3501 | '(' attribute_list function_ptr ')' '(' p ush parameter_type_list_opt pop')'3502 { $$ = $3->addQualifiers( $2 )->addParamList( $ 7); }3503 paren_identifier '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3) 3504 { $$ = $1->addParamList( $3 ); } 3505 | '(' function_ptr ')' '(' parameter_type_list_opt ')' 3506 { $$ = $2->addParamList( $5 ); } 3507 | '(' attribute_list function_ptr ')' '(' parameter_type_list_opt ')' 3508 { $$ = $3->addQualifiers( $2 )->addParamList( $6 ); } 3503 3509 | '(' function_no_ptr ')' // redundant parenthesis 3504 3510 { $$ = $2; } … … 3549 3555 paren_identifier '(' identifier_list ')' // function_declarator handles empty parameter 3550 3556 { $$ = $1->addIdList( $3 ); } 3551 | '(' KR_function_ptr ')' '(' p ush parameter_type_list_opt pop')'3552 { $$ = $2->addParamList( $ 6); }3553 | '(' attribute_list KR_function_ptr ')' '(' p ush parameter_type_list_opt pop')'3554 { $$ = $3->addQualifiers( $2 )->addParamList( $ 7); }3557 | '(' KR_function_ptr ')' '(' parameter_type_list_opt ')' 3558 { $$ = $2->addParamList( $5 ); } 3559 | '(' attribute_list KR_function_ptr ')' '(' parameter_type_list_opt ')' 3560 { $$ = $3->addQualifiers( $2 )->addParamList( $6 ); } 3555 3561 | '(' KR_function_no_ptr ')' // redundant parenthesis 3556 3562 { $$ = $2; } … … 3596 3602 { 3597 3603 // hide type name in enclosing scope by variable name 3598 typedefTable.addToEnclosingScope( *$1->name, IDENTIFIER, " ID" );3604 typedefTable.addToEnclosingScope( *$1->name, IDENTIFIER, "paren_type" ); 3599 3605 } 3600 3606 | '(' paren_type ')' … … 3641 3647 3642 3648 variable_type_function: 3643 '(' variable_type_ptr ')' '(' p ush parameter_type_list_opt pop')' // empty parameter list OBSOLESCENT (see 3)3644 { $$ = $2->addParamList( $ 6); }3645 | '(' attribute_list variable_type_ptr ')' '(' p ush parameter_type_list_opt pop')' // empty parameter list OBSOLESCENT (see 3)3646 { $$ = $3->addQualifiers( $2 )->addParamList( $ 7); }3649 '(' variable_type_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3) 3650 { $$ = $2->addParamList( $5 ); } 3651 | '(' attribute_list variable_type_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3) 3652 { $$ = $3->addQualifiers( $2 )->addParamList( $6 ); } 3647 3653 | '(' variable_type_function ')' // redundant parenthesis 3648 3654 { $$ = $2; } … … 3664 3670 3665 3671 function_type_no_ptr: 3666 paren_type '(' p ush parameter_type_list_opt pop')' // empty parameter list OBSOLESCENT (see 3)3667 { $$ = $1->addParamList( $ 4); }3668 | '(' function_type_ptr ')' '(' p ush parameter_type_list_opt pop')'3669 { $$ = $2->addParamList( $ 6); }3670 | '(' attribute_list function_type_ptr ')' '(' p ush parameter_type_list_opt pop')'3671 { $$ = $3->addQualifiers( $2 )->addParamList( $ 7); }3672 paren_type '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3) 3673 { $$ = $1->addParamList( $3 ); } 3674 | '(' function_type_ptr ')' '(' parameter_type_list_opt ')' 3675 { $$ = $2->addParamList( $5 ); } 3676 | '(' attribute_list function_type_ptr ')' '(' parameter_type_list_opt ')' 3677 { $$ = $3->addQualifiers( $2 )->addParamList( $6 ); } 3672 3678 | '(' function_type_no_ptr ')' // redundant parenthesis 3673 3679 { $$ = $2; } … … 3740 3746 3741 3747 identifier_parameter_function: 3742 paren_identifier '(' p ush parameter_type_list_opt pop')' // empty parameter list OBSOLESCENT (see 3)3743 { $$ = $1->addParamList( $ 4); }3744 | '(' identifier_parameter_ptr ')' '(' p ush parameter_type_list_opt pop')' // empty parameter list OBSOLESCENT (see 3)3745 { $$ = $2->addParamList( $ 6); }3748 paren_identifier '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3) 3749 { $$ = $1->addParamList( $3 ); } 3750 | '(' identifier_parameter_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3) 3751 { $$ = $2->addParamList( $5 ); } 3746 3752 | '(' identifier_parameter_function ')' // redundant parenthesis 3747 3753 { $$ = $2; } … … 3793 3799 3794 3800 type_parameter_function: 3795 typedef_name '(' p ush parameter_type_list_opt pop')' // empty parameter list OBSOLESCENT (see 3)3796 { $$ = $1->addParamList( $ 4); }3797 | '(' type_parameter_ptr ')' '(' p ush parameter_type_list_opt pop')' // empty parameter list OBSOLESCENT (see 3)3798 { $$ = $2->addParamList( $ 6); }3801 typedef_name '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3) 3802 { $$ = $1->addParamList( $3 ); } 3803 | '(' type_parameter_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3) 3804 { $$ = $2->addParamList( $5 ); } 3799 3805 ; 3800 3806 … … 3843 3849 3844 3850 abstract_function: 3845 '(' p ush parameter_type_list_opt pop')' // empty parameter list OBSOLESCENT (see 3)3846 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $ 3, nullptr ); }3847 | '(' abstract_ptr ')' '(' p ush parameter_type_list_opt pop')' // empty parameter list OBSOLESCENT (see 3)3848 { $$ = $2->addParamList( $ 6); }3851 '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3) 3852 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $2, nullptr ); } 3853 | '(' abstract_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3) 3854 { $$ = $2->addParamList( $5 ); } 3849 3855 | '(' abstract_function ')' // redundant parenthesis 3850 3856 { $$ = $2; } … … 3966 3972 3967 3973 abstract_parameter_function: 3968 '(' p ush parameter_type_list_opt pop')' // empty parameter list OBSOLESCENT (see 3)3969 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $ 3, nullptr ); }3970 | '(' abstract_parameter_ptr ')' '(' p ush parameter_type_list_opt pop')' // empty parameter list OBSOLESCENT (see 3)3971 { $$ = $2->addParamList( $ 6); }3974 '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3) 3975 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $2, nullptr ); } 3976 | '(' abstract_parameter_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3) 3977 { $$ = $2->addParamList( $5 ); } 3972 3978 | '(' abstract_parameter_function ')' // redundant parenthesis 3973 3979 { $$ = $2; } … … 4006 4012 // This pattern parses a declaration of an abstract variable, but does not allow "int ()" for a function pointer. 4007 4013 // 4008 // 4009 // 4010 // 4011 // 4012 // 4013 // 4014 // struct S { 4015 // int; 4016 // int *; 4017 // int [10]; 4018 // int (*)(); 4019 // }; 4014 4020 4015 4021 variable_abstract_declarator: … … 4045 4051 4046 4052 variable_abstract_function: 4047 '(' variable_abstract_ptr ')' '(' p ush parameter_type_list_opt pop')' // empty parameter list OBSOLESCENT (see 3)4048 { $$ = $2->addParamList( $ 6); }4053 '(' variable_abstract_ptr ')' '(' parameter_type_list_opt ')' // empty parameter list OBSOLESCENT (see 3) 4054 { $$ = $2->addParamList( $5 ); } 4049 4055 | '(' variable_abstract_function ')' // redundant parenthesis 4050 4056 { $$ = $2; }
Note: See TracChangeset
for help on using the changeset viewer.