Changes in / [1d9dc9c:ed274fe]
- Location:
- src/Parser
- Files:
-
- 3 edited
-
TypedefTable.cc (modified) (6 diffs)
-
TypedefTable.h (modified) (3 diffs)
-
parser.yy (modified) (34 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/TypedefTable.cc
r1d9dc9c red274fe 10 10 // Created On : Sat May 16 15:20:13 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jul 12 06:11:28 202313 // Update Count : 27 612 // Last Modified On : Tue Feb 15 08:27:24 2022 13 // Update Count : 275 14 14 // 15 15 … … 17 17 #include "TypedefTable.h" 18 18 19 #include <cassert> // for assert20 #include <string> // for string21 #include <iostream> // for iostream19 #include <cassert> // for assert 20 #include <string> // for string 21 #include <iostream> // for iostream 22 22 23 #include "ExpressionNode.h" // for LabelNode24 #include "ParserTypes.h" // for Token25 #include "StatementNode.h" // for CondCtl, ForCtrl23 #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" // for IDENTIFIER, TYPEDEFname, TYPEGENname27 #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 , const char * locn __attribute__((unused))) {74 void TypedefTable::makeTypedef( const string & name, int kind ) { 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 );83 82 if ( ! typedefTable.exists( name ) ) { 84 83 typedefTable.addToEnclosingScope( name, kind, "MTD" ); … … 86 85 } // TypedefTable::makeTypedef 87 86 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" ); 87 void TypedefTable::makeTypedef( const string & name ) { 88 return makeTypedef( name, TYPEDEFname ); 91 89 } // TypedefTable::makeTypedef 92 90 93 91 void TypedefTable::addToScope( const string & identifier, int kind, const char * locn __attribute__((unused)) ) { 94 92 KindTable::size_type scope = kindTable.currentScope(); 95 debugPrint( cerr << "Adding current at " << locn << " \"" << identifier << "\" as " << kindName( kind ) << " scope " << scope << endl );93 debugPrint( cerr << "Adding current at " << locn << " " << identifier << " as " << kindName( kind ) << " scope " << scope << endl ); 96 94 kindTable.insertAt( scope, identifier, kind ); 97 95 } // TypedefTable::addToScope … … 100 98 KindTable::size_type scope = kindTable.currentScope() - 1 - kindTable.getNote( kindTable.currentScope() - 1 ).level; 101 99 // size_type scope = level - kindTable.getNote( kindTable.currentScope() - 1 ).level; 102 debugPrint( cerr << "Adding enclosing at " << locn << " \"" << identifier << "\" as " << kindName( kind ) << " scope " << scope << " level " << level << " note " << kindTable.getNote( kindTable.currentScope() - 1 ).level << endl );100 debugPrint( cerr << "Adding enclosing at " << locn << " " << identifier << " as " << kindName( kind ) << " scope " << scope << " level " << level << " note " << kindTable.getNote( kindTable.currentScope() - 1 ).level << endl ); 103 101 pair< KindTable::iterator, bool > ret = kindTable.insertAt( scope, identifier, kind ); 104 102 if ( ! ret.second ) ret.first->second = kind; // exists => update -
src/Parser/TypedefTable.h
r1d9dc9c red274fe 10 10 // Created On : Sat May 16 15:24:36 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jul 12 06:09:37 202313 // Update Count : 11 812 // Last Modified On : Sat Feb 15 08:06:37 2020 13 // Update Count : 117 14 14 // 15 15 … … 21 21 22 22 class TypedefTable { 23 struct Note { 24 size_t level; 25 bool forall; 26 }; 23 struct Note { size_t level; bool forall; }; 27 24 typedef ScopedMap< std::string, int, Note > KindTable; 28 25 KindTable kindTable; … … 34 31 bool existsCurr( const std::string & identifier ) const; 35 32 int isKind( const std::string & identifier ) const; 36 void makeTypedef( const std::string & name, int kind , const char *);37 void makeTypedef( const std::string & name , const char *);33 void makeTypedef( const std::string & name, int kind ); 34 void makeTypedef( const std::string & name ); 38 35 void addToScope( const std::string & identifier, int kind, const char * ); 39 36 void addToEnclosingScope( const std::string & identifier, int kind, const char * ); -
src/Parser/parser.yy
r1d9dc9c red274fe 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jul 12 06:14:16 202313 // Update Count : 63 8212 // Last Modified On : Fri Jun 30 12:32:36 2023 13 // Update Count : 6364 14 14 // 15 15 … … 385 385 %type<str> string_literal_list 386 386 387 %type<enum_hiding> hide_opt visible_hide_opt387 %type<enum_hiding> hide_opt visible_hide_opt 388 388 389 389 // expressions 390 390 %type<expr> constant 391 %type<expr> tuple tuple_expression_list391 %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 cast_expression exponential_expression multiplicative_expression additive_expression395 %type<expr> shift_expression relational_expression equality_expression394 %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 comma_expression_opt400 %type<expr> argument_expression_list_opt argument_expression_list argument_expression default_initializer_opt399 %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 for_control_expression_list402 %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 asm_operands_list asm_operand406 %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 labeled_statement compound_statement414 %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 switch_clause_list417 %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 case_label_list419 %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 asm_statement421 %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 waituntil_statement429 %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 // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX603 // int f( forall(T) T (*f1) T , forall( S ) S (*f2)( S ) ); 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 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 ) ) ) ); }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 $$ = new StatementNode( build_waituntil_stmt( yylloc, $1 ) );1727 // $$ = new StatementNode( build_compound( yylloc, nullptr ) );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, " cfa_typedef_declaration1" );2009 typedefTable.addToEnclosingScope( *$2->name, TYPEDEFname, "1" ); 2010 2010 $$ = $2->addTypedef(); 2011 2011 } 2012 2012 | TYPEDEF cfa_function_specifier 2013 2013 { 2014 typedefTable.addToEnclosingScope( *$2->name, TYPEDEFname, " cfa_typedef_declaration2" );2014 typedefTable.addToEnclosingScope( *$2->name, TYPEDEFname, "2" ); 2015 2015 $$ = $2->addTypedef(); 2016 2016 } 2017 2017 | cfa_typedef_declaration pop ',' push identifier 2018 2018 { 2019 typedefTable.addToEnclosingScope( *$5, TYPEDEFname, " cfa_typedef_declaration3" );2019 typedefTable.addToEnclosingScope( *$5, TYPEDEFname, "3" ); 2020 2020 $$ = $1->appendList( $1->cloneType( $5 ) ); 2021 2021 } … … 2028 2028 TYPEDEF type_specifier declarator 2029 2029 { 2030 typedefTable.addToEnclosingScope( *$3->name, TYPEDEFname, " typedef_declaration 1" );2030 typedefTable.addToEnclosingScope( *$3->name, TYPEDEFname, "4" ); 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, " typedef_declaration 2" );2037 typedefTable.addToEnclosingScope( *$5->name, TYPEDEFname, "5" ); 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 , "aggregate_type: 1" );2467 typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef 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 , "aggregate_type: 2" );2476 typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef 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 , "aggregate_type: 3" );2486 typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); // create typedef 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 , "aggregate_type_nobody");2507 typedefTable.makeTypedef( *$3, forall || typedefTable.getEnclForall() ? TYPEGENname : TYPEDEFname ); 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 , "enum_type 1"); }2685 { typedefTable.makeTypedef( *$3 ); } 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 , "enum_type 2");2710 typedefTable.makeTypedef( *$6 ); 2711 2711 } 2712 2712 hide_opt '{' enumerator_list comma_opt '}' … … 2738 2738 enum_type_nobody: // enum - {...} 2739 2739 ENUM attribute_list_opt identifier 2740 { 2741 typedefTable.makeTypedef( *$3, "enum_type_nobody 1" ); 2742 $$ = DeclarationNode::newEnum( $3, nullptr, false, false )->addQualifiers( $2 ); 2743 } 2740 { typedefTable.makeTypedef( *$3 ); $$ = DeclarationNode::newEnum( $3, nullptr, false, false )->addQualifiers( $2 ); } 2744 2741 | ENUM attribute_list_opt type_name 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 } 2742 { typedefTable.makeTypedef( *$3->type->symbolic.name ); $$ = DeclarationNode::newEnum( $3->type->symbolic.name, nullptr, false, false )->addQualifiers( $2 ); } 2749 2743 ; 2750 2744 … … 2814 2808 { $$ = nullptr; } 2815 2809 | parameter_list 2816 | parameter_list ','ELLIPSIS2810 | parameter_list pop ',' push ELLIPSIS 2817 2811 { $$ = $1->addVarArgs(); } 2818 2812 ; … … 2821 2815 abstract_parameter_declaration 2822 2816 | parameter_declaration 2823 | parameter_list ','abstract_parameter_declaration2824 { $$ = $1->appendList( $ 3); }2825 | parameter_list ','parameter_declaration2826 { $$ = $1->appendList( $ 3); }2817 | parameter_list pop ',' push abstract_parameter_declaration 2818 { $$ = $1->appendList( $5 ); } 2819 | parameter_list pop ',' push parameter_declaration 2820 { $$ = $1->appendList( $5 ); } 2827 2821 ; 2828 2822 … … 2989 2983 type_class identifier_or_type_name 2990 2984 { 2991 typedefTable.addToScope( *$2, TYPEDEFname, " type_parameter 1" );2985 typedefTable.addToScope( *$2, TYPEDEFname, "9" ); 2992 2986 if ( $1 == ast::TypeDecl::Otype ) { SemanticError( yylloc, "otype keyword is deprecated, use T " ); } 2993 2987 if ( $1 == ast::TypeDecl::Dtype ) { SemanticError( yylloc, "dtype keyword is deprecated, use T &" ); } … … 2997 2991 { $$ = DeclarationNode::newTypeParam( $1, $2 )->addTypeInitializer( $4 )->addAssertions( $5 ); } 2998 2992 | identifier_or_type_name new_type_class 2999 { typedefTable.addToScope( *$1, TYPEDEFname, " type_parameter 2" ); }2993 { typedefTable.addToScope( *$1, TYPEDEFname, "9" ); } 3000 2994 type_initializer_opt assertion_list_opt 3001 2995 { $$ = DeclarationNode::newTypeParam( $2, $1 )->addTypeInitializer( $4 )->addAssertions( $5 ); } 3002 2996 | '[' identifier_or_type_name ']' 3003 2997 { 3004 typedefTable.addToScope( *$2, TYPEDIMname, " type_parameter 3" );2998 typedefTable.addToScope( *$2, TYPEDIMname, "9" ); 3005 2999 $$ = DeclarationNode::newTypeParam( ast::TypeDecl::Dimension, $2 ); 3006 3000 } … … 3084 3078 identifier_or_type_name 3085 3079 { 3086 typedefTable.addToEnclosingScope( *$1, TYPEDEFname, " type_declarator_name 1" );3080 typedefTable.addToEnclosingScope( *$1, TYPEDEFname, "10" ); 3087 3081 $$ = DeclarationNode::newTypeDecl( $1, nullptr ); 3088 3082 } 3089 3083 | identifier_or_type_name '(' type_parameter_list ')' 3090 3084 { 3091 typedefTable.addToEnclosingScope( *$1, TYPEGENname, " type_declarator_name 2" );3085 typedefTable.addToEnclosingScope( *$1, TYPEGENname, "11" ); 3092 3086 $$ = DeclarationNode::newTypeDecl( $1, $3 ); 3093 3087 } … … 3478 3472 3479 3473 variable_function: 3480 '(' variable_ptr ')' '(' p arameter_type_list_opt')' // empty parameter list OBSOLESCENT (see 3)3481 { $$ = $2->addParamList( $ 5); }3482 | '(' attribute_list variable_ptr ')' '(' p arameter_type_list_opt')' // empty parameter list OBSOLESCENT (see 3)3483 { $$ = $3->addQualifiers( $2 )->addParamList( $ 6); }3474 '(' variable_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 3475 { $$ = $2->addParamList( $6 ); } 3476 | '(' attribute_list variable_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 3477 { $$ = $3->addQualifiers( $2 )->addParamList( $7 ); } 3484 3478 | '(' variable_function ')' // redundant parenthesis 3485 3479 { $$ = $2; } … … 3501 3495 3502 3496 function_no_ptr: 3503 paren_identifier '(' p arameter_type_list_opt')' // empty parameter list OBSOLESCENT (see 3)3504 { $$ = $1->addParamList( $ 3); }3505 | '(' function_ptr ')' '(' p arameter_type_list_opt')'3506 { $$ = $2->addParamList( $ 5); }3507 | '(' attribute_list function_ptr ')' '(' p arameter_type_list_opt')'3508 { $$ = $3->addQualifiers( $2 )->addParamList( $ 6); }3497 paren_identifier '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 3498 { $$ = $1->addParamList( $4 ); } 3499 | '(' function_ptr ')' '(' push parameter_type_list_opt pop ')' 3500 { $$ = $2->addParamList( $6 ); } 3501 | '(' attribute_list function_ptr ')' '(' push parameter_type_list_opt pop ')' 3502 { $$ = $3->addQualifiers( $2 )->addParamList( $7 ); } 3509 3503 | '(' function_no_ptr ')' // redundant parenthesis 3510 3504 { $$ = $2; } … … 3555 3549 paren_identifier '(' identifier_list ')' // function_declarator handles empty parameter 3556 3550 { $$ = $1->addIdList( $3 ); } 3557 | '(' KR_function_ptr ')' '(' p arameter_type_list_opt')'3558 { $$ = $2->addParamList( $ 5); }3559 | '(' attribute_list KR_function_ptr ')' '(' p arameter_type_list_opt')'3560 { $$ = $3->addQualifiers( $2 )->addParamList( $ 6); }3551 | '(' KR_function_ptr ')' '(' push parameter_type_list_opt pop ')' 3552 { $$ = $2->addParamList( $6 ); } 3553 | '(' attribute_list KR_function_ptr ')' '(' push parameter_type_list_opt pop ')' 3554 { $$ = $3->addQualifiers( $2 )->addParamList( $7 ); } 3561 3555 | '(' KR_function_no_ptr ')' // redundant parenthesis 3562 3556 { $$ = $2; } … … 3602 3596 { 3603 3597 // hide type name in enclosing scope by variable name 3604 typedefTable.addToEnclosingScope( *$1->name, IDENTIFIER, " paren_type" );3598 typedefTable.addToEnclosingScope( *$1->name, IDENTIFIER, "ID" ); 3605 3599 } 3606 3600 | '(' paren_type ')' … … 3647 3641 3648 3642 variable_type_function: 3649 '(' variable_type_ptr ')' '(' p arameter_type_list_opt')' // empty parameter list OBSOLESCENT (see 3)3650 { $$ = $2->addParamList( $ 5); }3651 | '(' attribute_list variable_type_ptr ')' '(' p arameter_type_list_opt')' // empty parameter list OBSOLESCENT (see 3)3652 { $$ = $3->addQualifiers( $2 )->addParamList( $ 6); }3643 '(' variable_type_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 3644 { $$ = $2->addParamList( $6 ); } 3645 | '(' attribute_list variable_type_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 3646 { $$ = $3->addQualifiers( $2 )->addParamList( $7 ); } 3653 3647 | '(' variable_type_function ')' // redundant parenthesis 3654 3648 { $$ = $2; } … … 3670 3664 3671 3665 function_type_no_ptr: 3672 paren_type '(' p arameter_type_list_opt')' // empty parameter list OBSOLESCENT (see 3)3673 { $$ = $1->addParamList( $ 3); }3674 | '(' function_type_ptr ')' '(' p arameter_type_list_opt')'3675 { $$ = $2->addParamList( $ 5); }3676 | '(' attribute_list function_type_ptr ')' '(' p arameter_type_list_opt')'3677 { $$ = $3->addQualifiers( $2 )->addParamList( $ 6); }3666 paren_type '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 3667 { $$ = $1->addParamList( $4 ); } 3668 | '(' function_type_ptr ')' '(' push parameter_type_list_opt pop ')' 3669 { $$ = $2->addParamList( $6 ); } 3670 | '(' attribute_list function_type_ptr ')' '(' push parameter_type_list_opt pop ')' 3671 { $$ = $3->addQualifiers( $2 )->addParamList( $7 ); } 3678 3672 | '(' function_type_no_ptr ')' // redundant parenthesis 3679 3673 { $$ = $2; } … … 3746 3740 3747 3741 identifier_parameter_function: 3748 paren_identifier '(' p arameter_type_list_opt')' // empty parameter list OBSOLESCENT (see 3)3749 { $$ = $1->addParamList( $ 3); }3750 | '(' identifier_parameter_ptr ')' '(' p arameter_type_list_opt')' // empty parameter list OBSOLESCENT (see 3)3751 { $$ = $2->addParamList( $ 5); }3742 paren_identifier '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 3743 { $$ = $1->addParamList( $4 ); } 3744 | '(' identifier_parameter_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 3745 { $$ = $2->addParamList( $6 ); } 3752 3746 | '(' identifier_parameter_function ')' // redundant parenthesis 3753 3747 { $$ = $2; } … … 3799 3793 3800 3794 type_parameter_function: 3801 typedef_name '(' p arameter_type_list_opt')' // empty parameter list OBSOLESCENT (see 3)3802 { $$ = $1->addParamList( $ 3); }3803 | '(' type_parameter_ptr ')' '(' p arameter_type_list_opt')' // empty parameter list OBSOLESCENT (see 3)3804 { $$ = $2->addParamList( $ 5); }3795 typedef_name '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 3796 { $$ = $1->addParamList( $4 ); } 3797 | '(' type_parameter_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 3798 { $$ = $2->addParamList( $6 ); } 3805 3799 ; 3806 3800 … … 3849 3843 3850 3844 abstract_function: 3851 '(' p arameter_type_list_opt')' // empty parameter list OBSOLESCENT (see 3)3852 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $ 2, nullptr ); }3853 | '(' abstract_ptr ')' '(' p arameter_type_list_opt')' // empty parameter list OBSOLESCENT (see 3)3854 { $$ = $2->addParamList( $ 5); }3845 '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 3846 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $3, nullptr ); } 3847 | '(' abstract_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 3848 { $$ = $2->addParamList( $6 ); } 3855 3849 | '(' abstract_function ')' // redundant parenthesis 3856 3850 { $$ = $2; } … … 3972 3966 3973 3967 abstract_parameter_function: 3974 '(' p arameter_type_list_opt')' // empty parameter list OBSOLESCENT (see 3)3975 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $ 2, nullptr ); }3976 | '(' abstract_parameter_ptr ')' '(' p arameter_type_list_opt')' // empty parameter list OBSOLESCENT (see 3)3977 { $$ = $2->addParamList( $ 5); }3968 '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 3969 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $3, nullptr ); } 3970 | '(' abstract_parameter_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 3971 { $$ = $2->addParamList( $6 ); } 3978 3972 | '(' abstract_parameter_function ')' // redundant parenthesis 3979 3973 { $$ = $2; } … … 4012 4006 // This pattern parses a declaration of an abstract variable, but does not allow "int ()" for a function pointer. 4013 4007 // 4014 // struct S {4015 // int;4016 // int *;4017 // int [10];4018 // int (*)();4019 // };4008 // struct S { 4009 // int; 4010 // int *; 4011 // int [10]; 4012 // int (*)(); 4013 // }; 4020 4014 4021 4015 variable_abstract_declarator: … … 4051 4045 4052 4046 variable_abstract_function: 4053 '(' variable_abstract_ptr ')' '(' p arameter_type_list_opt')' // empty parameter list OBSOLESCENT (see 3)4054 { $$ = $2->addParamList( $ 5); }4047 '(' variable_abstract_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 4048 { $$ = $2->addParamList( $6 ); } 4055 4049 | '(' variable_abstract_function ')' // redundant parenthesis 4056 4050 { $$ = $2; }
Note:
See TracChangeset
for help on using the changeset viewer.