Changeset aee7e35
- Timestamp:
- Sep 29, 2016, 10:48:09 AM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, 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"7246 #line 1616 "parser.yy" 7246 7247 { (yyval.decl) = (yyvsp[(1) - (9)].decl)->appendList( (yyvsp[(5) - (9)].decl) )->appendList( (yyvsp[(9) - (9)].decl) ); } 7247 7248 break; … … 7250 7251 7251 7252 /* Line 1806 of yacc.c */ 7252 #line 162 1"parser.yy"7253 #line 1622 "parser.yy" 7253 7254 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); } 7254 7255 break; … … 7257 7258 7258 7259 /* Line 1806 of yacc.c */ 7259 #line 162 6"parser.yy"7260 #line 1627 "parser.yy" 7260 7261 { (yyval.decl) = 0; } 7261 7262 break; … … 7264 7265 7265 7266 /* Line 1806 of yacc.c */ 7266 #line 163 3"parser.yy"7267 #line 1634 "parser.yy" 7267 7268 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); } 7268 7269 break; … … 7271 7272 7272 7273 /* Line 1806 of yacc.c */ 7273 #line 164 0"parser.yy"7274 #line 1641 "parser.yy" 7274 7275 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); } 7275 7276 break; … … 7278 7279 7279 7280 /* Line 1806 of yacc.c */ 7280 #line 164 2"parser.yy"7281 #line 1643 "parser.yy" 7281 7282 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); } 7282 7283 break; … … 7285 7286 7286 7287 /* Line 1806 of yacc.c */ 7287 #line 165 1"parser.yy"7288 #line 1652 "parser.yy" 7288 7289 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addName( (yyvsp[(2) - (3)].tok) ); } 7289 7290 break; … … 7292 7293 7293 7294 /* Line 1806 of yacc.c */ 7294 #line 165 4"parser.yy"7295 #line 1655 "parser.yy" 7295 7296 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addName( (yyvsp[(2) - (3)].tok) ); } 7296 7297 break; … … 7299 7300 7300 7301 /* Line 1806 of yacc.c */ 7301 #line 165 6"parser.yy"7302 #line 1657 "parser.yy" 7302 7303 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addName( (yyvsp[(3) - (4)].tok) )->addQualifiers( (yyvsp[(1) - (4)].decl) ); } 7303 7304 break; … … 7306 7307 7307 7308 /* Line 1806 of yacc.c */ 7308 #line 166 6"parser.yy"7309 #line 1667 "parser.yy" 7309 7310 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 7310 7311 break; … … 7313 7314 7314 7315 /* Line 1806 of yacc.c */ 7315 #line 167 2"parser.yy"7316 #line 1673 "parser.yy" 7316 7317 { 7317 7318 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7323 7324 7324 7325 /* Line 1806 of yacc.c */ 7325 #line 167 7"parser.yy"7326 #line 1678 "parser.yy" 7326 7327 { 7327 7328 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7333 7334 7334 7335 /* Line 1806 of yacc.c */ 7335 #line 168 6"parser.yy"7336 #line 1687 "parser.yy" 7336 7337 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); } 7337 7338 break; … … 7340 7341 7341 7342 /* Line 1806 of yacc.c */ 7342 #line 169 5"parser.yy"7343 #line 1696 "parser.yy" 7343 7344 { (yyval.decl) = DeclarationNode::newName( (yyvsp[(1) - (1)].tok) ); } 7344 7345 break; … … 7347 7348 7348 7349 /* Line 1806 of yacc.c */ 7349 #line 169 7"parser.yy"7350 #line 1698 "parser.yy" 7350 7351 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( DeclarationNode::newName( (yyvsp[(3) - (3)].tok) ) ); } 7351 7352 break; … … 7354 7355 7355 7356 /* Line 1806 of yacc.c */ 7356 #line 172 2"parser.yy"7357 #line 1723 "parser.yy" 7357 7358 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); } 7358 7359 break; … … 7361 7362 7362 7363 /* Line 1806 of yacc.c */ 7363 #line 173 0"parser.yy"7364 #line 1731 "parser.yy" 7364 7365 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); } 7365 7366 break; … … 7368 7369 7369 7370 /* Line 1806 of yacc.c */ 7370 #line 173 5"parser.yy"7371 #line 1736 "parser.yy" 7371 7372 { (yyval.in) = 0; } 7372 7373 break; … … 7375 7376 7376 7377 /* Line 1806 of yacc.c */ 7377 #line 173 7"parser.yy"7378 #line 1738 "parser.yy" 7378 7379 { (yyval.in) = (yyvsp[(2) - (2)].in); } 7379 7380 break; … … 7382 7383 7383 7384 /* Line 1806 of yacc.c */ 7384 #line 17 39"parser.yy"7385 #line 1740 "parser.yy" 7385 7386 { (yyval.in) = (yyvsp[(2) - (2)].in)->set_maybeConstructed( false ); } 7386 7387 break; … … 7389 7390 7390 7391 /* Line 1806 of yacc.c */ 7391 #line 174 3"parser.yy"7392 #line 1744 "parser.yy" 7392 7393 { (yyval.in) = new InitializerNode( (yyvsp[(1) - (1)].en) ); } 7393 7394 break; … … 7396 7397 7397 7398 /* Line 1806 of yacc.c */ 7398 #line 174 4"parser.yy"7399 #line 1745 "parser.yy" 7399 7400 { (yyval.in) = new InitializerNode( (yyvsp[(2) - (4)].in), true ); } 7400 7401 break; … … 7403 7404 7404 7405 /* Line 1806 of yacc.c */ 7405 #line 17 49"parser.yy"7406 #line 1750 "parser.yy" 7406 7407 { (yyval.in) = 0; } 7407 7408 break; … … 7410 7411 7411 7412 /* Line 1806 of yacc.c */ 7412 #line 175 1"parser.yy"7413 #line 1752 "parser.yy" 7413 7414 { (yyval.in) = (yyvsp[(2) - (2)].in)->set_designators( (yyvsp[(1) - (2)].en) ); } 7414 7415 break; … … 7417 7418 7418 7419 /* Line 1806 of yacc.c */ 7419 #line 175 2"parser.yy"7420 #line 1753 "parser.yy" 7420 7421 { (yyval.in) = (InitializerNode *)( (yyvsp[(1) - (3)].in)->set_last( (yyvsp[(3) - (3)].in) ) ); } 7421 7422 break; … … 7424 7425 7425 7426 /* Line 1806 of yacc.c */ 7426 #line 175 4"parser.yy"7427 #line 1755 "parser.yy" 7427 7428 { (yyval.in) = (InitializerNode *)( (yyvsp[(1) - (4)].in)->set_last( (yyvsp[(4) - (4)].in)->set_designators( (yyvsp[(3) - (4)].en) ) ) ); } 7428 7429 break; … … 7431 7432 7432 7433 /* Line 1806 of yacc.c */ 7433 #line 177 0"parser.yy"7434 #line 1771 "parser.yy" 7434 7435 { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(1) - (2)].tok) ) ); } 7435 7436 break; … … 7438 7439 7439 7440 /* Line 1806 of yacc.c */ 7440 #line 177 6"parser.yy"7441 #line 1777 "parser.yy" 7441 7442 { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (2)].en)->set_last( (yyvsp[(2) - (2)].en) ) ); } 7442 7443 break; … … 7445 7446 7446 7447 /* Line 1806 of yacc.c */ 7447 #line 178 2"parser.yy"7448 #line 1783 "parser.yy" 7448 7449 { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(2) - (2)].tok) ) ); } 7449 7450 break; … … 7452 7453 7453 7454 /* Line 1806 of yacc.c */ 7454 #line 178 5"parser.yy"7455 #line 1786 "parser.yy" 7455 7456 { (yyval.en) = (yyvsp[(3) - (5)].en); } 7456 7457 break; … … 7459 7460 7460 7461 /* Line 1806 of yacc.c */ 7461 #line 178 7"parser.yy"7462 #line 1788 "parser.yy" 7462 7463 { (yyval.en) = (yyvsp[(3) - (5)].en); } 7463 7464 break; … … 7466 7467 7467 7468 /* Line 1806 of yacc.c */ 7468 #line 17 89"parser.yy"7469 #line 1790 "parser.yy" 7469 7470 { (yyval.en) = new ExpressionNode( build_range( (yyvsp[(3) - (7)].en), (yyvsp[(5) - (7)].en) ) ); } 7470 7471 break; … … 7473 7474 7474 7475 /* Line 1806 of yacc.c */ 7475 #line 179 1"parser.yy"7476 #line 1792 "parser.yy" 7476 7477 { (yyval.en) = (yyvsp[(4) - (6)].en); } 7477 7478 break; … … 7480 7481 7481 7482 /* Line 1806 of yacc.c */ 7482 #line 181 5"parser.yy"7483 #line 1816 "parser.yy" 7483 7484 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 7484 7485 break; … … 7487 7488 7488 7489 /* Line 1806 of yacc.c */ 7489 #line 181 7"parser.yy"7490 #line 1818 "parser.yy" 7490 7491 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 7491 7492 break; … … 7494 7495 7495 7496 /* Line 1806 of yacc.c */ 7496 #line 18 19"parser.yy"7497 #line 1820 "parser.yy" 7497 7498 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); } 7498 7499 break; … … 7501 7502 7502 7503 /* Line 1806 of yacc.c */ 7503 #line 182 5"parser.yy"7504 #line 1826 "parser.yy" 7504 7505 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 7505 7506 break; … … 7508 7509 7509 7510 /* Line 1806 of yacc.c */ 7510 #line 182 7"parser.yy"7511 #line 1828 "parser.yy" 7511 7512 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 7512 7513 break; … … 7515 7516 7516 7517 /* Line 1806 of yacc.c */ 7517 #line 183 2"parser.yy"7518 #line 1833 "parser.yy" 7518 7519 { (yyval.decl) = DeclarationNode::newFromTypeGen( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].en) ); } 7519 7520 break; … … 7522 7523 7523 7524 /* Line 1806 of yacc.c */ 7524 #line 183 8"parser.yy"7525 #line 1839 "parser.yy" 7525 7526 { (yyval.decl) = (yyvsp[(1) - (4)].decl)->appendList( (yyvsp[(3) - (4)].decl) ); } 7526 7527 break; … … 7529 7530 7530 7531 /* Line 1806 of yacc.c */ 7531 #line 184 3"parser.yy"7532 #line 1844 "parser.yy" 7532 7533 { typedefTable.addToEnclosingScope( *(yyvsp[(2) - (2)].tok), TypedefTable::TD ); } 7533 7534 break; … … 7536 7537 7537 7538 /* Line 1806 of yacc.c */ 7538 #line 184 5"parser.yy"7539 #line 1846 "parser.yy" 7539 7540 { (yyval.decl) = DeclarationNode::newTypeParam( (yyvsp[(1) - (4)].tclass), (yyvsp[(2) - (4)].tok) )->addAssertions( (yyvsp[(4) - (4)].decl) ); } 7540 7541 break; … … 7543 7544 7544 7545 /* Line 1806 of yacc.c */ 7545 #line 185 1"parser.yy"7546 #line 1852 "parser.yy" 7546 7547 { (yyval.tclass) = DeclarationNode::Otype; } 7547 7548 break; … … 7550 7551 7551 7552 /* Line 1806 of yacc.c */ 7552 #line 185 3"parser.yy"7553 #line 1854 "parser.yy" 7553 7554 { (yyval.tclass) = DeclarationNode::Ftype; } 7554 7555 break; … … 7557 7558 7558 7559 /* Line 1806 of yacc.c */ 7559 #line 185 5"parser.yy"7560 #line 1856 "parser.yy" 7560 7561 { (yyval.tclass) = DeclarationNode::Dtype; } 7561 7562 break; … … 7564 7565 7565 7566 /* Line 1806 of yacc.c */ 7566 #line 186 0"parser.yy"7567 #line 1861 "parser.yy" 7567 7568 { (yyval.decl) = 0; } 7568 7569 break; … … 7571 7572 7572 7573 /* Line 1806 of yacc.c */ 7573 #line 186 2"parser.yy"7574 #line 1863 "parser.yy" 7574 7575 { (yyval.decl) = (yyvsp[(1) - (2)].decl) != 0 ? (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(2) - (2)].decl) ) : (yyvsp[(2) - (2)].decl); } 7575 7576 break; … … 7578 7579 7579 7580 /* Line 1806 of yacc.c */ 7580 #line 186 7"parser.yy"7581 #line 1868 "parser.yy" 7581 7582 { 7582 7583 typedefTable.openTrait( *(yyvsp[(2) - (5)].tok) ); … … 7588 7589 7589 7590 /* Line 1806 of yacc.c */ 7590 #line 187 2"parser.yy"7591 #line 1873 "parser.yy" 7591 7592 { (yyval.decl) = (yyvsp[(4) - (5)].decl); } 7592 7593 break; … … 7595 7596 7596 7597 /* Line 1806 of yacc.c */ 7597 #line 187 4"parser.yy"7598 #line 1875 "parser.yy" 7598 7599 { (yyval.decl) = 0; } 7599 7600 break; … … 7602 7603 7603 7604 /* Line 1806 of yacc.c */ 7604 #line 18 79"parser.yy"7605 #line 1880 "parser.yy" 7605 7606 { (yyval.en) = new ExpressionNode( build_typevalue( (yyvsp[(1) - (1)].decl) ) ); } 7606 7607 break; … … 7609 7610 7610 7611 /* Line 1806 of yacc.c */ 7611 #line 188 2"parser.yy"7612 #line 1883 "parser.yy" 7612 7613 { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_last( new ExpressionNode( build_typevalue( (yyvsp[(3) - (3)].decl) ) ) ) ); } 7613 7614 break; … … 7616 7617 7617 7618 /* Line 1806 of yacc.c */ 7618 #line 188 4"parser.yy"7619 #line 1885 "parser.yy" 7619 7620 { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) )); } 7620 7621 break; … … 7623 7624 7624 7625 /* Line 1806 of yacc.c */ 7625 #line 18 89"parser.yy"7626 #line 1890 "parser.yy" 7626 7627 { (yyval.decl) = (yyvsp[(2) - (2)].decl); } 7627 7628 break; … … 7630 7631 7631 7632 /* Line 1806 of yacc.c */ 7632 #line 189 1"parser.yy"7633 #line 1892 "parser.yy" 7633 7634 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addQualifiers( (yyvsp[(1) - (3)].decl) ); } 7634 7635 break; … … 7637 7638 7638 7639 /* Line 1806 of yacc.c */ 7639 #line 189 3"parser.yy"7640 #line 1894 "parser.yy" 7640 7641 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl)->copyStorageClasses( (yyvsp[(1) - (3)].decl) ) ); } 7641 7642 break; … … 7644 7645 7645 7646 /* Line 1806 of yacc.c */ 7646 #line 189 8"parser.yy"7647 #line 1899 "parser.yy" 7647 7648 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addAssertions( (yyvsp[(2) - (2)].decl) ); } 7648 7649 break; … … 7651 7652 7652 7653 /* Line 1806 of yacc.c */ 7653 #line 190 0"parser.yy"7654 #line 1901 "parser.yy" 7654 7655 { (yyval.decl) = (yyvsp[(1) - (4)].decl)->addAssertions( (yyvsp[(2) - (4)].decl) )->addType( (yyvsp[(4) - (4)].decl) ); } 7655 7656 break; … … 7658 7659 7659 7660 /* Line 1806 of yacc.c */ 7660 #line 190 5"parser.yy"7661 #line 1906 "parser.yy" 7661 7662 { 7662 7663 typedefTable.addToEnclosingScope( *(yyvsp[(1) - (1)].tok), TypedefTable::TD ); … … 7668 7669 7669 7670 /* Line 1806 of yacc.c */ 7670 #line 191 0"parser.yy"7671 #line 1911 "parser.yy" 7671 7672 { 7672 7673 typedefTable.addToEnclosingScope( *(yyvsp[(1) - (6)].tok), TypedefTable::TG ); … … 7678 7679 7679 7680 /* Line 1806 of yacc.c */ 7680 #line 191 8"parser.yy"7681 #line 1919 "parser.yy" 7681 7682 { 7682 7683 typedefTable.addToEnclosingScope( *(yyvsp[(2) - (9)].tok), TypedefTable::ID ); … … 7688 7689 7689 7690 /* Line 1806 of yacc.c */ 7690 #line 192 3"parser.yy"7691 #line 1924 "parser.yy" 7691 7692 { 7692 7693 typedefTable.enterTrait( *(yyvsp[(2) - (8)].tok) ); … … 7698 7699 7699 7700 /* Line 1806 of yacc.c */ 7700 #line 192 8"parser.yy"7701 #line 1929 "parser.yy" 7701 7702 { 7702 7703 typedefTable.leaveTrait(); … … 7709 7710 7710 7711 /* Line 1806 of yacc.c */ 7711 #line 193 8"parser.yy"7712 #line 1939 "parser.yy" 7712 7713 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ); } 7713 7714 break; … … 7716 7717 7717 7718 /* Line 1806 of yacc.c */ 7718 #line 194 8"parser.yy"7719 #line 1949 "parser.yy" 7719 7720 { 7720 7721 typedefTable.addToEnclosingScope2( TypedefTable::ID ); … … 7726 7727 7727 7728 /* Line 1806 of yacc.c */ 7728 #line 195 3"parser.yy"7729 #line 1954 "parser.yy" 7729 7730 { 7730 7731 typedefTable.addToEnclosingScope2( TypedefTable::ID ); … … 7736 7737 7737 7738 /* Line 1806 of yacc.c */ 7738 #line 195 8"parser.yy"7739 #line 1959 "parser.yy" 7739 7740 { 7740 7741 typedefTable.addToEnclosingScope2( *(yyvsp[(5) - (5)].tok), TypedefTable::ID ); … … 7746 7747 7747 7748 /* Line 1806 of yacc.c */ 7748 #line 196 6"parser.yy"7749 #line 1967 "parser.yy" 7749 7750 { 7750 7751 typedefTable.addToEnclosingScope2( TypedefTable::ID ); … … 7756 7757 7757 7758 /* Line 1806 of yacc.c */ 7758 #line 197 1"parser.yy"7759 #line 1972 "parser.yy" 7759 7760 { 7760 7761 typedefTable.addToEnclosingScope2( TypedefTable::ID ); … … 7766 7767 7767 7768 /* Line 1806 of yacc.c */ 7768 #line 198 1"parser.yy"7769 #line 1982 "parser.yy" 7769 7770 {} 7770 7771 break; … … 7773 7774 7774 7775 /* Line 1806 of yacc.c */ 7775 #line 198 3"parser.yy"7776 #line 1984 "parser.yy" 7776 7777 { parseTree = parseTree != nullptr ? parseTree->appendList( (yyvsp[(1) - (1)].decl) ) : (yyvsp[(1) - (1)].decl); } 7777 7778 break; … … 7780 7781 7781 7782 /* Line 1806 of yacc.c */ 7782 #line 19 89"parser.yy"7783 #line 1990 "parser.yy" 7783 7784 { (yyval.decl) = (yyvsp[(1) - (3)].decl) != nullptr ? (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ) : (yyvsp[(3) - (3)].decl); } 7784 7785 break; … … 7787 7788 7788 7789 /* Line 1806 of yacc.c */ 7789 #line 199 4"parser.yy"7790 #line 1995 "parser.yy" 7790 7791 { (yyval.decl) = 0; } 7791 7792 break; … … 7794 7795 7795 7796 /* Line 1806 of yacc.c */ 7796 #line 200 2"parser.yy"7797 #line 2003 "parser.yy" 7797 7798 {} 7798 7799 break; … … 7801 7802 7802 7803 /* Line 1806 of yacc.c */ 7803 #line 200 4"parser.yy"7804 #line 2005 "parser.yy" 7804 7805 { 7805 7806 linkageStack.push( linkage ); // handle nested extern "C"/"Cforall" … … 7811 7812 7812 7813 /* Line 1806 of yacc.c */ 7813 #line 20 09"parser.yy"7814 #line 2010 "parser.yy" 7814 7815 { 7815 7816 linkage = linkageStack.top(); … … 7822 7823 7823 7824 /* Line 1806 of yacc.c */ 7824 #line 201 5"parser.yy"7825 #line 2016 "parser.yy" 7825 7826 { // mark all fields in list 7826 7827 for ( DeclarationNode *iter = (yyvsp[(2) - (2)].decl); iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) … … 7833 7834 7834 7835 /* Line 1806 of yacc.c */ 7835 #line 203 0"parser.yy"7836 #line 2031 "parser.yy" 7836 7837 { 7837 7838 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7844 7845 7845 7846 /* Line 1806 of yacc.c */ 7846 #line 203 6"parser.yy"7847 #line 2037 "parser.yy" 7847 7848 { 7848 7849 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7855 7856 7856 7857 /* Line 1806 of yacc.c */ 7857 #line 204 5"parser.yy"7858 #line 2046 "parser.yy" 7858 7859 { 7859 7860 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7866 7867 7867 7868 /* Line 1806 of yacc.c */ 7868 #line 205 1"parser.yy"7869 #line 2052 "parser.yy" 7869 7870 { 7870 7871 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7877 7878 7878 7879 /* Line 1806 of yacc.c */ 7879 #line 205 7"parser.yy"7880 #line 2058 "parser.yy" 7880 7881 { 7881 7882 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7888 7889 7889 7890 /* Line 1806 of yacc.c */ 7890 #line 206 3"parser.yy"7891 #line 2064 "parser.yy" 7891 7892 { 7892 7893 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7899 7900 7900 7901 /* Line 1806 of yacc.c */ 7901 #line 20 69"parser.yy"7902 #line 2070 "parser.yy" 7902 7903 { 7903 7904 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7910 7911 7911 7912 /* Line 1806 of yacc.c */ 7912 #line 207 7"parser.yy"7913 #line 2078 "parser.yy" 7913 7914 { 7914 7915 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7921 7922 7922 7923 /* Line 1806 of yacc.c */ 7923 #line 208 3"parser.yy"7924 #line 2084 "parser.yy" 7924 7925 { 7925 7926 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7932 7933 7933 7934 /* Line 1806 of yacc.c */ 7934 #line 209 1"parser.yy"7935 #line 2092 "parser.yy" 7935 7936 { 7936 7937 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7943 7944 7944 7945 /* Line 1806 of yacc.c */ 7945 #line 209 7"parser.yy"7946 #line 2098 "parser.yy" 7946 7947 { 7947 7948 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7954 7955 7955 7956 /* Line 1806 of yacc.c */ 7956 #line 211 2"parser.yy"7957 #line 2113 "parser.yy" 7957 7958 { (yyval.en) = new ExpressionNode( build_range( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 7958 7959 break; … … 7961 7962 7962 7963 /* Line 1806 of yacc.c */ 7963 #line 211 7"parser.yy"7964 #line 2118 "parser.yy" 7964 7965 { delete (yyvsp[(3) - (5)].str); } 7965 7966 break; … … 7968 7969 7969 7970 /* Line 1806 of yacc.c */ 7970 #line 212 2"parser.yy"7971 #line 2123 "parser.yy" 7971 7972 { (yyval.decl) = 0; } 7972 7973 break; … … 7975 7976 7976 7977 /* Line 1806 of yacc.c */ 7977 #line 21 29"parser.yy"7978 #line 2130 "parser.yy" 7978 7979 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 7979 7980 break; … … 7982 7983 7983 7984 /* Line 1806 of yacc.c */ 7984 #line 213 5"parser.yy"7985 #line 2136 "parser.yy" 7985 7986 { (yyval.decl) = 0; } 7986 7987 break; … … 7989 7990 7990 7991 /* Line 1806 of yacc.c */ 7991 #line 214 6"parser.yy"7992 #line 2147 "parser.yy" 7992 7993 { delete (yyvsp[(3) - (4)].en); } 7993 7994 break; … … 7996 7997 7997 7998 /* Line 1806 of yacc.c */ 7998 #line 215 0"parser.yy"7999 #line 2151 "parser.yy" 7999 8000 { delete (yyvsp[(1) - (1)].tok); } 8000 8001 break; 8001 8002 8002 8003 case 557: 8003 8004 /* Line 1806 of yacc.c */8005 #line 2151 "parser.yy"8006 { delete (yyvsp[(1) - (1)].decl); }8007 break;8008 8009 case 558:8010 8004 8011 8005 /* Line 1806 of yacc.c */ … … 8014 8008 break; 8015 8009 8016 case 55 9:8010 case 558: 8017 8011 8018 8012 /* Line 1806 of yacc.c */ … … 8021 8015 break; 8022 8016 8017 case 559: 8018 8019 /* Line 1806 of yacc.c */ 8020 #line 2154 "parser.yy" 8021 { delete (yyvsp[(1) - (1)].decl); } 8022 break; 8023 8023 8024 case 560: 8024 8025 8025 8026 /* Line 1806 of yacc.c */ 8026 #line 218 8"parser.yy"8027 #line 2189 "parser.yy" 8027 8028 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8028 8029 break; … … 8031 8032 8032 8033 /* Line 1806 of yacc.c */ 8033 #line 219 1"parser.yy"8034 #line 2192 "parser.yy" 8034 8035 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8035 8036 break; … … 8038 8039 8039 8040 /* Line 1806 of yacc.c */ 8040 #line 219 3"parser.yy"8041 #line 2194 "parser.yy" 8041 8042 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8042 8043 break; … … 8045 8046 8046 8047 /* Line 1806 of yacc.c */ 8047 #line 219 8"parser.yy"8048 #line 2199 "parser.yy" 8048 8049 { 8049 8050 typedefTable.setNextIdentifier( *(yyvsp[(1) - (1)].tok) ); … … 8055 8056 8056 8057 /* Line 1806 of yacc.c */ 8057 #line 220 3"parser.yy"8058 #line 2204 "parser.yy" 8058 8059 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8059 8060 break; … … 8062 8063 8063 8064 /* Line 1806 of yacc.c */ 8064 #line 220 8"parser.yy"8065 #line 2209 "parser.yy" 8065 8066 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8066 8067 break; … … 8069 8070 8070 8071 /* Line 1806 of yacc.c */ 8071 #line 221 0"parser.yy"8072 #line 2211 "parser.yy" 8072 8073 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8073 8074 break; … … 8076 8077 8077 8078 /* Line 1806 of yacc.c */ 8078 #line 221 2"parser.yy"8079 #line 2213 "parser.yy" 8079 8080 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8080 8081 break; … … 8083 8084 8084 8085 /* Line 1806 of yacc.c */ 8085 #line 221 7"parser.yy"8086 #line 2218 "parser.yy" 8086 8087 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); } 8087 8088 break; … … 8090 8091 8091 8092 /* Line 1806 of yacc.c */ 8092 #line 22 19"parser.yy"8093 #line 2220 "parser.yy" 8093 8094 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8094 8095 break; … … 8097 8098 8098 8099 /* Line 1806 of yacc.c */ 8099 #line 222 1"parser.yy"8100 #line 2222 "parser.yy" 8100 8101 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8101 8102 break; … … 8104 8105 8105 8106 /* Line 1806 of yacc.c */ 8106 #line 222 3"parser.yy"8107 #line 2224 "parser.yy" 8107 8108 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8108 8109 break; … … 8111 8112 8112 8113 /* Line 1806 of yacc.c */ 8113 #line 222 8"parser.yy"8114 #line 2229 "parser.yy" 8114 8115 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8115 8116 break; … … 8118 8119 8119 8120 /* Line 1806 of yacc.c */ 8120 #line 223 0"parser.yy"8121 #line 2231 "parser.yy" 8121 8122 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8122 8123 break; … … 8125 8126 8126 8127 /* Line 1806 of yacc.c */ 8127 #line 22 39"parser.yy"8128 #line 2240 "parser.yy" 8128 8129 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8129 8130 break; … … 8132 8133 8133 8134 /* Line 1806 of yacc.c */ 8134 #line 224 2"parser.yy"8135 #line 2243 "parser.yy" 8135 8136 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8136 8137 break; … … 8139 8140 8140 8141 /* Line 1806 of yacc.c */ 8141 #line 224 7"parser.yy"8142 #line 2248 "parser.yy" 8142 8143 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); } 8143 8144 break; … … 8146 8147 8147 8148 /* Line 1806 of yacc.c */ 8148 #line 22 49"parser.yy"8149 #line 2250 "parser.yy" 8149 8150 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8150 8151 break; … … 8153 8154 8154 8155 /* Line 1806 of yacc.c */ 8155 #line 225 1"parser.yy"8156 #line 2252 "parser.yy" 8156 8157 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8157 8158 break; … … 8160 8161 8161 8162 /* Line 1806 of yacc.c */ 8162 #line 225 6"parser.yy"8163 #line 2257 "parser.yy" 8163 8164 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8164 8165 break; … … 8167 8168 8168 8169 /* Line 1806 of yacc.c */ 8169 #line 225 8"parser.yy"8170 #line 2259 "parser.yy" 8170 8171 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8171 8172 break; … … 8174 8175 8175 8176 /* Line 1806 of yacc.c */ 8176 #line 226 0"parser.yy"8177 #line 2261 "parser.yy" 8177 8178 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8178 8179 break; … … 8181 8182 8182 8183 /* Line 1806 of yacc.c */ 8183 #line 226 5"parser.yy"8184 #line 2266 "parser.yy" 8184 8185 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8185 8186 break; … … 8188 8189 8189 8190 /* Line 1806 of yacc.c */ 8190 #line 226 7"parser.yy"8191 #line 2268 "parser.yy" 8191 8192 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8192 8193 break; … … 8195 8196 8196 8197 /* Line 1806 of yacc.c */ 8197 #line 22 69"parser.yy"8198 #line 2270 "parser.yy" 8198 8199 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8199 8200 break; … … 8202 8203 8203 8204 /* Line 1806 of yacc.c */ 8204 #line 228 4"parser.yy"8205 #line 2285 "parser.yy" 8205 8206 { (yyval.decl) = (yyvsp[(1) - (4)].decl)->addIdList( (yyvsp[(3) - (4)].decl) ); } 8206 8207 break; … … 8209 8210 8210 8211 /* Line 1806 of yacc.c */ 8211 #line 228 6"parser.yy"8212 #line 2287 "parser.yy" 8212 8213 { (yyval.decl) = (yyvsp[(2) - (6)].decl)->addIdList( (yyvsp[(5) - (6)].decl) ); } 8213 8214 break; … … 8216 8217 8217 8218 /* Line 1806 of yacc.c */ 8218 #line 228 8"parser.yy"8219 #line 2289 "parser.yy" 8219 8220 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8220 8221 break; … … 8223 8224 8224 8225 /* Line 1806 of yacc.c */ 8225 #line 229 3"parser.yy"8226 #line 2294 "parser.yy" 8226 8227 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8227 8228 break; … … 8230 8231 8231 8232 /* Line 1806 of yacc.c */ 8232 #line 229 5"parser.yy"8233 #line 2296 "parser.yy" 8233 8234 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8234 8235 break; … … 8237 8238 8238 8239 /* Line 1806 of yacc.c */ 8239 #line 229 7"parser.yy"8240 #line 2298 "parser.yy" 8240 8241 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8241 8242 break; … … 8244 8245 8245 8246 /* Line 1806 of yacc.c */ 8246 #line 230 2"parser.yy"8247 #line 2303 "parser.yy" 8247 8248 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8248 8249 break; … … 8251 8252 8252 8253 /* Line 1806 of yacc.c */ 8253 #line 230 4"parser.yy"8254 #line 2305 "parser.yy" 8254 8255 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8255 8256 break; … … 8258 8259 8259 8260 /* Line 1806 of yacc.c */ 8260 #line 230 6"parser.yy"8261 #line 2307 "parser.yy" 8261 8262 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8262 8263 break; … … 8265 8266 8266 8267 /* Line 1806 of yacc.c */ 8267 #line 232 1"parser.yy"8268 #line 2322 "parser.yy" 8268 8269 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8269 8270 break; … … 8272 8273 8273 8274 /* Line 1806 of yacc.c */ 8274 #line 232 4"parser.yy"8275 #line 2325 "parser.yy" 8275 8276 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8276 8277 break; … … 8279 8280 8280 8281 /* Line 1806 of yacc.c */ 8281 #line 232 6"parser.yy"8282 #line 2327 "parser.yy" 8282 8283 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8283 8284 break; … … 8286 8287 8287 8288 /* Line 1806 of yacc.c */ 8288 #line 233 2"parser.yy"8289 #line 2333 "parser.yy" 8289 8290 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8290 8291 break; … … 8293 8294 8294 8295 /* Line 1806 of yacc.c */ 8295 #line 233 7"parser.yy"8296 #line 2338 "parser.yy" 8296 8297 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8297 8298 break; … … 8300 8301 8301 8302 /* Line 1806 of yacc.c */ 8302 #line 23 39"parser.yy"8303 #line 2340 "parser.yy" 8303 8304 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8304 8305 break; … … 8307 8308 8308 8309 /* Line 1806 of yacc.c */ 8309 #line 234 1"parser.yy"8310 #line 2342 "parser.yy" 8310 8311 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8311 8312 break; … … 8314 8315 8315 8316 /* Line 1806 of yacc.c */ 8316 #line 234 6"parser.yy"8317 #line 2347 "parser.yy" 8317 8318 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); } 8318 8319 break; … … 8321 8322 8322 8323 /* Line 1806 of yacc.c */ 8323 #line 234 8"parser.yy"8324 #line 2349 "parser.yy" 8324 8325 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8325 8326 break; … … 8328 8329 8329 8330 /* Line 1806 of yacc.c */ 8330 #line 235 0"parser.yy"8331 #line 2351 "parser.yy" 8331 8332 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8332 8333 break; … … 8335 8336 8336 8337 /* Line 1806 of yacc.c */ 8337 #line 235 2"parser.yy"8338 #line 2353 "parser.yy" 8338 8339 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8339 8340 break; … … 8342 8343 8343 8344 /* Line 1806 of yacc.c */ 8344 #line 235 7"parser.yy"8345 #line 2358 "parser.yy" 8345 8346 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); } 8346 8347 break; … … 8349 8350 8350 8351 /* Line 1806 of yacc.c */ 8351 #line 23 59"parser.yy"8352 #line 2360 "parser.yy" 8352 8353 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8353 8354 break; … … 8356 8357 8357 8358 /* Line 1806 of yacc.c */ 8358 #line 236 1"parser.yy"8359 #line 2362 "parser.yy" 8359 8360 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8360 8361 break; … … 8363 8364 8364 8365 /* Line 1806 of yacc.c */ 8365 #line 237 1"parser.yy"8366 #line 2372 "parser.yy" 8366 8367 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8367 8368 break; … … 8370 8371 8371 8372 /* Line 1806 of yacc.c */ 8372 #line 237 4"parser.yy"8373 #line 2375 "parser.yy" 8373 8374 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8374 8375 break; … … 8377 8378 8378 8379 /* Line 1806 of yacc.c */ 8379 #line 237 6"parser.yy"8380 #line 2377 "parser.yy" 8380 8381 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8381 8382 break; … … 8384 8385 8385 8386 /* Line 1806 of yacc.c */ 8386 #line 238 1"parser.yy"8387 #line 2382 "parser.yy" 8387 8388 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8388 8389 break; … … 8391 8392 8392 8393 /* Line 1806 of yacc.c */ 8393 #line 238 3"parser.yy"8394 #line 2384 "parser.yy" 8394 8395 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8395 8396 break; … … 8398 8399 8399 8400 /* Line 1806 of yacc.c */ 8400 #line 238 5"parser.yy"8401 #line 2386 "parser.yy" 8401 8402 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8402 8403 break; … … 8405 8406 8406 8407 /* Line 1806 of yacc.c */ 8407 #line 239 0"parser.yy"8408 #line 2391 "parser.yy" 8408 8409 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); } 8409 8410 break; … … 8412 8413 8413 8414 /* Line 1806 of yacc.c */ 8414 #line 239 2"parser.yy"8415 #line 2393 "parser.yy" 8415 8416 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8416 8417 break; … … 8419 8420 8420 8421 /* Line 1806 of yacc.c */ 8421 #line 239 4"parser.yy"8422 #line 2395 "parser.yy" 8422 8423 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8423 8424 break; … … 8426 8427 8427 8428 /* Line 1806 of yacc.c */ 8428 #line 239 6"parser.yy"8429 #line 2397 "parser.yy" 8429 8430 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8430 8431 break; … … 8433 8434 8434 8435 /* Line 1806 of yacc.c */ 8435 #line 240 1"parser.yy"8436 #line 2402 "parser.yy" 8436 8437 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); } 8437 8438 break; … … 8440 8441 8441 8442 /* Line 1806 of yacc.c */ 8442 #line 240 3"parser.yy"8443 #line 2404 "parser.yy" 8443 8444 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8444 8445 break; … … 8447 8448 8448 8449 /* Line 1806 of yacc.c */ 8449 #line 240 5"parser.yy"8450 #line 2406 "parser.yy" 8450 8451 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8451 8452 break; … … 8454 8455 8455 8456 /* Line 1806 of yacc.c */ 8456 #line 243 6"parser.yy"8457 #line 2437 "parser.yy" 8457 8458 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8458 8459 break; … … 8461 8462 8462 8463 /* Line 1806 of yacc.c */ 8463 #line 24 39"parser.yy"8464 #line 2440 "parser.yy" 8464 8465 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8465 8466 break; … … 8468 8469 8469 8470 /* Line 1806 of yacc.c */ 8470 #line 244 1"parser.yy"8471 #line 2442 "parser.yy" 8471 8472 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8472 8473 break; … … 8475 8476 8476 8477 /* Line 1806 of yacc.c */ 8477 #line 244 6"parser.yy"8478 #line 2447 "parser.yy" 8478 8479 { 8479 8480 typedefTable.setNextIdentifier( *(yyvsp[(1) - (1)].tok) ); … … 8485 8486 8486 8487 /* Line 1806 of yacc.c */ 8487 #line 245 1"parser.yy"8488 #line 2452 "parser.yy" 8488 8489 { 8489 8490 typedefTable.setNextIdentifier( *(yyvsp[(1) - (1)].tok) ); … … 8495 8496 8496 8497 /* Line 1806 of yacc.c */ 8497 #line 24 59"parser.yy"8498 #line 2460 "parser.yy" 8498 8499 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8499 8500 break; … … 8502 8503 8503 8504 /* Line 1806 of yacc.c */ 8504 #line 246 1"parser.yy"8505 #line 2462 "parser.yy" 8505 8506 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8506 8507 break; … … 8509 8510 8510 8511 /* Line 1806 of yacc.c */ 8511 #line 246 3"parser.yy"8512 #line 2464 "parser.yy" 8512 8513 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8513 8514 break; … … 8516 8517 8517 8518 /* Line 1806 of yacc.c */ 8518 #line 246 8"parser.yy"8519 #line 2469 "parser.yy" 8519 8520 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); } 8520 8521 break; … … 8523 8524 8524 8525 /* Line 1806 of yacc.c */ 8525 #line 247 0"parser.yy"8526 #line 2471 "parser.yy" 8526 8527 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8527 8528 break; … … 8530 8531 8531 8532 /* Line 1806 of yacc.c */ 8532 #line 247 5"parser.yy"8533 #line 2476 "parser.yy" 8533 8534 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); } 8534 8535 break; … … 8537 8538 8538 8539 /* Line 1806 of yacc.c */ 8539 #line 247 7"parser.yy"8540 #line 2478 "parser.yy" 8540 8541 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8541 8542 break; … … 8544 8545 8545 8546 /* Line 1806 of yacc.c */ 8546 #line 249 2"parser.yy"8547 #line 2493 "parser.yy" 8547 8548 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8548 8549 break; … … 8551 8552 8552 8553 /* Line 1806 of yacc.c */ 8553 #line 249 4"parser.yy"8554 #line 2495 "parser.yy" 8554 8555 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8555 8556 break; … … 8558 8559 8559 8560 /* Line 1806 of yacc.c */ 8560 #line 2 499"parser.yy"8561 #line 2500 "parser.yy" 8561 8562 { (yyval.decl) = DeclarationNode::newPointer( 0 ); } 8562 8563 break; … … 8565 8566 8566 8567 /* Line 1806 of yacc.c */ 8567 #line 250 1"parser.yy"8568 #line 2502 "parser.yy" 8568 8569 { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); } 8569 8570 break; … … 8572 8573 8573 8574 /* Line 1806 of yacc.c */ 8574 #line 250 3"parser.yy"8575 #line 2504 "parser.yy" 8575 8576 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8576 8577 break; … … 8579 8580 8580 8581 /* Line 1806 of yacc.c */ 8581 #line 250 5"parser.yy"8582 #line 2506 "parser.yy" 8582 8583 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8583 8584 break; … … 8586 8587 8587 8588 /* Line 1806 of yacc.c */ 8588 #line 250 7"parser.yy"8589 #line 2508 "parser.yy" 8589 8590 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8590 8591 break; … … 8593 8594 8594 8595 /* Line 1806 of yacc.c */ 8595 #line 251 3"parser.yy"8596 #line 2514 "parser.yy" 8596 8597 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8597 8598 break; … … 8600 8601 8601 8602 /* Line 1806 of yacc.c */ 8602 #line 251 5"parser.yy"8603 #line 2516 "parser.yy" 8603 8604 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8604 8605 break; … … 8607 8608 8608 8609 /* Line 1806 of yacc.c */ 8609 #line 251 7"parser.yy"8610 #line 2518 "parser.yy" 8610 8611 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8611 8612 break; … … 8614 8615 8615 8616 /* Line 1806 of yacc.c */ 8616 #line 252 2"parser.yy"8617 { (yyval.decl) = DeclarationNode::newFunction( 0, 0, (yyvsp[(3) - (5)].decl), 0); }8617 #line 2523 "parser.yy" 8618 { (yyval.decl) = DeclarationNode::newFunction( nullptr, nullptr, (yyvsp[(3) - (5)].decl), nullptr ); } 8618 8619 break; 8619 8620 … … 8621 8622 8622 8623 /* Line 1806 of yacc.c */ 8623 #line 252 4"parser.yy"8624 #line 2525 "parser.yy" 8624 8625 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8625 8626 break; … … 8628 8629 8629 8630 /* Line 1806 of yacc.c */ 8630 #line 252 6"parser.yy"8631 #line 2527 "parser.yy" 8631 8632 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8632 8633 break; … … 8635 8636 8636 8637 /* Line 1806 of yacc.c */ 8637 #line 253 2"parser.yy"8638 #line 2533 "parser.yy" 8638 8639 { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); } 8639 8640 break; … … 8642 8643 8643 8644 /* Line 1806 of yacc.c */ 8644 #line 253 4"parser.yy"8645 #line 2535 "parser.yy" 8645 8646 { (yyval.decl) = DeclarationNode::newArray( 0, 0, false )->addArray( (yyvsp[(3) - (3)].decl) ); } 8646 8647 break; … … 8649 8650 8650 8651 /* Line 1806 of yacc.c */ 8651 #line 254 0"parser.yy"8652 #line 2541 "parser.yy" 8652 8653 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(3) - (5)].en), 0, false ); } 8653 8654 break; … … 8656 8657 8657 8658 /* Line 1806 of yacc.c */ 8658 #line 254 2"parser.yy"8659 #line 2543 "parser.yy" 8659 8660 { (yyval.decl) = DeclarationNode::newVarArray( 0 ); } 8660 8661 break; … … 8663 8664 8664 8665 /* Line 1806 of yacc.c */ 8665 #line 254 4"parser.yy"8666 #line 2545 "parser.yy" 8666 8667 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addArray( DeclarationNode::newArray( (yyvsp[(4) - (6)].en), 0, false ) ); } 8667 8668 break; … … 8670 8671 8671 8672 /* Line 1806 of yacc.c */ 8672 #line 254 6"parser.yy"8673 #line 2547 "parser.yy" 8673 8674 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addArray( DeclarationNode::newVarArray( 0 ) ); } 8674 8675 break; … … 8677 8678 8678 8679 /* Line 1806 of yacc.c */ 8679 #line 256 1"parser.yy"8680 #line 2562 "parser.yy" 8680 8681 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8681 8682 break; … … 8684 8685 8685 8686 /* Line 1806 of yacc.c */ 8686 #line 256 3"parser.yy"8687 #line 2564 "parser.yy" 8687 8688 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8688 8689 break; … … 8691 8692 8692 8693 /* Line 1806 of yacc.c */ 8693 #line 256 8"parser.yy"8694 #line 2569 "parser.yy" 8694 8695 { (yyval.decl) = DeclarationNode::newPointer( 0 ); } 8695 8696 break; … … 8698 8699 8699 8700 /* Line 1806 of yacc.c */ 8700 #line 257 0"parser.yy"8701 #line 2571 "parser.yy" 8701 8702 { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); } 8702 8703 break; … … 8705 8706 8706 8707 /* Line 1806 of yacc.c */ 8707 #line 257 2"parser.yy"8708 #line 2573 "parser.yy" 8708 8709 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8709 8710 break; … … 8712 8713 8713 8714 /* Line 1806 of yacc.c */ 8714 #line 257 4"parser.yy"8715 #line 2575 "parser.yy" 8715 8716 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8716 8717 break; … … 8719 8720 8720 8721 /* Line 1806 of yacc.c */ 8721 #line 257 6"parser.yy"8722 #line 2577 "parser.yy" 8722 8723 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8723 8724 break; … … 8726 8727 8727 8728 /* Line 1806 of yacc.c */ 8728 #line 258 2"parser.yy"8729 #line 2583 "parser.yy" 8729 8730 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8730 8731 break; … … 8733 8734 8734 8735 /* Line 1806 of yacc.c */ 8735 #line 258 4"parser.yy"8736 #line 2585 "parser.yy" 8736 8737 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8737 8738 break; … … 8740 8741 8741 8742 /* Line 1806 of yacc.c */ 8742 #line 258 6"parser.yy"8743 #line 2587 "parser.yy" 8743 8744 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8744 8745 break; … … 8747 8748 8748 8749 /* Line 1806 of yacc.c */ 8749 #line 259 1"parser.yy"8750 { (yyval.decl) = DeclarationNode::newFunction( 0, 0, (yyvsp[(3) - (5)].decl), 0); }8750 #line 2592 "parser.yy" 8751 { (yyval.decl) = DeclarationNode::newFunction( nullptr, nullptr, (yyvsp[(3) - (5)].decl), nullptr ); } 8751 8752 break; 8752 8753 … … 8754 8755 8755 8756 /* Line 1806 of yacc.c */ 8756 #line 259 3"parser.yy"8757 #line 2594 "parser.yy" 8757 8758 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8758 8759 break; … … 8761 8762 8762 8763 /* Line 1806 of yacc.c */ 8763 #line 259 5"parser.yy"8764 #line 2596 "parser.yy" 8764 8765 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8765 8766 break; … … 8768 8769 8769 8770 /* Line 1806 of yacc.c */ 8770 #line 260 2"parser.yy"8771 #line 2603 "parser.yy" 8771 8772 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); } 8772 8773 break; … … 8775 8776 8776 8777 /* Line 1806 of yacc.c */ 8777 #line 261 3"parser.yy"8778 #line 2614 "parser.yy" 8778 8779 { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); } 8779 8780 break; … … 8782 8783 8783 8784 /* Line 1806 of yacc.c */ 8784 #line 261 6"parser.yy"8785 #line 2617 "parser.yy" 8785 8786 { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[(3) - (6)].decl) ); } 8786 8787 break; … … 8789 8790 8790 8791 /* Line 1806 of yacc.c */ 8791 #line 261 8"parser.yy"8792 #line 2619 "parser.yy" 8792 8793 { (yyval.decl) = DeclarationNode::newArray( 0, (yyvsp[(3) - (5)].decl), false ); } 8793 8794 break; … … 8796 8797 8797 8798 /* Line 1806 of yacc.c */ 8798 #line 262 1"parser.yy"8799 #line 2622 "parser.yy" 8799 8800 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), false ); } 8800 8801 break; … … 8803 8804 8804 8805 /* Line 1806 of yacc.c */ 8805 #line 262 3"parser.yy"8806 #line 2624 "parser.yy" 8806 8807 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(4) - (7)].decl), true ); } 8807 8808 break; … … 8810 8811 8811 8812 /* Line 1806 of yacc.c */ 8812 #line 262 5"parser.yy"8813 #line 2626 "parser.yy" 8813 8814 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(3) - (7)].decl), true ); } 8814 8815 break; … … 8817 8818 8818 8819 /* Line 1806 of yacc.c */ 8819 #line 26 39"parser.yy"8820 #line 2640 "parser.yy" 8820 8821 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8821 8822 break; … … 8824 8825 8825 8826 /* Line 1806 of yacc.c */ 8826 #line 264 1"parser.yy"8827 #line 2642 "parser.yy" 8827 8828 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8828 8829 break; … … 8831 8832 8832 8833 /* Line 1806 of yacc.c */ 8833 #line 264 6"parser.yy"8834 #line 2647 "parser.yy" 8834 8835 { (yyval.decl) = DeclarationNode::newPointer( 0 ); } 8835 8836 break; … … 8838 8839 8839 8840 /* Line 1806 of yacc.c */ 8840 #line 264 8"parser.yy"8841 #line 2649 "parser.yy" 8841 8842 { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); } 8842 8843 break; … … 8845 8846 8846 8847 /* Line 1806 of yacc.c */ 8847 #line 265 0"parser.yy"8848 #line 2651 "parser.yy" 8848 8849 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8849 8850 break; … … 8852 8853 8853 8854 /* Line 1806 of yacc.c */ 8854 #line 265 2"parser.yy"8855 #line 2653 "parser.yy" 8855 8856 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8856 8857 break; … … 8859 8860 8860 8861 /* Line 1806 of yacc.c */ 8861 #line 265 4"parser.yy"8862 #line 2655 "parser.yy" 8862 8863 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8863 8864 break; … … 8866 8867 8867 8868 /* Line 1806 of yacc.c */ 8868 #line 266 0"parser.yy"8869 #line 2661 "parser.yy" 8869 8870 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8870 8871 break; … … 8873 8874 8874 8875 /* Line 1806 of yacc.c */ 8875 #line 266 2"parser.yy"8876 #line 2663 "parser.yy" 8876 8877 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8877 8878 break; … … 8880 8881 8881 8882 /* Line 1806 of yacc.c */ 8882 #line 266 4"parser.yy"8883 #line 2665 "parser.yy" 8883 8884 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8884 8885 break; … … 8887 8888 8888 8889 /* Line 1806 of yacc.c */ 8889 #line 26 69"parser.yy"8890 #line 2670 "parser.yy" 8890 8891 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8891 8892 break; … … 8894 8895 8895 8896 /* Line 1806 of yacc.c */ 8896 #line 267 1"parser.yy"8897 #line 2672 "parser.yy" 8897 8898 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8898 8899 break; … … 8901 8902 8902 8903 /* Line 1806 of yacc.c */ 8903 #line 268 1"parser.yy"8904 #line 2682 "parser.yy" 8904 8905 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 8905 8906 break; … … 8908 8909 8909 8910 /* Line 1806 of yacc.c */ 8910 #line 269 1"parser.yy"8911 #line 2692 "parser.yy" 8911 8912 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 8912 8913 break; … … 8915 8916 8916 8917 /* Line 1806 of yacc.c */ 8917 #line 269 3"parser.yy"8918 #line 2694 "parser.yy" 8918 8919 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); } 8919 8920 break; … … 8922 8923 8923 8924 /* Line 1806 of yacc.c */ 8924 #line 269 5"parser.yy"8925 #line 2696 "parser.yy" 8925 8926 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 8926 8927 break; … … 8929 8930 8930 8931 /* Line 1806 of yacc.c */ 8931 #line 269 7"parser.yy"8932 #line 2698 "parser.yy" 8932 8933 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); } 8933 8934 break; … … 8936 8937 8937 8938 /* Line 1806 of yacc.c */ 8938 #line 2 699"parser.yy"8939 #line 2700 "parser.yy" 8939 8940 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 8940 8941 break; … … 8943 8944 8944 8945 /* Line 1806 of yacc.c */ 8945 #line 270 1"parser.yy"8946 #line 2702 "parser.yy" 8946 8947 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); } 8947 8948 break; … … 8950 8951 8951 8952 /* Line 1806 of yacc.c */ 8952 #line 270 8"parser.yy"8953 #line 2709 "parser.yy" 8953 8954 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 8954 8955 break; … … 8957 8958 8958 8959 /* Line 1806 of yacc.c */ 8959 #line 271 0"parser.yy"8960 #line 2711 "parser.yy" 8960 8961 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); } 8961 8962 break; … … 8964 8965 8965 8966 /* Line 1806 of yacc.c */ 8966 #line 271 2"parser.yy"8967 #line 2713 "parser.yy" 8967 8968 { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 8968 8969 break; … … 8971 8972 8972 8973 /* Line 1806 of yacc.c */ 8973 #line 271 4"parser.yy"8974 #line 2715 "parser.yy" 8974 8975 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( (yyvsp[(2) - (3)].decl) )->addNewArray( (yyvsp[(1) - (3)].decl) ); } 8975 8976 break; … … 8978 8979 8979 8980 /* Line 1806 of yacc.c */ 8980 #line 271 6"parser.yy"8981 #line 2717 "parser.yy" 8981 8982 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); } 8982 8983 break; … … 8985 8986 8986 8987 /* Line 1806 of yacc.c */ 8987 #line 271 8"parser.yy"8988 #line 2719 "parser.yy" 8988 8989 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 8989 8990 break; … … 8992 8993 8993 8994 /* Line 1806 of yacc.c */ 8994 #line 272 0"parser.yy"8995 #line 2721 "parser.yy" 8995 8996 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); } 8996 8997 break; … … 8999 9000 9000 9001 /* Line 1806 of yacc.c */ 9001 #line 272 2"parser.yy"9002 #line 2723 "parser.yy" 9002 9003 { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 9003 9004 break; … … 9006 9007 9007 9008 /* Line 1806 of yacc.c */ 9008 #line 272 4"parser.yy"9009 #line 2725 "parser.yy" 9009 9010 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( (yyvsp[(2) - (3)].decl) )->addNewArray( (yyvsp[(1) - (3)].decl) ); } 9010 9011 break; … … 9013 9014 9014 9015 /* Line 1806 of yacc.c */ 9015 #line 272 6"parser.yy"9016 #line 2727 "parser.yy" 9016 9017 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); } 9017 9018 break; … … 9020 9021 9021 9022 /* Line 1806 of yacc.c */ 9022 #line 273 1"parser.yy"9023 #line 2732 "parser.yy" 9023 9024 { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[(3) - (6)].decl) ); } 9024 9025 break; … … 9027 9028 9028 9029 /* Line 1806 of yacc.c */ 9029 #line 273 3"parser.yy"9030 #line 2734 "parser.yy" 9030 9031 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), false ); } 9031 9032 break; … … 9034 9035 9035 9036 /* Line 1806 of yacc.c */ 9036 #line 273 8"parser.yy"9037 #line 2739 "parser.yy" 9037 9038 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), true ); } 9038 9039 break; … … 9041 9042 9042 9043 /* Line 1806 of yacc.c */ 9043 #line 274 0"parser.yy"9044 #line 2741 "parser.yy" 9044 9045 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(4) - (7)].decl)->addQualifiers( (yyvsp[(3) - (7)].decl) ), true ); } 9045 9046 break; … … 9048 9049 9049 9050 /* Line 1806 of yacc.c */ 9050 #line 276 7"parser.yy"9051 #line 2768 "parser.yy" 9051 9052 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 9052 9053 break; … … 9055 9056 9056 9057 /* Line 1806 of yacc.c */ 9057 #line 277 8"parser.yy"9058 #line 2779 "parser.yy" 9058 9059 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 9059 9060 break; … … 9062 9063 9063 9064 /* Line 1806 of yacc.c */ 9064 #line 278 0"parser.yy"9065 #line 2781 "parser.yy" 9065 9066 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); } 9066 9067 break; … … 9069 9070 9070 9071 /* Line 1806 of yacc.c */ 9071 #line 278 2"parser.yy"9072 #line 2783 "parser.yy" 9072 9073 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 9073 9074 break; … … 9076 9077 9077 9078 /* Line 1806 of yacc.c */ 9078 #line 278 4"parser.yy"9079 #line 2785 "parser.yy" 9079 9080 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); } 9080 9081 break; … … 9083 9084 9084 9085 /* Line 1806 of yacc.c */ 9085 #line 278 6"parser.yy"9086 #line 2787 "parser.yy" 9086 9087 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 9087 9088 break; … … 9090 9091 9091 9092 /* Line 1806 of yacc.c */ 9092 #line 278 8"parser.yy"9093 #line 2789 "parser.yy" 9093 9094 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); } 9094 9095 break; … … 9097 9098 9098 9099 /* Line 1806 of yacc.c */ 9099 #line 279 5"parser.yy"9100 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }9100 #line 2796 "parser.yy" 9101 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); } 9101 9102 break; 9102 9103 … … 9104 9105 9105 9106 /* Line 1806 of yacc.c */ 9106 #line 279 7"parser.yy"9107 { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }9107 #line 2798 "parser.yy" 9108 { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); } 9108 9109 break; 9109 9110 … … 9111 9112 9112 9113 /* Line 1806 of yacc.c */ 9113 #line 2 799"parser.yy"9114 #line 2800 "parser.yy" 9114 9115 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); } 9115 9116 break; … … 9118 9119 9119 9120 /* Line 1806 of yacc.c */ 9120 #line 280 1"parser.yy"9121 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }9121 #line 2802 "parser.yy" 9122 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); } 9122 9123 break; 9123 9124 … … 9125 9126 9126 9127 /* Line 1806 of yacc.c */ 9127 #line 280 3"parser.yy"9128 { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }9128 #line 2804 "parser.yy" 9129 { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); } 9129 9130 break; 9130 9131 … … 9132 9133 9133 9134 /* Line 1806 of yacc.c */ 9134 #line 280 5"parser.yy"9135 #line 2806 "parser.yy" 9135 9136 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); } 9136 9137 break; … … 9139 9140 9140 9141 /* Line 1806 of yacc.c */ 9141 #line 281 0"parser.yy"9142 #line 2811 "parser.yy" 9142 9143 { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[(3) - (5)].decl) ); } 9143 9144 break; … … 9146 9147 9147 9148 /* Line 1806 of yacc.c */ 9148 #line 281 5"parser.yy"9149 { (yyval.decl) = DeclarationNode::newFunction( 0, DeclarationNode::newTuple( 0 ), (yyvsp[(4) - (5)].decl), 0); }9149 #line 2816 "parser.yy" 9150 { (yyval.decl) = DeclarationNode::newFunction( nullptr, DeclarationNode::newTuple( nullptr ), (yyvsp[(4) - (5)].decl), nullptr ); } 9150 9151 break; 9151 9152 … … 9153 9154 9154 9155 /* Line 1806 of yacc.c */ 9155 #line 281 7"parser.yy"9156 { (yyval.decl) = DeclarationNode::newFunction( 0, (yyvsp[(1) - (6)].decl), (yyvsp[(4) - (6)].decl), 0); }9156 #line 2818 "parser.yy" 9157 { (yyval.decl) = DeclarationNode::newFunction( nullptr, (yyvsp[(1) - (6)].decl), (yyvsp[(4) - (6)].decl), nullptr ); } 9157 9158 break; 9158 9159 … … 9160 9161 9161 9162 /* Line 1806 of yacc.c */ 9162 #line 28 19"parser.yy"9163 { (yyval.decl) = DeclarationNode::newFunction( 0, (yyvsp[(1) - (6)].decl), (yyvsp[(4) - (6)].decl), 0); }9163 #line 2820 "parser.yy" 9164 { (yyval.decl) = DeclarationNode::newFunction( nullptr, (yyvsp[(1) - (6)].decl), (yyvsp[(4) - (6)].decl), nullptr ); } 9164 9165 break; 9165 9166 … … 9167 9168 9168 9169 /* Line 1806 of yacc.c */ 9169 #line 284 3"parser.yy"9170 #line 2844 "parser.yy" 9170 9171 { (yyval.en) = 0; } 9171 9172 break; … … 9174 9175 9175 9176 /* Line 1806 of yacc.c */ 9176 #line 284 5"parser.yy"9177 #line 2846 "parser.yy" 9177 9178 { (yyval.en) = (yyvsp[(2) - (2)].en); } 9178 9179 break; … … 9181 9182 9182 9183 /* Line 1806 of yacc.c */ 9183 #line 918 4"Parser/parser.cc"9184 #line 9185 "Parser/parser.cc" 9184 9185 default: break; 9185 9186 } … … 9412 9413 9413 9414 /* Line 2067 of yacc.c */ 9414 #line 284 8"parser.yy"9415 #line 2849 "parser.yy" 9415 9416 9416 9417 // ----end of grammar---- … … 9419 9420 9420 9421 void yyerror( const char * ) { 9421 std::cout << "Error ";9422 cout << "Error "; 9422 9423 if ( yyfilename ) { 9423 std::cout << "in file " << yyfilename << " ";9424 cout << "in file " << yyfilename << " "; 9424 9425 } // if 9425 std::cout << "at line " << yylineno << " reading token \"" << (yytext[0] == '\0' ? "EOF" : yytext) << "\"" << std::endl;9426 cout << "at line " << yylineno << " reading token \"" << (yytext[0] == '\0' ? "EOF" : yytext) << "\"" << endl; 9426 9427 } 9427 9428 -
src/Parser/parser.h
r7b69174 raee7e35 262 262 263 263 /* Line 2068 of yacc.c */ 264 #line 11 5"parser.yy"264 #line 116 "parser.yy" 265 265 266 266 Token tok; -
src/Parser/parser.yy
r7b69174 raee7e35 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Sep 12 17:29:45201613 // Update Count : 19 6912 // Last Modified On : Sat Sep 24 12:16:53 2016 13 // Update Count : 1992 14 14 // 15 15 … … 54 54 #include "TypeData.h" 55 55 #include "LinkageSpec.h" 56 using namespace std; 56 57 57 58 extern DeclarationNode * parseTree; … … 59 60 extern TypedefTable typedefTable; 60 61 61 st d::stack< LinkageSpec::Spec > linkageStack;62 63 void appendStr( st d::string *to, std::string *from ) {62 stack< LinkageSpec::Spec > linkageStack; 63 64 void appendStr( string *to, string *from ) { 64 65 // "abc" "def" "ghi" => "abcdefghi", remove new text from quotes and insert before last quote in old string. 65 66 to->insert( to->length() - 1, from->substr( 1, from->length() - 2 ) ); … … 359 360 { $$ = $2; } 360 361 | '(' compound_statement ')' // GCC, lambda expression 361 { $$ = new ExpressionNode( build_valexpr( $2 ) ); }362 { $$ = new ExpressionNode( build_valexpr( $2 ) ); } 362 363 ; 363 364 … … 389 390 { 390 391 Token fn; 391 fn.str = new std::string( "?{}" ); 392 fn.str = new std::string( "?{}" ); // location undefined - use location of '{'? 392 393 $$ = new ExpressionNode( new ConstructorExpr( build_func( new ExpressionNode( build_varref( fn ) ), (ExpressionNode *)( $1 )->set_last( $3 ) ) ) ); 393 394 } … … 666 667 { 667 668 Token fn; 668 fn.str = new st d::string( "^?{}" );// location undefined669 fn.str = new string( "^?{}" ); // location undefined 669 670 $$ = new StatementNode( build_expr( new ExpressionNode( build_func( new ExpressionNode( build_varref( fn ) ), (ExpressionNode *)( $2 )->set_last( $4 ) ) ) ) ); 670 671 } … … 896 897 { $$ = new StatementNode( build_catch( $5, $8 ) ); } 897 898 | handler_clause CATCH '(' push push exception_declaration pop ')' compound_statement pop 898 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $6, $9 ) ) ); }899 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $6, $9 ) ) ); } 899 900 | CATCHRESUME '(' push push exception_declaration pop ')' compound_statement pop 900 901 { $$ = new StatementNode( build_catch( $5, $8 ) ); } … … 968 969 { $$ = new ExpressionNode( build_asmexpr( 0, $1, $3 ) ); } 969 970 | '[' constant_expression ']' string_literal '(' constant_expression ')' 970 { $$ = new ExpressionNode( build_asmexpr( $2, $4, $6 ) ); }971 { $$ = new ExpressionNode( build_asmexpr( $2, $4, $6 ) ); } 971 972 ; 972 973 … … 1467 1468 aggregate_name: 1468 1469 aggregate_key '{' field_declaration_list '}' 1469 { $$ = DeclarationNode::newAggregate( $1, 0, 0, $3, true ); }1470 { $$ = DeclarationNode::newAggregate( $1, nullptr, nullptr, $3, true ); } 1470 1471 | aggregate_key no_attr_identifier_or_type_name 1471 1472 { 1472 1473 typedefTable.makeTypedef( *$2 ); 1473 $$ = DeclarationNode::newAggregate( $1, $2, 0, 0, false );1474 $$ = DeclarationNode::newAggregate( $1, $2, nullptr, nullptr, false ); 1474 1475 } 1475 1476 | aggregate_key no_attr_identifier_or_type_name 1476 1477 { typedefTable.makeTypedef( *$2 ); } 1477 1478 '{' field_declaration_list '}' 1478 { $$ = DeclarationNode::newAggregate( $1, $2, 0, $5, true ); }1479 { $$ = DeclarationNode::newAggregate( $1, $2, nullptr, $5, true ); } 1479 1480 | aggregate_key '(' type_name_list ')' '{' field_declaration_list '}' // CFA 1480 { $$ = DeclarationNode::newAggregate( $1, 0, $3, $6, false ); }1481 { $$ = DeclarationNode::newAggregate( $1, nullptr, $3, $6, false ); } 1481 1482 | aggregate_key typegen_name // CFA, S/R conflict 1482 1483 { $$ = $2; } … … 1559 1560 enum_name: 1560 1561 enum_key '{' enumerator_list comma_opt '}' 1561 { $$ = DeclarationNode::newEnum( 0, $3 ); }1562 { $$ = DeclarationNode::newEnum( nullptr, $3 ); } 1562 1563 | enum_key no_attr_identifier_or_type_name 1563 1564 { … … 2520 2521 abstract_function: 2521 2522 '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 2522 { $$ = DeclarationNode::newFunction( 0, 0, $3, 0); }2523 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $3, nullptr ); } 2523 2524 | '(' abstract_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 2524 2525 { $$ = $2->addParamList( $6 ); } … … 2589 2590 abstract_parameter_function: 2590 2591 '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 2591 { $$ = DeclarationNode::newFunction( 0, 0, $3, 0); }2592 { $$ = DeclarationNode::newFunction( nullptr, nullptr, $3, nullptr ); } 2592 2593 | '(' abstract_parameter_ptr ')' '(' push parameter_type_list_opt pop ')' // empty parameter list OBSOLESCENT (see 3) 2593 2594 { $$ = $2->addParamList( $6 ); } … … 2793 2794 // empty (void) function return type. 2794 2795 '[' ']' type_specifier 2795 { $$ = $3->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }2796 { $$ = $3->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); } 2796 2797 | '[' ']' multi_array_dimension type_specifier 2797 { $$ = $4->addNewArray( $3 )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }2798 { $$ = $4->addNewArray( $3 )->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); } 2798 2799 | multi_array_dimension type_specifier 2799 2800 { $$ = $2->addNewArray( $1 ); } 2800 2801 | '[' ']' new_abstract_ptr 2801 { $$ = $3->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }2802 { $$ = $3->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); } 2802 2803 | '[' ']' multi_array_dimension new_abstract_ptr 2803 { $$ = $4->addNewArray( $3 )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }2804 { $$ = $4->addNewArray( $3 )->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); } 2804 2805 | multi_array_dimension new_abstract_ptr 2805 2806 { $$ = $2->addNewArray( $1 ); } … … 2813 2814 new_abstract_function: // CFA 2814 2815 '[' ']' '(' new_parameter_type_list_opt ')' 2815 { $$ = DeclarationNode::newFunction( 0, DeclarationNode::newTuple( 0 ), $4, 0); }2816 { $$ = DeclarationNode::newFunction( nullptr, DeclarationNode::newTuple( nullptr ), $4, nullptr ); } 2816 2817 | new_abstract_tuple '(' push new_parameter_type_list_opt pop ')' 2817 { $$ = DeclarationNode::newFunction( 0, $1, $4, 0); }2818 { $$ = DeclarationNode::newFunction( nullptr, $1, $4, nullptr ); } 2818 2819 | new_function_return '(' push new_parameter_type_list_opt pop ')' 2819 { $$ = DeclarationNode::newFunction( 0, $1, $4, 0); }2820 { $$ = DeclarationNode::newFunction( nullptr, $1, $4, nullptr ); } 2820 2821 ; 2821 2822 … … 2852 2853 2853 2854 void yyerror( const char * ) { 2854 std::cout << "Error ";2855 cout << "Error "; 2855 2856 if ( yyfilename ) { 2856 std::cout << "in file " << yyfilename << " ";2857 cout << "in file " << yyfilename << " "; 2857 2858 } // if 2858 std::cout << "at line " << yylineno << " reading token \"" << (yytext[0] == '\0' ? "EOF" : yytext) << "\"" << std::endl;2859 cout << "at line " << yylineno << " reading token \"" << (yytext[0] == '\0' ? "EOF" : yytext) << "\"" << endl; 2859 2860 } 2860 2861 -
src/ResolvExpr/AdjustExprType.cc
r7b69174 raee7e35 37 37 virtual Type* mutate( TupleType *tupleType ); 38 38 virtual Type* mutate( VarArgsType *varArgsType ); 39 virtual Type* mutate( ZeroType *zeroType ); 40 virtual Type* mutate( OneType *oneType ); 39 41 40 42 const TypeEnvironment &env; … … 117 119 return varArgsType; 118 120 } 121 122 Type *AdjustExprType::mutate( ZeroType *zeroType ) { 123 return zeroType; 124 } 125 126 Type *AdjustExprType::mutate( OneType *oneType ) { 127 return oneType; 128 } 119 129 } // namespace ResolvExpr 120 130 -
src/ResolvExpr/CommonType.cc
r7b69174 raee7e35 39 39 virtual void visit( TupleType *tupleType ); 40 40 virtual void visit( VarArgsType *varArgsType ); 41 virtual void visit( ZeroType *zeroType ); 42 virtual void visit( OneType *oneType ); 41 43 42 44 template< typename RefType > void handleRefType( RefType *inst, Type *other ); … … 134 136 result = new BasicType( basicType->get_qualifiers() + otherBasic->get_qualifiers(), newType ); 135 137 } // if 136 } else if ( EnumInstType *enumInstType = dynamic_cast< EnumInstType * >( type2 ) ) {137 // use signed int in lieu of the enum type138 } else if ( dynamic_cast< EnumInstType * > ( type2 ) || dynamic_cast< ZeroType* >( type2 ) || dynamic_cast< OneType* >( type2 ) ) { 139 // use signed int in lieu of the enum/zero/one type 138 140 BasicType::Kind newType = combinedType[ basicType->get_kind() ][ BasicType::SignedInt ]; 139 if ( ( ( newType == basicType->get_kind() && basicType->get_qualifiers() >= enumInstType->get_qualifiers() ) || widenFirst ) && ( ( newType != basicType->get_kind() && basicType->get_qualifiers() <= enumInstType->get_qualifiers() ) || widenSecond ) ) {140 result = new BasicType( basicType->get_qualifiers() + enumInstType->get_qualifiers(), newType );141 if ( ( ( newType == basicType->get_kind() && basicType->get_qualifiers() >= type2->get_qualifiers() ) || widenFirst ) && ( ( newType != basicType->get_kind() && basicType->get_qualifiers() <= type2->get_qualifiers() ) || widenSecond ) ) { 142 result = new BasicType( basicType->get_qualifiers() + type2->get_qualifiers(), newType ); 141 143 } // if 142 144 } // if … … 171 173 otherPointer->get_base()->get_qualifiers() = tq2; 172 174 } // if 175 } else if ( widenSecond && dynamic_cast< ZeroType* >( type2 ) ) { 176 result = pointerType->clone(); 177 result->get_qualifiers() += type2->get_qualifiers(); 173 178 } // if 174 179 } … … 190 195 191 196 void CommonType::visit( EnumInstType *enumInstType ) { 192 if ( dynamic_cast< BasicType * >( type2 ) ) {197 if ( dynamic_cast< BasicType * >( type2 ) || dynamic_cast< ZeroType* >( type2 ) || dynamic_cast< OneType* >( type2 ) ) { 193 198 // reuse BasicType, EnumInstType code by swapping type2 with enumInstType 194 199 Type * temp = type2; … … 230 235 void CommonType::visit( VarArgsType *varArgsType ) { 231 236 } 237 238 void CommonType::visit( ZeroType *zeroType ) { 239 if ( widenFirst ) { 240 if ( dynamic_cast< BasicType* >( type2 ) || dynamic_cast< PointerType* >( type2 ) || dynamic_cast< EnumInstType* >( type2 ) ) { 241 if ( widenSecond || zeroType->get_qualifiers() <= type2->get_qualifiers() ) { 242 result = type2->clone(); 243 result->get_qualifiers() += zeroType->get_qualifiers(); 244 } 245 } 246 } 247 } 248 249 void CommonType::visit( OneType *oneType ) { 250 if ( widenFirst ) { 251 if ( dynamic_cast< BasicType* >( type2 ) || dynamic_cast< EnumInstType* >( type2 ) ) { 252 if ( widenSecond || oneType->get_qualifiers() <= type2->get_qualifiers() ) { 253 result = type2->clone(); 254 result->get_qualifiers() += oneType->get_qualifiers(); 255 } 256 } 257 } 258 } 232 259 } // namespace ResolvExpr 233 260 -
src/ResolvExpr/ConversionCost.cc
r7b69174 raee7e35 160 160 // xxx - not positive this is correct, but appears to allow casting int => enum 161 161 cost = Cost( 1, 0, 0 ); 162 } // if 162 } else if ( dynamic_cast< ZeroType* >( dest ) != nullptr || dynamic_cast< OneType* >( dest ) != nullptr ) { 163 cost = Cost( 1, 0, 0 ); 164 } // if 163 165 } 164 166 … … 175 177 } // if 176 178 } // if 179 } else if ( dynamic_cast< ZeroType* >( dest ) != nullptr || dynamic_cast< OneType* >( dest ) != nullptr ) { 180 cost = Cost( 1, 0, 0 ); 177 181 } // if 178 182 } … … 256 260 } 257 261 } 262 263 void ConversionCost::visit(ZeroType *zeroType) { 264 if ( dynamic_cast< ZeroType* >( dest ) ) { 265 cost = Cost::zero; 266 } else if ( BasicType *destAsBasic = dynamic_cast< BasicType* >( dest ) ) { 267 // copied from visit(BasicType*) for signed int, but +1 for safe conversions 268 int tableResult = costMatrix[ BasicType::SignedInt ][ destAsBasic->get_kind() ]; 269 if ( tableResult == -1 ) { 270 cost = Cost( 1, 0, 0 ); 271 } else { 272 cost = Cost( 0, 0, tableResult + 1 ); 273 } 274 } else if ( dynamic_cast< PointerType* >( dest ) ) { 275 cost = Cost( 0, 0, 1 ); 276 } 277 } 278 279 void ConversionCost::visit(OneType *oneType) { 280 if ( dynamic_cast< OneType* >( dest ) ) { 281 cost = Cost::zero; 282 } else if ( BasicType *destAsBasic = dynamic_cast< BasicType* >( dest ) ) { 283 // copied from visit(BasicType*) for signed int, but +1 for safe conversions 284 int tableResult = costMatrix[ BasicType::SignedInt ][ destAsBasic->get_kind() ]; 285 if ( tableResult == -1 ) { 286 cost = Cost( 1, 0, 0 ); 287 } else { 288 cost = Cost( 0, 0, tableResult + 1 ); 289 } 290 } 291 } 258 292 } // namespace ResolvExpr 259 293 -
src/ResolvExpr/ConversionCost.h
r7b69174 raee7e35 41 41 virtual void visit(TupleType *tupleType); 42 42 virtual void visit(VarArgsType *varArgsType); 43 virtual void visit(ZeroType *zeroType); 44 virtual void visit(OneType *oneType); 43 45 protected: 44 46 Type *dest; -
src/ResolvExpr/PtrsAssignable.cc
r7b69174 raee7e35 39 39 virtual void visit( TupleType *tupleType ); 40 40 virtual void visit( VarArgsType *varArgsType ); 41 virtual void visit( ZeroType *zeroType ); 42 virtual void visit( OneType *oneType ); 41 43 private: 42 44 Type *dest; … … 141 143 void PtrsAssignable::visit( VarArgsType *varArgsType ) { 142 144 } 145 146 void PtrsAssignable::visit( ZeroType *zeroType ) { 147 } 148 149 void PtrsAssignable::visit( OneType *oneType ) { 150 } 151 143 152 } // namespace ResolvExpr 144 153 -
src/ResolvExpr/PtrsCastable.cc
r7b69174 raee7e35 40 40 virtual void visit(TupleType *tupleType); 41 41 virtual void visit(VarArgsType *varArgsType); 42 virtual void visit(ZeroType *zeroType); 43 virtual void visit(OneType *oneType); 42 44 private: 43 45 Type *dest; … … 144 146 result = objectCast( dest, env, indexer ); 145 147 } 148 149 void PtrsCastable::visit(ZeroType *zeroType) { 150 result = objectCast( dest, env, indexer ); 151 } 152 153 void PtrsCastable::visit(OneType *oneType) { 154 result = objectCast( dest, env, indexer ); 155 } 146 156 } // namespace ResolvExpr 147 157 -
src/ResolvExpr/RenameVars.cc
r7b69174 raee7e35 110 110 } 111 111 112 void RenameVars::visit( ZeroType *zeroType ) { 113 typeBefore( zeroType ); 114 typeAfter( zeroType ); 115 } 116 117 void RenameVars::visit( OneType *oneType ) { 118 typeBefore( oneType ); 119 typeAfter( oneType ); 120 } 121 112 122 void RenameVars::typeBefore( Type *type ) { 113 123 if ( ! type->get_forall().empty() ) { -
src/ResolvExpr/RenameVars.h
r7b69174 raee7e35 44 44 virtual void visit( TupleType *tupleType ); 45 45 virtual void visit( VarArgsType *varArgsType ); 46 virtual void visit( ZeroType *zeroType ); 47 virtual void visit( OneType *oneType ); 46 48 47 49 void typeBefore( Type *type ); -
src/ResolvExpr/Resolver.cc
r7b69174 raee7e35 133 133 } else if ( BasicType *bt = dynamic_cast< BasicType * >( type ) ) { 134 134 return bt->isInteger(); 135 } else if ( dynamic_cast< ZeroType* >( type ) != nullptr || dynamic_cast< OneType* >( type ) != nullptr ) { 136 return true; 135 137 } else { 136 138 return false; … … 459 461 } 460 462 } else { 461 assert( dynamic_cast< BasicType * >( initContext ) || dynamic_cast< PointerType * >( initContext ) ); 463 assert( dynamic_cast< BasicType * >( initContext ) || dynamic_cast< PointerType * >( initContext ) 464 || dynamic_cast< ZeroType * >( initContext ) || dynamic_cast< OneType * >( initContext ) ); 462 465 // basic types are handled here 463 466 Visitor::visit( listInit ); -
src/ResolvExpr/Unify.cc
r7b69174 raee7e35 60 60 virtual void visit(TupleType *tupleType); 61 61 virtual void visit(VarArgsType *varArgsType); 62 virtual void visit(ZeroType *zeroType); 63 virtual void visit(OneType *oneType); 62 64 63 65 template< typename RefType > void handleRefType( RefType *inst, Type *other ); … … 588 590 } 589 591 592 void Unify::visit(ZeroType *zeroType) { 593 result = dynamic_cast< ZeroType* >( type2 ); 594 } 595 596 void Unify::visit(OneType *oneType) { 597 result = dynamic_cast< OneType* >( type2 ); 598 } 599 590 600 } // namespace ResolvExpr 591 601 -
src/SymTab/FixFunction.cc
r7b69174 raee7e35 77 77 return varArgsType; 78 78 } 79 80 Type * FixFunction::mutate(ZeroType *zeroType) { 81 return zeroType; 82 } 83 84 Type * FixFunction::mutate(OneType *oneType) { 85 return oneType; 86 } 79 87 } // namespace SymTab 80 88 -
src/SymTab/FixFunction.h
r7b69174 raee7e35 42 42 virtual Type* mutate(TupleType *tupleType); 43 43 virtual Type* mutate(VarArgsType *varArgsType); 44 virtual Type* mutate(ZeroType *zeroType); 45 virtual Type* mutate(OneType *oneType); 44 46 45 47 bool isVoid; -
src/SymTab/ImplementationType.cc
r7b69174 raee7e35 41 41 virtual void visit(TupleType *tupleType); 42 42 virtual void visit(VarArgsType *varArgsType); 43 virtual void visit(ZeroType *zeroType); 44 virtual void visit(OneType *oneType); 43 45 44 46 Type *result; // synthesized … … 120 122 void ImplementationType::visit(VarArgsType *varArgsType) { 121 123 } 124 125 void ImplementationType::visit(ZeroType *zeroType) { 126 } 127 128 void ImplementationType::visit(OneType *oneType) { 129 } 122 130 } // namespace SymTab 123 131 -
src/SymTab/Mangler.cc
r7b69174 raee7e35 229 229 printQualifiers( varArgsType ); 230 230 mangleName << "VARGS"; 231 } 232 233 void Mangler::visit( ZeroType *zeroType ) { 234 mangleName << "Z"; 235 } 236 237 void Mangler::visit( OneType *oneType ) { 238 mangleName << "O"; 231 239 } 232 240 -
src/SymTab/Mangler.h
r7b69174 raee7e35 46 46 virtual void visit( TupleType *tupleType ); 47 47 virtual void visit( VarArgsType *varArgsType ); 48 virtual void visit( ZeroType *zeroType ); 49 virtual void visit( OneType *oneType ); 48 50 49 51 std::string get_mangleName() { return mangleName.str(); } -
src/SymTab/TypeEquality.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 void handleQualifiers( Type * t ); … … 199 201 } 200 202 } 203 204 void TypeEquality::visit( ZeroType *zeroType ) { 205 handleQualifiers( zeroType ); 206 if ( ! dynamic_cast< ZeroType * >( other ) ) { 207 result = false; 208 } 209 } 210 211 void TypeEquality::visit( OneType *oneType ) { 212 handleQualifiers( oneType ); 213 if ( ! dynamic_cast< OneType * >( other ) ) { 214 result = false; 215 } 216 } 201 217 } // namespace SymTab -
src/SynTree/Mutator.cc
r7b69174 raee7e35 453 453 } 454 454 455 Type *Mutator::mutate( ZeroType *zeroType ) { 456 mutateAll( zeroType->get_forall(), *this ); 457 return zeroType; 458 } 459 460 Type *Mutator::mutate( OneType *oneType ) { 461 mutateAll( oneType->get_forall(), *this ); 462 return oneType; 463 } 464 455 465 Initializer *Mutator::mutate( SingleInit *singleInit ) { 456 466 singleInit->set_value( singleInit->get_value()->acceptMutator( *this ) ); -
src/SynTree/Mutator.h
r7b69174 raee7e35 95 95 virtual Type* mutate( AttrType *attrType ); 96 96 virtual Type* mutate( VarArgsType *varArgsType ); 97 virtual Type* mutate( ZeroType *zeroType ); 98 virtual Type* mutate( OneType *oneType ); 97 99 98 100 virtual Initializer* mutate( SingleInit *singleInit ); -
src/SynTree/SynTree.h
r7b69174 raee7e35 102 102 class AttrType; 103 103 class VarArgsType; 104 class ZeroType; 105 class OneType; 104 106 105 107 class Initializer; -
src/SynTree/Type.h
r7b69174 raee7e35 418 418 }; 419 419 420 /// Represents a zero constant 421 class ZeroType : public Type { 422 public: 423 ZeroType(); 424 ZeroType( Type::Qualifiers tq ); 425 426 virtual ZeroType *clone() const { return new ZeroType( *this ); } 427 virtual void accept( Visitor &v ) { v.visit( this ); } 428 virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); } 429 virtual void print( std::ostream &os, int indent = 0 ) const; 430 }; 431 432 /// Represents a one constant 433 class OneType : public Type { 434 public: 435 OneType(); 436 OneType( Type::Qualifiers tq ); 437 438 virtual OneType *clone() const { return new OneType( *this ); } 439 virtual void accept( Visitor &v ) { v.visit( this ); } 440 virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); } 441 virtual void print( std::ostream &os, int indent = 0 ) const; 442 }; 443 420 444 inline Type::Qualifiers &Type::Qualifiers::operator+=( const Type::Qualifiers &other ) { 421 445 isConst |= other.isConst; -
src/SynTree/TypeSubstitution.cc
r7b69174 raee7e35 179 179 } 180 180 181 Type * TypeSubstitution::mutate( VoidType * basicType ) {182 return handleType( basicType );181 Type * TypeSubstitution::mutate( VoidType *voidType ) { 182 return handleType( voidType ); 183 183 } 184 184 … … 221 221 Type * TypeSubstitution::mutate( VarArgsType *varArgsType ) { 222 222 return handleType( varArgsType ); 223 } 224 225 Type * TypeSubstitution::mutate( ZeroType *zeroType ) { 226 return handleType( zeroType ); 227 } 228 229 Type * TypeSubstitution::mutate( OneType *oneType ) { 230 return handleType( oneType ); 223 231 } 224 232 -
src/SynTree/TypeSubstitution.h
r7b69174 raee7e35 76 76 virtual Type* mutate(TupleType *tupleType); 77 77 virtual Type* mutate(VarArgsType *varArgsType); 78 virtual Type* mutate(ZeroType *zeroType); 79 virtual Type* mutate(OneType *oneType); 78 80 79 81 // TODO: worry about traversing into a forall-qualified function type or type decl with assertions -
src/SynTree/Visitor.cc
r7b69174 raee7e35 383 383 } 384 384 385 void Visitor::visit( ZeroType *zeroType ) { 386 acceptAll( zeroType->get_forall(), *this ); 387 } 388 389 void Visitor::visit( OneType *oneType ) { 390 acceptAll( oneType->get_forall(), *this ); 391 } 392 385 393 void Visitor::visit( SingleInit *singleInit ) { 386 394 singleInit->get_value()->accept( *this ); -
src/SynTree/Visitor.h
r7b69174 raee7e35 95 95 virtual void visit( AttrType *attrType ); 96 96 virtual void visit( VarArgsType *varArgsType ); 97 virtual void visit( ZeroType *zeroType ); 98 virtual void visit( OneType *oneType ); 97 99 98 100 virtual void visit( SingleInit *singleInit ); -
src/SynTree/module.mk
r7b69174 raee7e35 26 26 SynTree/AttrType.cc \ 27 27 SynTree/VarArgsType.cc \ 28 SynTree/ZeroOneType.cc \ 28 29 SynTree/Constant.cc \ 29 30 SynTree/Expression.cc \
Note: See TracChangeset
for help on using the changeset viewer.