Changeset aee7e35
- Timestamp:
- Sep 29, 2016, 10:48:09 AM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, 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, with_gc
- Children:
- 7e10773
- Parents:
- 7b69174 (diff), 4b1fd2c (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. - Files:
-
- 8 added
- 39 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/GenType.cc
r7b69174 raee7e35 42 42 virtual void visit( TypeInstType *typeInst ); 43 43 virtual void visit( VarArgsType *varArgsType ); 44 virtual void visit( ZeroType *zeroType ); 45 virtual void visit( OneType *oneType ); 44 46 45 47 private: … … 200 202 } 201 203 204 void GenType::visit( ZeroType *zeroType ) { 205 // ideally these wouldn't hit codegen at all, but should be safe to make them ints 206 typeString = "int " + typeString; 207 handleQualifiers( zeroType ); 208 } 209 210 void GenType::visit( OneType *oneType ) { 211 // ideally these wouldn't hit codegen at all, but should be safe to make them ints 212 typeString = "int " + typeString; 213 handleQualifiers( oneType ); 214 } 215 202 216 void GenType::handleQualifiers( Type *type ) { 203 217 if ( type->get_isConst() ) { -
src/Common/SemanticError.h
r7b69174 raee7e35 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jun 8 14:38:53 201513 // Update Count : 412 // Last Modified On : Sat Sep 24 15:13:42 2016 13 // Update Count : 5 14 14 // 15 15 … … 46 46 } 47 47 48 49 48 #endif // SEMANTICERROR_H 50 49 -
src/Common/module.mk
r7b69174 raee7e35 11 11 ## Created On : Mon Jun 1 17:49:17 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : T hu Aug 18 13:29:04201614 ## Update Count : 213 ## Last Modified On : Tue Sep 27 11:06:38 2016 14 ## Update Count : 4 15 15 ############################################################################### 16 16 17 17 SRC += Common/SemanticError.cc \ 18 18 Common/UniqueName.cc \ 19 Common/DebugMalloc.cc \ 19 20 Common/Assert.cc -
src/Common/utility.h
r7b69174 raee7e35 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 8 17:33:59201613 // Update Count : 2 212 // Last Modified On : Fri Sep 23 11:46:47 2016 13 // Update Count : 28 14 14 // 15 15 … … 25 25 #include <sstream> 26 26 #include <string> 27 #include <cassert> 27 28 28 29 template< typename T > … … 101 102 } // if 102 103 } // for 103 }104 105 static inline std::string assign_strptr( const std::string *str ) {106 if ( str == 0 ) {107 return "";108 } else {109 std::string tmp;110 tmp = *str;111 delete str;112 return tmp;113 } // if114 104 } 115 105 … … 141 131 142 132 template < typename T > 143 void toString_single 133 void toString_single( std::ostream & os, const T & value ) { 144 134 os << value; 145 135 } 146 136 147 137 template < typename T, typename... Params > 148 void toString_single 138 void toString_single( std::ostream & os, const T & value, const Params & ... params ) { 149 139 os << value; 150 140 toString_single( os, params ... ); … … 152 142 153 143 template < typename ... Params > 154 std::string toString 144 std::string toString( const Params & ... params ) { 155 145 std::ostringstream os; 156 146 toString_single( os, params... ); -
src/Makefile.am
r7b69174 raee7e35 11 11 ## Created On : Sun May 31 08:51:46 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Sat Aug 20 11:13:12 201614 ## Update Count : 7 113 ## Last Modified On : Sat Sep 24 15:03:52 2016 14 ## Update Count : 73 15 15 ############################################################################### 16 16 … … 40 40 cfa_cpplib_PROGRAMS = driver/cfa-cpp 41 41 driver_cfa_cpp_SOURCES = ${SRC} 42 driver_cfa_cpp_LDADD = ${LEXLIB} # yywrap42 driver_cfa_cpp_LDADD = ${LEXLIB} -ldl # yywrap 43 43 driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL -rdynamic -I${abs_top_srcdir}/src/include 44 44 -
src/Makefile.in
r7b69174 raee7e35 98 98 Common/driver_cfa_cpp-SemanticError.$(OBJEXT) \ 99 99 Common/driver_cfa_cpp-UniqueName.$(OBJEXT) \ 100 Common/driver_cfa_cpp-DebugMalloc.$(OBJEXT) \ 100 101 Common/driver_cfa_cpp-Assert.$(OBJEXT) \ 101 102 ControlStruct/driver_cfa_cpp-LabelGenerator.$(OBJEXT) \ … … 165 166 SynTree/driver_cfa_cpp-AttrType.$(OBJEXT) \ 166 167 SynTree/driver_cfa_cpp-VarArgsType.$(OBJEXT) \ 168 SynTree/driver_cfa_cpp-ZeroOneType.$(OBJEXT) \ 167 169 SynTree/driver_cfa_cpp-Constant.$(OBJEXT) \ 168 170 SynTree/driver_cfa_cpp-Expression.$(OBJEXT) \ … … 358 360 CodeGen/CodeGenerator.cc CodeGen/GenType.cc \ 359 361 CodeGen/FixNames.cc CodeGen/OperatorTable.cc \ 360 Common/SemanticError.cc Common/UniqueName.cc Common/Assert.cc \ 362 Common/SemanticError.cc Common/UniqueName.cc \ 363 Common/DebugMalloc.cc Common/Assert.cc \ 361 364 ControlStruct/LabelGenerator.cc ControlStruct/LabelFixer.cc \ 362 365 ControlStruct/MLEMutator.cc ControlStruct/Mutate.cc \ … … 390 393 SynTree/ReferenceToType.cc SynTree/TupleType.cc \ 391 394 SynTree/TypeofType.cc SynTree/AttrType.cc \ 392 SynTree/VarArgsType.cc SynTree/ Constant.cc \393 SynTree/ Expression.cc SynTree/TupleExpr.cc \395 SynTree/VarArgsType.cc SynTree/ZeroOneType.cc \ 396 SynTree/Constant.cc SynTree/Expression.cc SynTree/TupleExpr.cc \ 394 397 SynTree/CommaExpr.cc SynTree/TypeExpr.cc \ 395 398 SynTree/ApplicationExpr.cc SynTree/AddressExpr.cc \ … … 413 416 cfa_cpplibdir = ${libdir} 414 417 driver_cfa_cpp_SOURCES = ${SRC} 415 driver_cfa_cpp_LDADD = ${LEXLIB} # yywrap418 driver_cfa_cpp_LDADD = ${LEXLIB} -ldl # yywrap 416 419 driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL -rdynamic -I${abs_top_srcdir}/src/include 417 420 all: $(BUILT_SOURCES) … … 513 516 Common/$(DEPDIR)/$(am__dirstamp) 514 517 Common/driver_cfa_cpp-UniqueName.$(OBJEXT): Common/$(am__dirstamp) \ 518 Common/$(DEPDIR)/$(am__dirstamp) 519 Common/driver_cfa_cpp-DebugMalloc.$(OBJEXT): Common/$(am__dirstamp) \ 515 520 Common/$(DEPDIR)/$(am__dirstamp) 516 521 Common/driver_cfa_cpp-Assert.$(OBJEXT): Common/$(am__dirstamp) \ … … 715 720 SynTree/driver_cfa_cpp-VarArgsType.$(OBJEXT): SynTree/$(am__dirstamp) \ 716 721 SynTree/$(DEPDIR)/$(am__dirstamp) 722 SynTree/driver_cfa_cpp-ZeroOneType.$(OBJEXT): SynTree/$(am__dirstamp) \ 723 SynTree/$(DEPDIR)/$(am__dirstamp) 717 724 SynTree/driver_cfa_cpp-Constant.$(OBJEXT): SynTree/$(am__dirstamp) \ 718 725 SynTree/$(DEPDIR)/$(am__dirstamp) … … 786 793 -rm -f CodeGen/driver_cfa_cpp-OperatorTable.$(OBJEXT) 787 794 -rm -f Common/driver_cfa_cpp-Assert.$(OBJEXT) 795 -rm -f Common/driver_cfa_cpp-DebugMalloc.$(OBJEXT) 788 796 -rm -f Common/driver_cfa_cpp-SemanticError.$(OBJEXT) 789 797 -rm -f Common/driver_cfa_cpp-UniqueName.$(OBJEXT) … … 877 885 -rm -f SynTree/driver_cfa_cpp-Visitor.$(OBJEXT) 878 886 -rm -f SynTree/driver_cfa_cpp-VoidType.$(OBJEXT) 887 -rm -f SynTree/driver_cfa_cpp-ZeroOneType.$(OBJEXT) 879 888 -rm -f Tuples/driver_cfa_cpp-NameMatcher.$(OBJEXT) 880 889 -rm -f Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT) … … 891 900 @AMDEP_TRUE@@am__include@ @am__quote@CodeGen/$(DEPDIR)/driver_cfa_cpp-OperatorTable.Po@am__quote@ 892 901 @AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-Assert.Po@am__quote@ 902 @AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-DebugMalloc.Po@am__quote@ 893 903 @AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-SemanticError.Po@am__quote@ 894 904 @AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-UniqueName.Po@am__quote@ … … 982 992 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Visitor.Po@am__quote@ 983 993 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-VoidType.Po@am__quote@ 994 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Po@am__quote@ 984 995 @AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Po@am__quote@ 985 996 @AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-TupleAssignment.Po@am__quote@ … … 1127 1138 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Common/driver_cfa_cpp-UniqueName.obj `if test -f 'Common/UniqueName.cc'; then $(CYGPATH_W) 'Common/UniqueName.cc'; else $(CYGPATH_W) '$(srcdir)/Common/UniqueName.cc'; fi` 1128 1139 1140 Common/driver_cfa_cpp-DebugMalloc.o: Common/DebugMalloc.cc 1141 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Common/driver_cfa_cpp-DebugMalloc.o -MD -MP -MF Common/$(DEPDIR)/driver_cfa_cpp-DebugMalloc.Tpo -c -o Common/driver_cfa_cpp-DebugMalloc.o `test -f 'Common/DebugMalloc.cc' || echo '$(srcdir)/'`Common/DebugMalloc.cc 1142 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) Common/$(DEPDIR)/driver_cfa_cpp-DebugMalloc.Tpo Common/$(DEPDIR)/driver_cfa_cpp-DebugMalloc.Po 1143 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Common/DebugMalloc.cc' object='Common/driver_cfa_cpp-DebugMalloc.o' libtool=no @AMDEPBACKSLASH@ 1144 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1145 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Common/driver_cfa_cpp-DebugMalloc.o `test -f 'Common/DebugMalloc.cc' || echo '$(srcdir)/'`Common/DebugMalloc.cc 1146 1147 Common/driver_cfa_cpp-DebugMalloc.obj: Common/DebugMalloc.cc 1148 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Common/driver_cfa_cpp-DebugMalloc.obj -MD -MP -MF Common/$(DEPDIR)/driver_cfa_cpp-DebugMalloc.Tpo -c -o Common/driver_cfa_cpp-DebugMalloc.obj `if test -f 'Common/DebugMalloc.cc'; then $(CYGPATH_W) 'Common/DebugMalloc.cc'; else $(CYGPATH_W) '$(srcdir)/Common/DebugMalloc.cc'; fi` 1149 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) Common/$(DEPDIR)/driver_cfa_cpp-DebugMalloc.Tpo Common/$(DEPDIR)/driver_cfa_cpp-DebugMalloc.Po 1150 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Common/DebugMalloc.cc' object='Common/driver_cfa_cpp-DebugMalloc.obj' libtool=no @AMDEPBACKSLASH@ 1151 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1152 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Common/driver_cfa_cpp-DebugMalloc.obj `if test -f 'Common/DebugMalloc.cc'; then $(CYGPATH_W) 'Common/DebugMalloc.cc'; else $(CYGPATH_W) '$(srcdir)/Common/DebugMalloc.cc'; fi` 1153 1129 1154 Common/driver_cfa_cpp-Assert.o: Common/Assert.cc 1130 1155 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Common/driver_cfa_cpp-Assert.o -MD -MP -MF Common/$(DEPDIR)/driver_cfa_cpp-Assert.Tpo -c -o Common/driver_cfa_cpp-Assert.o `test -f 'Common/Assert.cc' || echo '$(srcdir)/'`Common/Assert.cc … … 2064 2089 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 2065 2090 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-VarArgsType.obj `if test -f 'SynTree/VarArgsType.cc'; then $(CYGPATH_W) 'SynTree/VarArgsType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/VarArgsType.cc'; fi` 2091 2092 SynTree/driver_cfa_cpp-ZeroOneType.o: SynTree/ZeroOneType.cc 2093 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-ZeroOneType.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Tpo -c -o SynTree/driver_cfa_cpp-ZeroOneType.o `test -f 'SynTree/ZeroOneType.cc' || echo '$(srcdir)/'`SynTree/ZeroOneType.cc 2094 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Po 2095 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='SynTree/ZeroOneType.cc' object='SynTree/driver_cfa_cpp-ZeroOneType.o' libtool=no @AMDEPBACKSLASH@ 2096 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 2097 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ZeroOneType.o `test -f 'SynTree/ZeroOneType.cc' || echo '$(srcdir)/'`SynTree/ZeroOneType.cc 2098 2099 SynTree/driver_cfa_cpp-ZeroOneType.obj: SynTree/ZeroOneType.cc 2100 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-ZeroOneType.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Tpo -c -o SynTree/driver_cfa_cpp-ZeroOneType.obj `if test -f 'SynTree/ZeroOneType.cc'; then $(CYGPATH_W) 'SynTree/ZeroOneType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ZeroOneType.cc'; fi` 2101 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Po 2102 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='SynTree/ZeroOneType.cc' object='SynTree/driver_cfa_cpp-ZeroOneType.obj' libtool=no @AMDEPBACKSLASH@ 2103 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 2104 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ZeroOneType.obj `if test -f 'SynTree/ZeroOneType.cc'; then $(CYGPATH_W) 'SynTree/ZeroOneType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ZeroOneType.cc'; fi` 2066 2105 2067 2106 SynTree/driver_cfa_cpp-Constant.o: SynTree/Constant.cc -
src/Parser/DeclarationNode.cc
r7b69174 raee7e35 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Sep 14 23:13:28201613 // Update Count : 50212 // Last Modified On : Mon Sep 26 22:18:40 2016 13 // Update Count : 640 14 14 // 15 15 … … 31 31 32 32 // These must remain in the same order as the corresponding DeclarationNode enumerations. 33 const char * DeclarationNode::storageName[] = { "extern", "static", "auto", "register", "inline", "fortran", "_Noreturn", "_Thread_local", "NoStorageClass" };34 const char * DeclarationNode::qualifierName[] = { "const", "restrict", "volatile", "lvalue", "_Atomic", "NoQualifier" };35 const char * DeclarationNode::basicTypeName[] = { "void", "_Bool", "char", "int", "float", "double", "long double", "NoBasicType" };36 const char * DeclarationNode::complexTypeName[] = { "_Complex", "_Imaginary", "NoComplexType" };37 const char * DeclarationNode::signednessName[] = { "signed", "unsigned", "NoSignedness" };38 const char * DeclarationNode::lengthName[] = { "short", "long", "long long", "NoLength" };39 const char * DeclarationNode::aggregateName[] = { "struct", "union", "context" };40 const char * DeclarationNode::typeClassName[] = { "otype", "dtype", "ftype" };41 const char * DeclarationNode::builtinTypeName[] = { "__builtin_va_list" };33 const char * DeclarationNode::storageName[] = { "extern", "static", "auto", "register", "inline", "fortran", "_Noreturn", "_Thread_local", "NoStorageClass" }; 34 const char * DeclarationNode::qualifierName[] = { "const", "restrict", "volatile", "lvalue", "_Atomic", "NoQualifier" }; 35 const char * DeclarationNode::basicTypeName[] = { "void", "_Bool", "char", "int", "float", "double", "long double", "NoBasicType" }; 36 const char * DeclarationNode::complexTypeName[] = { "_Complex", "_Imaginary", "NoComplexType" }; 37 const char * DeclarationNode::signednessName[] = { "signed", "unsigned", "NoSignedness" }; 38 const char * DeclarationNode::lengthName[] = { "short", "long", "long long", "NoLength" }; 39 const char * DeclarationNode::aggregateName[] = { "struct", "union", "context" }; 40 const char * DeclarationNode::typeClassName[] = { "otype", "dtype", "ftype" }; 41 const char * DeclarationNode::builtinTypeName[] = { "__builtin_va_list" }; 42 42 43 43 UniqueName DeclarationNode::anonymous( "__anonymous" ); … … 46 46 47 47 DeclarationNode::DeclarationNode() : 48 type( 0),48 type( nullptr ), 49 49 storageClass( NoStorageClass ), 50 50 isInline( false ), 51 51 isNoreturn( false ), 52 bitfieldWidth( 0),53 initializer( 0),52 bitfieldWidth( nullptr ), 53 initializer( nullptr ), 54 54 hasEllipsis( false ), 55 55 linkage( ::linkage ), 56 56 extension( false ) { 57 58 variable.name = nullptr; 57 59 variable.tyClass = DeclarationNode::Otype; 58 60 variable.assertions = nullptr; 59 61 62 attr.name = nullptr; 60 63 attr.expr = nullptr; 61 64 attr.type = nullptr; … … 63 66 64 67 DeclarationNode::~DeclarationNode() { 68 delete attr.name; 65 69 delete attr.expr; 66 70 delete attr.type; 71 72 delete variable.name; 73 delete variable.assertions; 74 67 75 delete type; 68 76 delete bitfieldWidth; … … 70 78 } 71 79 72 DeclarationNode * DeclarationNode::clone() const {73 DeclarationNode * newnode = new DeclarationNode;80 DeclarationNode * DeclarationNode::clone() const { 81 DeclarationNode * newnode = new DeclarationNode; 74 82 newnode->type = maybeClone( type ); 75 newnode->name = name ;83 newnode->name = name ? new string( *name ) : nullptr; 76 84 newnode->storageClass = storageClass; 77 85 newnode->isInline = isInline; … … 83 91 newnode->linkage = linkage; 84 92 93 newnode->variable.name = variable.name ? new string( *variable.name ) : nullptr; 94 newnode->variable.tyClass = variable.tyClass; 85 95 newnode->variable.assertions = maybeClone( variable.assertions ); 86 newnode->variable.name = variable.name; 87 newnode->variable.tyClass = variable.tyClass; 88 96 97 newnode->attr.name = attr.name ? new string( *attr.name ) : nullptr; 89 98 newnode->attr.expr = maybeClone( attr.expr ); 90 99 newnode->attr.type = maybeClone( attr.type ); … … 98 107 void DeclarationNode::print( std::ostream &os, int indent ) const { 99 108 os << string( indent, ' ' ); 100 if ( name == "" ) { 109 if ( name ) { 110 os << *name << ": "; 111 } else { 101 112 os << "unnamed: "; 102 } else {103 os << name << ": ";104 113 } // if 105 114 … … 122 131 } // if 123 132 124 if ( initializer != 0) {133 if ( initializer ) { 125 134 os << endl << string( indent + 2, ' ' ) << "with initializer "; 126 135 initializer->printOneLine( os ); … … 139 148 } 140 149 141 DeclarationNode *DeclarationNode::newFunction( std::string *name, DeclarationNode *ret, DeclarationNode *param, StatementNode *body, bool newStyle ) { 142 DeclarationNode *newnode = new DeclarationNode; 143 newnode->name = assign_strptr( name ); 144 150 DeclarationNode * DeclarationNode::newFunction( string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body, bool newStyle ) { 151 DeclarationNode * newnode = new DeclarationNode; 152 newnode->name = name; 145 153 newnode->type = new TypeData( TypeData::Function ); 146 154 newnode->type->function.params = param; 147 155 newnode->type->function.newStyle = newStyle; 148 156 newnode->type->function.body = body; 149 typedefTable.addToEnclosingScope( newnode->name, TypedefTable::ID ); 157 // ignore unnamed routine declarations: void p( int (*)(int) ); 158 if ( newnode->name ) { 159 typedefTable.addToEnclosingScope( *newnode->name, TypedefTable::ID ); 160 } // if 150 161 151 162 if ( body ) { … … 155 166 if ( ret ) { 156 167 newnode->type->base = ret->type; 157 ret->type = 0;168 ret->type = nullptr; 158 169 delete ret; 159 170 } // if … … 163 174 164 175 DeclarationNode * DeclarationNode::newQualifier( Qualifier q ) { 165 DeclarationNode * newnode = new DeclarationNode;176 DeclarationNode * newnode = new DeclarationNode; 166 177 newnode->type = new TypeData(); 167 178 newnode->type->qualifiers[ q ] = 1; … … 169 180 } // DeclarationNode::newQualifier 170 181 171 DeclarationNode * DeclarationNode::newForall( DeclarationNode * forall ) {172 DeclarationNode * newnode = new DeclarationNode;182 DeclarationNode * DeclarationNode::newForall( DeclarationNode * forall ) { 183 DeclarationNode * newnode = new DeclarationNode; 173 184 newnode->type = new TypeData( TypeData::Unknown ); 174 185 newnode->type->forall = forall; … … 177 188 178 189 DeclarationNode * DeclarationNode::newStorageClass( DeclarationNode::StorageClass sc ) { 179 DeclarationNode *newnode = new DeclarationNode; 180 //switch (sc) { 181 // case Inline: newnode->isInline = true; break; 182 // case Noreturn: newnode->isNoreturn = true; break; 183 // default: newnode->storageClass = sc; break; 184 //} 190 DeclarationNode * newnode = new DeclarationNode; 185 191 newnode->storageClass = sc; 186 192 return newnode; … … 188 194 189 195 DeclarationNode * DeclarationNode::newBasicType( BasicType bt ) { 190 DeclarationNode * newnode = new DeclarationNode;196 DeclarationNode * newnode = new DeclarationNode; 191 197 newnode->type = new TypeData( TypeData::Basic ); 192 198 newnode->type->basictype = bt; … … 195 201 196 202 DeclarationNode * DeclarationNode::newComplexType( ComplexType ct ) { 197 DeclarationNode * newnode = new DeclarationNode;203 DeclarationNode * newnode = new DeclarationNode; 198 204 newnode->type = new TypeData( TypeData::Basic ); 199 205 newnode->type->complextype = ct; … … 202 208 203 209 DeclarationNode * DeclarationNode::newSignedNess( Signedness sn ) { 204 DeclarationNode * newnode = new DeclarationNode;210 DeclarationNode * newnode = new DeclarationNode; 205 211 newnode->type = new TypeData( TypeData::Basic ); 206 212 newnode->type->signedness = sn; … … 209 215 210 216 DeclarationNode * DeclarationNode::newLength( Length lnth ) { 211 DeclarationNode * newnode = new DeclarationNode;217 DeclarationNode * newnode = new DeclarationNode; 212 218 newnode->type = new TypeData( TypeData::Basic ); 213 219 newnode->type->length = lnth; … … 215 221 } // DeclarationNode::newLength 216 222 217 DeclarationNode * DeclarationNode::newFromTypedef( st d::string *name ) {218 DeclarationNode * newnode = new DeclarationNode;223 DeclarationNode * DeclarationNode::newFromTypedef( string * name ) { 224 DeclarationNode * newnode = new DeclarationNode; 219 225 newnode->type = new TypeData( TypeData::SymbolicInst ); 220 newnode->type->symbolic.name = assign_strptr( name );226 newnode->type->symbolic.name = name; 221 227 newnode->type->symbolic.isTypedef = true; 222 newnode->type->symbolic.params = 0;228 newnode->type->symbolic.params = nullptr; 223 229 return newnode; 224 230 } // DeclarationNode::newFromTypedef 225 231 226 DeclarationNode * DeclarationNode::newAggregate( Aggregate kind, const st d::string *name, ExpressionNode *actuals, DeclarationNode *fields, bool body ) {227 DeclarationNode * newnode = new DeclarationNode;232 DeclarationNode * DeclarationNode::newAggregate( Aggregate kind, const string * name, ExpressionNode * actuals, DeclarationNode * fields, bool body ) { 233 DeclarationNode * newnode = new DeclarationNode; 228 234 newnode->type = new TypeData( TypeData::Aggregate ); 229 235 newnode->type->aggregate.kind = kind; 230 newnode->type->aggregate.name = assign_strptr( name ); 231 if ( newnode->type->aggregate.name == "" ) { // anonymous aggregate ? 232 newnode->type->aggregate.name = anonymous.newName(); 236 if ( name ) { 237 newnode->type->aggregate.name = name; 238 } else { // anonymous aggregate ? 239 newnode->type->aggregate.name = new string( anonymous.newName() ); 233 240 } // if 234 241 newnode->type->aggregate.actuals = actuals; … … 238 245 } // DeclarationNode::newAggregate 239 246 240 DeclarationNode *DeclarationNode::newEnum( std::string *name, DeclarationNode *constants ) { 241 DeclarationNode *newnode = new DeclarationNode; 242 newnode->name = assign_strptr( name ); 247 DeclarationNode * DeclarationNode::newEnum( string * name, DeclarationNode * constants ) { 248 DeclarationNode * newnode = new DeclarationNode; 243 249 newnode->type = new TypeData( TypeData::Enum ); 244 newnode->type->enumeration.name = newnode->name; 245 if ( newnode->type->enumeration.name == "" ) { // anonymous enumeration ? 246 newnode->type->enumeration.name = DeclarationNode::anonymous.newName(); 250 if ( name ) { 251 newnode->type->enumeration.name = name; 252 } else { // anonymous aggregate ? 253 newnode->type->enumeration.name = new string( anonymous.newName() ); 247 254 } // if 248 255 newnode->type->enumeration.constants = constants; … … 250 257 } // DeclarationNode::newEnum 251 258 252 DeclarationNode * DeclarationNode::newEnumConstant( std::string *name, ExpressionNode *constant ) {253 DeclarationNode * newnode = new DeclarationNode;254 newnode->name = assign_strptr( name );259 DeclarationNode * DeclarationNode::newEnumConstant( string * name, ExpressionNode * constant ) { 260 DeclarationNode * newnode = new DeclarationNode; 261 newnode->name = name; 255 262 newnode->enumeratorValue.reset( constant ); 256 typedefTable.addToEnclosingScope( newnode->name, TypedefTable::ID );263 typedefTable.addToEnclosingScope( *newnode->name, TypedefTable::ID ); 257 264 return newnode; 258 265 } // DeclarationNode::newEnumConstant 259 266 260 DeclarationNode * DeclarationNode::newName( std::string *name ) {261 DeclarationNode * newnode = new DeclarationNode;262 newnode->name = assign_strptr( name );267 DeclarationNode * DeclarationNode::newName( string * name ) { 268 DeclarationNode * newnode = new DeclarationNode; 269 newnode->name = name; 263 270 return newnode; 264 271 } // DeclarationNode::newName 265 272 266 DeclarationNode * DeclarationNode::newFromTypeGen( std::string *name, ExpressionNode *params ) {267 DeclarationNode * newnode = new DeclarationNode;273 DeclarationNode * DeclarationNode::newFromTypeGen( string * name, ExpressionNode * params ) { 274 DeclarationNode * newnode = new DeclarationNode; 268 275 newnode->type = new TypeData( TypeData::SymbolicInst ); 269 newnode->type->symbolic.name = assign_strptr( name );276 newnode->type->symbolic.name = name; 270 277 newnode->type->symbolic.isTypedef = false; 271 278 newnode->type->symbolic.actuals = params; … … 273 280 } // DeclarationNode::newFromTypeGen 274 281 275 DeclarationNode *DeclarationNode::newTypeParam( TypeClass tc, std::string *name ) { 276 DeclarationNode *newnode = new DeclarationNode; 277 newnode->name = assign_strptr( name ); 278 newnode->type = new TypeData( TypeData::Variable ); 282 DeclarationNode * DeclarationNode::newTypeParam( TypeClass tc, string * name ) { 283 DeclarationNode * newnode = new DeclarationNode; 284 newnode->type = nullptr; 279 285 newnode->variable.tyClass = tc; 280 newnode->variable.name = n ewnode->name;286 newnode->variable.name = name; 281 287 return newnode; 282 288 } // DeclarationNode::newTypeParam 283 289 284 DeclarationNode * DeclarationNode::newTrait( std::string *name, DeclarationNode *params, DeclarationNode *asserts ) {285 DeclarationNode * newnode = new DeclarationNode;290 DeclarationNode * DeclarationNode::newTrait( const string * name, DeclarationNode * params, DeclarationNode * asserts ) { 291 DeclarationNode * newnode = new DeclarationNode; 286 292 newnode->type = new TypeData( TypeData::Aggregate ); 293 newnode->type->aggregate.name = name; 287 294 newnode->type->aggregate.kind = Trait; 288 295 newnode->type->aggregate.params = params; 289 296 newnode->type->aggregate.fields = asserts; 290 newnode->type->aggregate.name = assign_strptr( name );291 297 return newnode; 292 298 } // DeclarationNode::newTrait 293 299 294 DeclarationNode * DeclarationNode::newTraitUse( std::string *name, ExpressionNode *params ) {295 DeclarationNode * newnode = new DeclarationNode;300 DeclarationNode * DeclarationNode::newTraitUse( const string * name, ExpressionNode * params ) { 301 DeclarationNode * newnode = new DeclarationNode; 296 302 newnode->type = new TypeData( TypeData::AggregateInst ); 297 303 newnode->type->aggInst.aggregate = new TypeData( TypeData::Aggregate ); 298 304 newnode->type->aggInst.aggregate->aggregate.kind = Trait; 299 newnode->type->aggInst.aggregate->aggregate.name = assign_strptr( name );305 newnode->type->aggInst.aggregate->aggregate.name = name; 300 306 newnode->type->aggInst.params = params; 301 307 return newnode; 302 308 } // DeclarationNode::newTraitUse 303 309 304 DeclarationNode *DeclarationNode::newTypeDecl( std::string *name, DeclarationNode *typeParams ) { 305 DeclarationNode *newnode = new DeclarationNode; 306 newnode->name = assign_strptr( name ); 310 DeclarationNode * DeclarationNode::newTypeDecl( string * name, DeclarationNode * typeParams ) { 311 DeclarationNode * newnode = new DeclarationNode; 307 312 newnode->type = new TypeData( TypeData::Symbolic ); 308 313 newnode->type->symbolic.isTypedef = false; 309 314 newnode->type->symbolic.params = typeParams; 310 newnode->type->symbolic.name = n ewnode->name;315 newnode->type->symbolic.name = name; 311 316 return newnode; 312 317 } // DeclarationNode::newTypeDecl 313 318 314 DeclarationNode * DeclarationNode::newPointer( DeclarationNode *qualifiers ) {315 DeclarationNode * newnode = new DeclarationNode;319 DeclarationNode * DeclarationNode::newPointer( DeclarationNode * qualifiers ) { 320 DeclarationNode * newnode = new DeclarationNode; 316 321 newnode->type = new TypeData( TypeData::Pointer ); 317 322 return newnode->addQualifiers( qualifiers ); 318 323 } // DeclarationNode::newPointer 319 324 320 DeclarationNode * DeclarationNode::newArray( ExpressionNode *size, DeclarationNode *qualifiers, bool isStatic ) {321 DeclarationNode * newnode = new DeclarationNode;325 DeclarationNode * DeclarationNode::newArray( ExpressionNode * size, DeclarationNode * qualifiers, bool isStatic ) { 326 DeclarationNode * newnode = new DeclarationNode; 322 327 newnode->type = new TypeData( TypeData::Array ); 323 328 newnode->type->array.dimension = size; 324 329 newnode->type->array.isStatic = isStatic; 325 if ( newnode->type->array.dimension == 0 || newnode->type->array.dimension->isExpressionType<ConstantExpr *>() ) {330 if ( newnode->type->array.dimension == nullptr || newnode->type->array.dimension->isExpressionType<ConstantExpr * >() ) { 326 331 newnode->type->array.isVarLen = false; 327 332 } else { … … 331 336 } // DeclarationNode::newArray 332 337 333 DeclarationNode * DeclarationNode::newVarArray( DeclarationNode *qualifiers ) {334 DeclarationNode * newnode = new DeclarationNode;338 DeclarationNode * DeclarationNode::newVarArray( DeclarationNode * qualifiers ) { 339 DeclarationNode * newnode = new DeclarationNode; 335 340 newnode->type = new TypeData( TypeData::Array ); 336 newnode->type->array.dimension = 0;341 newnode->type->array.dimension = nullptr; 337 342 newnode->type->array.isStatic = false; 338 343 newnode->type->array.isVarLen = true; … … 340 345 } 341 346 342 DeclarationNode * DeclarationNode::newBitfield( ExpressionNode *size ) {343 DeclarationNode * newnode = new DeclarationNode;347 DeclarationNode * DeclarationNode::newBitfield( ExpressionNode * size ) { 348 DeclarationNode * newnode = new DeclarationNode; 344 349 newnode->bitfieldWidth = size; 345 350 return newnode; 346 351 } 347 352 348 DeclarationNode * DeclarationNode::newTuple( DeclarationNode *members ) {349 DeclarationNode * newnode = new DeclarationNode;353 DeclarationNode * DeclarationNode::newTuple( DeclarationNode * members ) { 354 DeclarationNode * newnode = new DeclarationNode; 350 355 newnode->type = new TypeData( TypeData::Tuple ); 351 356 newnode->type->tuple = members; … … 353 358 } 354 359 355 DeclarationNode * DeclarationNode::newTypeof( ExpressionNode *expr ) {356 DeclarationNode * newnode = new DeclarationNode;360 DeclarationNode * DeclarationNode::newTypeof( ExpressionNode * expr ) { 361 DeclarationNode * newnode = new DeclarationNode; 357 362 newnode->type = new TypeData( TypeData::Typeof ); 358 363 newnode->type->typeexpr = expr; … … 361 366 362 367 DeclarationNode * DeclarationNode::newBuiltinType( BuiltinType bt ) { 363 DeclarationNode * newnode = new DeclarationNode;368 DeclarationNode * newnode = new DeclarationNode; 364 369 newnode->type = new TypeData( TypeData::Builtin ); 365 370 newnode->builtin = bt; … … 367 372 } // DeclarationNode::newBuiltinType 368 373 369 DeclarationNode * DeclarationNode::newAttr( std::string *name, ExpressionNode *expr ) {370 DeclarationNode * newnode = new DeclarationNode;371 newnode->type = n ew TypeData( TypeData::Attr );372 newnode->attr.name = assign_strptr( name );374 DeclarationNode * DeclarationNode::newAttr( string * name, ExpressionNode * expr ) { 375 DeclarationNode * newnode = new DeclarationNode; 376 newnode->type = nullptr; 377 newnode->attr.name = name; 373 378 newnode->attr.expr = expr; 374 379 return newnode; 375 380 } 376 381 377 DeclarationNode * DeclarationNode::newAttr( std::string *name, DeclarationNode *type ) {378 DeclarationNode * newnode = new DeclarationNode;379 newnode->type = n ew TypeData( TypeData::Attr );380 newnode->attr.name = assign_strptr( name );382 DeclarationNode * DeclarationNode::newAttr( string * name, DeclarationNode * type ) { 383 DeclarationNode * newnode = new DeclarationNode; 384 newnode->type = nullptr; 385 newnode->attr.name = name; 381 386 newnode->attr.type = type; 382 387 return newnode; … … 389 394 } // appendError 390 395 391 void DeclarationNode::checkQualifiers( const TypeData * src, const TypeData *dst ) {396 void DeclarationNode::checkQualifiers( const TypeData * src, const TypeData * dst ) { 392 397 TypeData::Qualifiers qsrc = src->qualifiers, qdst = dst->qualifiers; // optimization 393 398 … … 401 406 } // DeclarationNode::checkQualifiers 402 407 403 void DeclarationNode::checkStorageClasses( DeclarationNode * q ) {408 void DeclarationNode::checkStorageClasses( DeclarationNode * q ) { 404 409 if ( storageClass != NoStorageClass && q->storageClass != NoStorageClass ) { 405 410 if ( storageClass == q->storageClass ) { // duplicate qualifier … … 413 418 } // DeclarationNode::copyStorageClasses 414 419 415 DeclarationNode * DeclarationNode::copyStorageClasses( DeclarationNode *q ) {420 DeclarationNode * DeclarationNode::copyStorageClasses( DeclarationNode * q ) { 416 421 isInline = isInline || q->isInline; 417 422 isNoreturn = isNoreturn || q->isNoreturn; … … 424 429 } // DeclarationNode::copyStorageClasses 425 430 426 static void addQualifiersToType( TypeData *&src, TypeData * dst ) {431 static void addQualifiersToType( TypeData *&src, TypeData * dst ) { 427 432 if ( src->forall && dst->kind == TypeData::Function ) { 428 433 if ( dst->forall ) { … … 431 436 dst->forall = src->forall; 432 437 } // if 433 src->forall = 0;438 src->forall = nullptr; 434 439 } // if 435 440 if ( dst->base ) { … … 437 442 } else if ( dst->kind == TypeData::Function ) { 438 443 dst->base = src; 439 src = 0;444 src = nullptr; 440 445 } else { 441 446 dst->qualifiers |= src->qualifiers; … … 443 448 } // addQualifiersToType 444 449 445 DeclarationNode * DeclarationNode::addQualifiers( DeclarationNode *q ) {446 if ( ! q ) return this;450 DeclarationNode * DeclarationNode::addQualifiers( DeclarationNode * q ) { 451 if ( ! q ) { delete q; return this; } 447 452 448 453 checkStorageClasses( q ); 449 454 copyStorageClasses( q ); 450 455 451 if ( ! q->type ) { delete q; return this; } 456 if ( ! q->type ) { 457 delete q; 458 return this; 459 } // if 452 460 453 461 if ( ! type ) { 454 // type = new TypeData; 455 type = q->type; 462 type = q->type; // reuse this structure 463 q->type = nullptr; 464 delete q; 456 465 return this; 457 466 } // if … … 467 476 type->aggregate.params = q->type->forall; 468 477 // change implicit typedef from TYPEDEFname to TYPEGENname 469 typedefTable.changeKind( type->aggregate.name, TypedefTable::TG );478 typedefTable.changeKind( *type->aggregate.name, TypedefTable::TG ); 470 479 } else { 471 480 type->forall = q->type->forall; 472 481 } // if 473 482 } // if 474 q->type->forall = 0;483 q->type->forall = nullptr; 475 484 } // if 476 485 delete q; … … 485 494 dst->forall = src->forall; 486 495 } // if 487 src->forall = 0;496 src->forall = nullptr; 488 497 } // if 489 498 if ( dst->base ) { … … 494 503 src->qualifiers |= dst->qualifiers; 495 504 dst = src; 496 src = 0;505 src = nullptr; 497 506 break; 498 507 case TypeData::Basic: … … 504 513 dst->basictype = src->basictype; 505 514 } else if ( src->basictype != DeclarationNode::NoBasicType ) 506 throw SemanticError( st d::string( "conflicting type specifier " ) + DeclarationNode::basicTypeName[ src->basictype ] + " in type: ", src );515 throw SemanticError( string( "conflicting type specifier " ) + DeclarationNode::basicTypeName[ src->basictype ] + " in type: ", src ); 507 516 508 517 if ( dst->complextype == DeclarationNode::NoComplexType ) { 509 518 dst->complextype = src->complextype; 510 519 } else if ( src->complextype != DeclarationNode::NoComplexType ) 511 throw SemanticError( st d::string( "conflicting type specifier " ) + DeclarationNode::complexTypeName[ src->complextype ] + " in type: ", src );520 throw SemanticError( string( "conflicting type specifier " ) + DeclarationNode::complexTypeName[ src->complextype ] + " in type: ", src ); 512 521 513 522 if ( dst->signedness == DeclarationNode::NoSignedness ) { 514 523 dst->signedness = src->signedness; 515 524 } else if ( src->signedness != DeclarationNode::NoSignedness ) 516 throw SemanticError( st d::string( "conflicting type specifier " ) + DeclarationNode::signednessName[ src->signedness ] + " in type: ", src );525 throw SemanticError( string( "conflicting type specifier " ) + DeclarationNode::signednessName[ src->signedness ] + " in type: ", src ); 517 526 518 527 if ( dst->length == DeclarationNode::NoLength ) { … … 521 530 dst->length = DeclarationNode::LongLong; 522 531 } else if ( src->length != DeclarationNode::NoLength ) 523 throw SemanticError( st d::string( "conflicting type specifier " ) + DeclarationNode::lengthName[ src->length ] + " in type: ", src );532 throw SemanticError( string( "conflicting type specifier " ) + DeclarationNode::lengthName[ src->length ] + " in type: ", src ); 524 533 } // if 525 534 break; … … 534 543 } // if 535 544 dst->base->qualifiers |= src->qualifiers; 536 src = 0;545 src = nullptr; 537 546 break; 538 547 default: … … 542 551 dst->forall = src->forall; 543 552 } // if 544 src->forall = 0;553 src->forall = nullptr; 545 554 dst->base = src; 546 src = 0;555 src = nullptr; 547 556 } // switch 548 557 } // switch … … 550 559 } 551 560 552 DeclarationNode * DeclarationNode::addType( DeclarationNode *o ) {561 DeclarationNode * DeclarationNode::addType( DeclarationNode * o ) { 553 562 if ( o ) { 554 563 checkStorageClasses( o ); … … 566 575 type = o->type; 567 576 } // if 568 o->type = 0;577 o->type = nullptr; 569 578 } else { 570 579 addTypeToType( o->type, type ); … … 584 593 } 585 594 586 DeclarationNode * DeclarationNode::addTypedef() {587 TypeData * newtype = new TypeData( TypeData::Symbolic );588 newtype->symbolic.params = 0;595 DeclarationNode * DeclarationNode::addTypedef() { 596 TypeData * newtype = new TypeData( TypeData::Symbolic ); 597 newtype->symbolic.params = nullptr; 589 598 newtype->symbolic.isTypedef = true; 590 newtype->symbolic.name = name ;599 newtype->symbolic.name = name ? new string( *name ) : nullptr; 591 600 newtype->base = type; 592 601 type = newtype; … … 594 603 } 595 604 596 DeclarationNode *DeclarationNode::addAssertions( DeclarationNode *assertions ) { 605 DeclarationNode * DeclarationNode::addAssertions( DeclarationNode * assertions ) { 606 if ( variable.name ) { 607 if ( variable.assertions ) { 608 variable.assertions->appendList( assertions ); 609 } else { 610 variable.assertions = assertions; 611 } // if 612 return this; 613 } // if 614 597 615 assert( type ); 598 616 switch ( type->kind ) { … … 604 622 } // if 605 623 break; 606 case TypeData::Variable:607 if ( variable.assertions ) {608 variable.assertions->appendList( assertions );609 } else {610 variable.assertions = assertions;611 } // if612 break;624 // case TypeData::Variable: 625 // if ( variable.assertions ) { 626 // variable.assertions->appendList( assertions ); 627 // } else { 628 // variable.assertions = assertions; 629 // } // if 630 // break; 613 631 default: 614 632 assert( false ); … … 618 636 } 619 637 620 DeclarationNode *DeclarationNode::addName( std::string *newname ) { 621 name = assign_strptr( newname ); 622 return this; 623 } 624 625 DeclarationNode *DeclarationNode::addBitfield( ExpressionNode *size ) { 638 DeclarationNode * DeclarationNode::addName( string * newname ) { 639 assert( ! name ); 640 name = newname; 641 return this; 642 } 643 644 DeclarationNode * DeclarationNode::addBitfield( ExpressionNode * size ) { 626 645 bitfieldWidth = size; 627 646 return this; 628 647 } 629 648 630 DeclarationNode * DeclarationNode::addVarArgs() {649 DeclarationNode * DeclarationNode::addVarArgs() { 631 650 assert( type ); 632 651 hasEllipsis = true; … … 634 653 } 635 654 636 DeclarationNode * DeclarationNode::addFunctionBody( StatementNode *body ) {655 DeclarationNode * DeclarationNode::addFunctionBody( StatementNode * body ) { 637 656 assert( type ); 638 657 assert( type->kind == TypeData::Function ); 639 assert( type->function.body == 0);658 assert( ! type->function.body ); 640 659 type->function.body = body; 641 660 type->function.hasBody = true; … … 643 662 } 644 663 645 DeclarationNode * DeclarationNode::addOldDeclList( DeclarationNode *list ) {664 DeclarationNode * DeclarationNode::addOldDeclList( DeclarationNode * list ) { 646 665 assert( type ); 647 666 assert( type->kind == TypeData::Function ); 648 assert( type->function.oldDeclList == 0);667 assert( ! type->function.oldDeclList ); 649 668 type->function.oldDeclList = list; 650 669 return this; 651 670 } 652 671 653 static void setBase( TypeData *&type, TypeData * newType ) {672 static void setBase( TypeData *&type, TypeData * newType ) { 654 673 if ( type ) { 655 TypeData * prevBase = type;656 TypeData * curBase = type->base;657 while ( curBase != 0) {674 TypeData * prevBase = type; 675 TypeData * curBase = type->base; 676 while ( curBase != nullptr ) { 658 677 prevBase = curBase; 659 678 curBase = curBase->base; … … 665 684 } 666 685 667 DeclarationNode * DeclarationNode::addPointer( DeclarationNode *p ) {686 DeclarationNode * DeclarationNode::addPointer( DeclarationNode * p ) { 668 687 if ( p ) { 669 688 assert( p->type->kind == TypeData::Pointer ); 670 689 setBase( type, p->type ); 671 p->type = 0;690 p->type = nullptr; 672 691 delete p; 673 692 } // if … … 675 694 } 676 695 677 DeclarationNode * DeclarationNode::addArray( DeclarationNode *a ) {696 DeclarationNode * DeclarationNode::addArray( DeclarationNode * a ) { 678 697 if ( a ) { 679 698 assert( a->type->kind == TypeData::Array ); 680 699 setBase( type, a->type ); 681 a->type = 0;700 a->type = nullptr; 682 701 delete a; 683 702 } // if … … 685 704 } 686 705 687 DeclarationNode * DeclarationNode::addNewPointer( DeclarationNode *p ) {706 DeclarationNode * DeclarationNode::addNewPointer( DeclarationNode * p ) { 688 707 if ( p ) { 689 708 assert( p->type->kind == TypeData::Pointer ); … … 703 722 p->type->base = type; 704 723 } // switch 705 type = 0;724 type = nullptr; 706 725 } // if 707 726 delete this; … … 712 731 } 713 732 714 static TypeData * findLast( TypeData *a ) {733 static TypeData * findLast( TypeData * a ) { 715 734 assert( a ); 716 TypeData * cur = a;735 TypeData * cur = a; 717 736 while ( cur->base ) { 718 737 cur = cur->base; … … 721 740 } 722 741 723 DeclarationNode * DeclarationNode::addNewArray( DeclarationNode *a ) {742 DeclarationNode * DeclarationNode::addNewArray( DeclarationNode * a ) { 724 743 if ( a ) { 725 744 assert( a->type->kind == TypeData::Array ); 726 TypeData * lastArray = findLast( a->type );745 TypeData * lastArray = findLast( a->type ); 727 746 if ( type ) { 728 747 switch ( type->kind ) { … … 739 758 lastArray->base = type; 740 759 } // switch 741 type = 0;760 type = nullptr; 742 761 } // if 743 762 delete this; … … 748 767 } 749 768 750 DeclarationNode * DeclarationNode::addParamList( DeclarationNode *params ) {751 TypeData * ftype = new TypeData( TypeData::Function );769 DeclarationNode * DeclarationNode::addParamList( DeclarationNode * params ) { 770 TypeData * ftype = new TypeData( TypeData::Function ); 752 771 ftype->function.params = params; 753 772 setBase( type, ftype ); … … 755 774 } 756 775 757 static TypeData * addIdListToType( TypeData *type, DeclarationNode *ids ) {776 static TypeData * addIdListToType( TypeData * type, DeclarationNode * ids ) { 758 777 if ( type ) { 759 778 if ( type->kind != TypeData::Function ) { … … 764 783 return type; 765 784 } else { 766 TypeData * newtype = new TypeData( TypeData::Function );785 TypeData * newtype = new TypeData( TypeData::Function ); 767 786 newtype->function.idList = ids; 768 787 return newtype; 769 788 } // if 770 } 771 772 DeclarationNode * DeclarationNode::addIdList( DeclarationNode *ids ) {789 } // addIdListToType 790 791 DeclarationNode * DeclarationNode::addIdList( DeclarationNode * ids ) { 773 792 type = addIdListToType( type, ids ); 774 793 return this; 775 794 } 776 795 777 DeclarationNode *DeclarationNode::addInitializer( InitializerNode *init ) { 778 //assert 796 DeclarationNode * DeclarationNode::addInitializer( InitializerNode * init ) { 779 797 initializer = init; 780 798 return this; 781 799 } 782 800 783 DeclarationNode *DeclarationNode::cloneBaseType( string *newName ) { 784 DeclarationNode *newnode = new DeclarationNode; 785 TypeData *srcType = type; 786 while ( srcType->base ) { 787 srcType = srcType->base; 788 } // while 789 newnode->type = maybeClone( srcType ); 790 if ( newnode->type->kind == TypeData::AggregateInst ) { 791 // don't duplicate members 792 if ( newnode->type->aggInst.aggregate->kind == TypeData::Enum ) { 793 delete newnode->type->aggInst.aggregate->enumeration.constants; 794 newnode->type->aggInst.aggregate->enumeration.constants = 0; 795 } else { 796 assert( newnode->type->aggInst.aggregate->kind == TypeData::Aggregate ); 797 delete newnode->type->aggInst.aggregate->aggregate.fields; 798 newnode->type->aggInst.aggregate->aggregate.fields = 0; 799 } // if 800 } // if 801 newnode->type->forall = maybeClone( type->forall ); 802 assert( storageClass == NoStorageClass ); 803 newnode->copyStorageClasses( this ); 804 newnode->name = assign_strptr( newName ); 805 return newnode; 806 } 807 808 DeclarationNode *DeclarationNode::cloneBaseType( DeclarationNode *o ) { 809 if ( o ) { 810 o->copyStorageClasses( this ); 811 if ( type ) { 812 TypeData *srcType = type; 813 while ( srcType->base ) { 814 srcType = srcType->base; 815 } // while 816 TypeData *newType = srcType->clone(); 817 if ( newType->kind == TypeData::AggregateInst ) { 818 // don't duplicate members 819 if ( newType->aggInst.aggregate->kind == TypeData::Enum ) { 820 delete newType->aggInst.aggregate->enumeration.constants; 821 newType->aggInst.aggregate->enumeration.constants = 0; 822 } else { 823 assert( newType->aggInst.aggregate->kind == TypeData::Aggregate ); 824 delete newType->aggInst.aggregate->aggregate.fields; 825 newType->aggInst.aggregate->aggregate.fields = 0; 826 } // if 827 } // if 828 newType->forall = maybeClone( type->forall ); 829 if ( ! o->type ) { 830 o->type = newType; 831 } else { 832 addTypeToType( newType, o->type ); 833 delete newType; 834 } // if 835 } // if 836 } // if 837 return o; 838 } 839 840 DeclarationNode *DeclarationNode::cloneType( string *newName ) { 841 DeclarationNode *newnode = new DeclarationNode; 801 DeclarationNode * DeclarationNode::cloneType( string * newName ) { 802 DeclarationNode * newnode = new DeclarationNode; 842 803 newnode->type = maybeClone( type ); 843 804 assert( storageClass == NoStorageClass ); 844 805 newnode->copyStorageClasses( this ); 845 newnode->name = assign_strptr( newName ); 846 return newnode; 847 } 848 849 DeclarationNode *DeclarationNode::cloneType( DeclarationNode *o ) { 850 if ( o ) { 851 assert( storageClass == NoStorageClass ); 852 o->copyStorageClasses( this ); 853 if ( type ) { 854 TypeData *newType = type->clone(); 855 if ( ! o->type ) { 856 o->type = newType; 806 assert( newName ); 807 newnode->name = newName; 808 return newnode; 809 } 810 811 DeclarationNode * DeclarationNode::cloneBaseType( DeclarationNode * o ) { 812 if ( ! o ) return nullptr; 813 814 o->copyStorageClasses( this ); 815 if ( type ) { 816 TypeData * srcType = type; 817 818 while ( srcType->base ) { 819 srcType = srcType->base; 820 } // while 821 822 TypeData * newType = srcType->clone(); 823 if ( newType->kind == TypeData::AggregateInst ) { 824 // don't duplicate members 825 if ( newType->aggInst.aggregate->kind == TypeData::Enum ) { 826 delete newType->aggInst.aggregate->enumeration.constants; 827 newType->aggInst.aggregate->enumeration.constants = nullptr; 857 828 } else { 858 addTypeToType( newType, o->type ); 859 delete newType; 829 assert( newType->aggInst.aggregate->kind == TypeData::Aggregate ); 830 delete newType->aggInst.aggregate->aggregate.fields; 831 newType->aggInst.aggregate->aggregate.fields = nullptr; 860 832 } // if 861 833 } // if 862 } // if 863 delete o; 834 835 newType->forall = maybeClone( type->forall ); 836 if ( ! o->type ) { 837 o->type = newType; 838 } else { 839 addTypeToType( newType, o->type ); 840 delete newType; 841 } // if 842 } // if 864 843 return o; 865 844 } 866 845 867 DeclarationNode * DeclarationNode::extractAggregate() const {846 DeclarationNode * DeclarationNode::extractAggregate() const { 868 847 if ( type ) { 869 TypeData * ret = typeextractAggregate( type );848 TypeData * ret = typeextractAggregate( type ); 870 849 if ( ret ) { 871 DeclarationNode * newnode = new DeclarationNode;850 DeclarationNode * newnode = new DeclarationNode; 872 851 newnode->type = ret; 873 852 return newnode; 874 853 } // if 875 854 } // if 876 return 0;877 } 878 879 void buildList( const DeclarationNode * firstNode, std::list< Declaration * > &outputList ) {855 return nullptr; 856 } 857 858 void buildList( const DeclarationNode * firstNode, std::list< Declaration * > &outputList ) { 880 859 SemanticError errors; 881 860 std::back_insert_iterator< std::list< Declaration * > > out( outputList ); 882 const DeclarationNode *cur = firstNode; 861 const DeclarationNode * cur = firstNode; 862 883 863 while ( cur ) { 884 864 try { 885 if ( DeclarationNode * extr = cur->extractAggregate() ) {865 if ( DeclarationNode * extr = cur->extractAggregate() ) { 886 866 // handle the case where a structure declaration is contained within an object or type declaration 887 Declaration * decl = extr->build();867 Declaration * decl = extr->build(); 888 868 if ( decl ) { 889 * out++ = decl;869 * out++ = decl; 890 870 } // if 891 871 delete extr; 892 872 } // if 893 Declaration *decl = cur->build(); 873 874 Declaration * decl = cur->build(); 894 875 if ( decl ) { 895 * out++ = decl;876 * out++ = decl; 896 877 } // if 897 878 } catch( SemanticError &e ) { … … 900 881 cur = dynamic_cast< DeclarationNode * >( cur->get_next() ); 901 882 } // while 883 902 884 if ( ! errors.isEmpty() ) { 903 885 throw errors; 904 886 } // if 905 } 906 907 void buildList( const DeclarationNode * firstNode, std::list< DeclarationWithType * > &outputList ) {887 } // buildList 888 889 void buildList( const DeclarationNode * firstNode, std::list< DeclarationWithType * > &outputList ) { 908 890 SemanticError errors; 909 891 std::back_insert_iterator< std::list< DeclarationWithType * > > out( outputList ); 910 const DeclarationNode * cur = firstNode;892 const DeclarationNode * cur = firstNode; 911 893 while ( cur ) { 912 894 try { 913 Declaration * decl = cur->build();895 Declaration * decl = cur->build(); 914 896 if ( decl ) { 915 if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * >( decl ) ) {916 * out++ = dwt;917 } else if ( StructDecl * agg = dynamic_cast< StructDecl * >( decl ) ) {918 StructInstType * inst = new StructInstType( Type::Qualifiers(), agg->get_name() );919 * out++ = new ObjectDecl( "", DeclarationNode::NoStorageClass, linkage, 0, inst, 0);897 if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * >( decl ) ) { 898 * out++ = dwt; 899 } else if ( StructDecl * agg = dynamic_cast< StructDecl * >( decl ) ) { 900 StructInstType * inst = new StructInstType( Type::Qualifiers(), agg->get_name() ); 901 * out++ = new ObjectDecl( "", DeclarationNode::NoStorageClass, linkage, nullptr, inst, nullptr ); 920 902 delete agg; 921 } else if ( UnionDecl * agg = dynamic_cast< UnionDecl * >( decl ) ) {922 UnionInstType * inst = new UnionInstType( Type::Qualifiers(), agg->get_name() );923 * out++ = new ObjectDecl( "", DeclarationNode::NoStorageClass, linkage, 0, inst, 0);903 } else if ( UnionDecl * agg = dynamic_cast< UnionDecl * >( decl ) ) { 904 UnionInstType * inst = new UnionInstType( Type::Qualifiers(), agg->get_name() ); 905 * out++ = new ObjectDecl( "", DeclarationNode::NoStorageClass, linkage, nullptr, inst, nullptr ); 924 906 } // if 925 907 } // if … … 932 914 throw errors; 933 915 } // if 934 } 935 936 void buildTypeList( const DeclarationNode * firstNode, std::list< Type * > &outputList ) {916 } // buildList 917 918 void buildTypeList( const DeclarationNode * firstNode, std::list< Type * > &outputList ) { 937 919 SemanticError errors; 938 920 std::back_insert_iterator< std::list< Type * > > out( outputList ); 939 const DeclarationNode *cur = firstNode; 921 const DeclarationNode * cur = firstNode; 922 940 923 while ( cur ) { 941 924 try { 942 * out++ = cur->buildType();925 * out++ = cur->buildType(); 943 926 } catch( SemanticError &e ) { 944 927 errors.append( e ); … … 946 929 cur = dynamic_cast< DeclarationNode * >( cur->get_next() ); 947 930 } // while 931 948 932 if ( ! errors.isEmpty() ) { 949 933 throw errors; 950 934 } // if 951 } 952 953 Declaration * DeclarationNode::build() const {935 } // buildTypeList 936 937 Declaration * DeclarationNode::build() const { 954 938 if ( ! error.empty() ) throw SemanticError( error + " in declaration of ", this ); 939 940 if ( variable.name ) { 941 static const TypeDecl::Kind kindMap[] = { TypeDecl::Any, TypeDecl::Ftype, TypeDecl::Dtype }; 942 TypeDecl * ret = new TypeDecl( *variable.name, DeclarationNode::NoStorageClass, nullptr, kindMap[ variable.tyClass ] ); 943 buildList( variable.assertions, ret->get_assertions() ); 944 return ret; 945 } // if 946 955 947 if ( type ) { 956 if ( type->kind == TypeData::Variable ) { 957 static const TypeDecl::Kind kindMap[] = { TypeDecl::Any, TypeDecl::Ftype, TypeDecl::Dtype }; 958 TypeDecl * ret = new TypeDecl( variable.name, DeclarationNode::NoStorageClass, 0, kindMap[ variable.tyClass ] ); 959 buildList( variable.assertions, ret->get_assertions() ); 960 return ret; 948 return buildDecl( type, name ? *name : string( "" ), storageClass, maybeBuild< Expression >( bitfieldWidth ), isInline, isNoreturn, linkage, maybeBuild< Initializer >(initializer) )->set_extension( extension ); 949 } // if 950 951 if ( ! isInline && ! isNoreturn ) { 952 assertf( name, "ObjectDecl are assumed to have names\n" ); 953 return (new ObjectDecl( *name, storageClass, linkage, maybeBuild< Expression >( bitfieldWidth ), nullptr, maybeBuild< Initializer >( initializer ) ))->set_extension( extension ); 954 } // if 955 956 throw SemanticError( "invalid function specifier ", this ); 957 } 958 959 Type * DeclarationNode::buildType() const { 960 assert( type ); 961 962 if ( attr.name ) { 963 AttrType * ret; 964 if ( attr.expr ) { 965 ret = new AttrType( buildQualifiers( type ), *attr.name, attr.expr->build() ); 961 966 } else { 962 return buildDecl( type, name, storageClass, maybeBuild< Expression >( bitfieldWidth ), isInline, isNoreturn, linkage, maybeBuild< Initializer >(initializer) )->set_extension( extension ); 963 } // if 964 } // if 965 if ( ! isInline && ! isNoreturn ) { 966 return (new ObjectDecl( name, storageClass, linkage, maybeBuild< Expression >( bitfieldWidth ), 0, maybeBuild< Initializer >( initializer ) ))->set_extension( extension ); 967 } // if 968 throw SemanticError( "invalid function specifier ", this ); 969 } 970 971 Type *DeclarationNode::buildType() const { 972 assert( type ); 967 assert( attr.type ); 968 ret = new AttrType( buildQualifiers( type ), *attr.name, attr.type->buildType() ); 969 } // if 970 return ret; 971 } // if 973 972 974 973 switch ( type->kind ) { 975 974 case TypeData::Enum: 976 return new EnumInstType( buildQualifiers( type ), type->enumeration.name );975 return new EnumInstType( buildQualifiers( type ), *type->enumeration.name ); 977 976 case TypeData::Aggregate: { 978 ReferenceToType * ret;977 ReferenceToType * ret; 979 978 switch ( type->aggregate.kind ) { 980 979 case DeclarationNode::Struct: 981 ret = new StructInstType( buildQualifiers( type ), type->aggregate.name );980 ret = new StructInstType( buildQualifiers( type ), *type->aggregate.name ); 982 981 break; 983 982 case DeclarationNode::Union: 984 ret = new UnionInstType( buildQualifiers( type ), type->aggregate.name );983 ret = new UnionInstType( buildQualifiers( type ), *type->aggregate.name ); 985 984 break; 986 985 case DeclarationNode::Trait: 987 ret = new TraitInstType( buildQualifiers( type ), type->aggregate.name );986 ret = new TraitInstType( buildQualifiers( type ), *type->aggregate.name ); 988 987 break; 989 988 default: … … 994 993 } 995 994 case TypeData::Symbolic: { 996 TypeInstType * ret = new TypeInstType( buildQualifiers( type ),type->symbolic.name, false );995 TypeInstType * ret = new TypeInstType( buildQualifiers( type ), *type->symbolic.name, false ); 997 996 buildList( type->symbolic.actuals, ret->get_parameters() ); 998 return ret;999 }1000 case TypeData::Attr: {1001 assert( type->kind == TypeData::Attr );1002 // assert( type->attr );1003 AttrType * ret;1004 if ( attr.expr ) {1005 ret = new AttrType( buildQualifiers( type ), attr.name, attr.expr->build() );1006 } else {1007 assert( attr.type );1008 ret = new AttrType( buildQualifiers( type ), attr.name, attr.type->buildType() );1009 } // if1010 997 return ret; 1011 998 } -
src/Parser/ExpressionNode.cc
r7b69174 raee7e35 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 25 21:39:40201613 // Update Count : 50 312 // Last Modified On : Fri Sep 16 16:27:44 2016 13 // Update Count : 508 14 14 // 15 15 … … 31 31 32 32 using namespace std; 33 34 ExpressionNode::ExpressionNode( const ExpressionNode &other ) : ParseNode( other.get_name() ), extension( other.extension ) {}35 33 36 34 //############################################################################## -
src/Parser/ParseNode.h
r7b69174 raee7e35 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Sep 12 08:00:05201613 // Update Count : 6 0312 // Last Modified On : Sat Sep 24 11:12:04 2016 13 // Update Count : 633 14 14 // 15 15 … … 41 41 public: 42 42 ParseNode() {}; 43 ParseNode( const std::string * name ) : name( * name ) { assert( false ); delete name; } 44 ParseNode( const std::string &name ) : name( name ) { assert( false ); } 45 virtual ~ParseNode() { delete next; }; 43 virtual ~ParseNode() { delete next; delete name; }; 46 44 virtual ParseNode * clone() const = 0; 47 45 48 46 ParseNode * get_next() const { return next; } 49 47 ParseNode * set_next( ParseNode * newlink ) { next = newlink; return this; } 48 50 49 ParseNode * get_last() { 51 50 ParseNode * current; 52 for ( current = this; current->get_next() != 0; current = current->get_next() );51 for ( current = this; current->get_next() != nullptr; current = current->get_next() ); 53 52 return current; 54 53 } 55 54 ParseNode * set_last( ParseNode * newlast ) { 56 if ( newlast != 0) get_last()->set_next( newlast );55 if ( newlast != nullptr ) get_last()->set_next( newlast ); 57 56 return this; 58 57 } 59 60 const std::string &get_name() const { return name; }61 void set_name( const std::string &newValue ) { name = newValue; }62 58 63 59 virtual void print( std::ostream &os, int indent = 0 ) const {} 64 60 virtual void printList( std::ostream &os, int indent = 0 ) const {} 65 private: 61 66 62 static int indent_by; 67 63 68 64 ParseNode * next = nullptr; 69 std::string name;65 std::string * name = nullptr; 70 66 }; // ParseNode 71 67 … … 74 70 class InitializerNode : public ParseNode { 75 71 public: 76 InitializerNode( ExpressionNode *, bool aggrp = false, ExpressionNode * des = 0);77 InitializerNode( InitializerNode *, bool aggrp = false, ExpressionNode * des = 0);72 InitializerNode( ExpressionNode *, bool aggrp = false, ExpressionNode * des = nullptr ); 73 InitializerNode( InitializerNode *, bool aggrp = false, ExpressionNode * des = nullptr ); 78 74 ~InitializerNode(); 79 75 virtual InitializerNode * clone() const { assert( false ); return nullptr; } … … 106 102 public: 107 103 ExpressionNode( Expression * expr = nullptr ) : expr( expr ) {} 108 ExpressionNode( Expression * expr, const std::string * name ) : ParseNode( name ), expr( expr ) {}109 104 ExpressionNode( const ExpressionNode &other ); 110 105 virtual ~ExpressionNode() {} … … 183 178 Expression * build_attrexpr( NameExpr * var, ExpressionNode * expr_node ); 184 179 Expression * build_attrtype( NameExpr * var, DeclarationNode * decl_node ); 185 Expression * build_tuple( ExpressionNode * expr_node = 0);180 Expression * build_tuple( ExpressionNode * expr_node = nullptr ); 186 181 Expression * build_func( ExpressionNode * function, ExpressionNode * expr_node ); 187 182 Expression * build_range( ExpressionNode * low, ExpressionNode * high ); … … 219 214 static DeclarationNode * newFunction( std::string * name, DeclarationNode * ret, DeclarationNode * param, StatementNode * body, bool newStyle = false ); 220 215 static DeclarationNode * newQualifier( Qualifier ); 221 static DeclarationNode * newForall( DeclarationNode * );216 static DeclarationNode * newForall( DeclarationNode * ); 222 217 static DeclarationNode * newStorageClass( StorageClass ); 223 218 static DeclarationNode * newBasicType( BasicType ); … … 226 221 static DeclarationNode * newLength( Length lnth ); 227 222 static DeclarationNode * newBuiltinType( BuiltinType ); 228 static DeclarationNode * newFromTypedef( std::string * );223 static DeclarationNode * newFromTypedef( std::string * ); 229 224 static DeclarationNode * newAggregate( Aggregate kind, const std::string * name, ExpressionNode * actuals, DeclarationNode * fields, bool body ); 230 225 static DeclarationNode * newEnum( std::string * name, DeclarationNode * constants ); 231 226 static DeclarationNode * newEnumConstant( std::string * name, ExpressionNode * constant ); 232 static DeclarationNode * newName( std::string * );227 static DeclarationNode * newName( std::string * ); 233 228 static DeclarationNode * newFromTypeGen( std::string *, ExpressionNode * params ); 234 static DeclarationNode * newTypeParam( TypeClass, std::string * );235 static DeclarationNode * newTrait( std::string * name, DeclarationNode * params, DeclarationNode * asserts );236 static DeclarationNode * newTraitUse( std::string * name, ExpressionNode * params );229 static DeclarationNode * newTypeParam( TypeClass, std::string * ); 230 static DeclarationNode * newTrait( const std::string * name, DeclarationNode * params, DeclarationNode * asserts ); 231 static DeclarationNode * newTraitUse( const std::string * name, ExpressionNode * params ); 237 232 static DeclarationNode * newTypeDecl( std::string * name, DeclarationNode * typeParams ); 238 233 static DeclarationNode * newPointer( DeclarationNode * qualifiers ); … … 249 244 DeclarationNode * clone() const; 250 245 251 DeclarationNode * addQualifiers( DeclarationNode * );246 DeclarationNode * addQualifiers( DeclarationNode * ); 252 247 void checkQualifiers( const TypeData *, const TypeData * ); 253 void checkStorageClasses( DeclarationNode * q);254 DeclarationNode * copyStorageClasses( DeclarationNode * );255 DeclarationNode * addType( DeclarationNode * );248 void checkStorageClasses( DeclarationNode * ); 249 DeclarationNode * copyStorageClasses( DeclarationNode * ); 250 DeclarationNode * addType( DeclarationNode * ); 256 251 DeclarationNode * addTypedef(); 257 DeclarationNode * addAssertions( DeclarationNode * );258 DeclarationNode * addName( std::string * );252 DeclarationNode * addAssertions( DeclarationNode * ); 253 DeclarationNode * addName( std::string * ); 259 254 DeclarationNode * addBitfield( ExpressionNode * size ); 260 255 DeclarationNode * addVarArgs(); … … 270 265 271 266 DeclarationNode * cloneType( std::string * newName ); 272 DeclarationNode * cloneType( DeclarationNode * existing );273 DeclarationNode * cloneType( int ) { return cloneType( ( std::string *)0 ); }274 DeclarationNode * cloneBaseType( std::string * newName );275 267 DeclarationNode * cloneBaseType( DeclarationNode * newdecl ); 276 268 … … 286 278 287 279 bool get_hasEllipsis() const; 288 const std::string &get_name() const { return name; }289 280 LinkageSpec::Spec get_linkage() const { return linkage; } 290 281 DeclarationNode * extractAggregate() const; … … 295 286 DeclarationNode * set_extension( bool exten ) { extension = exten; return this; } 296 287 public: 297 // StorageClass buildStorageClass() const;298 // bool buildFuncSpecifier( StorageClass key ) const;299 300 288 struct Variable_t { 289 const std::string * name; 301 290 DeclarationNode::TypeClass tyClass; 302 std::string name;303 291 DeclarationNode * assertions; 304 292 }; … … 306 294 307 295 struct Attr_t { 308 std::stringname;296 const std::string * name; 309 297 ExpressionNode * expr; 310 298 DeclarationNode * type; … … 315 303 316 304 TypeData * type; 317 std::string name;318 305 StorageClass storageClass; 319 306 bool isInline, isNoreturn; … … 331 318 332 319 Type * buildType( TypeData * type ); 333 //Type::Qualifiers buildQualifiers( const TypeData::Qualifiers & qualifiers );334 320 335 321 static inline Type * maybeMoveBuildType( const DeclarationNode * orig ) { … … 393 379 Statement * build_finally( StatementNode * stmt ); 394 380 Statement * build_compound( StatementNode * first ); 395 Statement * build_asmstmt( bool voltile, ConstantExpr * instruction, ExpressionNode * output = 0, ExpressionNode * input = 0, ExpressionNode * clobber = 0, LabelNode * gotolabels = 0);381 Statement * build_asmstmt( bool voltile, ConstantExpr * instruction, ExpressionNode * output = nullptr, ExpressionNode * input = nullptr, ExpressionNode * clobber = nullptr, LabelNode * gotolabels = nullptr ); 396 382 397 383 //############################################################################## -
src/Parser/TypeData.cc
r7b69174 raee7e35 10 10 // Created On : Sat May 16 15:12:51 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Sep 12 21:11:22201613 // Update Count : 37712 // Last Modified On : Sat Sep 24 11:14:26 2016 13 // Update Count : 415 14 14 // 15 15 … … 24 24 #include "SynTree/Statement.h" 25 25 #include "SynTree/Initializer.h" 26 27 TypeData::TypeData( Kind k ) : kind( k ), base( 0 ), forall( 0 ) { 26 using namespace std; 27 28 TypeData::TypeData( Kind k ) : kind( k ), base( nullptr ), forall( nullptr ) { 28 29 switch ( kind ) { 29 30 case Unknown: … … 37 38 case Array: 38 39 // array = new Array_t; 39 array.dimension = 0;40 array.dimension = nullptr; 40 41 array.isVarLen = false; 41 42 array.isStatic = false; … … 43 44 case Function: 44 45 // function = new Function_t; 45 function.params = 0;46 function.idList = 0;47 function.oldDeclList = 0;48 function.body = 0;46 function.params = nullptr; 47 function.idList = nullptr; 48 function.oldDeclList = nullptr; 49 function.body = nullptr; 49 50 function.hasBody = false; 50 51 function.newStyle = false; … … 52 53 case Aggregate: 53 54 // aggregate = new Aggregate_t; 54 aggregate.params = 0; 55 aggregate.actuals = 0; 56 aggregate.fields = 0; 55 aggregate.name = nullptr; 56 aggregate.params = nullptr; 57 aggregate.actuals = nullptr; 58 aggregate.fields = nullptr; 57 59 break; 58 60 case AggregateInst: 59 61 // aggInst = new AggInst_t; 60 aggInst.aggregate = 0;61 aggInst.params = 0;62 aggInst.aggregate = nullptr; 63 aggInst.params = nullptr; 62 64 break; 63 65 case Enum: 64 66 // enumeration = new Enumeration_t; 65 enumeration.constants = 0; 67 enumeration.name = nullptr; 68 enumeration.constants = nullptr; 66 69 break; 67 70 case Symbolic: 68 71 case SymbolicInst: 69 72 // symbolic = new Symbolic_t; 70 symbolic.params = 0; 71 symbolic.actuals = 0; 72 symbolic.assertions = 0; 73 break; 74 case Variable: 75 // variable = new Variable_t; 76 // variable.tyClass = DeclarationNode::Type; 77 // variable.assertions = 0; 73 symbolic.name = nullptr; 74 symbolic.params = nullptr; 75 symbolic.actuals = nullptr; 76 symbolic.assertions = nullptr; 78 77 break; 79 78 case Tuple: … … 84 83 // typeexpr = new Typeof_t; 85 84 typeexpr = nullptr; 86 break;87 case Attr:88 // attr = new Attr_t;89 // attr.expr = nullptr;90 // attr.type = nullptr;91 85 break; 92 86 case Builtin: … … 121 115 break; 122 116 case Aggregate: 117 delete aggregate.name; 123 118 delete aggregate.params; 124 119 delete aggregate.actuals; … … 132 127 break; 133 128 case Enum: 129 delete enumeration.name; 134 130 delete enumeration.constants; 135 131 // delete enumeration; … … 137 133 case Symbolic: 138 134 case SymbolicInst: 135 delete symbolic.name; 139 136 delete symbolic.params; 140 137 delete symbolic.actuals; … … 142 139 // delete symbolic; 143 140 break; 144 case Variable:145 // delete variable.assertions;146 // delete variable;147 break;148 141 case Tuple: 149 142 // delete tuple->members; … … 153 146 // delete typeexpr->expr; 154 147 delete typeexpr; 155 break;156 case Attr:157 // delete attr.expr;158 // delete attr.type;159 // delete attr;160 148 break; 161 149 case Builtin: … … 197 185 break; 198 186 case Aggregate: 187 newtype->aggregate.name = aggregate.name ? new string( *aggregate.name ) : nullptr; 199 188 newtype->aggregate.params = maybeClone( aggregate.params ); 200 189 newtype->aggregate.actuals = maybeClone( aggregate.actuals ); 201 190 newtype->aggregate.fields = maybeClone( aggregate.fields ); 202 newtype->aggregate.name = aggregate.name;203 191 newtype->aggregate.kind = aggregate.kind; 204 192 newtype->aggregate.body = aggregate.body; … … 209 197 break; 210 198 case Enum: 211 newtype->enumeration.name = enumeration.name ;199 newtype->enumeration.name = enumeration.name ? new string( *enumeration.name ) : nullptr; 212 200 newtype->enumeration.constants = maybeClone( enumeration.constants ); 213 201 break; 214 202 case Symbolic: 215 203 case SymbolicInst: 204 newtype->symbolic.name = symbolic.name ? new string( *symbolic.name ) : nullptr; 216 205 newtype->symbolic.params = maybeClone( symbolic.params ); 217 206 newtype->symbolic.actuals = maybeClone( symbolic.actuals ); 218 207 newtype->symbolic.assertions = maybeClone( symbolic.assertions ); 219 208 newtype->symbolic.isTypedef = symbolic.isTypedef; 220 newtype->symbolic.name = symbolic.name;221 break;222 case Variable:223 assert( false );224 // newtype->variable.assertions = maybeClone( variable.assertions );225 // newtype->variable.name = variable.name;226 // newtype->variable.tyClass = variable.tyClass;227 209 break; 228 210 case Tuple: … … 231 213 case Typeof: 232 214 newtype->typeexpr = maybeClone( typeexpr ); 233 break;234 case Attr:235 assert( false );236 // newtype->attr.expr = maybeClone( attr.expr );237 // newtype->attr.type = maybeClone( attr.type );238 215 break; 239 216 case Builtin: … … 245 222 } // TypeData::clone 246 223 247 void TypeData::print( std::ostream &os, int indent ) const { 248 using std::endl; 249 using std::string; 250 224 void TypeData::print( ostream &os, int indent ) const { 251 225 for ( int i = 0; i < DeclarationNode::NoQualifier; i += 1 ) { 252 226 if ( qualifiers[i] ) os << DeclarationNode::qualifierName[ i ] << ' '; … … 326 300 break; 327 301 case Aggregate: 328 os << DeclarationNode::aggregateName[ aggregate.kind ] << ' ' << aggregate.name << endl;302 os << DeclarationNode::aggregateName[ aggregate.kind ] << ' ' << *aggregate.name << endl; 329 303 if ( aggregate.params ) { 330 304 os << string( indent + 2, ' ' ) << "with type parameters " << endl; … … 363 337 break; 364 338 case SymbolicInst: 365 os << "instance of type " << symbolic.name;339 os << "instance of type " << *symbolic.name; 366 340 if ( symbolic.actuals ) { 367 341 os << " with parameters" << endl; … … 389 363 } // if 390 364 break; 391 case Variable:392 // os << DeclarationNode::typeClassName[ variable.tyClass ] << " variable ";393 // if ( variable.assertions ) {394 // os << endl << string( indent + 2, ' ' ) << "with assertions" << endl;395 // variable.assertions->printList( os, indent + 4 );396 // os << string( indent + 2, ' ' );397 // } // if398 break;399 365 case Tuple: 400 366 os << "tuple "; … … 410 376 } // if 411 377 break; 412 case Attr:413 // os << "attribute type decl " << attr.name << " applied to ";414 // if ( attr.expr ) {415 // attr.expr->print( os, indent + 2 );416 // } // if417 // if ( attr.type ) {418 // attr.type->print( os, indent + 2 );419 // } // if420 break;421 378 case Builtin: 422 379 os << "gcc builtin type"; … … 428 385 } // TypeData::print 429 386 430 void buildForall( const DeclarationNode * firstNode, std::list< TypeDecl* > &outputList ) {387 void buildForall( const DeclarationNode * firstNode, list< TypeDecl* > &outputList ) { 431 388 buildList( firstNode, outputList ); 432 for ( std::list< TypeDecl* >::iterator i = outputList.begin(); i != outputList.end(); ++i ) {389 for ( list< TypeDecl* >::iterator i = outputList.begin(); i != outputList.end(); ++i ) { 433 390 if ( (*i)->get_kind() == TypeDecl::Any ) { 434 391 // add assertion parameters to `type' tyvars in reverse order 435 392 // add dtor: void ^?{}(T *) 436 393 FunctionType * dtorType = new FunctionType( Type::Qualifiers(), false ); 437 dtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), 0) );438 (*i)->get_assertions().push_front( new FunctionDecl( "^?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, dtorType, 0, false, false ) );394 dtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), nullptr ) ); 395 (*i)->get_assertions().push_front( new FunctionDecl( "^?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, dtorType, nullptr, false, false ) ); 439 396 440 397 // add copy ctor: void ?{}(T *, T) 441 398 FunctionType * copyCtorType = new FunctionType( Type::Qualifiers(), false ); 442 copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), 0) );443 copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), 0) );444 (*i)->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, copyCtorType, 0, false, false ) );399 copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), nullptr ) ); 400 copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), nullptr ) ); 401 (*i)->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, copyCtorType, nullptr, false, false ) ); 445 402 446 403 // add default ctor: void ?{}(T *) 447 404 FunctionType * ctorType = new FunctionType( Type::Qualifiers(), false ); 448 ctorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), 0) );449 (*i)->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, ctorType, 0, false, false ) );405 ctorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), nullptr ) ); 406 (*i)->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, ctorType, nullptr, false, false ) ); 450 407 451 408 // add assignment operator: T * ?=?(T *, T) 452 409 FunctionType * assignType = new FunctionType( Type::Qualifiers(), false ); 453 assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), 0) );454 assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), 0) );455 assignType->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), 0) );456 (*i)->get_assertions().push_front( new FunctionDecl( "?=?", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, assignType, 0, false, false ) );410 assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), nullptr ) ); 411 assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), nullptr ) ); 412 assignType->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), nullptr ) ); 413 (*i)->get_assertions().push_front( new FunctionDecl( "?=?", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, assignType, nullptr, false, false ) ); 457 414 } // if 458 415 } // for … … 486 443 case TypeData::Builtin: 487 444 return new VarArgsType( buildQualifiers( td ) ); 488 case TypeData::Attr:489 assert( false );490 return buildAttr( td );491 445 case TypeData::Symbolic: 492 446 case TypeData::Enum: 493 447 case TypeData::Aggregate: 494 case TypeData::Variable:495 448 assert( false ); 496 449 } // switch 497 return 0;450 return nullptr; 498 451 } // typebuild 499 452 500 453 TypeData * typeextractAggregate( const TypeData * td, bool toplevel ) { 501 TypeData * ret = 0;454 TypeData * ret = nullptr; 502 455 503 456 switch ( td->kind ) { … … 549 502 case DeclarationNode::Bool: 550 503 if ( td->signedness != DeclarationNode::NoSignedness ) { 551 throw SemanticError( st d::string( "invalid type specifier " ) + DeclarationNode::signednessName[ td->signedness ] + " in type: ", td );504 throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::signednessName[ td->signedness ] + " in type: ", td ); 552 505 } // if 553 506 if ( td->length != DeclarationNode::NoLength ) { 554 throw SemanticError( st d::string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td );507 throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td ); 555 508 } // if 556 509 … … 565 518 566 519 if ( td->length != DeclarationNode::NoLength ) { 567 throw SemanticError( st d::string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td );520 throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td ); 568 521 } // if 569 522 … … 595 548 FloatingPoint: ; 596 549 if ( td->signedness != DeclarationNode::NoSignedness ) { 597 throw SemanticError( st d::string( "invalid type specifier " ) + DeclarationNode::signednessName[ td->signedness ] + " in type: ", td );550 throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::signednessName[ td->signedness ] + " in type: ", td ); 598 551 } // if 599 552 if ( td->length == DeclarationNode::Short || td->length == DeclarationNode::LongLong ) { 600 throw SemanticError( st d::string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td );553 throw SemanticError( string( "invalid type specifier " ) + DeclarationNode::lengthName[ td->length ] + " in type: ", td ); 601 554 } // if 602 555 if ( td->basictype == DeclarationNode::Float && td->length == DeclarationNode::Long ) { … … 655 608 switch ( td->aggregate.kind ) { 656 609 case DeclarationNode::Struct: 657 at = new StructDecl( td->aggregate.name );610 at = new StructDecl( *td->aggregate.name ); 658 611 buildForall( td->aggregate.params, at->get_parameters() ); 659 612 break; 660 613 case DeclarationNode::Union: 661 at = new UnionDecl( td->aggregate.name );614 at = new UnionDecl( *td->aggregate.name ); 662 615 buildForall( td->aggregate.params, at->get_parameters() ); 663 616 break; 664 617 case DeclarationNode::Trait: 665 at = new TraitDecl( td->aggregate.name );618 at = new TraitDecl( *td->aggregate.name ); 666 619 buildList( td->aggregate.params, at->get_parameters() ); 667 620 break; … … 681 634 ReferenceToType * ret; 682 635 if ( td->aggInst.aggregate->kind == TypeData::Enum ) { 683 ret = new EnumInstType( buildQualifiers( td ), td->aggInst.aggregate->enumeration.name );636 ret = new EnumInstType( buildQualifiers( td ), *td->aggInst.aggregate->enumeration.name ); 684 637 } else { 685 638 assert( td->aggInst.aggregate->kind == TypeData::Aggregate ); 686 639 switch ( td->aggInst.aggregate->aggregate.kind ) { 687 640 case DeclarationNode::Struct: 688 ret = new StructInstType( buildQualifiers( td ), td->aggInst.aggregate->aggregate.name ); 641 assert( td->aggInst.aggregate->aggregate.name ); 642 ret = new StructInstType( buildQualifiers( td ), *td->aggInst.aggregate->aggregate.name ); 689 643 break; 690 644 case DeclarationNode::Union: 691 ret = new UnionInstType( buildQualifiers( td ), td->aggInst.aggregate->aggregate.name );645 ret = new UnionInstType( buildQualifiers( td ), *td->aggInst.aggregate->aggregate.name ); 692 646 break; 693 647 case DeclarationNode::Trait: 694 ret = new TraitInstType( buildQualifiers( td ), td->aggInst.aggregate->aggregate.name );648 ret = new TraitInstType( buildQualifiers( td ), *td->aggInst.aggregate->aggregate.name ); 695 649 break; 696 650 default: … … 703 657 } // buildAggInst 704 658 705 NamedTypeDecl * buildSymbolic( const TypeData * td, const st d::string & name, DeclarationNode::StorageClass sc ) {659 NamedTypeDecl * buildSymbolic( const TypeData * td, const string & name, DeclarationNode::StorageClass sc ) { 706 660 assert( td->kind == TypeData::Symbolic ); 707 661 NamedTypeDecl * ret; … … 717 671 } // buildSymbolic 718 672 719 TypeDecl * buildVariable( const TypeData * td ) {720 assert( false );721 return nullptr;722 // assert( td->kind == TypeData::Variable );723 // static const TypeDecl::Kind kindMap[] = { TypeDecl::Any, TypeDecl::Ftype, TypeDecl::Dtype };724 725 // TypeDecl * ret = new TypeDecl( td->variable.name, DeclarationNode::NoStorageClass, 0, kindMap[ td->variable.tyClass ] );726 // buildList( td->variable.assertions, ret->get_assertions() );727 // return ret;728 } // buildSymbolic729 730 673 EnumDecl * buildEnum( const TypeData * td ) { 731 674 assert( td->kind == TypeData::Enum ); 732 EnumDecl * ret = new EnumDecl( td->enumeration.name );675 EnumDecl * ret = new EnumDecl( *td->enumeration.name ); 733 676 buildList( td->enumeration.constants, ret->get_members() ); 734 std::list< Declaration * >::iterator members = ret->get_members().begin();677 list< Declaration * >::iterator members = ret->get_members().begin(); 735 678 for ( const DeclarationNode * cur = td->enumeration. constants; cur != nullptr; cur = dynamic_cast< DeclarationNode * >( cur->get_next() ), ++members ) { 736 679 if ( cur->has_enumeratorValue() ) { 737 680 ObjectDecl * member = dynamic_cast< ObjectDecl * >(* members); 738 member->set_init( new SingleInit( maybeMoveBuild< Expression >( cur->consume_enumeratorValue() ), std::list< Expression * >() ) );681 member->set_init( new SingleInit( maybeMoveBuild< Expression >( cur->consume_enumeratorValue() ), list< Expression * >() ) ); 739 682 } // if 740 683 } // for … … 744 687 TypeInstType * buildSymbolicInst( const TypeData * td ) { 745 688 assert( td->kind == TypeData::SymbolicInst ); 746 TypeInstType * ret = new TypeInstType( buildQualifiers( td ), td->symbolic.name, false );689 TypeInstType * ret = new TypeInstType( buildQualifiers( td ), *td->symbolic.name, false ); 747 690 buildList( td->symbolic.actuals, ret->get_parameters() ); 748 691 buildForall( td->forall, ret->get_forall() ); … … 765 708 } // buildTypeof 766 709 767 AttrType * buildAttr( const TypeData * td ) { 768 assert( false ); 769 return nullptr; 770 // assert( td->kind == TypeData::Attr ); 771 // // assert( td->attr ); 772 // AttrType * ret; 773 // if ( td->attr.expr ) { 774 // ret = new AttrType( buildQualifiers( td ), td->attr.name, td->attr.expr->build() ); 775 // } else { 776 // assert( td->attr.type ); 777 // ret = new AttrType( buildQualifiers( td ), td->attr.name, td->attr.type->buildType() ); 778 // } // if 779 // return ret; 780 } // buildAttr 781 782 Declaration * buildDecl( const TypeData * td, std::string name, DeclarationNode::StorageClass sc, Expression * bitfieldWidth, bool isInline, bool isNoreturn, LinkageSpec::Spec linkage, Initializer * init ) { 710 Declaration * buildDecl( const TypeData * td, const string &name, DeclarationNode::StorageClass sc, Expression * bitfieldWidth, bool isInline, bool isNoreturn, LinkageSpec::Spec linkage, Initializer * init ) { 783 711 if ( td->kind == TypeData::Function ) { 784 712 FunctionDecl * decl; … … 790 718 decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), body, isInline, isNoreturn ); 791 719 } else { 792 // std::list< Label > ls;793 decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), new CompoundStmt( std::list< Label >() ), isInline, isNoreturn );720 // list< Label > ls; 721 decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), new CompoundStmt( list< Label >() ), isInline, isNoreturn ); 794 722 } // if 795 723 } else { 796 decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), 0, isInline, isNoreturn );797 } // if 798 for ( DeclarationNode * cur = td->function.idList; cur != 0; cur = dynamic_cast< DeclarationNode* >( cur->get_next() ) ) {799 if ( cur-> get_name() != "") {800 decl->get_oldIdents().insert( decl->get_oldIdents().end(), cur->get_name());724 decl = new FunctionDecl( name, sc, linkage, buildFunction( td ), nullptr, isInline, isNoreturn ); 725 } // if 726 for ( DeclarationNode * cur = td->function.idList; cur != nullptr; cur = dynamic_cast< DeclarationNode* >( cur->get_next() ) ) { 727 if ( cur->name ) { 728 decl->get_oldIdents().insert( decl->get_oldIdents().end(), *cur->name ); 801 729 } // if 802 730 } // for … … 809 737 } else if ( td->kind == TypeData::Symbolic ) { 810 738 return buildSymbolic( td, name, sc ); 811 } else if ( td->kind == TypeData::Variable ) {812 assert( false );813 return buildVariable( td );814 739 } else { 815 return new ObjectDecl( name, sc, linkage, bitfieldWidth, typebuild( td ), init, std::list< Attribute * >(), isInline, isNoreturn );740 return new ObjectDecl( name, sc, linkage, bitfieldWidth, typebuild( td ), init, list< Attribute * >(), isInline, isNoreturn ); 816 741 } // if 817 return 0;742 return nullptr; 818 743 } // buildDecl 819 744 … … 831 756 break; 832 757 default: 833 ft->get_returnVals().push_back( dynamic_cast< DeclarationWithType* >( buildDecl( td->base, "", DeclarationNode::NoStorageClass, 0, false, false, LinkageSpec::Cforall ) ) );758 ft->get_returnVals().push_back( dynamic_cast< DeclarationWithType* >( buildDecl( td->base, "", DeclarationNode::NoStorageClass, nullptr, false, false, LinkageSpec::Cforall ) ) ); 834 759 } // switch 835 760 } else { 836 ft->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), 0) );761 ft->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr ) ); 837 762 } // if 838 763 return ft; -
src/Parser/TypeData.h
r7b69174 raee7e35 10 10 // Created On : Sat May 16 15:18:36 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Sep 12 17:15:49201613 // Update Count : 1 2912 // Last Modified On : Sat Sep 24 11:10:38 2016 13 // Update Count : 141 14 14 // 15 15 … … 24 24 struct TypeData { 25 25 enum Kind { Unknown, Basic, Pointer, Array, Function, Aggregate, AggregateInst, 26 Enum, EnumConstant, Symbolic, SymbolicInst, Variable, Tuple, Typeof, Builtin, Attr};26 Enum, EnumConstant, Symbolic, SymbolicInst, Tuple, Typeof, Builtin }; 27 27 28 28 struct Aggregate_t { 29 29 DeclarationNode::Aggregate kind; 30 std::stringname;30 const std::string * name; 31 31 DeclarationNode * params; 32 ExpressionNode 32 ExpressionNode * actuals; // holds actual parameters later applied to AggInst 33 33 DeclarationNode * fields; 34 34 bool body; … … 47 47 48 48 struct Enumeration_t { 49 std::stringname;49 const std::string * name; 50 50 DeclarationNode * constants; 51 51 }; … … 61 61 62 62 struct Symbolic_t { 63 std::stringname;63 const std::string * name; 64 64 bool isTypedef; // false => TYPEGENname, true => TYPEDEFname 65 65 DeclarationNode * params; … … 88 88 DeclarationNode * tuple; 89 89 ExpressionNode * typeexpr; 90 // Attr_t attr;91 90 // DeclarationNode::BuiltinType builtin; 92 91 … … 111 110 TupleType * buildTuple( const TypeData * ); 112 111 TypeofType * buildTypeof( const TypeData * ); 113 AttrType * buildAttr( const TypeData * ); 114 Declaration * buildDecl( const TypeData *, std::string, DeclarationNode::StorageClass, Expression *, bool isInline, bool isNoreturn, LinkageSpec::Spec, Initializer * init = 0 ); 112 Declaration * buildDecl( const TypeData *, const std::string &, DeclarationNode::StorageClass, Expression *, bool isInline, bool isNoreturn, LinkageSpec::Spec, Initializer * init = nullptr ); 115 113 FunctionType * buildFunction( const TypeData * ); 116 114 -
src/Parser/parser.cc
r7b69174 raee7e35 82 82 #include "TypeData.h" 83 83 #include "LinkageSpec.h" 84 using namespace std; 84 85 85 86 extern DeclarationNode * parseTree; … … 87 88 extern TypedefTable typedefTable; 88 89 89 st d::stack< LinkageSpec::Spec > linkageStack;90 91 void appendStr( st d::string *to, std::string *from ) {90 stack< LinkageSpec::Spec > linkageStack; 91 92 void appendStr( string *to, string *from ) { 92 93 // "abc" "def" "ghi" => "abcdefghi", remove new text from quotes and insert before last quote in old string. 93 94 to->insert( to->length() - 1, from->substr( 1, from->length() - 2 ) ); … … 96 97 97 98 /* Line 268 of yacc.c */ 98 #line 99"Parser/parser.cc"99 #line 100 "Parser/parser.cc" 99 100 100 101 /* Enabling traces. */ … … 347 348 348 349 /* Line 293 of yacc.c */ 349 #line 11 5"parser.yy"350 #line 116 "parser.yy" 350 351 351 352 Token tok; … … 367 368 368 369 /* Line 293 of yacc.c */ 369 #line 37 0"Parser/parser.cc"370 #line 371 "Parser/parser.cc" 370 371 } YYSTYPE; 371 372 # define YYSTYPE_IS_TRIVIAL 1 … … 379 380 380 381 /* Line 343 of yacc.c */ 381 #line 38 2"Parser/parser.cc"382 #line 383 "Parser/parser.cc" 382 383 383 384 #ifdef short … … 1021 1022 static const yytype_uint16 yyrline[] = 1022 1023 { 1023 0, 30 0, 300, 304, 311, 312, 313, 317, 318, 319,1024 32 3, 324, 328, 329, 333, 334, 338, 342, 343, 354,1025 35 6, 358, 360, 365, 366, 372, 376, 378, 379, 381,1026 38 2, 384, 386, 388, 397, 398, 404, 405, 409, 410,1027 41 4, 418, 420, 422, 424, 429, 432, 434, 436, 441,1028 45 4, 456, 458, 460, 462, 464, 466, 468, 470, 472,1029 47 4, 481, 482, 488, 489, 490, 491, 495, 496, 498,1030 50 3, 504, 506, 508, 513, 514, 516, 521, 522, 524,1031 5 29, 530, 532, 534, 536, 541, 542, 544, 549, 550,1032 55 5, 556, 561, 562, 567, 568, 573, 574, 579, 580,1033 58 3, 585, 590, 595, 596, 598, 604, 605, 609, 610,1034 61 1, 612, 613, 614, 615, 616, 617, 618, 619, 620,1035 62 6, 628, 630, 632, 637, 638, 643, 644, 650, 651,1036 65 7, 658, 659, 660, 661, 662, 663, 664, 665, 675,1037 68 2, 684, 694, 695, 700, 702, 708, 710, 714, 715,1038 72 0, 725, 728, 730, 732, 742, 744, 755, 756, 758,1039 76 2, 764, 768, 769, 774, 775, 779, 784, 785, 789,1040 79 1, 797, 798, 802, 804, 806, 808, 814, 815, 819,1041 82 1, 826, 828, 830, 835, 837, 842, 844, 848, 851,1042 85 5, 858, 862, 864, 866, 868, 873, 875, 877, 882,1043 88 4, 886, 888, 890, 895, 897, 899, 901, 906, 918,1044 9 19, 924, 926, 931, 935, 937, 939, 941, 943, 949,1045 95 0, 956, 957, 961, 962, 967, 969, 975, 976, 978,1046 98 3, 988, 998, 1000, 1004, 1005, 1010, 1012, 1016, 1017,1047 102 1, 1023, 1027, 1028, 1032, 1033, 1037, 1038, 1053, 1054,1048 105 5, 1056, 1057, 1061, 1066, 1073, 1083, 1088, 1093, 1101,1049 110 6, 1111, 1116, 1121, 1129, 1151, 1156, 1163, 1165, 1172,1050 117 7, 1182, 1193, 1198, 1203, 1208, 1213, 1222, 1227, 1235,1051 123 6, 1237, 1238, 1244, 1249, 1257, 1258, 1259, 1260, 1264,1052 126 5, 1266, 1267, 1272, 1273, 1282, 1283, 1288, 1289, 1294,1053 129 6, 1298, 1300, 1302, 1305, 1304, 1316, 1317, 1319, 1329,1054 133 0, 1335, 1337, 1339, 1341, 1343, 1346, 1348, 1351, 1356,1055 135 8, 1360, 1362, 1364, 1366, 1368, 1370, 1372, 1374, 1376,1056 137 8, 1380, 1386, 1387, 1389, 1391, 1393, 1398, 1399, 1405,1057 140 6, 1408, 1410, 1415, 1417, 1419, 1421, 1426, 1427, 1429,1058 143 1, 1436, 1437, 1439, 1444, 1445, 1447, 1449, 1454, 1456,1059 145 8, 1463, 1464, 1468, 1470, 1476, 1475, 1479, 1481, 1486,1060 148 8, 1494, 1495, 1500, 1501, 1503, 1504, 1513, 1514, 1516,1061 151 8, 1523, 1525, 1531, 1532, 1534, 1537, 1540, 1545, 1546,1062 155 1, 1556, 1560, 1562, 1568, 1567, 1574, 1576, 1582, 1583,1063 159 1, 1592, 1596, 1597, 1598, 1600, 1602, 1609, 1610, 1612,1064 161 4, 1619, 1620, 1626, 1627, 1631, 1632, 1637, 1638, 1639,1065 164 1, 1649, 1650, 1652, 1655, 1657, 1661, 1662, 1663, 1665,1066 166 7, 1671, 1676, 1684, 1685, 1694, 1696, 1701, 1702, 1703,1067 170 7, 1708, 1709, 1713, 1714, 1715, 1719, 1720, 1721, 1726,1068 172 7, 1728, 1729, 1735, 1736, 1738, 1743, 1744, 1749, 1750,1069 175 1, 1752, 1753, 1768, 1769, 1774, 1775, 1781, 1783, 1786,1070 178 8, 1790, 1813, 1814, 1816, 1818, 1823, 1824, 1826, 1831,1071 183 6, 1837, 1843, 1842, 1846, 1850, 1852, 1854, 1860, 1861,1072 186 6, 1871, 1873, 1878, 1880, 1881, 1883, 1888, 1890, 1892,1073 189 7, 1899, 1904, 1909, 1917, 1923, 1922, 1936, 1937, 1942,1074 194 3, 1947, 1952, 1957, 1965, 1970, 1981, 1982, 1987, 1988,1075 199 4, 1995, 1999, 2000, 2001, 2004, 2003, 2014, 2023, 2029,1076 203 5, 2044, 2050, 2056, 2062, 2068, 2076, 2082, 2090, 2096,1077 210 5, 2106, 2107, 2111, 2115, 2117, 2122, 2123, 2127, 2128,1078 213 3, 2139, 2140, 2143, 2145, 2146, 2150, 2151, 2152, 2153,1079 218 7, 2189, 2190, 2192, 2197, 2202, 2207, 2209, 2211, 2216,1080 221 8, 2220, 2222, 2227, 2229, 2238, 2240, 2241, 2246, 2248,1081 225 0, 2255, 2257, 2259, 2264, 2266, 2268, 2277, 2278, 2279,1082 228 3, 2285, 2287, 2292, 2294, 2296, 2301, 2303, 2305, 2320,1083 232 2, 2323, 2325, 2330, 2331, 2336, 2338, 2340, 2345, 2347,1084 23 49, 2351, 2356, 2358, 2360, 2370, 2372, 2373, 2375, 2380,1085 238 2, 2384, 2389, 2391, 2393, 2395, 2400, 2402, 2404, 2435,1086 243 7, 2438, 2440, 2445, 2450, 2458, 2460, 2462, 2467, 2469,1087 247 4, 2476, 2490, 2491, 2493, 2498, 2500, 2502, 2504, 2506,1088 251 1, 2512, 2514, 2516, 2521, 2523, 2525, 2531, 2533, 2535,1089 25 39, 2541, 2543, 2545, 2559, 2560, 2562, 2567, 2569, 2571,1090 257 3, 2575, 2580, 2581, 2583, 2585, 2590, 2592, 2594, 2600,1091 260 1, 2603, 2612, 2615, 2617, 2620, 2622, 2624, 2637, 2638,1092 264 0, 2645, 2647, 2649, 2651, 2653, 2658, 2659, 2661, 2663,1093 266 8, 2670, 2678, 2679, 2680, 2685, 2686, 2690, 2692, 2694,1094 269 6, 2698, 2700, 2707, 2709, 2711, 2713, 2715, 2717, 2719,1095 272 1, 2723, 2725, 2730, 2732, 2734, 2739, 2765, 2766, 2768,1096 277 2, 2773, 2777, 2779, 2781, 2783, 2785, 2787, 2794, 2796,1097 279 8, 2800, 2802, 2804, 2809, 2814, 2816, 2818, 2836, 2838,1098 284 3, 28441024 0, 301, 301, 305, 312, 313, 314, 318, 319, 320, 1025 324, 325, 329, 330, 334, 335, 339, 343, 344, 355, 1026 357, 359, 361, 366, 367, 373, 377, 379, 380, 382, 1027 383, 385, 387, 389, 398, 399, 405, 406, 410, 411, 1028 415, 419, 421, 423, 425, 430, 433, 435, 437, 442, 1029 455, 457, 459, 461, 463, 465, 467, 469, 471, 473, 1030 475, 482, 483, 489, 490, 491, 492, 496, 497, 499, 1031 504, 505, 507, 509, 514, 515, 517, 522, 523, 525, 1032 530, 531, 533, 535, 537, 542, 543, 545, 550, 551, 1033 556, 557, 562, 563, 568, 569, 574, 575, 580, 581, 1034 584, 586, 591, 596, 597, 599, 605, 606, 610, 611, 1035 612, 613, 614, 615, 616, 617, 618, 619, 620, 621, 1036 627, 629, 631, 633, 638, 639, 644, 645, 651, 652, 1037 658, 659, 660, 661, 662, 663, 664, 665, 666, 676, 1038 683, 685, 695, 696, 701, 703, 709, 711, 715, 716, 1039 721, 726, 729, 731, 733, 743, 745, 756, 757, 759, 1040 763, 765, 769, 770, 775, 776, 780, 785, 786, 790, 1041 792, 798, 799, 803, 805, 807, 809, 815, 816, 820, 1042 822, 827, 829, 831, 836, 838, 843, 845, 849, 852, 1043 856, 859, 863, 865, 867, 869, 874, 876, 878, 883, 1044 885, 887, 889, 891, 896, 898, 900, 902, 907, 919, 1045 920, 925, 927, 932, 936, 938, 940, 942, 944, 950, 1046 951, 957, 958, 962, 963, 968, 970, 976, 977, 979, 1047 984, 989, 999, 1001, 1005, 1006, 1011, 1013, 1017, 1018, 1048 1022, 1024, 1028, 1029, 1033, 1034, 1038, 1039, 1054, 1055, 1049 1056, 1057, 1058, 1062, 1067, 1074, 1084, 1089, 1094, 1102, 1050 1107, 1112, 1117, 1122, 1130, 1152, 1157, 1164, 1166, 1173, 1051 1178, 1183, 1194, 1199, 1204, 1209, 1214, 1223, 1228, 1236, 1052 1237, 1238, 1239, 1245, 1250, 1258, 1259, 1260, 1261, 1265, 1053 1266, 1267, 1268, 1273, 1274, 1283, 1284, 1289, 1290, 1295, 1054 1297, 1299, 1301, 1303, 1306, 1305, 1317, 1318, 1320, 1330, 1055 1331, 1336, 1338, 1340, 1342, 1344, 1347, 1349, 1352, 1357, 1056 1359, 1361, 1363, 1365, 1367, 1369, 1371, 1373, 1375, 1377, 1057 1379, 1381, 1387, 1388, 1390, 1392, 1394, 1399, 1400, 1406, 1058 1407, 1409, 1411, 1416, 1418, 1420, 1422, 1427, 1428, 1430, 1059 1432, 1437, 1438, 1440, 1445, 1446, 1448, 1450, 1455, 1457, 1060 1459, 1464, 1465, 1469, 1471, 1477, 1476, 1480, 1482, 1487, 1061 1489, 1495, 1496, 1501, 1502, 1504, 1505, 1514, 1515, 1517, 1062 1519, 1524, 1526, 1532, 1533, 1535, 1538, 1541, 1546, 1547, 1063 1552, 1557, 1561, 1563, 1569, 1568, 1575, 1577, 1583, 1584, 1064 1592, 1593, 1597, 1598, 1599, 1601, 1603, 1610, 1611, 1613, 1065 1615, 1620, 1621, 1627, 1628, 1632, 1633, 1638, 1639, 1640, 1066 1642, 1650, 1651, 1653, 1656, 1658, 1662, 1663, 1664, 1666, 1067 1668, 1672, 1677, 1685, 1686, 1695, 1697, 1702, 1703, 1704, 1068 1708, 1709, 1710, 1714, 1715, 1716, 1720, 1721, 1722, 1727, 1069 1728, 1729, 1730, 1736, 1737, 1739, 1744, 1745, 1750, 1751, 1070 1752, 1753, 1754, 1769, 1770, 1775, 1776, 1782, 1784, 1787, 1071 1789, 1791, 1814, 1815, 1817, 1819, 1824, 1825, 1827, 1832, 1072 1837, 1838, 1844, 1843, 1847, 1851, 1853, 1855, 1861, 1862, 1073 1867, 1872, 1874, 1879, 1881, 1882, 1884, 1889, 1891, 1893, 1074 1898, 1900, 1905, 1910, 1918, 1924, 1923, 1937, 1938, 1943, 1075 1944, 1948, 1953, 1958, 1966, 1971, 1982, 1983, 1988, 1989, 1076 1995, 1996, 2000, 2001, 2002, 2005, 2004, 2015, 2024, 2030, 1077 2036, 2045, 2051, 2057, 2063, 2069, 2077, 2083, 2091, 2097, 1078 2106, 2107, 2108, 2112, 2116, 2118, 2123, 2124, 2128, 2129, 1079 2134, 2140, 2141, 2144, 2146, 2147, 2151, 2152, 2153, 2154, 1080 2188, 2190, 2191, 2193, 2198, 2203, 2208, 2210, 2212, 2217, 1081 2219, 2221, 2223, 2228, 2230, 2239, 2241, 2242, 2247, 2249, 1082 2251, 2256, 2258, 2260, 2265, 2267, 2269, 2278, 2279, 2280, 1083 2284, 2286, 2288, 2293, 2295, 2297, 2302, 2304, 2306, 2321, 1084 2323, 2324, 2326, 2331, 2332, 2337, 2339, 2341, 2346, 2348, 1085 2350, 2352, 2357, 2359, 2361, 2371, 2373, 2374, 2376, 2381, 1086 2383, 2385, 2390, 2392, 2394, 2396, 2401, 2403, 2405, 2436, 1087 2438, 2439, 2441, 2446, 2451, 2459, 2461, 2463, 2468, 2470, 1088 2475, 2477, 2491, 2492, 2494, 2499, 2501, 2503, 2505, 2507, 1089 2512, 2513, 2515, 2517, 2522, 2524, 2526, 2532, 2534, 2536, 1090 2540, 2542, 2544, 2546, 2560, 2561, 2563, 2568, 2570, 2572, 1091 2574, 2576, 2581, 2582, 2584, 2586, 2591, 2593, 2595, 2601, 1092 2602, 2604, 2613, 2616, 2618, 2621, 2623, 2625, 2638, 2639, 1093 2641, 2646, 2648, 2650, 2652, 2654, 2659, 2660, 2662, 2664, 1094 2669, 2671, 2679, 2680, 2681, 2686, 2687, 2691, 2693, 2695, 1095 2697, 2699, 2701, 2708, 2710, 2712, 2714, 2716, 2718, 2720, 1096 2722, 2724, 2726, 2731, 2733, 2735, 2740, 2766, 2767, 2769, 1097 2773, 2774, 2778, 2780, 2782, 2784, 2786, 2788, 2795, 2797, 1098 2799, 2801, 2803, 2805, 2810, 2815, 2817, 2819, 2837, 2839, 1099 2844, 2845 1099 1100 }; 1100 1101 #endif … … 4971 4972 4972 4973 /* Line 1806 of yacc.c */ 4973 #line 30 0"parser.yy"4974 #line 301 "parser.yy" 4974 4975 { typedefTable.enterScope(); } 4975 4976 break; … … 4978 4979 4979 4980 /* Line 1806 of yacc.c */ 4980 #line 30 4"parser.yy"4981 #line 305 "parser.yy" 4981 4982 { typedefTable.leaveScope(); } 4982 4983 break; … … 4985 4986 4986 4987 /* Line 1806 of yacc.c */ 4987 #line 31 1"parser.yy"4988 #line 312 "parser.yy" 4988 4989 { (yyval.en) = new ExpressionNode( build_constantInteger( *(yyvsp[(1) - (1)].tok) ) ); } 4989 4990 break; … … 4992 4993 4993 4994 /* Line 1806 of yacc.c */ 4994 #line 31 2"parser.yy"4995 #line 313 "parser.yy" 4995 4996 { (yyval.en) = new ExpressionNode( build_constantFloat( *(yyvsp[(1) - (1)].tok) ) ); } 4996 4997 break; … … 4999 5000 5000 5001 /* Line 1806 of yacc.c */ 5001 #line 31 3"parser.yy"5002 #line 314 "parser.yy" 5002 5003 { (yyval.en) = new ExpressionNode( build_constantChar( *(yyvsp[(1) - (1)].tok) ) ); } 5003 5004 break; … … 5006 5007 5007 5008 /* Line 1806 of yacc.c */ 5008 #line 33 8"parser.yy"5009 #line 339 "parser.yy" 5009 5010 { (yyval.constant) = build_constantStr( *(yyvsp[(1) - (1)].str) ); } 5010 5011 break; … … 5013 5014 5014 5015 /* Line 1806 of yacc.c */ 5015 #line 34 2"parser.yy"5016 #line 343 "parser.yy" 5016 5017 { (yyval.str) = (yyvsp[(1) - (1)].tok); } 5017 5018 break; … … 5020 5021 5021 5022 /* Line 1806 of yacc.c */ 5022 #line 34 4"parser.yy"5023 #line 345 "parser.yy" 5023 5024 { 5024 5025 appendStr( (yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].tok) ); // append 2nd juxtaposed string to 1st … … 5031 5032 5032 5033 /* Line 1806 of yacc.c */ 5033 #line 35 5"parser.yy"5034 #line 356 "parser.yy" 5034 5035 { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(1) - (1)].tok) ) ); } 5035 5036 break; … … 5038 5039 5039 5040 /* Line 1806 of yacc.c */ 5040 #line 35 7"parser.yy"5041 #line 358 "parser.yy" 5041 5042 { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(1) - (1)].tok) ) ); } 5042 5043 break; … … 5045 5046 5046 5047 /* Line 1806 of yacc.c */ 5047 #line 3 59"parser.yy"5048 #line 360 "parser.yy" 5048 5049 { (yyval.en) = (yyvsp[(2) - (3)].en); } 5049 5050 break; … … 5052 5053 5053 5054 /* Line 1806 of yacc.c */ 5054 #line 36 1"parser.yy"5055 #line 362 "parser.yy" 5055 5056 { (yyval.en) = new ExpressionNode( build_valexpr( (yyvsp[(2) - (3)].sn) ) ); } 5056 5057 break; … … 5059 5060 5060 5061 /* Line 1806 of yacc.c */ 5061 #line 37 1"parser.yy"5062 #line 372 "parser.yy" 5062 5063 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Index, (yyvsp[(1) - (6)].en), (yyvsp[(4) - (6)].en) ) ); } 5063 5064 break; … … 5066 5067 5067 5068 /* Line 1806 of yacc.c */ 5068 #line 37 3"parser.yy"5069 #line 374 "parser.yy" 5069 5070 { (yyval.en) = new ExpressionNode( build_func( (yyvsp[(1) - (4)].en), (yyvsp[(3) - (4)].en) ) ); } 5070 5071 break; … … 5073 5074 5074 5075 /* Line 1806 of yacc.c */ 5075 #line 37 7"parser.yy"5076 #line 378 "parser.yy" 5076 5077 { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(1) - (3)].en), build_varref( (yyvsp[(3) - (3)].tok) ) ) ); } 5077 5078 break; … … 5080 5081 5081 5082 /* Line 1806 of yacc.c */ 5082 #line 38 0"parser.yy"5083 #line 381 "parser.yy" 5083 5084 { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(1) - (3)].en), build_varref( (yyvsp[(3) - (3)].tok) ) ) ); } 5084 5085 break; … … 5087 5088 5088 5089 /* Line 1806 of yacc.c */ 5089 #line 38 3"parser.yy"5090 #line 384 "parser.yy" 5090 5091 { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::IncrPost, (yyvsp[(1) - (2)].en) ) ); } 5091 5092 break; … … 5094 5095 5095 5096 /* Line 1806 of yacc.c */ 5096 #line 38 5"parser.yy"5097 #line 386 "parser.yy" 5097 5098 { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::DecrPost, (yyvsp[(1) - (2)].en) ) ); } 5098 5099 break; … … 5101 5102 5102 5103 /* Line 1806 of yacc.c */ 5103 #line 38 7"parser.yy"5104 #line 388 "parser.yy" 5104 5105 { (yyval.en) = new ExpressionNode( build_compoundLiteral( (yyvsp[(2) - (7)].decl), new InitializerNode( (yyvsp[(5) - (7)].in), true ) ) ); } 5105 5106 break; … … 5108 5109 5109 5110 /* Line 1806 of yacc.c */ 5110 #line 3 89"parser.yy"5111 #line 390 "parser.yy" 5111 5112 { 5112 5113 Token fn; 5113 fn.str = new std::string( "?{}" ); 5114 fn.str = new std::string( "?{}" ); // location undefined - use location of '{'? 5114 5115 (yyval.en) = new ExpressionNode( new ConstructorExpr( build_func( new ExpressionNode( build_varref( fn ) ), (ExpressionNode *)( (yyvsp[(1) - (4)].en) )->set_last( (yyvsp[(3) - (4)].en) ) ) ) ); 5115 5116 } … … 5119 5120 5120 5121 /* Line 1806 of yacc.c */ 5121 #line 399"parser.yy"5122 #line 400 "parser.yy" 5122 5123 { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) )); } 5123 5124 break; … … 5126 5127 5127 5128 /* Line 1806 of yacc.c */ 5128 #line 40 4"parser.yy"5129 #line 405 "parser.yy" 5129 5130 { (yyval.en) = 0; } 5130 5131 break; … … 5133 5134 5134 5135 /* Line 1806 of yacc.c */ 5135 #line 41 0"parser.yy"5136 #line 411 "parser.yy" 5136 5137 { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) ); } 5137 5138 break; … … 5140 5141 5141 5142 /* Line 1806 of yacc.c */ 5142 #line 41 5"parser.yy"5143 #line 416 "parser.yy" 5143 5144 { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(1) - (1)].tok) ) ); } 5144 5145 break; … … 5147 5148 5148 5149 /* Line 1806 of yacc.c */ 5149 #line 4 19"parser.yy"5150 #line 420 "parser.yy" 5150 5151 { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(3) - (3)].en), build_varref( (yyvsp[(1) - (3)].tok) ) ) ); } 5151 5152 break; … … 5154 5155 5155 5156 /* Line 1806 of yacc.c */ 5156 #line 42 1"parser.yy"5157 #line 422 "parser.yy" 5157 5158 { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(5) - (7)].en), build_varref( (yyvsp[(1) - (7)].tok) ) ) ); } 5158 5159 break; … … 5161 5162 5162 5163 /* Line 1806 of yacc.c */ 5163 #line 42 3"parser.yy"5164 #line 424 "parser.yy" 5164 5165 { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(3) - (3)].en), build_varref( (yyvsp[(1) - (3)].tok) ) ) ); } 5165 5166 break; … … 5168 5169 5169 5170 /* Line 1806 of yacc.c */ 5170 #line 42 5"parser.yy"5171 #line 426 "parser.yy" 5171 5172 { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(5) - (7)].en), build_varref( (yyvsp[(1) - (7)].tok) ) ) ); } 5172 5173 break; … … 5175 5176 5176 5177 /* Line 1806 of yacc.c */ 5177 #line 43 3"parser.yy"5178 #line 434 "parser.yy" 5178 5179 { (yyval.en) = (yyvsp[(1) - (1)].en); } 5179 5180 break; … … 5182 5183 5183 5184 /* Line 1806 of yacc.c */ 5184 #line 43 5"parser.yy"5185 #line 436 "parser.yy" 5185 5186 { (yyval.en) = new ExpressionNode( (yyvsp[(1) - (1)].constant) ); } 5186 5187 break; … … 5189 5190 5190 5191 /* Line 1806 of yacc.c */ 5191 #line 43 7"parser.yy"5192 #line 438 "parser.yy" 5192 5193 { (yyval.en) = (yyvsp[(2) - (2)].en)->set_extension( true ); } 5193 5194 break; … … 5196 5197 5197 5198 /* Line 1806 of yacc.c */ 5198 #line 44 2"parser.yy"5199 #line 443 "parser.yy" 5199 5200 { 5200 5201 switch ( (yyvsp[(1) - (2)].op) ) { … … 5214 5215 5215 5216 /* Line 1806 of yacc.c */ 5216 #line 45 5"parser.yy"5217 #line 456 "parser.yy" 5217 5218 { (yyval.en) = new ExpressionNode( build_unary_val( (yyvsp[(1) - (2)].op), (yyvsp[(2) - (2)].en) ) ); } 5218 5219 break; … … 5221 5222 5222 5223 /* Line 1806 of yacc.c */ 5223 #line 45 7"parser.yy"5224 #line 458 "parser.yy" 5224 5225 { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::Incr, (yyvsp[(2) - (2)].en) ) ); } 5225 5226 break; … … 5228 5229 5229 5230 /* Line 1806 of yacc.c */ 5230 #line 4 59"parser.yy"5231 #line 460 "parser.yy" 5231 5232 { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::Decr, (yyvsp[(2) - (2)].en) ) ); } 5232 5233 break; … … 5235 5236 5236 5237 /* Line 1806 of yacc.c */ 5237 #line 46 1"parser.yy"5238 #line 462 "parser.yy" 5238 5239 { (yyval.en) = new ExpressionNode( build_sizeOfexpr( (yyvsp[(2) - (2)].en) ) ); } 5239 5240 break; … … 5242 5243 5243 5244 /* Line 1806 of yacc.c */ 5244 #line 46 3"parser.yy"5245 #line 464 "parser.yy" 5245 5246 { (yyval.en) = new ExpressionNode( build_sizeOftype( (yyvsp[(3) - (4)].decl) ) ); } 5246 5247 break; … … 5249 5250 5250 5251 /* Line 1806 of yacc.c */ 5251 #line 46 5"parser.yy"5252 #line 466 "parser.yy" 5252 5253 { (yyval.en) = new ExpressionNode( build_alignOfexpr( (yyvsp[(2) - (2)].en) ) ); } 5253 5254 break; … … 5256 5257 5257 5258 /* Line 1806 of yacc.c */ 5258 #line 46 7"parser.yy"5259 #line 468 "parser.yy" 5259 5260 { (yyval.en) = new ExpressionNode( build_alignOftype( (yyvsp[(3) - (4)].decl) ) ); } 5260 5261 break; … … 5263 5264 5264 5265 /* Line 1806 of yacc.c */ 5265 #line 4 69"parser.yy"5266 #line 470 "parser.yy" 5266 5267 { (yyval.en) = new ExpressionNode( build_offsetOf( (yyvsp[(3) - (6)].decl), build_varref( (yyvsp[(5) - (6)].tok) ) ) ); } 5267 5268 break; … … 5270 5271 5271 5272 /* Line 1806 of yacc.c */ 5272 #line 47 1"parser.yy"5273 #line 472 "parser.yy" 5273 5274 { (yyval.en) = new ExpressionNode( build_attrexpr( build_varref( (yyvsp[(1) - (1)].tok) ), nullptr ) ); } 5274 5275 break; … … 5277 5278 5278 5279 /* Line 1806 of yacc.c */ 5279 #line 47 3"parser.yy"5280 #line 474 "parser.yy" 5280 5281 { (yyval.en) = new ExpressionNode( build_attrexpr( build_varref( (yyvsp[(1) - (4)].tok) ), (yyvsp[(3) - (4)].en) ) ); } 5281 5282 break; … … 5284 5285 5285 5286 /* Line 1806 of yacc.c */ 5286 #line 47 5"parser.yy"5287 #line 476 "parser.yy" 5287 5288 { (yyval.en) = new ExpressionNode( build_attrtype( build_varref( (yyvsp[(1) - (4)].tok) ), (yyvsp[(3) - (4)].decl) ) ); } 5288 5289 break; … … 5291 5292 5292 5293 /* Line 1806 of yacc.c */ 5293 #line 48 1"parser.yy"5294 #line 482 "parser.yy" 5294 5295 { (yyval.op) = OperKinds::PointTo; } 5295 5296 break; … … 5298 5299 5299 5300 /* Line 1806 of yacc.c */ 5300 #line 48 2"parser.yy"5301 #line 483 "parser.yy" 5301 5302 { (yyval.op) = OperKinds::AddressOf; } 5302 5303 break; … … 5305 5306 5306 5307 /* Line 1806 of yacc.c */ 5307 #line 48 8"parser.yy"5308 #line 489 "parser.yy" 5308 5309 { (yyval.op) = OperKinds::UnPlus; } 5309 5310 break; … … 5312 5313 5313 5314 /* Line 1806 of yacc.c */ 5314 #line 4 89"parser.yy"5315 #line 490 "parser.yy" 5315 5316 { (yyval.op) = OperKinds::UnMinus; } 5316 5317 break; … … 5319 5320 5320 5321 /* Line 1806 of yacc.c */ 5321 #line 49 0"parser.yy"5322 #line 491 "parser.yy" 5322 5323 { (yyval.op) = OperKinds::Neg; } 5323 5324 break; … … 5326 5327 5327 5328 /* Line 1806 of yacc.c */ 5328 #line 49 1"parser.yy"5329 #line 492 "parser.yy" 5329 5330 { (yyval.op) = OperKinds::BitNeg; } 5330 5331 break; … … 5333 5334 5334 5335 /* Line 1806 of yacc.c */ 5335 #line 49 7"parser.yy"5336 #line 498 "parser.yy" 5336 5337 { (yyval.en) = new ExpressionNode( build_cast( (yyvsp[(2) - (4)].decl), (yyvsp[(4) - (4)].en) ) ); } 5337 5338 break; … … 5340 5341 5341 5342 /* Line 1806 of yacc.c */ 5342 #line 499"parser.yy"5343 #line 500 "parser.yy" 5343 5344 { (yyval.en) = new ExpressionNode( build_cast( (yyvsp[(2) - (4)].decl), (yyvsp[(4) - (4)].en) ) ); } 5344 5345 break; … … 5347 5348 5348 5349 /* Line 1806 of yacc.c */ 5349 #line 50 5"parser.yy"5350 #line 506 "parser.yy" 5350 5351 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Mul, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5351 5352 break; … … 5354 5355 5355 5356 /* Line 1806 of yacc.c */ 5356 #line 50 7"parser.yy"5357 #line 508 "parser.yy" 5357 5358 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Div, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5358 5359 break; … … 5361 5362 5362 5363 /* Line 1806 of yacc.c */ 5363 #line 5 09"parser.yy"5364 #line 510 "parser.yy" 5364 5365 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Mod, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5365 5366 break; … … 5368 5369 5369 5370 /* Line 1806 of yacc.c */ 5370 #line 51 5"parser.yy"5371 #line 516 "parser.yy" 5371 5372 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Plus, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5372 5373 break; … … 5375 5376 5376 5377 /* Line 1806 of yacc.c */ 5377 #line 51 7"parser.yy"5378 #line 518 "parser.yy" 5378 5379 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Minus, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5379 5380 break; … … 5382 5383 5383 5384 /* Line 1806 of yacc.c */ 5384 #line 52 3"parser.yy"5385 #line 524 "parser.yy" 5385 5386 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::LShift, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5386 5387 break; … … 5389 5390 5390 5391 /* Line 1806 of yacc.c */ 5391 #line 52 5"parser.yy"5392 #line 526 "parser.yy" 5392 5393 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::RShift, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5393 5394 break; … … 5396 5397 5397 5398 /* Line 1806 of yacc.c */ 5398 #line 53 1"parser.yy"5399 #line 532 "parser.yy" 5399 5400 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::LThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5400 5401 break; … … 5403 5404 5404 5405 /* Line 1806 of yacc.c */ 5405 #line 53 3"parser.yy"5406 #line 534 "parser.yy" 5406 5407 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::GThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5407 5408 break; … … 5410 5411 5411 5412 /* Line 1806 of yacc.c */ 5412 #line 53 5"parser.yy"5413 #line 536 "parser.yy" 5413 5414 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::LEThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5414 5415 break; … … 5417 5418 5418 5419 /* Line 1806 of yacc.c */ 5419 #line 53 7"parser.yy"5420 #line 538 "parser.yy" 5420 5421 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::GEThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5421 5422 break; … … 5424 5425 5425 5426 /* Line 1806 of yacc.c */ 5426 #line 54 3"parser.yy"5427 #line 544 "parser.yy" 5427 5428 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Eq, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5428 5429 break; … … 5431 5432 5432 5433 /* Line 1806 of yacc.c */ 5433 #line 54 5"parser.yy"5434 #line 546 "parser.yy" 5434 5435 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Neq, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5435 5436 break; … … 5438 5439 5439 5440 /* Line 1806 of yacc.c */ 5440 #line 55 1"parser.yy"5441 #line 552 "parser.yy" 5441 5442 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::BitAnd, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5442 5443 break; … … 5445 5446 5446 5447 /* Line 1806 of yacc.c */ 5447 #line 55 7"parser.yy"5448 #line 558 "parser.yy" 5448 5449 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Xor, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5449 5450 break; … … 5452 5453 5453 5454 /* Line 1806 of yacc.c */ 5454 #line 56 3"parser.yy"5455 #line 564 "parser.yy" 5455 5456 { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::BitOr, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5456 5457 break; … … 5459 5460 5460 5461 /* Line 1806 of yacc.c */ 5461 #line 5 69"parser.yy"5462 #line 570 "parser.yy" 5462 5463 { (yyval.en) = new ExpressionNode( build_and_or( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en), true ) ); } 5463 5464 break; … … 5466 5467 5467 5468 /* Line 1806 of yacc.c */ 5468 #line 57 5"parser.yy"5469 #line 576 "parser.yy" 5469 5470 { (yyval.en) = new ExpressionNode( build_and_or( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en), false ) ); } 5470 5471 break; … … 5473 5474 5474 5475 /* Line 1806 of yacc.c */ 5475 #line 58 1"parser.yy"5476 #line 582 "parser.yy" 5476 5477 { (yyval.en) = new ExpressionNode( build_cond( (yyvsp[(1) - (5)].en), (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].en) ) ); } 5477 5478 break; … … 5480 5481 5481 5482 /* Line 1806 of yacc.c */ 5482 #line 58 4"parser.yy"5483 #line 585 "parser.yy" 5483 5484 { (yyval.en) = new ExpressionNode( build_cond( (yyvsp[(1) - (4)].en), (yyvsp[(1) - (4)].en), (yyvsp[(4) - (4)].en) ) ); } 5484 5485 break; … … 5487 5488 5488 5489 /* Line 1806 of yacc.c */ 5489 #line 58 6"parser.yy"5490 #line 587 "parser.yy" 5490 5491 { (yyval.en) = new ExpressionNode( build_cond( (yyvsp[(1) - (5)].en), (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].en) ) ); } 5491 5492 break; … … 5494 5495 5495 5496 /* Line 1806 of yacc.c */ 5496 #line 59 7"parser.yy"5497 #line 598 "parser.yy" 5497 5498 { (yyval.en) = new ExpressionNode( build_binary_ptr( (yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5498 5499 break; … … 5501 5502 5502 5503 /* Line 1806 of yacc.c */ 5503 #line 599"parser.yy"5504 #line 600 "parser.yy" 5504 5505 { (yyval.en) = ( (yyvsp[(2) - (2)].en) == 0 ) ? (yyvsp[(1) - (2)].en) : new ExpressionNode( build_binary_ptr( OperKinds::Assign, (yyvsp[(1) - (2)].en), (yyvsp[(2) - (2)].en) ) ); } 5505 5506 break; … … 5508 5509 5509 5510 /* Line 1806 of yacc.c */ 5510 #line 60 4"parser.yy"5511 #line 605 "parser.yy" 5511 5512 { (yyval.en) = nullptr; } 5512 5513 break; … … 5515 5516 5516 5517 /* Line 1806 of yacc.c */ 5517 #line 6 09"parser.yy"5518 #line 610 "parser.yy" 5518 5519 { (yyval.op) = OperKinds::Assign; } 5519 5520 break; … … 5522 5523 5523 5524 /* Line 1806 of yacc.c */ 5524 #line 61 0"parser.yy"5525 #line 611 "parser.yy" 5525 5526 { (yyval.op) = OperKinds::AtAssn; } 5526 5527 break; … … 5529 5530 5530 5531 /* Line 1806 of yacc.c */ 5531 #line 61 1"parser.yy"5532 #line 612 "parser.yy" 5532 5533 { (yyval.op) = OperKinds::MulAssn; } 5533 5534 break; … … 5536 5537 5537 5538 /* Line 1806 of yacc.c */ 5538 #line 61 2"parser.yy"5539 #line 613 "parser.yy" 5539 5540 { (yyval.op) = OperKinds::DivAssn; } 5540 5541 break; … … 5543 5544 5544 5545 /* Line 1806 of yacc.c */ 5545 #line 61 3"parser.yy"5546 #line 614 "parser.yy" 5546 5547 { (yyval.op) = OperKinds::ModAssn; } 5547 5548 break; … … 5550 5551 5551 5552 /* Line 1806 of yacc.c */ 5552 #line 61 4"parser.yy"5553 #line 615 "parser.yy" 5553 5554 { (yyval.op) = OperKinds::PlusAssn; } 5554 5555 break; … … 5557 5558 5558 5559 /* Line 1806 of yacc.c */ 5559 #line 61 5"parser.yy"5560 #line 616 "parser.yy" 5560 5561 { (yyval.op) = OperKinds::MinusAssn; } 5561 5562 break; … … 5564 5565 5565 5566 /* Line 1806 of yacc.c */ 5566 #line 61 6"parser.yy"5567 #line 617 "parser.yy" 5567 5568 { (yyval.op) = OperKinds::LSAssn; } 5568 5569 break; … … 5571 5572 5572 5573 /* Line 1806 of yacc.c */ 5573 #line 61 7"parser.yy"5574 #line 618 "parser.yy" 5574 5575 { (yyval.op) = OperKinds::RSAssn; } 5575 5576 break; … … 5578 5579 5579 5580 /* Line 1806 of yacc.c */ 5580 #line 61 8"parser.yy"5581 #line 619 "parser.yy" 5581 5582 { (yyval.op) = OperKinds::AndAssn; } 5582 5583 break; … … 5585 5586 5586 5587 /* Line 1806 of yacc.c */ 5587 #line 6 19"parser.yy"5588 #line 620 "parser.yy" 5588 5589 { (yyval.op) = OperKinds::ERAssn; } 5589 5590 break; … … 5592 5593 5593 5594 /* Line 1806 of yacc.c */ 5594 #line 62 0"parser.yy"5595 #line 621 "parser.yy" 5595 5596 { (yyval.op) = OperKinds::OrAssn; } 5596 5597 break; … … 5599 5600 5600 5601 /* Line 1806 of yacc.c */ 5601 #line 62 7"parser.yy"5602 #line 628 "parser.yy" 5602 5603 { (yyval.en) = new ExpressionNode( build_tuple() ); } 5603 5604 break; … … 5606 5607 5607 5608 /* Line 1806 of yacc.c */ 5608 #line 6 29"parser.yy"5609 #line 630 "parser.yy" 5609 5610 { (yyval.en) = new ExpressionNode( build_tuple( (yyvsp[(3) - (5)].en) ) ); } 5610 5611 break; … … 5613 5614 5614 5615 /* Line 1806 of yacc.c */ 5615 #line 63 1"parser.yy"5616 #line 632 "parser.yy" 5616 5617 { (yyval.en) = new ExpressionNode( build_tuple( (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( (yyvsp[(4) - (6)].en) ) ) ); } 5617 5618 break; … … 5620 5621 5621 5622 /* Line 1806 of yacc.c */ 5622 #line 63 3"parser.yy"5623 #line 634 "parser.yy" 5623 5624 { (yyval.en) = new ExpressionNode( build_tuple( (ExpressionNode *)(yyvsp[(3) - (7)].en)->set_last( (yyvsp[(5) - (7)].en) ) ) ); } 5624 5625 break; … … 5627 5628 5628 5629 /* Line 1806 of yacc.c */ 5629 #line 6 39"parser.yy"5630 #line 640 "parser.yy" 5630 5631 { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) ); } 5631 5632 break; … … 5634 5635 5635 5636 /* Line 1806 of yacc.c */ 5636 #line 64 5"parser.yy"5637 #line 646 "parser.yy" 5637 5638 { (yyval.en) = new ExpressionNode( build_comma( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5638 5639 break; … … 5641 5642 5642 5643 /* Line 1806 of yacc.c */ 5643 #line 65 0"parser.yy"5644 #line 651 "parser.yy" 5644 5645 { (yyval.en) = 0; } 5645 5646 break; … … 5648 5649 5649 5650 /* Line 1806 of yacc.c */ 5650 #line 6 59"parser.yy"5651 #line 660 "parser.yy" 5651 5652 { (yyval.sn) = (yyvsp[(1) - (1)].sn); } 5652 5653 break; … … 5655 5656 5656 5657 /* Line 1806 of yacc.c */ 5657 #line 66 6"parser.yy"5658 #line 667 "parser.yy" 5658 5659 { 5659 5660 Token fn; 5660 fn.str = new st d::string( "^?{}" );// location undefined5661 fn.str = new string( "^?{}" ); // location undefined 5661 5662 (yyval.sn) = new StatementNode( build_expr( new ExpressionNode( build_func( new ExpressionNode( build_varref( fn ) ), (ExpressionNode *)( (yyvsp[(2) - (6)].en) )->set_last( (yyvsp[(4) - (6)].en) ) ) ) ) ); 5662 5663 } … … 5666 5667 5667 5668 /* Line 1806 of yacc.c */ 5668 #line 67 6"parser.yy"5669 #line 677 "parser.yy" 5669 5670 { 5670 5671 (yyval.sn) = (yyvsp[(4) - (4)].sn)->add_label( (yyvsp[(1) - (4)].tok) ); … … 5675 5676 5676 5677 /* Line 1806 of yacc.c */ 5677 #line 68 3"parser.yy"5678 #line 684 "parser.yy" 5678 5679 { (yyval.sn) = new StatementNode( build_compound( (StatementNode *)0 ) ); } 5679 5680 break; … … 5682 5683 5683 5684 /* Line 1806 of yacc.c */ 5684 #line 69 0"parser.yy"5685 #line 691 "parser.yy" 5685 5686 { (yyval.sn) = new StatementNode( build_compound( (yyvsp[(5) - (7)].sn) ) ); } 5686 5687 break; … … 5689 5690 5690 5691 /* Line 1806 of yacc.c */ 5691 #line 69 6"parser.yy"5692 #line 697 "parser.yy" 5692 5693 { if ( (yyvsp[(1) - (3)].sn) != 0 ) { (yyvsp[(1) - (3)].sn)->set_last( (yyvsp[(3) - (3)].sn) ); (yyval.sn) = (yyvsp[(1) - (3)].sn); } } 5693 5694 break; … … 5696 5697 5697 5698 /* Line 1806 of yacc.c */ 5698 #line 70 1"parser.yy"5699 #line 702 "parser.yy" 5699 5700 { (yyval.sn) = new StatementNode( (yyvsp[(1) - (1)].decl) ); } 5700 5701 break; … … 5703 5704 5704 5705 /* Line 1806 of yacc.c */ 5705 #line 70 3"parser.yy"5706 #line 704 "parser.yy" 5706 5707 { // mark all fields in list 5707 5708 for ( DeclarationNode *iter = (yyvsp[(2) - (2)].decl); iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) … … 5714 5715 5715 5716 /* Line 1806 of yacc.c */ 5716 #line 7 09"parser.yy"5717 #line 710 "parser.yy" 5717 5718 { (yyval.sn) = new StatementNode( (yyvsp[(1) - (1)].decl) ); } 5718 5719 break; … … 5721 5722 5722 5723 /* Line 1806 of yacc.c */ 5723 #line 71 6"parser.yy"5724 #line 717 "parser.yy" 5724 5725 { if ( (yyvsp[(1) - (2)].sn) != 0 ) { (yyvsp[(1) - (2)].sn)->set_last( (yyvsp[(2) - (2)].sn) ); (yyval.sn) = (yyvsp[(1) - (2)].sn); } } 5725 5726 break; … … 5728 5729 5729 5730 /* Line 1806 of yacc.c */ 5730 #line 72 1"parser.yy"5731 #line 722 "parser.yy" 5731 5732 { (yyval.sn) = new StatementNode( build_expr( (yyvsp[(1) - (2)].en) ) ); } 5732 5733 break; … … 5735 5736 5736 5737 /* Line 1806 of yacc.c */ 5737 #line 72 7"parser.yy"5738 #line 728 "parser.yy" 5738 5739 { (yyval.sn) = new StatementNode( build_if( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn), nullptr ) ); } 5739 5740 break; … … 5742 5743 5743 5744 /* Line 1806 of yacc.c */ 5744 #line 7 29"parser.yy"5745 #line 730 "parser.yy" 5745 5746 { (yyval.sn) = new StatementNode( build_if( (yyvsp[(3) - (7)].en), (yyvsp[(5) - (7)].sn), (yyvsp[(7) - (7)].sn) ) ); } 5746 5747 break; … … 5749 5750 5750 5751 /* Line 1806 of yacc.c */ 5751 #line 73 1"parser.yy"5752 #line 732 "parser.yy" 5752 5753 { (yyval.sn) = new StatementNode( build_switch( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ) ); } 5753 5754 break; … … 5756 5757 5757 5758 /* Line 1806 of yacc.c */ 5758 #line 73 3"parser.yy"5759 #line 734 "parser.yy" 5759 5760 { 5760 5761 StatementNode *sw = new StatementNode( build_switch( (yyvsp[(3) - (9)].en), (yyvsp[(8) - (9)].sn) ) ); … … 5771 5772 5772 5773 /* Line 1806 of yacc.c */ 5773 #line 74 3"parser.yy"5774 #line 744 "parser.yy" 5774 5775 { (yyval.sn) = new StatementNode( build_switch( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ) ); } 5775 5776 break; … … 5778 5779 5779 5780 /* Line 1806 of yacc.c */ 5780 #line 74 5"parser.yy"5781 #line 746 "parser.yy" 5781 5782 { 5782 5783 StatementNode *sw = new StatementNode( build_switch( (yyvsp[(3) - (9)].en), (yyvsp[(8) - (9)].sn) ) ); … … 5788 5789 5789 5790 /* Line 1806 of yacc.c */ 5790 #line 75 5"parser.yy"5791 #line 756 "parser.yy" 5791 5792 { (yyval.en) = (yyvsp[(1) - (1)].en); } 5792 5793 break; … … 5795 5796 5796 5797 /* Line 1806 of yacc.c */ 5797 #line 75 7"parser.yy"5798 #line 758 "parser.yy" 5798 5799 { (yyval.en) = new ExpressionNode( build_range( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 5799 5800 break; … … 5802 5803 5803 5804 /* Line 1806 of yacc.c */ 5804 #line 76 2"parser.yy"5805 #line 763 "parser.yy" 5805 5806 { (yyval.sn) = new StatementNode( build_case( (yyvsp[(1) - (1)].en) ) ); } 5806 5807 break; … … 5809 5810 5810 5811 /* Line 1806 of yacc.c */ 5811 #line 76 4"parser.yy"5812 #line 765 "parser.yy" 5812 5813 { (yyval.sn) = (StatementNode *)((yyvsp[(1) - (3)].sn)->set_last( new StatementNode( build_case( (yyvsp[(3) - (3)].en) ) ) ) ); } 5813 5814 break; … … 5816 5817 5817 5818 /* Line 1806 of yacc.c */ 5818 #line 76 8"parser.yy"5819 #line 769 "parser.yy" 5819 5820 { (yyval.sn) = (yyvsp[(2) - (3)].sn); } 5820 5821 break; … … 5823 5824 5824 5825 /* Line 1806 of yacc.c */ 5825 #line 7 69"parser.yy"5826 #line 770 "parser.yy" 5826 5827 { (yyval.sn) = new StatementNode( build_default() ); } 5827 5828 break; … … 5830 5831 5831 5832 /* Line 1806 of yacc.c */ 5832 #line 77 5"parser.yy"5833 #line 776 "parser.yy" 5833 5834 { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (2)].sn)->set_last( (yyvsp[(2) - (2)].sn) )); } 5834 5835 break; … … 5837 5838 5838 5839 /* Line 1806 of yacc.c */ 5839 #line 7 79"parser.yy"5840 #line 780 "parser.yy" 5840 5841 { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( new StatementNode( build_compound( (yyvsp[(2) - (2)].sn) ) ) ); } 5841 5842 break; … … 5844 5845 5845 5846 /* Line 1806 of yacc.c */ 5846 #line 78 4"parser.yy"5847 #line 785 "parser.yy" 5847 5848 { (yyval.sn) = 0; } 5848 5849 break; … … 5851 5852 5852 5853 /* Line 1806 of yacc.c */ 5853 #line 79 0"parser.yy"5854 #line 791 "parser.yy" 5854 5855 { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( new StatementNode( build_compound( (yyvsp[(2) - (2)].sn) ) ) ); } 5855 5856 break; … … 5858 5859 5859 5860 /* Line 1806 of yacc.c */ 5860 #line 79 2"parser.yy"5861 #line 793 "parser.yy" 5861 5862 { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (3)].sn)->set_last( (yyvsp[(2) - (3)].sn)->append_last_case( new StatementNode( build_compound( (yyvsp[(3) - (3)].sn) ) ) ) ) ); } 5862 5863 break; … … 5865 5866 5866 5867 /* Line 1806 of yacc.c */ 5867 #line 79 7"parser.yy"5868 #line 798 "parser.yy" 5868 5869 { (yyval.sn) = 0; } 5869 5870 break; … … 5872 5873 5873 5874 /* Line 1806 of yacc.c */ 5874 #line 80 3"parser.yy"5875 #line 804 "parser.yy" 5875 5876 { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( (yyvsp[(2) - (2)].sn) ); } 5876 5877 break; … … 5879 5880 5880 5881 /* Line 1806 of yacc.c */ 5881 #line 80 5"parser.yy"5882 #line 806 "parser.yy" 5882 5883 { (yyval.sn) = (yyvsp[(1) - (3)].sn)->append_last_case( new StatementNode( build_compound( (StatementNode *)(yyvsp[(2) - (3)].sn)->set_last( (yyvsp[(3) - (3)].sn) ) ) ) ); } 5883 5884 break; … … 5886 5887 5887 5888 /* Line 1806 of yacc.c */ 5888 #line 80 7"parser.yy"5889 #line 808 "parser.yy" 5889 5890 { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (3)].sn)->set_last( (yyvsp[(2) - (3)].sn)->append_last_case( (yyvsp[(3) - (3)].sn) ))); } 5890 5891 break; … … 5893 5894 5894 5895 /* Line 1806 of yacc.c */ 5895 #line 8 09"parser.yy"5896 #line 810 "parser.yy" 5896 5897 { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (4)].sn)->set_last( (yyvsp[(2) - (4)].sn)->append_last_case( new StatementNode( build_compound( (StatementNode *)(yyvsp[(3) - (4)].sn)->set_last( (yyvsp[(4) - (4)].sn) ) ) ) ) ) ); } 5897 5898 break; … … 5900 5901 5901 5902 /* Line 1806 of yacc.c */ 5902 #line 81 4"parser.yy"5903 #line 815 "parser.yy" 5903 5904 { (yyval.sn) = new StatementNode( build_branch( BranchStmt::Break ) ); } 5904 5905 break; … … 5907 5908 5908 5909 /* Line 1806 of yacc.c */ 5909 #line 82 0"parser.yy"5910 #line 821 "parser.yy" 5910 5911 { (yyval.sn) = 0; } 5911 5912 break; … … 5914 5915 5915 5916 /* Line 1806 of yacc.c */ 5916 #line 82 2"parser.yy"5917 #line 823 "parser.yy" 5917 5918 { (yyval.sn) = 0; } 5918 5919 break; … … 5921 5922 5922 5923 /* Line 1806 of yacc.c */ 5923 #line 82 7"parser.yy"5924 #line 828 "parser.yy" 5924 5925 { (yyval.sn) = new StatementNode( build_while( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ) ); } 5925 5926 break; … … 5928 5929 5929 5930 /* Line 1806 of yacc.c */ 5930 #line 8 29"parser.yy"5931 #line 830 "parser.yy" 5931 5932 { (yyval.sn) = new StatementNode( build_while( (yyvsp[(5) - (7)].en), (yyvsp[(2) - (7)].sn), true ) ); } 5932 5933 break; … … 5935 5936 5936 5937 /* Line 1806 of yacc.c */ 5937 #line 83 1"parser.yy"5938 #line 832 "parser.yy" 5938 5939 { (yyval.sn) = new StatementNode( build_for( (yyvsp[(4) - (6)].fctl), (yyvsp[(6) - (6)].sn) ) ); } 5939 5940 break; … … 5942 5943 5943 5944 /* Line 1806 of yacc.c */ 5944 #line 83 6"parser.yy"5945 #line 837 "parser.yy" 5945 5946 { (yyval.fctl) = new ForCtl( (yyvsp[(1) - (6)].en), (yyvsp[(4) - (6)].en), (yyvsp[(6) - (6)].en) ); } 5946 5947 break; … … 5949 5950 5950 5951 /* Line 1806 of yacc.c */ 5951 #line 83 8"parser.yy"5952 #line 839 "parser.yy" 5952 5953 { (yyval.fctl) = new ForCtl( (yyvsp[(1) - (4)].decl), (yyvsp[(2) - (4)].en), (yyvsp[(4) - (4)].en) ); } 5953 5954 break; … … 5956 5957 5957 5958 /* Line 1806 of yacc.c */ 5958 #line 84 3"parser.yy"5959 #line 844 "parser.yy" 5959 5960 { (yyval.sn) = new StatementNode( build_branch( (yyvsp[(2) - (3)].tok), BranchStmt::Goto ) ); } 5960 5961 break; … … 5963 5964 5964 5965 /* Line 1806 of yacc.c */ 5965 #line 84 7"parser.yy"5966 #line 848 "parser.yy" 5966 5967 { (yyval.sn) = new StatementNode( build_computedgoto( (yyvsp[(3) - (4)].en) ) ); } 5967 5968 break; … … 5970 5971 5971 5972 /* Line 1806 of yacc.c */ 5972 #line 85 0"parser.yy"5973 #line 851 "parser.yy" 5973 5974 { (yyval.sn) = new StatementNode( build_branch( BranchStmt::Continue ) ); } 5974 5975 break; … … 5977 5978 5978 5979 /* Line 1806 of yacc.c */ 5979 #line 85 4"parser.yy"5980 #line 855 "parser.yy" 5980 5981 { (yyval.sn) = new StatementNode( build_branch( (yyvsp[(2) - (3)].tok), BranchStmt::Continue ) ); } 5981 5982 break; … … 5984 5985 5985 5986 /* Line 1806 of yacc.c */ 5986 #line 85 7"parser.yy"5987 #line 858 "parser.yy" 5987 5988 { (yyval.sn) = new StatementNode( build_branch( BranchStmt::Break ) ); } 5988 5989 break; … … 5991 5992 5992 5993 /* Line 1806 of yacc.c */ 5993 #line 86 1"parser.yy"5994 #line 862 "parser.yy" 5994 5995 { (yyval.sn) = new StatementNode( build_branch( (yyvsp[(2) - (3)].tok), BranchStmt::Break ) ); } 5995 5996 break; … … 5998 5999 5999 6000 /* Line 1806 of yacc.c */ 6000 #line 86 3"parser.yy"6001 #line 864 "parser.yy" 6001 6002 { (yyval.sn) = new StatementNode( build_return( (yyvsp[(2) - (3)].en) ) ); } 6002 6003 break; … … 6005 6006 6006 6007 /* Line 1806 of yacc.c */ 6007 #line 86 5"parser.yy"6008 #line 866 "parser.yy" 6008 6009 { (yyval.sn) = new StatementNode( build_throw( (yyvsp[(2) - (3)].en) ) ); } 6009 6010 break; … … 6012 6013 6013 6014 /* Line 1806 of yacc.c */ 6014 #line 86 7"parser.yy"6015 #line 868 "parser.yy" 6015 6016 { (yyval.sn) = new StatementNode( build_throw( (yyvsp[(2) - (3)].en) ) ); } 6016 6017 break; … … 6019 6020 6020 6021 /* Line 1806 of yacc.c */ 6021 #line 8 69"parser.yy"6022 #line 870 "parser.yy" 6022 6023 { (yyval.sn) = new StatementNode( build_throw( (yyvsp[(2) - (5)].en) ) ); } 6023 6024 break; … … 6026 6027 6027 6028 /* Line 1806 of yacc.c */ 6028 #line 87 4"parser.yy"6029 #line 875 "parser.yy" 6029 6030 { (yyval.sn) = new StatementNode( build_try( (yyvsp[(2) - (3)].sn), (yyvsp[(3) - (3)].sn), 0 ) ); } 6030 6031 break; … … 6033 6034 6034 6035 /* Line 1806 of yacc.c */ 6035 #line 87 6"parser.yy"6036 #line 877 "parser.yy" 6036 6037 { (yyval.sn) = new StatementNode( build_try( (yyvsp[(2) - (3)].sn), 0, (yyvsp[(3) - (3)].sn) ) ); } 6037 6038 break; … … 6040 6041 6041 6042 /* Line 1806 of yacc.c */ 6042 #line 87 8"parser.yy"6043 #line 879 "parser.yy" 6043 6044 { (yyval.sn) = new StatementNode( build_try( (yyvsp[(2) - (4)].sn), (yyvsp[(3) - (4)].sn), (yyvsp[(4) - (4)].sn) ) ); } 6044 6045 break; … … 6047 6048 6048 6049 /* Line 1806 of yacc.c */ 6049 #line 88 5"parser.yy"6050 #line 886 "parser.yy" 6050 6051 { (yyval.sn) = new StatementNode( build_catch( 0, (yyvsp[(5) - (5)].sn), true ) ); } 6051 6052 break; … … 6054 6055 6055 6056 /* Line 1806 of yacc.c */ 6056 #line 88 7"parser.yy"6057 #line 888 "parser.yy" 6057 6058 { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (6)].sn)->set_last( new StatementNode( build_catch( 0, (yyvsp[(6) - (6)].sn), true ) ) ); } 6058 6059 break; … … 6061 6062 6062 6063 /* Line 1806 of yacc.c */ 6063 #line 8 89"parser.yy"6064 #line 890 "parser.yy" 6064 6065 { (yyval.sn) = new StatementNode( build_catch( 0, (yyvsp[(5) - (5)].sn), true ) ); } 6065 6066 break; … … 6068 6069 6069 6070 /* Line 1806 of yacc.c */ 6070 #line 89 1"parser.yy"6071 #line 892 "parser.yy" 6071 6072 { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (6)].sn)->set_last( new StatementNode( build_catch( 0, (yyvsp[(6) - (6)].sn), true ) ) ); } 6072 6073 break; … … 6075 6076 6076 6077 /* Line 1806 of yacc.c */ 6077 #line 89 6"parser.yy"6078 #line 897 "parser.yy" 6078 6079 { (yyval.sn) = new StatementNode( build_catch( (yyvsp[(5) - (9)].decl), (yyvsp[(8) - (9)].sn) ) ); } 6079 6080 break; … … 6082 6083 6083 6084 /* Line 1806 of yacc.c */ 6084 #line 89 8"parser.yy"6085 #line 899 "parser.yy" 6085 6086 { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (10)].sn)->set_last( new StatementNode( build_catch( (yyvsp[(6) - (10)].decl), (yyvsp[(9) - (10)].sn) ) ) ); } 6086 6087 break; … … 6089 6090 6090 6091 /* Line 1806 of yacc.c */ 6091 #line 90 0"parser.yy"6092 #line 901 "parser.yy" 6092 6093 { (yyval.sn) = new StatementNode( build_catch( (yyvsp[(5) - (9)].decl), (yyvsp[(8) - (9)].sn) ) ); } 6093 6094 break; … … 6096 6097 6097 6098 /* Line 1806 of yacc.c */ 6098 #line 90 2"parser.yy"6099 #line 903 "parser.yy" 6099 6100 { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (10)].sn)->set_last( new StatementNode( build_catch( (yyvsp[(6) - (10)].decl), (yyvsp[(9) - (10)].sn) ) ) ); } 6100 6101 break; … … 6103 6104 6104 6105 /* Line 1806 of yacc.c */ 6105 #line 90 7"parser.yy"6106 #line 908 "parser.yy" 6106 6107 { 6107 6108 (yyval.sn) = new StatementNode( build_finally( (yyvsp[(2) - (2)].sn) ) ); … … 6112 6113 6113 6114 /* Line 1806 of yacc.c */ 6114 #line 92 0"parser.yy"6115 #line 921 "parser.yy" 6115 6116 { 6116 6117 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6122 6123 6123 6124 /* Line 1806 of yacc.c */ 6124 #line 92 5"parser.yy"6125 #line 926 "parser.yy" 6125 6126 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); } 6126 6127 break; … … 6129 6130 6130 6131 /* Line 1806 of yacc.c */ 6131 #line 92 7"parser.yy"6132 #line 928 "parser.yy" 6132 6133 { 6133 6134 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6139 6140 6140 6141 /* Line 1806 of yacc.c */ 6141 #line 93 6"parser.yy"6142 #line 937 "parser.yy" 6142 6143 { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (6)].flag), (yyvsp[(4) - (6)].constant), 0 ) ); } 6143 6144 break; … … 6146 6147 6147 6148 /* Line 1806 of yacc.c */ 6148 #line 93 8"parser.yy"6149 #line 939 "parser.yy" 6149 6150 { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (8)].flag), (yyvsp[(4) - (8)].constant), (yyvsp[(6) - (8)].en) ) ); } 6150 6151 break; … … 6153 6154 6154 6155 /* Line 1806 of yacc.c */ 6155 #line 94 0"parser.yy"6156 #line 941 "parser.yy" 6156 6157 { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (10)].flag), (yyvsp[(4) - (10)].constant), (yyvsp[(6) - (10)].en), (yyvsp[(8) - (10)].en) ) ); } 6157 6158 break; … … 6160 6161 6161 6162 /* Line 1806 of yacc.c */ 6162 #line 94 2"parser.yy"6163 #line 943 "parser.yy" 6163 6164 { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (12)].flag), (yyvsp[(4) - (12)].constant), (yyvsp[(6) - (12)].en), (yyvsp[(8) - (12)].en), (yyvsp[(10) - (12)].en) ) ); } 6164 6165 break; … … 6167 6168 6168 6169 /* Line 1806 of yacc.c */ 6169 #line 94 4"parser.yy"6170 #line 945 "parser.yy" 6170 6171 { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (14)].flag), (yyvsp[(5) - (14)].constant), 0, (yyvsp[(8) - (14)].en), (yyvsp[(10) - (14)].en), (yyvsp[(12) - (14)].label) ) ); } 6171 6172 break; … … 6174 6175 6175 6176 /* Line 1806 of yacc.c */ 6176 #line 9 49"parser.yy"6177 #line 950 "parser.yy" 6177 6178 { (yyval.flag) = false; } 6178 6179 break; … … 6181 6182 6182 6183 /* Line 1806 of yacc.c */ 6183 #line 95 1"parser.yy"6184 #line 952 "parser.yy" 6184 6185 { (yyval.flag) = true; } 6185 6186 break; … … 6188 6189 6189 6190 /* Line 1806 of yacc.c */ 6190 #line 95 6"parser.yy"6191 #line 957 "parser.yy" 6191 6192 { (yyval.en) = 0; } 6192 6193 break; … … 6195 6196 6196 6197 /* Line 1806 of yacc.c */ 6197 #line 96 3"parser.yy"6198 #line 964 "parser.yy" 6198 6199 { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) ); } 6199 6200 break; … … 6202 6203 6203 6204 /* Line 1806 of yacc.c */ 6204 #line 96 8"parser.yy"6205 #line 969 "parser.yy" 6205 6206 { (yyval.en) = new ExpressionNode( build_asmexpr( 0, (yyvsp[(1) - (4)].constant), (yyvsp[(3) - (4)].en) ) ); } 6206 6207 break; … … 6209 6210 6210 6211 /* Line 1806 of yacc.c */ 6211 #line 97 0"parser.yy"6212 #line 971 "parser.yy" 6212 6213 { (yyval.en) = new ExpressionNode( build_asmexpr( (yyvsp[(2) - (7)].en), (yyvsp[(4) - (7)].constant), (yyvsp[(6) - (7)].en) ) ); } 6213 6214 break; … … 6216 6217 6217 6218 /* Line 1806 of yacc.c */ 6218 #line 97 5"parser.yy"6219 #line 976 "parser.yy" 6219 6220 { (yyval.en) = 0; } 6220 6221 break; … … 6223 6224 6224 6225 /* Line 1806 of yacc.c */ 6225 #line 97 7"parser.yy"6226 #line 978 "parser.yy" 6226 6227 { (yyval.en) = new ExpressionNode( (yyvsp[(1) - (1)].constant) ); } 6227 6228 break; … … 6230 6231 6231 6232 /* Line 1806 of yacc.c */ 6232 #line 9 79"parser.yy"6233 #line 980 "parser.yy" 6233 6234 { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_last( new ExpressionNode( (yyvsp[(3) - (3)].constant) ) ); } 6234 6235 break; … … 6237 6238 6238 6239 /* Line 1806 of yacc.c */ 6239 #line 98 4"parser.yy"6240 #line 985 "parser.yy" 6240 6241 { 6241 6242 (yyval.label) = new LabelNode(); (yyval.label)->labels.push_back( *(yyvsp[(1) - (1)].tok) ); … … 6247 6248 6248 6249 /* Line 1806 of yacc.c */ 6249 #line 9 89"parser.yy"6250 #line 990 "parser.yy" 6250 6251 { 6251 6252 (yyval.label) = (yyvsp[(1) - (3)].label); (yyvsp[(1) - (3)].label)->labels.push_back( *(yyvsp[(3) - (3)].tok) ); … … 6257 6258 6258 6259 /* Line 1806 of yacc.c */ 6259 #line 999"parser.yy"6260 #line 1000 "parser.yy" 6260 6261 { (yyval.decl) = 0; } 6261 6262 break; … … 6264 6265 6265 6266 /* Line 1806 of yacc.c */ 6266 #line 100 6"parser.yy"6267 #line 1007 "parser.yy" 6267 6268 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ); } 6268 6269 break; … … 6271 6272 6272 6273 /* Line 1806 of yacc.c */ 6273 #line 101 1"parser.yy"6274 #line 1012 "parser.yy" 6274 6275 { (yyval.decl) = 0; } 6275 6276 break; … … 6278 6279 6279 6280 /* Line 1806 of yacc.c */ 6280 #line 101 8"parser.yy"6281 #line 1019 "parser.yy" 6281 6282 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ); } 6282 6283 break; 6283 6284 6284 6285 case 244: 6285 6286 /* Line 1806 of yacc.c */6287 #line 1032 "parser.yy"6288 {}6289 break;6290 6291 case 245:6292 6286 6293 6287 /* Line 1806 of yacc.c */ … … 6296 6290 break; 6297 6291 6292 case 245: 6293 6294 /* Line 1806 of yacc.c */ 6295 #line 1034 "parser.yy" 6296 {} 6297 break; 6298 6298 6299 case 253: 6299 6300 6300 6301 /* Line 1806 of yacc.c */ 6301 #line 106 2"parser.yy"6302 #line 1063 "parser.yy" 6302 6303 { 6303 6304 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6309 6310 6310 6311 /* Line 1806 of yacc.c */ 6311 #line 10 69"parser.yy"6312 #line 1070 "parser.yy" 6312 6313 { 6313 6314 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6319 6320 6320 6321 /* Line 1806 of yacc.c */ 6321 #line 107 4"parser.yy"6322 #line 1075 "parser.yy" 6322 6323 { 6323 6324 typedefTable.addToEnclosingScope( *(yyvsp[(5) - (6)].tok), TypedefTable::ID ); … … 6329 6330 6330 6331 /* Line 1806 of yacc.c */ 6331 #line 108 4"parser.yy"6332 #line 1085 "parser.yy" 6332 6333 { 6333 6334 typedefTable.setNextIdentifier( *(yyvsp[(2) - (3)].tok) ); … … 6339 6340 6340 6341 /* Line 1806 of yacc.c */ 6341 #line 10 89"parser.yy"6342 #line 1090 "parser.yy" 6342 6343 { 6343 6344 typedefTable.setNextIdentifier( *(yyvsp[(2) - (3)].tok) ); … … 6349 6350 6350 6351 /* Line 1806 of yacc.c */ 6351 #line 109 4"parser.yy"6352 #line 1095 "parser.yy" 6352 6353 { 6353 6354 typedefTable.setNextIdentifier( *(yyvsp[(3) - (4)].tok) ); … … 6359 6360 6360 6361 /* Line 1806 of yacc.c */ 6361 #line 110 2"parser.yy"6362 #line 1103 "parser.yy" 6362 6363 { 6363 6364 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6369 6370 6370 6371 /* Line 1806 of yacc.c */ 6371 #line 110 7"parser.yy"6372 #line 1108 "parser.yy" 6372 6373 { 6373 6374 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6379 6380 6380 6381 /* Line 1806 of yacc.c */ 6381 #line 111 2"parser.yy"6382 #line 1113 "parser.yy" 6382 6383 { 6383 6384 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6389 6390 6390 6391 /* Line 1806 of yacc.c */ 6391 #line 111 7"parser.yy"6392 #line 1118 "parser.yy" 6392 6393 { 6393 6394 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6399 6400 6400 6401 /* Line 1806 of yacc.c */ 6401 #line 112 2"parser.yy"6402 #line 1123 "parser.yy" 6402 6403 { 6403 6404 typedefTable.addToEnclosingScope( *(yyvsp[(5) - (5)].tok), TypedefTable::ID ); … … 6409 6410 6410 6411 /* Line 1806 of yacc.c */ 6411 #line 113 0"parser.yy"6412 #line 1131 "parser.yy" 6412 6413 { 6413 6414 (yyval.decl) = DeclarationNode::newFunction( (yyvsp[(3) - (8)].tok), DeclarationNode::newTuple( 0 ), (yyvsp[(6) - (8)].decl), 0, true ); … … 6418 6419 6419 6420 /* Line 1806 of yacc.c */ 6420 #line 115 3"parser.yy"6421 #line 1154 "parser.yy" 6421 6422 { 6422 6423 (yyval.decl) = DeclarationNode::newFunction( (yyvsp[(2) - (7)].tok), (yyvsp[(1) - (7)].decl), (yyvsp[(5) - (7)].decl), 0, true ); … … 6427 6428 6428 6429 /* Line 1806 of yacc.c */ 6429 #line 115 7"parser.yy"6430 #line 1158 "parser.yy" 6430 6431 { 6431 6432 (yyval.decl) = DeclarationNode::newFunction( (yyvsp[(2) - (7)].tok), (yyvsp[(1) - (7)].decl), (yyvsp[(5) - (7)].decl), 0, true ); … … 6436 6437 6437 6438 /* Line 1806 of yacc.c */ 6438 #line 116 4"parser.yy"6439 #line 1165 "parser.yy" 6439 6440 { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[(3) - (5)].decl) ); } 6440 6441 break; … … 6443 6444 6444 6445 /* Line 1806 of yacc.c */ 6445 #line 116 8"parser.yy"6446 #line 1169 "parser.yy" 6446 6447 { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[(3) - (9)].decl)->appendList( (yyvsp[(7) - (9)].decl) ) ); } 6447 6448 break; … … 6450 6451 6451 6452 /* Line 1806 of yacc.c */ 6452 #line 117 3"parser.yy"6453 #line 1174 "parser.yy" 6453 6454 { 6454 6455 typedefTable.addToEnclosingScope( TypedefTable::TD ); … … 6460 6461 6461 6462 /* Line 1806 of yacc.c */ 6462 #line 117 8"parser.yy"6463 #line 1179 "parser.yy" 6463 6464 { 6464 6465 typedefTable.addToEnclosingScope( TypedefTable::TD ); … … 6470 6471 6471 6472 /* Line 1806 of yacc.c */ 6472 #line 118 3"parser.yy"6473 #line 1184 "parser.yy" 6473 6474 { 6474 6475 typedefTable.addToEnclosingScope( *(yyvsp[(5) - (5)].tok), TypedefTable::TD ); … … 6480 6481 6481 6482 /* Line 1806 of yacc.c */ 6482 #line 119 4"parser.yy"6483 #line 1195 "parser.yy" 6483 6484 { 6484 6485 typedefTable.addToEnclosingScope( TypedefTable::TD ); … … 6490 6491 6491 6492 /* Line 1806 of yacc.c */ 6492 #line 1 199"parser.yy"6493 #line 1200 "parser.yy" 6493 6494 { 6494 6495 typedefTable.addToEnclosingScope( TypedefTable::TD ); … … 6500 6501 6501 6502 /* Line 1806 of yacc.c */ 6502 #line 120 4"parser.yy"6503 #line 1205 "parser.yy" 6503 6504 { 6504 6505 typedefTable.addToEnclosingScope( TypedefTable::TD ); … … 6510 6511 6511 6512 /* Line 1806 of yacc.c */ 6512 #line 12 09"parser.yy"6513 #line 1210 "parser.yy" 6513 6514 { 6514 6515 typedefTable.addToEnclosingScope( TypedefTable::TD ); … … 6520 6521 6521 6522 /* Line 1806 of yacc.c */ 6522 #line 121 4"parser.yy"6523 #line 1215 "parser.yy" 6523 6524 { 6524 6525 typedefTable.addToEnclosingScope( TypedefTable::TD ); … … 6530 6531 6531 6532 /* Line 1806 of yacc.c */ 6532 #line 122 3"parser.yy"6533 #line 1224 "parser.yy" 6533 6534 { 6534 6535 typedefTable.addToEnclosingScope( *(yyvsp[(2) - (4)].tok), TypedefTable::TD ); … … 6540 6541 6541 6542 /* Line 1806 of yacc.c */ 6542 #line 122 8"parser.yy"6543 #line 1229 "parser.yy" 6543 6544 { 6544 6545 typedefTable.addToEnclosingScope( *(yyvsp[(5) - (7)].tok), TypedefTable::TD ); … … 6550 6551 6551 6552 /* Line 1806 of yacc.c */ 6552 #line 124 5"parser.yy"6553 #line 1246 "parser.yy" 6553 6554 { 6554 6555 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6560 6561 6561 6562 /* Line 1806 of yacc.c */ 6562 #line 125 0"parser.yy"6563 #line 1251 "parser.yy" 6563 6564 { 6564 6565 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6570 6571 6571 6572 /* Line 1806 of yacc.c */ 6572 #line 127 2"parser.yy"6573 #line 1273 "parser.yy" 6573 6574 { (yyval.decl) = 0; } 6574 6575 break; … … 6577 6578 6578 6579 /* Line 1806 of yacc.c */ 6579 #line 128 4"parser.yy"6580 #line 1285 "parser.yy" 6580 6581 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 6581 6582 break; … … 6584 6585 6585 6586 /* Line 1806 of yacc.c */ 6586 #line 129 5"parser.yy"6587 #line 1296 "parser.yy" 6587 6588 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Const ); } 6588 6589 break; … … 6591 6592 6592 6593 /* Line 1806 of yacc.c */ 6593 #line 129 7"parser.yy"6594 #line 1298 "parser.yy" 6594 6595 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Restrict ); } 6595 6596 break; … … 6598 6599 6599 6600 /* Line 1806 of yacc.c */ 6600 #line 1 299"parser.yy"6601 #line 1300 "parser.yy" 6601 6602 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Volatile ); } 6602 6603 break; … … 6605 6606 6606 6607 /* Line 1806 of yacc.c */ 6607 #line 130 1"parser.yy"6608 #line 1302 "parser.yy" 6608 6609 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Lvalue ); } 6609 6610 break; … … 6612 6613 6613 6614 /* Line 1806 of yacc.c */ 6614 #line 130 3"parser.yy"6615 #line 1304 "parser.yy" 6615 6616 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Atomic ); } 6616 6617 break; … … 6619 6620 6620 6621 /* Line 1806 of yacc.c */ 6621 #line 130 5"parser.yy"6622 #line 1306 "parser.yy" 6622 6623 { 6623 6624 typedefTable.enterScope(); … … 6628 6629 6629 6630 /* Line 1806 of yacc.c */ 6630 #line 13 09"parser.yy"6631 #line 1310 "parser.yy" 6631 6632 { 6632 6633 typedefTable.leaveScope(); … … 6638 6639 6639 6640 /* Line 1806 of yacc.c */ 6640 #line 131 8"parser.yy"6641 #line 1319 "parser.yy" 6641 6642 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 6642 6643 break; … … 6645 6646 6646 6647 /* Line 1806 of yacc.c */ 6647 #line 132 0"parser.yy"6648 #line 1321 "parser.yy" 6648 6649 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); } 6649 6650 break; … … 6652 6653 6653 6654 /* Line 1806 of yacc.c */ 6654 #line 133 1"parser.yy"6655 #line 1332 "parser.yy" 6655 6656 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 6656 6657 break; … … 6659 6660 6660 6661 /* Line 1806 of yacc.c */ 6661 #line 133 6"parser.yy"6662 #line 1337 "parser.yy" 6662 6663 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Extern ); } 6663 6664 break; … … 6666 6667 6667 6668 /* Line 1806 of yacc.c */ 6668 #line 133 8"parser.yy"6669 #line 1339 "parser.yy" 6669 6670 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Static ); } 6670 6671 break; … … 6673 6674 6674 6675 /* Line 1806 of yacc.c */ 6675 #line 134 0"parser.yy"6676 #line 1341 "parser.yy" 6676 6677 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Auto ); } 6677 6678 break; … … 6680 6681 6681 6682 /* Line 1806 of yacc.c */ 6682 #line 134 2"parser.yy"6683 #line 1343 "parser.yy" 6683 6684 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Register ); } 6684 6685 break; … … 6687 6688 6688 6689 /* Line 1806 of yacc.c */ 6689 #line 134 5"parser.yy"6690 #line 1346 "parser.yy" 6690 6691 { (yyval.decl) = new DeclarationNode; (yyval.decl)->isInline = true; } 6691 6692 break; … … 6694 6695 6695 6696 /* Line 1806 of yacc.c */ 6696 #line 134 7"parser.yy"6697 #line 1348 "parser.yy" 6697 6698 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Fortran ); } 6698 6699 break; … … 6701 6702 6702 6703 /* Line 1806 of yacc.c */ 6703 #line 135 0"parser.yy"6704 #line 1351 "parser.yy" 6704 6705 { (yyval.decl) = new DeclarationNode; (yyval.decl)->isNoreturn = true; } 6705 6706 break; … … 6708 6709 6709 6710 /* Line 1806 of yacc.c */ 6710 #line 135 2"parser.yy"6711 #line 1353 "parser.yy" 6711 6712 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Threadlocal ); } 6712 6713 break; … … 6715 6716 6716 6717 /* Line 1806 of yacc.c */ 6717 #line 135 7"parser.yy"6718 #line 1358 "parser.yy" 6718 6719 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Char ); } 6719 6720 break; … … 6722 6723 6723 6724 /* Line 1806 of yacc.c */ 6724 #line 13 59"parser.yy"6725 #line 1360 "parser.yy" 6725 6726 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Double ); } 6726 6727 break; … … 6729 6730 6730 6731 /* Line 1806 of yacc.c */ 6731 #line 136 1"parser.yy"6732 #line 1362 "parser.yy" 6732 6733 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Float ); } 6733 6734 break; … … 6736 6737 6737 6738 /* Line 1806 of yacc.c */ 6738 #line 136 3"parser.yy"6739 #line 1364 "parser.yy" 6739 6740 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Int ); } 6740 6741 break; … … 6743 6744 6744 6745 /* Line 1806 of yacc.c */ 6745 #line 136 5"parser.yy"6746 #line 1366 "parser.yy" 6746 6747 { (yyval.decl) = DeclarationNode::newLength( DeclarationNode::Long ); } 6747 6748 break; … … 6750 6751 6751 6752 /* Line 1806 of yacc.c */ 6752 #line 136 7"parser.yy"6753 #line 1368 "parser.yy" 6753 6754 { (yyval.decl) = DeclarationNode::newLength( DeclarationNode::Short ); } 6754 6755 break; … … 6757 6758 6758 6759 /* Line 1806 of yacc.c */ 6759 #line 13 69"parser.yy"6760 #line 1370 "parser.yy" 6760 6761 { (yyval.decl) = DeclarationNode::newSignedNess( DeclarationNode::Signed ); } 6761 6762 break; … … 6764 6765 6765 6766 /* Line 1806 of yacc.c */ 6766 #line 137 1"parser.yy"6767 #line 1372 "parser.yy" 6767 6768 { (yyval.decl) = DeclarationNode::newSignedNess( DeclarationNode::Unsigned ); } 6768 6769 break; … … 6771 6772 6772 6773 /* Line 1806 of yacc.c */ 6773 #line 137 3"parser.yy"6774 #line 1374 "parser.yy" 6774 6775 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Void ); } 6775 6776 break; … … 6778 6779 6779 6780 /* Line 1806 of yacc.c */ 6780 #line 137 5"parser.yy"6781 #line 1376 "parser.yy" 6781 6782 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Bool ); } 6782 6783 break; … … 6785 6786 6786 6787 /* Line 1806 of yacc.c */ 6787 #line 137 7"parser.yy"6788 #line 1378 "parser.yy" 6788 6789 { (yyval.decl) = DeclarationNode::newComplexType( DeclarationNode::Complex ); } 6789 6790 break; … … 6792 6793 6793 6794 /* Line 1806 of yacc.c */ 6794 #line 13 79"parser.yy"6795 #line 1380 "parser.yy" 6795 6796 { (yyval.decl) = DeclarationNode::newComplexType( DeclarationNode::Imaginary ); } 6796 6797 break; … … 6799 6800 6800 6801 /* Line 1806 of yacc.c */ 6801 #line 138 1"parser.yy"6802 #line 1382 "parser.yy" 6802 6803 { (yyval.decl) = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); } 6803 6804 break; … … 6806 6807 6807 6808 /* Line 1806 of yacc.c */ 6808 #line 138 8"parser.yy"6809 #line 1389 "parser.yy" 6809 6810 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 6810 6811 break; … … 6813 6814 6814 6815 /* Line 1806 of yacc.c */ 6815 #line 139 0"parser.yy"6816 #line 1391 "parser.yy" 6816 6817 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 6817 6818 break; … … 6820 6821 6821 6822 /* Line 1806 of yacc.c */ 6822 #line 139 2"parser.yy"6823 #line 1393 "parser.yy" 6823 6824 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); } 6824 6825 break; … … 6827 6828 6828 6829 /* Line 1806 of yacc.c */ 6829 #line 139 4"parser.yy"6830 #line 1395 "parser.yy" 6830 6831 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addType( (yyvsp[(1) - (3)].decl) ); } 6831 6832 break; … … 6834 6835 6835 6836 /* Line 1806 of yacc.c */ 6836 #line 140 0"parser.yy"6837 #line 1401 "parser.yy" 6837 6838 { (yyval.decl) = (yyvsp[(2) - (3)].decl)->addQualifiers( (yyvsp[(1) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); } 6838 6839 break; … … 6841 6842 6842 6843 /* Line 1806 of yacc.c */ 6843 #line 140 7"parser.yy"6844 #line 1408 "parser.yy" 6844 6845 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 6845 6846 break; … … 6848 6849 6849 6850 /* Line 1806 of yacc.c */ 6850 #line 14 09"parser.yy"6851 #line 1410 "parser.yy" 6851 6852 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 6852 6853 break; … … 6855 6856 6856 6857 /* Line 1806 of yacc.c */ 6857 #line 141 1"parser.yy"6858 #line 1412 "parser.yy" 6858 6859 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addType( (yyvsp[(2) - (2)].decl) ); } 6859 6860 break; … … 6862 6863 6863 6864 /* Line 1806 of yacc.c */ 6864 #line 141 6"parser.yy"6865 #line 1417 "parser.yy" 6865 6866 { (yyval.decl) = (yyvsp[(3) - (4)].decl); } 6866 6867 break; … … 6869 6870 6870 6871 /* Line 1806 of yacc.c */ 6871 #line 141 8"parser.yy"6872 #line 1419 "parser.yy" 6872 6873 { (yyval.decl) = DeclarationNode::newTypeof( (yyvsp[(3) - (4)].en) ); } 6873 6874 break; … … 6876 6877 6877 6878 /* Line 1806 of yacc.c */ 6878 #line 142 0"parser.yy"6879 #line 1421 "parser.yy" 6879 6880 { (yyval.decl) = DeclarationNode::newAttr( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].decl) ); } 6880 6881 break; … … 6883 6884 6884 6885 /* Line 1806 of yacc.c */ 6885 #line 142 2"parser.yy"6886 #line 1423 "parser.yy" 6886 6887 { (yyval.decl) = DeclarationNode::newAttr( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].en) ); } 6887 6888 break; … … 6890 6891 6891 6892 /* Line 1806 of yacc.c */ 6892 #line 142 8"parser.yy"6893 #line 1429 "parser.yy" 6893 6894 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 6894 6895 break; … … 6897 6898 6898 6899 /* Line 1806 of yacc.c */ 6899 #line 143 0"parser.yy"6900 #line 1431 "parser.yy" 6900 6901 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 6901 6902 break; … … 6904 6905 6905 6906 /* Line 1806 of yacc.c */ 6906 #line 143 2"parser.yy"6907 #line 1433 "parser.yy" 6907 6908 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); } 6908 6909 break; … … 6911 6912 6912 6913 /* Line 1806 of yacc.c */ 6913 #line 143 8"parser.yy"6914 #line 1439 "parser.yy" 6914 6915 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 6915 6916 break; … … 6918 6919 6919 6920 /* Line 1806 of yacc.c */ 6920 #line 144 0"parser.yy"6921 #line 1441 "parser.yy" 6921 6922 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 6922 6923 break; … … 6925 6926 6926 6927 /* Line 1806 of yacc.c */ 6927 #line 144 6"parser.yy"6928 #line 1447 "parser.yy" 6928 6929 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 6929 6930 break; … … 6932 6933 6933 6934 /* Line 1806 of yacc.c */ 6934 #line 144 8"parser.yy"6935 #line 1449 "parser.yy" 6935 6936 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 6936 6937 break; … … 6939 6940 6940 6941 /* Line 1806 of yacc.c */ 6941 #line 145 0"parser.yy"6942 #line 1451 "parser.yy" 6942 6943 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); } 6943 6944 break; … … 6946 6947 6947 6948 /* Line 1806 of yacc.c */ 6948 #line 145 5"parser.yy"6949 #line 1456 "parser.yy" 6949 6950 { (yyval.decl) = DeclarationNode::newFromTypedef( (yyvsp[(1) - (1)].tok) ); } 6950 6951 break; … … 6953 6954 6954 6955 /* Line 1806 of yacc.c */ 6955 #line 145 7"parser.yy"6956 #line 1458 "parser.yy" 6956 6957 { (yyval.decl) = DeclarationNode::newFromTypedef( (yyvsp[(2) - (2)].tok) )->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 6957 6958 break; … … 6960 6961 6961 6962 /* Line 1806 of yacc.c */ 6962 #line 14 59"parser.yy"6963 #line 1460 "parser.yy" 6963 6964 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 6964 6965 break; … … 6967 6968 6968 6969 /* Line 1806 of yacc.c */ 6969 #line 14 69"parser.yy"6970 { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (4)].aggKey), 0, 0, (yyvsp[(3) - (4)].decl), true ); }6970 #line 1470 "parser.yy" 6971 { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (4)].aggKey), nullptr, nullptr, (yyvsp[(3) - (4)].decl), true ); } 6971 6972 break; 6972 6973 … … 6974 6975 6975 6976 /* Line 1806 of yacc.c */ 6976 #line 147 1"parser.yy"6977 #line 1472 "parser.yy" 6977 6978 { 6978 6979 typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); 6979 (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (2)].aggKey), (yyvsp[(2) - (2)].tok), 0, 0, false );6980 (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (2)].aggKey), (yyvsp[(2) - (2)].tok), nullptr, nullptr, false ); 6980 6981 } 6981 6982 break; … … 6984 6985 6985 6986 /* Line 1806 of yacc.c */ 6986 #line 147 6"parser.yy"6987 #line 1477 "parser.yy" 6987 6988 { typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); } 6988 6989 break; … … 6991 6992 6992 6993 /* Line 1806 of yacc.c */ 6993 #line 147 8"parser.yy"6994 { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (6)].aggKey), (yyvsp[(2) - (6)].tok), 0, (yyvsp[(5) - (6)].decl), true ); }6994 #line 1479 "parser.yy" 6995 { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (6)].aggKey), (yyvsp[(2) - (6)].tok), nullptr, (yyvsp[(5) - (6)].decl), true ); } 6995 6996 break; 6996 6997 … … 6998 6999 6999 7000 /* Line 1806 of yacc.c */ 7000 #line 148 0"parser.yy"7001 { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (7)].aggKey), 0, (yyvsp[(3) - (7)].en), (yyvsp[(6) - (7)].decl), false ); }7001 #line 1481 "parser.yy" 7002 { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (7)].aggKey), nullptr, (yyvsp[(3) - (7)].en), (yyvsp[(6) - (7)].decl), false ); } 7002 7003 break; 7003 7004 … … 7005 7006 7006 7007 /* Line 1806 of yacc.c */ 7007 #line 148 2"parser.yy"7008 #line 1483 "parser.yy" 7008 7009 { (yyval.decl) = (yyvsp[(2) - (2)].decl); } 7009 7010 break; … … 7012 7013 7013 7014 /* Line 1806 of yacc.c */ 7014 #line 148 7"parser.yy"7015 #line 1488 "parser.yy" 7015 7016 { (yyval.aggKey) = DeclarationNode::Struct; } 7016 7017 break; … … 7019 7020 7020 7021 /* Line 1806 of yacc.c */ 7021 #line 14 89"parser.yy"7022 #line 1490 "parser.yy" 7022 7023 { (yyval.aggKey) = DeclarationNode::Union; } 7023 7024 break; … … 7026 7027 7027 7028 /* Line 1806 of yacc.c */ 7028 #line 149 4"parser.yy"7029 #line 1495 "parser.yy" 7029 7030 { (yyval.decl) = 0; } 7030 7031 break; … … 7033 7034 7034 7035 /* Line 1806 of yacc.c */ 7035 #line 149 6"parser.yy"7036 #line 1497 "parser.yy" 7036 7037 { (yyval.decl) = (yyvsp[(1) - (2)].decl) != 0 ? (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(2) - (2)].decl) ) : (yyvsp[(2) - (2)].decl); } 7037 7038 break; … … 7040 7041 7041 7042 /* Line 1806 of yacc.c */ 7042 #line 150 2"parser.yy"7043 #line 1503 "parser.yy" 7043 7044 { (yyval.decl) = (yyvsp[(2) - (3)].decl)->set_extension( true ); } 7044 7045 break; … … 7047 7048 7048 7049 /* Line 1806 of yacc.c */ 7049 #line 150 5"parser.yy"7050 #line 1506 "parser.yy" 7050 7051 { // mark all fields in list 7051 7052 for ( DeclarationNode *iter = (yyvsp[(2) - (3)].decl); iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) … … 7058 7059 7059 7060 /* Line 1806 of yacc.c */ 7060 #line 151 5"parser.yy"7061 #line 1516 "parser.yy" 7061 7062 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addName( (yyvsp[(2) - (2)].tok) ); } 7062 7063 break; … … 7065 7066 7066 7067 /* Line 1806 of yacc.c */ 7067 #line 151 7"parser.yy"7068 #line 1518 "parser.yy" 7068 7069 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(1) - (3)].decl)->cloneType( (yyvsp[(3) - (3)].tok) ) ); } 7069 7070 break; … … 7072 7073 7073 7074 /* Line 1806 of yacc.c */ 7074 #line 15 19"parser.yy"7075 #line 1520 "parser.yy" 7075 7076 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(1) - (2)].decl)->cloneType( 0 ) ); } 7076 7077 break; … … 7079 7080 7080 7081 /* Line 1806 of yacc.c */ 7081 #line 152 4"parser.yy"7082 #line 1525 "parser.yy" 7082 7083 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); } 7083 7084 break; … … 7086 7087 7087 7088 /* Line 1806 of yacc.c */ 7088 #line 152 6"parser.yy"7089 #line 1527 "parser.yy" 7089 7090 { (yyval.decl) = (yyvsp[(1) - (4)].decl)->appendList( (yyvsp[(1) - (4)].decl)->cloneBaseType( (yyvsp[(4) - (4)].decl) ) ); } 7090 7091 break; … … 7093 7094 7094 7095 /* Line 1806 of yacc.c */ 7095 #line 153 1"parser.yy"7096 #line 1532 "parser.yy" 7096 7097 { (yyval.decl) = DeclarationNode::newName( 0 ); /* XXX */ } 7097 7098 break; … … 7100 7101 7101 7102 /* Line 1806 of yacc.c */ 7102 #line 153 3"parser.yy"7103 #line 1534 "parser.yy" 7103 7104 { (yyval.decl) = DeclarationNode::newBitfield( (yyvsp[(1) - (1)].en) ); } 7104 7105 break; … … 7107 7108 7108 7109 /* Line 1806 of yacc.c */ 7109 #line 153 6"parser.yy"7110 #line 1537 "parser.yy" 7110 7111 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addBitfield( (yyvsp[(2) - (2)].en) ); } 7111 7112 break; … … 7114 7115 7115 7116 /* Line 1806 of yacc.c */ 7116 #line 15 39"parser.yy"7117 #line 1540 "parser.yy" 7117 7118 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addBitfield( (yyvsp[(2) - (2)].en) ); } 7118 7119 break; … … 7121 7122 7122 7123 /* Line 1806 of yacc.c */ 7123 #line 154 5"parser.yy"7124 #line 1546 "parser.yy" 7124 7125 { (yyval.en) = 0; } 7125 7126 break; … … 7128 7129 7129 7130 /* Line 1806 of yacc.c */ 7130 #line 154 7"parser.yy"7131 #line 1548 "parser.yy" 7131 7132 { (yyval.en) = (yyvsp[(1) - (1)].en); } 7132 7133 break; … … 7135 7136 7136 7137 /* Line 1806 of yacc.c */ 7137 #line 155 2"parser.yy"7138 #line 1553 "parser.yy" 7138 7139 { (yyval.en) = (yyvsp[(2) - (2)].en); } 7139 7140 break; … … 7142 7143 7143 7144 /* Line 1806 of yacc.c */ 7144 #line 156 1"parser.yy"7145 { (yyval.decl) = DeclarationNode::newEnum( 0, (yyvsp[(3) - (5)].decl) ); }7145 #line 1562 "parser.yy" 7146 { (yyval.decl) = DeclarationNode::newEnum( nullptr, (yyvsp[(3) - (5)].decl) ); } 7146 7147 break; 7147 7148 … … 7149 7150 7150 7151 /* Line 1806 of yacc.c */ 7151 #line 156 3"parser.yy"7152 #line 1564 "parser.yy" 7152 7153 { 7153 7154 typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); … … 7159 7160 7160 7161 /* Line 1806 of yacc.c */ 7161 #line 156 8"parser.yy"7162 #line 1569 "parser.yy" 7162 7163 { typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); } 7163 7164 break; … … 7166 7167 7167 7168 /* Line 1806 of yacc.c */ 7168 #line 157 0"parser.yy"7169 #line 1571 "parser.yy" 7169 7170 { (yyval.decl) = DeclarationNode::newEnum( (yyvsp[(2) - (7)].tok), (yyvsp[(5) - (7)].decl) ); } 7170 7171 break; … … 7173 7174 7174 7175 /* Line 1806 of yacc.c */ 7175 #line 157 5"parser.yy"7176 #line 1576 "parser.yy" 7176 7177 { (yyval.decl) = DeclarationNode::newEnumConstant( (yyvsp[(1) - (2)].tok), (yyvsp[(2) - (2)].en) ); } 7177 7178 break; … … 7180 7181 7181 7182 /* Line 1806 of yacc.c */ 7182 #line 157 7"parser.yy"7183 #line 1578 "parser.yy" 7183 7184 { (yyval.decl) = (yyvsp[(1) - (4)].decl)->appendList( DeclarationNode::newEnumConstant( (yyvsp[(3) - (4)].tok), (yyvsp[(4) - (4)].en) ) ); } 7184 7185 break; … … 7187 7188 7188 7189 /* Line 1806 of yacc.c */ 7189 #line 158 2"parser.yy"7190 #line 1583 "parser.yy" 7190 7191 { (yyval.en) = 0; } 7191 7192 break; … … 7194 7195 7195 7196 /* Line 1806 of yacc.c */ 7196 #line 158 4"parser.yy"7197 #line 1585 "parser.yy" 7197 7198 { (yyval.en) = (yyvsp[(2) - (2)].en); } 7198 7199 break; … … 7201 7202 7202 7203 /* Line 1806 of yacc.c */ 7203 #line 159 1"parser.yy"7204 #line 1592 "parser.yy" 7204 7205 { (yyval.decl) = 0; } 7205 7206 break; … … 7208 7209 7209 7210 /* Line 1806 of yacc.c */ 7210 #line 1 599"parser.yy"7211 #line 1600 "parser.yy" 7211 7212 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); } 7212 7213 break; … … 7215 7216 7216 7217 /* Line 1806 of yacc.c */ 7217 #line 160 1"parser.yy"7218 #line 1602 "parser.yy" 7218 7219 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); } 7219 7220 break; … … 7222 7223 7223 7224 /* Line 1806 of yacc.c */ 7224 #line 160 3"parser.yy"7225 #line 1604 "parser.yy" 7225 7226 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); } 7226 7227 break; … … 7229 7230 7230 7231 /* Line 1806 of yacc.c */ 7231 #line 161 1"parser.yy"7232 #line 1612 "parser.yy" 7232 7233 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); } 7233 7234 break; … … 7236 7237 7237 7238 /* Line 1806 of yacc.c */ 7238 #line 161 3"parser.yy"7239 #line 1614 "parser.yy" 7239 7240 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); } 7240 7241 break; … … 7243 7244 7244 7245 /* Line 1806 of yacc.c */ 7245 #line 161 5"parser.yy"