Changeset 136ccd7 for src/Parser
- Timestamp:
- Nov 3, 2017, 3:01:31 PM (8 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
- Children:
- 4ee36bf0
- Parents:
- 4ee1efb (diff), 760ba67 (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:
-
- 4 edited
-
DeclarationNode.cc (modified) (1 diff)
-
TypeData.cc (modified) (2 diffs)
-
lex.ll (modified) (2 diffs)
-
parser.yy (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
r4ee1efb r136ccd7 1031 1031 1032 1032 if ( variable.tyClass != NoTypeClass ) { 1033 static const TypeDecl::Kind kindMap[] = { TypeDecl::Any, TypeDecl::Dtype, TypeDecl::Ftype, TypeDecl::Ttype }; 1034 assertf( sizeof(kindMap)/sizeof(kindMap[0] == NoTypeClass-1), "DeclarationNode::build: kindMap is out of sync." ); 1033 // otype is internally converted to dtype + otype parameters 1034 static const TypeDecl::Kind kindMap[] = { TypeDecl::Dtype, TypeDecl::Dtype, TypeDecl::Ftype, TypeDecl::Ttype }; 1035 assertf( sizeof(kindMap)/sizeof(kindMap[0]) == NoTypeClass, "DeclarationNode::build: kindMap is out of sync." ); 1035 1036 assertf( variable.tyClass < sizeof(kindMap)/sizeof(kindMap[0]), "Variable's tyClass is out of bounds." ); 1036 TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable. initializer ? variable.initializer->buildType() : nullptr );1037 TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.tyClass == Otype, variable.initializer ? variable.initializer->buildType() : nullptr ); 1037 1038 buildList( variable.assertions, ret->get_assertions() ); 1038 1039 return ret; -
src/Parser/TypeData.cc
r4ee1efb r136ccd7 406 406 void buildForall( const DeclarationNode * firstNode, ForallList &outputList ) { 407 407 buildList( firstNode, outputList ); 408 for ( typename ForallList::iterator i = outputList.begin(); i != outputList.end(); ++i ) { 408 auto n = firstNode; 409 for ( typename ForallList::iterator i = outputList.begin(); i != outputList.end(); ++i, n = (DeclarationNode*)n->get_next() ) { 409 410 TypeDecl * td = static_cast<TypeDecl *>(*i); 410 if ( td->get_kind() == TypeDecl::Any) {411 if ( n->variable.tyClass == DeclarationNode::Otype ) { 411 412 // add assertion parameters to `type' tyvars in reverse order 412 413 // add dtor: void ^?{}(T *) … … 798 799 ret = new TypedefDecl( name, scs, typebuild( td->base ), linkage ); 799 800 } else { 800 ret = new TypeDecl( name, scs, typebuild( td->base ), TypeDecl:: Any);801 ret = new TypeDecl( name, scs, typebuild( td->base ), TypeDecl::Dtype, true ); 801 802 } // if 802 803 buildList( td->symbolic.params, ret->get_parameters() ); -
src/Parser/lex.ll
r4ee1efb r136ccd7 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Sat Sep 23 17:29:28201713 * Update Count : 63 212 * Last Modified On : Wed Oct 25 13:53:56 2017 13 * Update Count : 634 14 14 */ 15 15 … … 233 233 __extension__ { KEYWORD_RETURN(EXTENSION); } // GCC 234 234 extern { KEYWORD_RETURN(EXTERN); } 235 fallthrough { KEYWORD_RETURN(FALLTHRU); } // CFA236 235 fallthru { KEYWORD_RETURN(FALLTHRU); } // CFA 236 fallthrough { KEYWORD_RETURN(FALLTHROUGH); } // CFA 237 237 finally { KEYWORD_RETURN(FINALLY); } // CFA 238 238 float { KEYWORD_RETURN(FLOAT); } -
src/Parser/parser.yy
r4ee1efb r136ccd7 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Oct 16 11:07:29201713 // Update Count : 289 212 // Last Modified On : Wed Oct 25 12:28:54 2017 13 // Update Count : 2893 14 14 // 15 15 … … 180 180 %token ATTRIBUTE EXTENSION // GCC 181 181 %token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN 182 %token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT WITH WHEN WAITFOR // CFA182 %token CHOOSE DISABLE ENABLE FALLTHRU FALLTHROUGH TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT WITH WHEN WAITFOR // CFA 183 183 %token ASM // C99, extension ISO/IEC 9899:1999 Section J.5.10(1) 184 184 %token ALIGNAS ALIGNOF GENERIC STATICASSERT // C11 … … 362 362 %precedence ELSE // token precedence for start of else clause in IF/WAITFOR statement 363 363 364 %locations 364 %locations // support location tracking for error messages 365 365 366 366 %start translation_unit // parse-tree root … … 458 458 { $$ = new ExpressionNode( new StmtExpr( dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >($2) ) ) ); } 459 459 | type_name '.' no_attr_identifier // CFA, nested type 460 { $$ = nullptr; } // FIX ME460 { throw SemanticError("Qualified names are currently unimplemented."); $$ = nullptr; } // FIX ME 461 461 | type_name '.' '[' push field_list pop ']' // CFA, nested type / tuple field selector 462 { $$ = nullptr; } // FIX ME462 { throw SemanticError("Qualified names are currently unimplemented."); $$ = nullptr; } // FIX ME 463 463 ; 464 464 … … 974 974 ; 975 975 976 fall_through_name: // CFA 977 FALLTHRU 978 | FALLTHROUGH 979 ; 980 976 981 fall_through: // CFA 977 FALLTHRU982 fall_through_name 978 983 { $$ = nullptr; } 979 | FALLTHRU';'984 | fall_through_name ';' 980 985 { $$ = nullptr; } 981 986 ; … … 2486 2491 | TYPEDEFname 2487 2492 | TYPEGENname 2493 | FALLTHROUGH 2494 { $$ = Token{ new string( "fallthrough" ), { nullptr, -1 } }; } 2488 2495 | CONST 2489 2496 { $$ = Token{ new string( "__const__" ), { nullptr, -1 } }; } … … 2751 2758 // 2752 2759 // typedef int foo; 2753 // forall( otype T ) foo( T );2760 // forall( otype T ) struct foo; 2754 2761 // int f( int foo ); // redefine typedef name in new scope 2755 2762 //
Note:
See TracChangeset
for help on using the changeset viewer.