Changeset e319fc5 for src/Parser
- Timestamp:
- Jun 19, 2021, 3:53:18 PM (4 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 15f769c
- Parents:
- 6992f95 (diff), c7d8696a (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:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
r6992f95 re319fc5 1076 1076 if ( variable.tyClass != TypeDecl::NUMBER_OF_KINDS ) { 1077 1077 // otype is internally converted to dtype + otype parameters 1078 static const TypeDecl::Kind kindMap[] = { TypeDecl::Dtype, TypeDecl::DStype, TypeDecl::Dtype, TypeDecl::Ftype, TypeDecl::Ttype, TypeDecl::D type};1078 static const TypeDecl::Kind kindMap[] = { TypeDecl::Dtype, TypeDecl::DStype, TypeDecl::Dtype, TypeDecl::Ftype, TypeDecl::Ttype, TypeDecl::Dimension }; 1079 1079 static_assert( sizeof(kindMap) / sizeof(kindMap[0]) == TypeDecl::NUMBER_OF_KINDS, "DeclarationNode::build: kindMap is out of sync." ); 1080 1080 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 == TypeDecl::Otype || variable.tyClass == TypeDecl::ALtype, variable.initializer ? variable.initializer->buildType() : nullptr );1081 TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.tyClass == TypeDecl::Otype, variable.initializer ? variable.initializer->buildType() : nullptr ); 1082 1082 buildList( variable.assertions, ret->get_assertions() ); 1083 1083 return ret; -
src/Parser/ExpressionNode.cc
r6992f95 re319fc5 509 509 } // build_varref 510 510 511 DimensionExpr * build_dimensionref( const string * name ) { 512 DimensionExpr * expr = new DimensionExpr( *name ); 513 delete name; 514 return expr; 515 } // build_varref 511 516 // TODO: get rid of this and OperKinds and reuse code from OperatorTable 512 517 static const char * OperName[] = { // must harmonize with OperKinds -
src/Parser/ParseNode.h
r6992f95 re319fc5 183 183 184 184 NameExpr * build_varref( const std::string * name ); 185 DimensionExpr * build_dimensionref( const std::string * name ); 185 186 186 187 Expression * build_cast( DeclarationNode * decl_node, ExpressionNode * expr_node ); -
src/Parser/TypedefTable.cc
r6992f95 re319fc5 10 10 // Created On : Sat May 16 15:20:13 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Mar 15 20:56:47202113 // Update Count : 26 012 // Last Modified On : Wed May 19 08:30:14 2021 13 // Update Count : 262 14 14 // 15 15 … … 31 31 switch ( kind ) { 32 32 case IDENTIFIER: return "identifier"; 33 case TYPEDIMname: return "typedim"; 33 34 case TYPEDEFname: return "typedef"; 34 35 case TYPEGENname: return "typegen"; -
src/Parser/parser.yy
r6992f95 re319fc5 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Apr 26 18:41:54202113 // Update Count : 499012 // Last Modified On : Wed May 19 14:20:36 2021 13 // Update Count : 5022 14 14 // 15 15 … … 287 287 288 288 // names and constants: lexer differentiates between identifier and typedef names 289 %token<tok> IDENTIFIER QUOTED_IDENTIFIER TYPED EFname TYPEGENname289 %token<tok> IDENTIFIER QUOTED_IDENTIFIER TYPEDIMname TYPEDEFname TYPEGENname 290 290 %token<tok> TIMEOUT WOR CATCH RECOVER CATCHRESUME FIXUP FINALLY // CFA 291 291 %token<tok> INTEGERconstant CHARACTERconstant STRINGliteral … … 586 586 | quasi_keyword 587 587 { $$ = new ExpressionNode( build_varref( $1 ) ); } 588 | TYPEDIMname // CFA, generic length argument 589 // { $$ = new ExpressionNode( new TypeExpr( maybeMoveBuildType( DeclarationNode::newFromTypedef( $1 ) ) ) ); } 590 // { $$ = new ExpressionNode( build_varref( $1 ) ); } 591 { $$ = new ExpressionNode( build_dimensionref( $1 ) ); } 588 592 | tuple 589 593 | '(' comma_expression ')' … … 2535 2539 | '[' identifier_or_type_name ']' 2536 2540 { 2537 typedefTable.addToScope( *$2, TYPED EFname, "9" );2538 $$ = DeclarationNode::newTypeParam( TypeDecl:: ALtype, $2 );2541 typedefTable.addToScope( *$2, TYPEDIMname, "9" ); 2542 $$ = DeclarationNode::newTypeParam( TypeDecl::Dimension, $2 ); 2539 2543 } 2540 2544 // | type_specifier identifier_parameter_declarator … … 2590 2594 { $$ = new ExpressionNode( new TypeExpr( maybeMoveBuildType( $1 ) ) ); } 2591 2595 | assignment_expression 2592 { SemanticError( yylloc, toString("Expression generic parameters are currently unimplemented: ", $1->build()) ); $$ = nullptr; }2593 2596 | type_list ',' type 2594 2597 { $$ = (ExpressionNode *)($1->set_last( new ExpressionNode( new TypeExpr( maybeMoveBuildType( $3 ) ) ) )); } 2595 2598 | type_list ',' assignment_expression 2596 { SemanticError( yylloc, toString("Expression generic parameters are currently unimplemented: ", $3->build()) ); $$ = nullptr; } 2597 // { $$ = (ExpressionNode *)( $1->set_last( $3 )); } 2599 { $$ = (ExpressionNode *)( $1->set_last( $3 )); } 2598 2600 ; 2599 2601
Note: See TracChangeset
for help on using the changeset viewer.