Changeset b7d6a36 for src/Parser
- Timestamp:
- Feb 20, 2020, 4:15:51 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 6a490b2
- Parents:
- dca5802 (diff), 2cbfe92 (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:
-
- 1 deleted
- 11 edited
-
DeclarationNode.cc (modified) (9 diffs)
-
ExpressionNode.cc (modified) (3 diffs)
-
LinkageSpec.cc (deleted)
-
ParseNode.h (modified) (6 diffs)
-
ParserTypes.h (modified) (2 diffs)
-
TypeData.cc (modified) (3 diffs)
-
TypeData.h (modified) (2 diffs)
-
TypedefTable.cc (modified) (2 diffs)
-
TypedefTable.h (modified) (2 diffs)
-
lex.ll (modified) (4 diffs)
-
module.mk (modified) (2 diffs)
-
parser.yy (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
rdca5802 rb7d6a36 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Dec 11 07:40:14201913 // Update Count : 11 2312 // Last Modified On : Mon Dec 16 15:32:22 2019 13 // Update Count : 1133 14 14 // 15 15 … … 24 24 #include "Common/UniqueName.h" // for UniqueName 25 25 #include "Common/utility.h" // for maybeClone, maybeBuild, CodeLocation 26 #include "Parser/LinkageSpec.h" // for Spec, linkageName, Cforall27 26 #include "Parser/ParseNode.h" // for DeclarationNode, ExpressionNode 27 #include "SynTree/LinkageSpec.h" // for Spec, linkageName, Cforall 28 28 #include "SynTree/Attribute.h" // for Attribute 29 29 #include "SynTree/Declaration.h" // for TypeDecl, ObjectDecl, Declaration … … 47 47 const char * DeclarationNode::signednessNames[] = { "signed", "unsigned", "NoSignednessNames" }; 48 48 const char * DeclarationNode::lengthNames[] = { "short", "long", "long long", "NoLengthNames" }; 49 const char * DeclarationNode::typeClassNames[] = { "otype", "dtype", "ftype", "NoTypeClassNames" };50 49 const char * DeclarationNode::builtinTypeNames[] = { "__builtin_va_list", "__auto_type", "zero_t", "one_t", "NoBuiltinTypeNames" }; 51 50 … … 58 57 59 58 // variable.name = nullptr; 60 variable.tyClass = NoTypeClass;59 variable.tyClass = TypeDecl::NUMBER_OF_KINDS; 61 60 variable.assertions = nullptr; 62 61 variable.initializer = nullptr; … … 134 133 135 134 if ( linkage != LinkageSpec::Cforall ) { 136 os << LinkageSpec:: linkageName( linkage ) << " ";135 os << LinkageSpec::name( linkage ) << " "; 137 136 } // if 138 137 … … 312 311 } // DeclarationNode::newFromTypeGen 313 312 314 DeclarationNode * DeclarationNode::newTypeParam( Type Classtc, const string * name ) {313 DeclarationNode * DeclarationNode::newTypeParam( TypeDecl::Kind tc, const string * name ) { 315 314 DeclarationNode * newnode = new DeclarationNode; 316 315 newnode->type = nullptr; … … 670 669 671 670 DeclarationNode * DeclarationNode::addAssertions( DeclarationNode * assertions ) { 672 if ( variable.tyClass != NoTypeClass) {671 if ( variable.tyClass != TypeDecl::NUMBER_OF_KINDS ) { 673 672 if ( variable.assertions ) { 674 673 variable.assertions->appendList( assertions ); … … 875 874 876 875 DeclarationNode * DeclarationNode::addTypeInitializer( DeclarationNode * init ) { 877 assertf( variable.tyClass != NoTypeClass, "Called addTypeInitializer on something that isn't a type variable." );876 assertf( variable.tyClass != TypeDecl::NUMBER_OF_KINDS, "Called addTypeInitializer on something that isn't a type variable." ); 878 877 variable.initializer = init; 879 878 return this; … … 1074 1073 } // if 1075 1074 1076 if ( variable.tyClass != NoTypeClass) {1075 if ( variable.tyClass != TypeDecl::NUMBER_OF_KINDS ) { 1077 1076 // otype is internally converted to dtype + otype parameters 1078 1077 static const TypeDecl::Kind kindMap[] = { TypeDecl::Dtype, TypeDecl::Dtype, TypeDecl::Ftype, TypeDecl::Ttype }; 1079 assertf( sizeof(kindMap)/sizeof(kindMap[0]) == NoTypeClass, "DeclarationNode::build: kindMap is out of sync." );1078 static_assert( sizeof(kindMap)/sizeof(kindMap[0]) == TypeDecl::NUMBER_OF_KINDS, "DeclarationNode::build: kindMap is out of sync." ); 1080 1079 assertf( variable.tyClass < sizeof(kindMap)/sizeof(kindMap[0]), "Variable's tyClass is out of bounds." ); 1081 TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.tyClass == Otype, variable.initializer ? variable.initializer->buildType() : nullptr );1080 TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.tyClass == TypeDecl::Otype, variable.initializer ? variable.initializer->buildType() : nullptr ); 1082 1081 buildList( variable.assertions, ret->get_assertions() ); 1083 1082 return ret; -
src/Parser/ExpressionNode.cc
rdca5802 rb7d6a36 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 10 23:01:47201913 // Update Count : 98 012 // Last Modified On : Wed Dec 18 21:14:58 2019 13 // Update Count : 981 14 14 // 15 15 … … 265 265 static const BasicType::Kind kind[2][12] = { 266 266 { BasicType::Float, BasicType::Double, BasicType::LongDouble, BasicType::uuFloat80, BasicType::uuFloat128, BasicType::uFloat16, BasicType::uFloat32, BasicType::uFloat32x, BasicType::uFloat64, BasicType::uFloat64x, BasicType::uFloat128, BasicType::uFloat128x }, 267 { BasicType::FloatComplex, BasicType::DoubleComplex, BasicType::LongDoubleComplex, (BasicType::Kind)-1, (BasicType::Kind)-1, BasicType::uFloat16Complex, BasicType::uFloat32Complex, BasicType::uFloat32xComplex, BasicType::uFloat64Complex, BasicType::uFloat64xComplex, BasicType::uFloat128Complex, BasicType::uFloat128xComplex },267 { BasicType::FloatComplex, BasicType::DoubleComplex, BasicType::LongDoubleComplex, BasicType::NUMBER_OF_BASIC_TYPES, BasicType::NUMBER_OF_BASIC_TYPES, BasicType::uFloat16Complex, BasicType::uFloat32Complex, BasicType::uFloat32xComplex, BasicType::uFloat64Complex, BasicType::uFloat64xComplex, BasicType::uFloat128Complex, BasicType::uFloat128xComplex }, 268 268 }; 269 269 … … 374 374 375 375 Expression * build_field_name_FLOATING_DECIMALconstant( const string & str ) { 376 if ( str[str.size() -1] != '.' ) SemanticError( yylloc, "invalid tuple index " + str );376 if ( str[str.size() - 1] != '.' ) SemanticError( yylloc, "invalid tuple index " + str ); 377 377 Expression * ret = build_constantInteger( *new string( str.substr( 0, str.size()-1 ) ) ); 378 378 delete &str; -
src/Parser/ParseNode.h
rdca5802 rb7d6a36 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Dec 11 07:40:07 201913 // Update Count : 8 8212 // Last Modified On : Fri Feb 7 17:56:02 2020 13 // Update Count : 891 14 14 // 15 15 … … 28 28 #include "Common/UniqueName.h" // for UniqueName 29 29 #include "Common/utility.h" // for maybeClone, maybeBuild 30 #include " Parser/LinkageSpec.h"// for Spec30 #include "SynTree/LinkageSpec.h" // for Spec 31 31 #include "SynTree/Declaration.h" // for Aggregate 32 32 #include "SynTree/Expression.h" // for Expression, ConstantExpr (ptr only) … … 218 218 enum Length { Short, Long, LongLong, NoLength }; 219 219 static const char * lengthNames[]; 220 enum TypeClass { Otype, Dtype, Ftype, Ttype, NoTypeClass };221 static const char * typeClassNames[];222 220 enum BuiltinType { Valist, AutoType, Zero, One, NoBuiltinType }; 223 221 static const char * builtinTypeNames[]; … … 241 239 static DeclarationNode * newName( const std::string * ); 242 240 static DeclarationNode * newFromTypeGen( const std::string *, ExpressionNode * params ); 243 static DeclarationNode * newTypeParam( Type Class, const std::string * );241 static DeclarationNode * newTypeParam( TypeDecl::Kind, const std::string * ); 244 242 static DeclarationNode * newTrait( const std::string * name, DeclarationNode * params, DeclarationNode * asserts ); 245 243 static DeclarationNode * newTraitUse( const std::string * name, ExpressionNode * params ); … … 311 309 struct Variable_t { 312 310 // const std::string * name; 313 DeclarationNode::TypeClasstyClass;311 TypeDecl::Kind tyClass; 314 312 DeclarationNode * assertions; 315 313 DeclarationNode * initializer; … … 451 449 * out++ = result; 452 450 } else { 453 assertf(false, "buildList unknown type");451 SemanticError( cur->location, "type specifier declaration in forall clause is currently unimplemented." ); 454 452 } // if 455 453 } catch( SemanticErrorException & e ) { -
src/Parser/ParserTypes.h
rdca5802 rb7d6a36 10 10 // Created On : Sat Sep 22 08:58:10 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:33:28 201713 // Update Count : 35 012 // Last Modified On : Sat Feb 15 11:04:40 2020 13 // Update Count : 351 14 14 // 15 15 … … 27 27 // current location in the input 28 28 extern int yylineno; 29 extern char * yyfilename;29 extern char * yyfilename; 30 30 31 31 struct Location { 32 char * file;32 char * file; 33 33 int line; 34 34 }; // Location 35 35 36 36 struct Token { 37 std::string * str; // must be pointer as used in union37 std::string * str; // must be pointer as used in union 38 38 Location loc; 39 39 -
src/Parser/TypeData.cc
rdca5802 rb7d6a36 10 10 // Created On : Sat May 16 15:12:51 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Dec 11 07:48:33201913 // Update Count : 6 5912 // Last Modified On : Mon Dec 16 07:56:46 2019 13 // Update Count : 662 14 14 // 15 15 … … 489 489 for ( typename ForallList::iterator i = outputList.begin(); i != outputList.end(); ++i, n = (DeclarationNode*)n->get_next() ) { 490 490 TypeDecl * td = static_cast<TypeDecl *>(*i); 491 if ( n->variable.tyClass == DeclarationNode::Otype ) {491 if ( n->variable.tyClass == TypeDecl::Otype ) { 492 492 // add assertion parameters to `type' tyvars in reverse order 493 493 // add dtor: void ^?{}(T *) … … 522 522 switch ( td->kind ) { 523 523 case TypeData::Unknown: 524 // fill in implicit int525 return new BasicType( buildQualifiers( td ), BasicType::SignedInt );524 // fill in implicit int 525 return new BasicType( buildQualifiers( td ), BasicType::SignedInt ); 526 526 case TypeData::Basic: 527 return buildBasicType( td );527 return buildBasicType( td ); 528 528 case TypeData::Pointer: 529 return buildPointer( td );529 return buildPointer( td ); 530 530 case TypeData::Array: 531 return buildArray( td );531 return buildArray( td ); 532 532 case TypeData::Reference: 533 return buildReference( td );533 return buildReference( td ); 534 534 case TypeData::Function: 535 return buildFunction( td );535 return buildFunction( td ); 536 536 case TypeData::AggregateInst: 537 return buildAggInst( td );537 return buildAggInst( td ); 538 538 case TypeData::EnumConstant: 539 // the name gets filled in later -- by SymTab::Validate540 return new EnumInstType( buildQualifiers( td ), "" );539 // the name gets filled in later -- by SymTab::Validate 540 return new EnumInstType( buildQualifiers( td ), "" ); 541 541 case TypeData::SymbolicInst: 542 return buildSymbolicInst( td );542 return buildSymbolicInst( td ); 543 543 case TypeData::Tuple: 544 return buildTuple( td );544 return buildTuple( td ); 545 545 case TypeData::Typeof: 546 546 case TypeData::Basetypeof: 547 return buildTypeof( td );547 return buildTypeof( td ); 548 548 case TypeData::Builtin: 549 if (td->builtintype == DeclarationNode::Zero) { 550 return new ZeroType( noQualifiers ); 551 } 552 else if (td->builtintype == DeclarationNode::One) { 553 return new OneType( noQualifiers ); 554 } 555 else { 556 return new VarArgsType( buildQualifiers( td ) ); 557 } 549 switch ( td->builtintype ) { 550 case DeclarationNode::Zero: 551 return new ZeroType( noQualifiers ); 552 case DeclarationNode::One: 553 return new OneType( noQualifiers ); 554 default: 555 return new VarArgsType( buildQualifiers( td ) ); 556 } // switch 558 557 case TypeData::GlobalScope: 559 return new GlobalScopeType();560 case TypeData::Qualified:561 return new QualifiedType( buildQualifiers( td ), typebuild( td->qualified.parent ), typebuild( td->qualified.child ) );558 return new GlobalScopeType(); 559 case TypeData::Qualified: 560 return new QualifiedType( buildQualifiers( td ), typebuild( td->qualified.parent ), typebuild( td->qualified.child ) ); 562 561 case TypeData::Symbolic: 563 562 case TypeData::Enum: 564 563 case TypeData::Aggregate: 565 assert( false );564 assert( false ); 566 565 } // switch 567 566 -
src/Parser/TypeData.h
rdca5802 rb7d6a36 10 10 // Created On : Sat May 16 15:18:36 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 10 23:01:07201913 // Update Count : 19 812 // Last Modified On : Fri Dec 13 23:42:35 2019 13 // Update Count : 199 14 14 // 15 15 … … 21 21 22 22 #include "ParseNode.h" // for DeclarationNode, DeclarationNode::Ag... 23 #include " Parser/LinkageSpec.h"// for Spec23 #include "SynTree/LinkageSpec.h" // for Spec 24 24 #include "SynTree/Type.h" // for Type, ReferenceToType (ptr only) 25 25 #include "SynTree/SynTree.h" // for Visitor Nodes -
src/Parser/TypedefTable.cc
rdca5802 rb7d6a36 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 25 15:32:35 201813 // Update Count : 25 812 // Last Modified On : Sat Feb 15 08:06:36 2020 13 // Update Count : 259 14 14 // 15 15 … … 47 47 } // TypedefTable::~TypedefTable 48 48 49 bool TypedefTable::exists( const string & identifier ) {49 bool TypedefTable::exists( const string & identifier ) const { 50 50 return kindTable.find( identifier ) != kindTable.end(); 51 51 } // TypedefTable::exists 52 52 53 bool TypedefTable::existsCurr( const string & identifier ) {53 bool TypedefTable::existsCurr( const string & identifier ) const { 54 54 return kindTable.findAt( kindTable.currentScope() - 1, identifier ) != kindTable.end(); 55 55 } // TypedefTable::exists -
src/Parser/TypedefTable.h
rdca5802 rb7d6a36 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 25 15:33:55 201813 // Update Count : 11 412 // Last Modified On : Sat Feb 15 08:06:37 2020 13 // Update Count : 117 14 14 // 15 15 … … 30 30 ~TypedefTable(); 31 31 32 bool exists( const std::string & identifier ) ;33 bool existsCurr( const std::string & identifier ) ;32 bool exists( const std::string & identifier ) const; 33 bool existsCurr( const std::string & identifier ) const; 34 34 int isKind( const std::string & identifier ) const; 35 35 void makeTypedef( const std::string & name, int kind = TYPEDEFname ); -
src/Parser/lex.ll
rdca5802 rb7d6a36 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : S un Aug 4 20:53:47 201913 * Update Count : 7 1912 * Last Modified On : Sat Feb 15 11:05:50 2020 13 * Update Count : 737 14 14 */ 15 15 … … 42 42 #include "ParseNode.h" 43 43 #include "TypedefTable.h" 44 45 string * build_postfix_name( string * name ); 44 46 45 47 char *yyfilename; … … 330 332 /* identifier */ 331 333 {identifier} { IDENTIFIER_RETURN(); } 332 "` "{identifier}"`" {// CFA333 yytext[yyleng - 1] = '\0'; yytext += 1;// SKULLDUGGERY: remove backquotes (ok to shorten?)334 "``"{identifier} { // CFA 335 yytext[yyleng] = '\0'; yytext += 2; // SKULLDUGGERY: remove backquotes (ok to shorten?) 334 336 IDENTIFIER_RETURN(); 335 337 } … … 432 434 "?"({op_unary_pre_post}|"()"|"[?]"|"{}") { IDENTIFIER_RETURN(); } 433 435 "^?{}" { IDENTIFIER_RETURN(); } 434 "?`"{identifier} { IDENTIFIER_RETURN(); } // postfix operator 436 "?`"{identifier} { // postfix operator 437 yylval.tok.str = new string( &yytext[2] ); // remove ?` 438 yylval.tok.str = build_postfix_name( yylval.tok.str ); // add prefix 439 RETURN_LOCN( typedefTable.isKind( *yylval.tok.str ) ); 440 } 435 441 "?"{op_binary_over}"?" { IDENTIFIER_RETURN(); } // binary 436 442 /* -
src/Parser/module.mk
rdca5802 rb7d6a36 11 11 ## Created On : Sat May 16 15:29:09 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Wed Jun 28 21:58:29 201714 ## Update Count : 10 413 ## Last Modified On : Sat Dec 14 07:34:47 2019 14 ## Update Count : 107 15 15 ############################################################################### 16 16 … … 19 19 AM_YFLAGS = -d -t -v 20 20 21 SRC += Parser/parser.yy \ 22 Parser/lex.ll \ 23 Parser/TypedefTable.cc \ 24 Parser/ParseNode.cc \ 21 SRC += \ 25 22 Parser/DeclarationNode.cc \ 26 23 Parser/ExpressionNode.cc \ 24 Parser/InitializerNode.cc \ 25 Parser/ParseNode.cc \ 27 26 Parser/StatementNode.cc \ 28 Parser/InitializerNode.cc \29 27 Parser/TypeData.cc \ 30 Parser/LinkageSpec.cc \ 28 Parser/TypedefTable.cc \ 29 Parser/lex.ll \ 30 Parser/parser.yy \ 31 31 Parser/parserutility.cc 32 32 33 SRCDEMANGLE += \34 Parser/LinkageSpec.cc35 36 37 33 MOSTLYCLEANFILES += Parser/lex.cc Parser/parser.cc Parser/parser.hh Parser/parser.output -
src/Parser/parser.yy
rdca5802 rb7d6a36 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 10 23:07:17 201913 // Update Count : 44 0012 // Last Modified On : Sun Feb 16 08:22:14 2020 13 // Update Count : 4461 14 14 // 15 15 … … 55 55 #include "TypedefTable.h" 56 56 #include "TypeData.h" 57 #include " LinkageSpec.h"57 #include "SynTree/LinkageSpec.h" 58 58 #include "Common/SemanticError.h" // error_str 59 59 #include "Common/utility.h" // for maybeMoveBuild, maybeBuild, CodeLo... … … 166 166 } // rebindForall 167 167 168 NameExpr * build_postfix_name( const string * name ) { 169 NameExpr * new_name = build_varref( new string( "?`" + *name ) ); 170 delete name; 171 return new_name; 168 string * build_postfix_name( string * name ) { 169 *name = string("__postfix_func_") + *name; 170 return name; 172 171 } // build_postfix_name 173 172 … … 238 237 DeclarationNode * decl; 239 238 AggregateDecl::Aggregate aggKey; 240 DeclarationNode::TypeClasstclass;239 TypeDecl::Kind tclass; 241 240 StatementNode * sn; 242 241 WaitForStmt * wfs; … … 323 322 %type<op> ptrref_operator unary_operator assignment_operator 324 323 %type<en> primary_expression postfix_expression unary_expression 325 %type<en> cast_expression exponential_expression multiplicative_expression additive_expression324 %type<en> cast_expression_list cast_expression exponential_expression multiplicative_expression additive_expression 326 325 %type<en> shift_expression relational_expression equality_expression 327 326 %type<en> AND_expression exclusive_OR_expression inclusive_OR_expression … … 579 578 | '(' compound_statement ')' // GCC, lambda expression 580 579 { $$ = new ExpressionNode( new StmtExpr( dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >($2) ) ) ); } 581 | constant '`' IDENTIFIER // CFA, postfix call582 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); }583 | string_literal '`' IDENTIFIER // CFA, postfix call584 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), new ExpressionNode( $1 ) ) ); }585 | IDENTIFIER '`' IDENTIFIER // CFA, postfix call586 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), new ExpressionNode( build_varref( $1 ) ) ) ); }587 | tuple '`' IDENTIFIER // CFA, postfix call588 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $3 ) ), $1 ) ); }589 | '(' comma_expression ')' '`' IDENTIFIER // CFA, postfix call590 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_postfix_name( $5 ) ), $2 ) ); }591 580 | type_name '.' identifier // CFA, nested type 592 581 { SemanticError( yylloc, "Qualified name is currently unimplemented." ); $$ = nullptr; } … … 642 631 | postfix_expression '(' argument_expression_list ')' 643 632 { $$ = new ExpressionNode( build_func( $1, $3 ) ); } 633 | postfix_expression '`' identifier // CFA, postfix call 634 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_varref( build_postfix_name( $3 ) ) ), $1 ) ); } 635 | constant '`' identifier // CFA, postfix call 636 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_varref( build_postfix_name( $3 ) ) ), $1 ) ); } 637 | string_literal '`' identifier // CFA, postfix call 638 { $$ = new ExpressionNode( build_func( new ExpressionNode( build_varref( build_postfix_name( $3 ) ) ), new ExpressionNode( $1 ) ) ); } 644 639 | postfix_expression '.' identifier 645 640 { $$ = new ExpressionNode( build_fieldSel( $1, build_varref( $3 ) ) ); } … … 666 661 | '(' type_no_function ')' '@' '{' initializer_list_opt comma_opt '}' // CFA, explicit C compound-literal 667 662 { $$ = new ExpressionNode( build_compoundLiteral( $2, (new InitializerNode( $6, true ))->set_maybeConstructed( false ) ) ); } 668 | '^' primary_expression '{' argument_expression_list '}' // CFA 663 | '^' primary_expression '{' argument_expression_list '}' // CFA, destructor call 669 664 { 670 665 Token fn; … … 679 674 | argument_expression 680 675 | argument_expression_list ',' argument_expression 681 { $$ = (ExpressionNode *)( $1->set_last( $3 )); }676 { $$ = (ExpressionNode *)($1->set_last( $3 )); } 682 677 ; 683 678 … … 691 686 field_name_list: // CFA, tuple field selector 692 687 field 693 | field_name_list ',' field { $$ = (ExpressionNode *) $1->set_last( $3); }688 | field_name_list ',' field { $$ = (ExpressionNode *)($1->set_last( $3 )); } 694 689 ; 695 690 … … 960 955 { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( $3 ) ) ); } 961 956 | '[' push assignment_expression pop ',' tuple_expression_list ']' 962 { $$ = new ExpressionNode( build_tuple( (ExpressionNode *) $3->set_last( $6 ) )); }957 { $$ = new ExpressionNode( build_tuple( (ExpressionNode *)($3->set_last( $6 ) ) )); } 963 958 ; 964 959 … … 966 961 assignment_expression_opt 967 962 | tuple_expression_list ',' assignment_expression_opt 968 { $$ = (ExpressionNode *) $1->set_last( $3); }963 { $$ = (ExpressionNode *)($1->set_last( $3 )); } 969 964 ; 970 965 … … 1190 1185 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), 1191 1186 OperKinds::LThan, $1->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); } 1187 | '=' comma_expression // CFA 1188 { $$ = forCtrl( $2, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), 1189 OperKinds::LEThan, $2->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); } 1192 1190 | comma_expression inclexcl comma_expression // CFA 1193 1191 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); } … … 1197 1195 { $$ = forCtrl( $3, $1, new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), 1198 1196 OperKinds::LThan, $3->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); } 1197 | comma_expression ';' '=' comma_expression // CFA 1198 { $$ = forCtrl( $4, $1, new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), 1199 OperKinds::LEThan, $4->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); } 1199 1200 | comma_expression ';' comma_expression inclexcl comma_expression // CFA 1200 1201 { $$ = forCtrl( $3, $1, $3->clone(), $4, $5, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); } … … 1301 1302 WAITFOR '(' cast_expression ')' 1302 1303 { $$ = $3; } 1303 | WAITFOR '(' cast_expression ',' argument_expression_list ')' 1304 { $$ = (ExpressionNode *)$3->set_last( $5 ); } 1304 // | WAITFOR '(' cast_expression ',' argument_expression_list ')' 1305 // { $$ = (ExpressionNode *)$3->set_last( $5 ); } 1306 | WAITFOR '(' cast_expression_list ':' argument_expression_list ')' 1307 { $$ = (ExpressionNode *)($3->set_last( $5 )); } 1308 ; 1309 1310 cast_expression_list: 1311 cast_expression 1312 | cast_expression_list ',' cast_expression 1313 { $$ = (ExpressionNode *)($1->set_last( $3 )); } 1305 1314 ; 1306 1315 … … 1413 1422 asm_operand 1414 1423 | asm_operands_list ',' asm_operand 1415 { $$ = (ExpressionNode *) $1->set_last( $3); }1424 { $$ = (ExpressionNode *)($1->set_last( $3 )); } 1416 1425 ; 1417 1426 … … 1429 1438 { $$ = new ExpressionNode( $1 ); } 1430 1439 | asm_clobbers_list_opt ',' string_literal 1431 // set_last returns ParseNode * 1432 { $$ = (ExpressionNode *)$1->set_last( new ExpressionNode( $3 ) ); } 1440 { $$ = (ExpressionNode *)($1->set_last( new ExpressionNode( $3 ) )); } 1433 1441 ; 1434 1442 … … 2353 2361 | initializer_list_opt ',' initializer { $$ = (InitializerNode *)( $1->set_last( $3 ) ); } 2354 2362 | initializer_list_opt ',' designation initializer 2355 { $$ = (InitializerNode *)( $1->set_last( $4->set_designators( $3 ) )); }2363 { $$ = (InitializerNode *)($1->set_last( $4->set_designators( $3 ) )); } 2356 2364 ; 2357 2365 … … 2375 2383 designator 2376 2384 | designator_list designator 2377 { $$ = (ExpressionNode *)( $1->set_last( $2 )); }2385 { $$ = (ExpressionNode *)($1->set_last( $2 )); } 2378 2386 //| designator_list designator { $$ = new ExpressionNode( $1, $2 ); } 2379 2387 ; … … 2431 2439 | type_specifier identifier_parameter_declarator 2432 2440 | assertion_list 2433 { $$ = DeclarationNode::newTypeParam( DeclarationNode::Dtype, new string( DeclarationNode::anonymous.newName() ) )->addAssertions( $1 ); }2441 { $$ = DeclarationNode::newTypeParam( TypeDecl::Dtype, new string( DeclarationNode::anonymous.newName() ) )->addAssertions( $1 ); } 2434 2442 ; 2435 2443 2436 2444 type_class: // CFA 2437 2445 OTYPE 2438 { $$ = DeclarationNode::Otype; }2446 { $$ = TypeDecl::Otype; } 2439 2447 | DTYPE 2440 { $$ = DeclarationNode::Dtype; }2448 { $$ = TypeDecl::Dtype; } 2441 2449 | FTYPE 2442 { $$ = DeclarationNode::Ftype; }2450 { $$ = TypeDecl::Ftype; } 2443 2451 | TTYPE 2444 { $$ = DeclarationNode::Ttype; }2452 { $$ = TypeDecl::Ttype; } 2445 2453 ; 2446 2454 … … 2472 2480 { SemanticError( yylloc, toString("Expression generic parameters are currently unimplemented: ", $1->build()) ); $$ = nullptr; } 2473 2481 | type_list ',' type 2474 { $$ = (ExpressionNode *)( $1->set_last( new ExpressionNode( new TypeExpr( maybeMoveBuildType( $3 ) ) ) )); }2482 { $$ = (ExpressionNode *)($1->set_last( new ExpressionNode( new TypeExpr( maybeMoveBuildType( $3 ) ) ) )); } 2475 2483 | type_list ',' assignment_expression 2476 2484 { SemanticError( yylloc, toString("Expression generic parameters are currently unimplemented: ", $3->build()) ); $$ = nullptr; } … … 2583 2591 { 2584 2592 linkageStack.push( linkage ); // handle nested extern "C"/"Cforall" 2585 linkage = LinkageSpec:: linkageUpdate( yylloc, linkage, $2 );2593 linkage = LinkageSpec::update( yylloc, linkage, $2 ); 2586 2594 } 2587 2595 '{' up external_definition_list_opt down '}'
Note:
See TracChangeset
for help on using the changeset viewer.