Changeset 28e58fd for src/Parser
- Timestamp:
- Aug 25, 2017, 10:38:34 AM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, stuck-waitfor-destruct, with_gc
- Children:
- 800d275
- Parents:
- af08051 (diff), 3eab308c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- src/Parser
- Files:
-
- 7 edited
-
DeclarationNode.cc (modified) (3 diffs)
-
ExpressionNode.cc (modified) (2 diffs)
-
ParseNode.h (modified) (1 diff)
-
TypeData.cc (modified) (7 diffs)
-
TypeData.h (modified) (2 diffs)
-
lex.ll (modified) (5 diffs)
-
parser.yy (modified) (29 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
raf08051 r28e58fd 340 340 } // DeclarationNode::newTypeDecl 341 341 342 DeclarationNode * DeclarationNode::newPointer( DeclarationNode * qualifiers ) {343 DeclarationNode * newnode = new DeclarationNode; 344 newnode->type = new TypeData( TypeData::Pointer);342 DeclarationNode * DeclarationNode::newPointer( DeclarationNode * qualifiers, OperKinds kind ) { 343 DeclarationNode * newnode = new DeclarationNode; 344 newnode->type = new TypeData( kind == OperKinds::PointTo ? TypeData::Pointer : TypeData::Reference ); 345 345 if ( qualifiers ) { 346 346 return newnode->addQualifiers( qualifiers ); … … 759 759 DeclarationNode * DeclarationNode::addPointer( DeclarationNode * p ) { 760 760 if ( p ) { 761 assert( p->type->kind == TypeData::Pointer );761 assert( p->type->kind == TypeData::Pointer || TypeData::Reference ); 762 762 setBase( p->type ); 763 763 p->type = nullptr; … … 781 781 DeclarationNode * DeclarationNode::addNewPointer( DeclarationNode * p ) { 782 782 if ( p ) { 783 assert( p->type->kind == TypeData::Pointer );783 assert( p->type->kind == TypeData::Pointer || p->type->kind == TypeData::Reference ); 784 784 if ( type ) { 785 785 switch ( type->kind ) { -
src/Parser/ExpressionNode.cc
raf08051 r28e58fd 314 314 Expression * build_unary_ptr( OperKinds op, ExpressionNode * expr_node ) { 315 315 std::list< Expression * > args; 316 args.push_back( new AddressExpr( maybeMoveBuild< Expression >(expr_node) ) );316 args.push_back( maybeMoveBuild< Expression >(expr_node) ); // xxx 317 317 return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args ); 318 318 } // build_unary_ptr … … 327 327 Expression * build_binary_ptr( OperKinds op, ExpressionNode * expr_node1, ExpressionNode * expr_node2 ) { 328 328 std::list< Expression * > args; 329 args.push_back( new AddressExpr( maybeMoveBuild< Expression >(expr_node1)) );329 args.push_back( maybeMoveBuild< Expression >(expr_node1) ); 330 330 args.push_back( maybeMoveBuild< Expression >(expr_node2) ); 331 331 return new UntypedExpr( new NameExpr( OperName[ (int)op ] ), args ); -
src/Parser/ParseNode.h
raf08051 r28e58fd 243 243 static DeclarationNode * newTraitUse( const std::string * name, ExpressionNode * params ); 244 244 static DeclarationNode * newTypeDecl( std::string * name, DeclarationNode * typeParams ); 245 static DeclarationNode * newPointer( DeclarationNode * qualifiers );245 static DeclarationNode * newPointer( DeclarationNode * qualifiers, OperKinds kind ); 246 246 static DeclarationNode * newArray( ExpressionNode * size, DeclarationNode * qualifiers, bool isStatic ); 247 247 static DeclarationNode * newVarArray( DeclarationNode * qualifiers ); -
src/Parser/TypeData.cc
raf08051 r28e58fd 35 35 case Unknown: 36 36 case Pointer: 37 case Reference: 37 38 case EnumConstant: 38 39 // nothing else to initialize … … 104 105 case Unknown: 105 106 case Pointer: 107 case Reference: 106 108 case EnumConstant: 107 109 // nothing to destroy … … 170 172 case EnumConstant: 171 173 case Pointer: 174 case Reference: 172 175 // nothing else to copy 173 176 break; … … 405 408 // add dtor: void ^?{}(T *) 406 409 FunctionType * dtorType = new FunctionType( Type::Qualifiers(), false ); 407 dtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );410 dtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) ); 408 411 td->get_assertions().push_front( new FunctionDecl( "^?{}", Type::StorageClasses(), LinkageSpec::Cforall, dtorType, nullptr ) ); 409 412 410 413 // add copy ctor: void ?{}(T *, T) 411 414 FunctionType * copyCtorType = new FunctionType( Type::Qualifiers(), false ); 412 copyCtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );415 copyCtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) ); 413 416 copyCtorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) ); 414 417 td->get_assertions().push_front( new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, copyCtorType, nullptr ) ); … … 416 419 // add default ctor: void ?{}(T *) 417 420 FunctionType * ctorType = new FunctionType( Type::Qualifiers(), false ); 418 ctorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );421 ctorType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) ); 419 422 td->get_assertions().push_front( new FunctionDecl( "?{}", Type::StorageClasses(), LinkageSpec::Cforall, ctorType, nullptr ) ); 420 423 421 424 // add assignment operator: T * ?=?(T *, T) 422 425 FunctionType * assignType = new FunctionType( Type::Qualifiers(), false ); 423 assignType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );426 assignType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new ReferenceType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) ); 424 427 assignType->get_parameters().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) ); 425 428 assignType->get_returnVals().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) ); … … 441 444 case TypeData::Array: 442 445 return buildArray( td ); 446 case TypeData::Reference: 447 return buildReference( td ); 443 448 case TypeData::Function: 444 449 return buildFunction( td ); … … 619 624 buildForall( td->forall, at->get_forall() ); 620 625 return at; 621 } // buildPointer 626 } // buildArray 627 628 ReferenceType * buildReference( const TypeData * td ) { 629 ReferenceType * rt; 630 if ( td->base ) { 631 rt = new ReferenceType( buildQualifiers( td ), typebuild( td->base ) ); 632 } else { 633 rt = new ReferenceType( buildQualifiers( td ), new BasicType( Type::Qualifiers(), BasicType::SignedInt ) ); 634 } // if 635 buildForall( td->forall, rt->get_forall() ); 636 return rt; 637 } // buildReference 622 638 623 639 AggregateDecl * buildAggregate( const TypeData * td, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) { -
src/Parser/TypeData.h
raf08051 r28e58fd 26 26 27 27 struct TypeData { 28 enum Kind { Basic, Pointer, Array, Function, Aggregate, AggregateInst, Enum, EnumConstant, Symbolic,28 enum Kind { Basic, Pointer, Array, Reference, Function, Aggregate, AggregateInst, Enum, EnumConstant, Symbolic, 29 29 SymbolicInst, Tuple, Typeof, Builtin, Unknown }; 30 30 … … 109 109 PointerType * buildPointer( const TypeData * ); 110 110 ArrayType * buildArray( const TypeData * ); 111 ReferenceType * buildReference( const TypeData * ); 111 112 AggregateDecl * buildAggregate( const TypeData *, std::list< Attribute * > ); 112 113 ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ); -
src/Parser/lex.ll
raf08051 r28e58fd 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : T hu Jul 27 21:46:06201713 * Update Count : 55 012 * Last Modified On : Tue Aug 22 22:43:39 2017 13 * Update Count : 558 14 14 */ 15 15 … … 45 45 #define NUMERIC_RETURN(x) rm_underscore(); RETURN_VAL( x ) // numeric constant 46 46 #define KEYWORD_RETURN(x) RETURN_CHAR( x ) // keyword 47 #define QKEYWORD_RETURN(x) typedefTable.isKind( yytext ); RETURN_VAL(x); // quasi-keyword 47 48 #define IDENTIFIER_RETURN() RETURN_VAL( typedefTable.isKind( yytext ) ) 48 49 #define ATTRIBUTE_RETURN() RETURN_VAL( ATTR_IDENTIFIER ) … … 236 237 __label__ { KEYWORD_RETURN(LABEL); } // GCC 237 238 long { KEYWORD_RETURN(LONG); } 238 lvalue { KEYWORD_RETURN(LVALUE); } // CFA239 239 monitor { KEYWORD_RETURN(MONITOR); } // CFA 240 240 mutex { KEYWORD_RETURN(MUTEX); } // CFA … … 261 261 throw { KEYWORD_RETURN(THROW); } // CFA 262 262 throwResume { KEYWORD_RETURN(THROWRESUME); } // CFA 263 timeout { QKEYWORD_RETURN(TIMEOUT); } // CFA 263 264 trait { KEYWORD_RETURN(TRAIT); } // CFA 264 265 try { KEYWORD_RETURN(TRY); } // CFA … … 277 278 __volatile { KEYWORD_RETURN(VOLATILE); } // GCC 278 279 __volatile__ { KEYWORD_RETURN(VOLATILE); } // GCC 280 waitfor { KEYWORD_RETURN(WAITFOR); } 281 or { QKEYWORD_RETURN(WOR); } // CFA 282 when { KEYWORD_RETURN(WHEN); } 279 283 while { KEYWORD_RETURN(WHILE); } 280 284 with { KEYWORD_RETURN(WITH); } // CFA -
src/Parser/parser.yy
raf08051 r28e58fd 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Aug 20 09:21:54201713 // Update Count : 2 57312 // Last Modified On : Wed Aug 23 21:08:08 2017 13 // Update Count : 2704 14 14 // 15 15 … … 119 119 %token RESTRICT // C99 120 120 %token ATOMIC // C11 121 %token FORALL LVALUEMUTEX VIRTUAL // CFA121 %token FORALL MUTEX VIRTUAL // CFA 122 122 %token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED 123 123 %token BOOL COMPLEX IMAGINARY // C99 … … 131 131 %token ATTRIBUTE EXTENSION // GCC 132 132 %token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN 133 %token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT WITH // CFA133 %token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT WITH WHEN WAITFOR // CFA 134 134 %token ASM // C99, extension ISO/IEC 9899:1999 Section J.5.10(1) 135 135 %token ALIGNAS ALIGNOF GENERIC STATICASSERT // C11 … … 137 137 // names and constants: lexer differentiates between identifier and typedef names 138 138 %token<tok> IDENTIFIER QUOTED_IDENTIFIER TYPEDEFname TYPEGENname 139 %token<tok> TIMEOUT WOR 139 140 %token<tok> ATTR_IDENTIFIER ATTR_TYPEDEFname ATTR_TYPEGENname 140 141 %token<tok> INTEGERconstant CHARACTERconstant STRINGliteral … … 161 162 %type<tok> identifier no_attr_identifier 162 163 %type<tok> identifier_or_type_name no_attr_identifier_or_type_name attr_name 164 %type<tok> quasi_keyword 163 165 %type<constant> string_literal 164 166 %type<str> string_literal_list … … 190 192 %type<sn> iteration_statement jump_statement 191 193 %type<sn> with_statement exception_statement asm_statement 194 %type<sn> when_clause_opt waitfor_statement waitfor_clause waitfor timeout 192 195 %type<sn> fall_through_opt fall_through 193 196 %type<sn> statement statement_list … … 197 200 %type<sn> case_clause case_value_list case_label case_label_list 198 201 %type<sn> switch_clause_list_opt switch_clause_list choose_clause_list_opt choose_clause_list 199 %type<sn> /* handler_list */handler_clause finally_clause202 %type<sn> handler_clause finally_clause 200 203 %type<catch_kind> handler_key 201 204 … … 295 298 // Handle single shift/reduce conflict for dangling else by shifting the ELSE token. For example, this string 296 299 // is ambiguous: 297 // .---------. matches IF '(' comma_expression ')' statement 300 // .---------. matches IF '(' comma_expression ')' statement . (reduce) 298 301 // if ( C ) S1 else S2 299 // `-----------------' matches IF '(' comma_expression ')' statement ELSE statement */ 300 301 %nonassoc THEN // rule precedence for IF '(' comma_expression ')' statement 302 %nonassoc ELSE // token precedence for start of else clause in IF statement 302 // `-----------------' matches IF '(' comma_expression ')' statement . (shift) ELSE statement */ 303 // Similar issues exit with the waitfor statement. 304 305 // Order of these lines matters (low-to-high precedence). THEN is left associative over WOR/TIMEOUT/ELSE, WOR is left 306 // associative over TIMEOUT/ELSE, and TIMEOUT is left associative over ELSE. 307 %precedence THEN // rule precedence for IF/WAITFOR statement 308 %precedence WOR // token precedence for start of WOR in WAITFOR statement 309 %precedence TIMEOUT // token precedence for start of TIMEOUT in WAITFOR statement 310 %precedence ELSE // token precedence for start of else clause in IF/WAITFOR statement 303 311 304 312 %start translation_unit // parse-tree root … … 353 361 ; 354 362 363 quasi_keyword: // CFA 364 TIMEOUT 365 | WOR 366 ; 367 355 368 identifier: 356 369 IDENTIFIER 357 370 | ATTR_IDENTIFIER // CFA 371 | quasi_keyword 358 372 ; 359 373 360 374 no_attr_identifier: 361 375 IDENTIFIER 376 | quasi_keyword 362 377 ; 363 378 … … 380 395 primary_expression: 381 396 IDENTIFIER // typedef name cannot be used as a variable name 397 { $$ = new ExpressionNode( build_varref( $1 ) ); } 398 | quasi_keyword 382 399 { $$ = new ExpressionNode( build_varref( $1 ) ); } 383 400 | tuple … … 548 565 | '&' { $$ = OperKinds::AddressOf; } 549 566 // GCC, address of label must be handled by semantic check for ref,ref,label 550 //| ANDAND { $$ = OperKinds::And; }567 | ANDAND { $$ = OperKinds::And; } 551 568 ; 552 569 … … 670 687 conditional_expression 671 688 | unary_expression assignment_operator assignment_expression 672 { $$ = new ExpressionNode( build_binary_ ptr( $2, $1, $3 ) ); }689 { $$ = new ExpressionNode( build_binary_val( $2, $1, $3 ) ); } 673 690 ; 674 691 … … 736 753 | jump_statement 737 754 | with_statement 755 | waitfor_statement 738 756 | exception_statement 739 757 | asm_statement … … 955 973 956 974 with_statement: 957 WITH '(' tuple_expression_list ')' compound_statement 958 { $$ = (StatementNode *)0; } // FIX ME 975 WITH '(' tuple_expression_list ')' statement 976 { $$ = nullptr; } // FIX ME 977 ; 978 979 when_clause_opt: 980 // empty 981 { $$ = nullptr; } // FIX ME 982 | WHEN '(' comma_expression ')' 983 { $$ = nullptr; } // FIX ME 984 ; 985 986 waitfor: 987 WAITFOR '(' identifier ')' 988 { $$ = nullptr; } // FIX ME 989 | WAITFOR '(' identifier ',' argument_expression_list ')' 990 { $$ = nullptr; } // FIX ME 991 ; 992 993 timeout: 994 TIMEOUT '(' comma_expression ')' 995 { $$ = nullptr; } // FIX ME 996 ; 997 998 waitfor_clause: 999 when_clause_opt waitfor statement %prec THEN 1000 { $$ = nullptr; } // FIX ME 1001 | when_clause_opt waitfor statement WOR waitfor_clause 1002 { $$ = nullptr; } // FIX ME 1003 | when_clause_opt timeout statement %prec THEN 1004 { $$ = nullptr; } // FIX ME 1005 | when_clause_opt ELSE statement 1006 { $$ = nullptr; } // FIX ME 1007 | when_clause_opt timeout statement WOR when_clause_opt ELSE statement 1008 { $$ = nullptr; } // FIX ME 1009 ; 1010 1011 waitfor_statement: 1012 when_clause_opt waitfor statement %prec THEN 1013 { $$ = nullptr; } // FIX ME 1014 | when_clause_opt waitfor statement WOR waitfor_clause 1015 { $$ = nullptr; } // FIX ME 959 1016 ; 960 1017 … … 967 1024 { $$ = new StatementNode( build_try( $2, $3, $4 ) ); } 968 1025 ; 969 970 //handler_list:971 // handler_clause972 // // ISO/IEC 9899:1999 Section 15.3(6 ) If present, a "..." handler shall be the last handler for its try block.973 // | CATCH '(' ELLIPSIS ')' compound_statement974 // { $$ = new StatementNode( build_catch( 0, $5, true ) ); }975 // | handler_clause CATCH '(' ELLIPSIS ')' compound_statement976 // { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( 0, $6, true ) ) ); }977 // | CATCHRESUME '(' ELLIPSIS ')' compound_statement978 // { $$ = new StatementNode( build_catch( 0, $5, true ) ); }979 // | handler_clause CATCHRESUME '(' ELLIPSIS ')' compound_statement980 // { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( 0, $6, true ) ) ); }981 // ;982 1026 983 1027 handler_clause: … … 1439 1483 | VOLATILE 1440 1484 { $$ = DeclarationNode::newTypeQualifier( Type::Volatile ); } 1441 | LVALUE // CFA1442 { $$ = DeclarationNode::newTypeQualifier( Type::Lvalue ); }1443 1485 | MUTEX 1444 1486 { $$ = DeclarationNode::newTypeQualifier( Type::Mutex ); } … … 2241 2283 with_clause_opt: 2242 2284 // empty 2243 { $$ = (StatementNode *)0; }// FIX ME2285 { $$ = nullptr; } // FIX ME 2244 2286 | WITH '(' tuple_expression_list ')' 2245 { $$ = (StatementNode *)0; }// FIX ME2287 { $$ = nullptr; } // FIX ME 2246 2288 ; 2247 2289 … … 2363 2405 attr_name: // GCC 2364 2406 IDENTIFIER 2407 | quasi_keyword 2365 2408 | TYPEDEFname 2366 2409 | TYPEGENname … … 2421 2464 variable_ptr: 2422 2465 ptrref_operator variable_declarator 2423 { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }2466 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); } 2424 2467 | ptrref_operator type_qualifier_list variable_declarator 2425 { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }2468 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); } 2426 2469 | '(' variable_ptr ')' attribute_list_opt 2427 2470 { $$ = $2->addQualifiers( $4 ); } // redundant parenthesis … … 2469 2512 function_ptr: 2470 2513 ptrref_operator function_declarator 2471 { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }2514 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); } 2472 2515 | ptrref_operator type_qualifier_list function_declarator 2473 { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }2516 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); } 2474 2517 | '(' function_ptr ')' 2475 2518 { $$ = $2; } … … 2509 2552 KR_function_ptr: 2510 2553 ptrref_operator KR_function_declarator 2511 { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }2554 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); } 2512 2555 | ptrref_operator type_qualifier_list KR_function_declarator 2513 { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }2556 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); } 2514 2557 | '(' KR_function_ptr ')' 2515 2558 { $$ = $2; } … … 2553 2596 type_ptr: 2554 2597 ptrref_operator variable_type_redeclarator 2555 { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }2598 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); } 2556 2599 | ptrref_operator type_qualifier_list variable_type_redeclarator 2557 { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }2600 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); } 2558 2601 | '(' type_ptr ')' attribute_list_opt 2559 2602 { $$ = $2->addQualifiers( $4 ); } … … 2597 2640 identifier_parameter_ptr: 2598 2641 ptrref_operator identifier_parameter_declarator 2599 { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }2642 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); } 2600 2643 | ptrref_operator type_qualifier_list identifier_parameter_declarator 2601 { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }2644 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); } 2602 2645 | '(' identifier_parameter_ptr ')' attribute_list_opt 2603 2646 { $$ = $2->addQualifiers( $4 ); } … … 2657 2700 type_parameter_ptr: 2658 2701 ptrref_operator type_parameter_redeclarator 2659 { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }2702 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); } 2660 2703 | ptrref_operator type_qualifier_list type_parameter_redeclarator 2661 { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }2704 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); } 2662 2705 | '(' type_parameter_ptr ')' attribute_list_opt 2663 2706 { $$ = $2->addQualifiers( $4 ); } … … 2700 2743 abstract_ptr: 2701 2744 ptrref_operator 2702 { $$ = DeclarationNode::newPointer( 0 ); }2745 { $$ = DeclarationNode::newPointer( 0, $1 ); } 2703 2746 | ptrref_operator type_qualifier_list 2704 { $$ = DeclarationNode::newPointer( $2 ); }2747 { $$ = DeclarationNode::newPointer( $2, $1 ); } 2705 2748 | ptrref_operator abstract_declarator 2706 { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }2749 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); } 2707 2750 | ptrref_operator type_qualifier_list abstract_declarator 2708 { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }2751 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); } 2709 2752 | '(' abstract_ptr ')' attribute_list_opt 2710 2753 { $$ = $2->addQualifiers( $4 ); } … … 2789 2832 abstract_parameter_ptr: 2790 2833 ptrref_operator 2791 { $$ = DeclarationNode::newPointer( nullptr ); }2834 { $$ = DeclarationNode::newPointer( nullptr, $1 ); } 2792 2835 | ptrref_operator type_qualifier_list 2793 { $$ = DeclarationNode::newPointer( $2 ); }2836 { $$ = DeclarationNode::newPointer( $2, $1 ); } 2794 2837 | ptrref_operator abstract_parameter_declarator 2795 { $$ = $2->addPointer( DeclarationNode::newPointer( nullptr ) ); }2838 { $$ = $2->addPointer( DeclarationNode::newPointer( nullptr, $1 ) ); } 2796 2839 | ptrref_operator type_qualifier_list abstract_parameter_declarator 2797 { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }2840 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); } 2798 2841 | '(' abstract_parameter_ptr ')' attribute_list_opt 2799 2842 { $$ = $2->addQualifiers( $4 ); } … … 2868 2911 variable_abstract_ptr: 2869 2912 ptrref_operator 2870 { $$ = DeclarationNode::newPointer( 0 ); }2913 { $$ = DeclarationNode::newPointer( 0, $1 ); } 2871 2914 | ptrref_operator type_qualifier_list 2872 { $$ = DeclarationNode::newPointer( $2 ); }2915 { $$ = DeclarationNode::newPointer( $2, $1 ); } 2873 2916 | ptrref_operator variable_abstract_declarator 2874 { $$ = $2->addPointer( DeclarationNode::newPointer( 0 ) ); }2917 { $$ = $2->addPointer( DeclarationNode::newPointer( 0, $1 ) ); } 2875 2918 | ptrref_operator type_qualifier_list variable_abstract_declarator 2876 { $$ = $3->addPointer( DeclarationNode::newPointer( $2 ) ); }2919 { $$ = $3->addPointer( DeclarationNode::newPointer( $2, $1 ) ); } 2877 2920 | '(' variable_abstract_ptr ')' attribute_list_opt 2878 2921 { $$ = $2->addQualifiers( $4 ); } … … 2914 2957 // No SUE declaration in parameter list. 2915 2958 ptrref_operator type_specifier_nobody 2916 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0 ) ); }2959 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); } 2917 2960 | type_qualifier_list ptrref_operator type_specifier_nobody 2918 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1 ) ); }2961 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); } 2919 2962 | ptrref_operator cfa_abstract_function 2920 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0 ) ); }2963 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); } 2921 2964 | type_qualifier_list ptrref_operator cfa_abstract_function 2922 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1 ) ); }2965 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); } 2923 2966 | ptrref_operator cfa_identifier_parameter_declarator_tuple 2924 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0 ) ); }2967 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); } 2925 2968 | type_qualifier_list ptrref_operator cfa_identifier_parameter_declarator_tuple 2926 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1 ) ); }2969 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); } 2927 2970 ; 2928 2971 … … 3002 3045 cfa_abstract_ptr: // CFA 3003 3046 ptrref_operator type_specifier 3004 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0 ) ); }3047 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); } 3005 3048 | type_qualifier_list ptrref_operator type_specifier 3006 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1 ) ); }3049 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); } 3007 3050 | ptrref_operator cfa_abstract_function 3008 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0 ) ); }3051 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); } 3009 3052 | type_qualifier_list ptrref_operator cfa_abstract_function 3010 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1 ) ); }3053 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); } 3011 3054 | ptrref_operator cfa_abstract_declarator_tuple 3012 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0 ) ); }3055 { $$ = $2->addNewPointer( DeclarationNode::newPointer( 0, $1 ) ); } 3013 3056 | type_qualifier_list ptrref_operator cfa_abstract_declarator_tuple 3014 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1 ) ); }3057 { $$ = $3->addNewPointer( DeclarationNode::newPointer( $1, $2 ) ); } 3015 3058 ; 3016 3059
Note:
See TracChangeset
for help on using the changeset viewer.