Save state before re-write of RegEx.

This commit is contained in:
Nathan Braswell
2014-01-07 13:14:58 -05:00
parent 82df9b1592
commit 0297f29dcd
13 changed files with 139 additions and 57 deletions

View File

@@ -15,27 +15,22 @@ Type::Type(ValueType typeIn, int indirectionIn) {
baseType = typeIn;
}
Type::Type(std::string typeIn) {
Type::Type(NodeTree<ASTData>* typeDefinitionIn) {
indirection = 0;
while (typeIn[typeIn.size() - indirection - 1] == '*') indirection++;
std::string edited = strSlice(typeIn, 0, -(indirection + 1));
if (edited == "void")
baseType = void_type;
else if (edited == "bool")
baseType = boolean;
else if (edited == "int")
baseType = integer;
else if (edited == "float")
baseType = floating;
else if (edited == "double")
baseType = double_percision;
else if (edited == "char")
baseType = character;
else
baseType = none;
//std::cout << ":ALKJF:LSKDJF:SDJF:LKSJDF\t\t\t" << typeIn << "\t" << edited << std::endl;
baseType = none;
typeDefinition = typeDefinitionIn;
}
Type::Type(NodeTree<ASTData>* typeDefinitionIn, int indirectionIn) {
indirection = indirectionIn;
baseType = none;
typeDefinition = typeDefinitionIn;
}
Type::Type(ValueType typeIn, NodeTree<ASTData>* typeDefinitionIn, int indirectionIn) {
baseType = typeIn;
indirection = indirectionIn;
typeDefinition = typeDefinitionIn;
}
Type::~Type() {
}
@@ -44,7 +39,10 @@ std::string Type::toString() {
std::string typeString;
switch (baseType) {
case none:
typeString = "none";
if (typeDefinition)
typeString = typeDefinition->getDataRef()->symbol.getName();
else
typeString = "none";
break;
case void_type:
typeString = "void";
@@ -65,7 +63,10 @@ std::string Type::toString() {
typeString = "char";
break;
default:
typeString = "unknown_type";
if (typeDefinition)
typeString = typeDefinition->getDataRef()->symbol.getName();
else
typeString = "unknown_type";
}
for (int i = 0; i < indirection; i++)
typeString += "*";