Strongly typed enum for type tokens.
This commit is contained in:
parent
76ee587672
commit
ce513643da
10
Monicelli.ll
10
Monicelli.ll
|
@ -37,23 +37,23 @@ CHAR [a-zA-Z_]
|
||||||
return RETURN;
|
return RETURN;
|
||||||
}
|
}
|
||||||
"Necchi" {
|
"Necchi" {
|
||||||
monicelli_lval.typeval = TYPENAME_INT;
|
monicelli_lval.typeval = Type::INT;
|
||||||
return TYPENAME;
|
return TYPENAME;
|
||||||
}
|
}
|
||||||
"Mascetti" {
|
"Mascetti" {
|
||||||
monicelli_lval.typeval = TYPENAME_CHAR;
|
monicelli_lval.typeval = Type::CHAR;
|
||||||
return TYPENAME;
|
return TYPENAME;
|
||||||
}
|
}
|
||||||
"Perozzi" {
|
"Perozzi" {
|
||||||
monicelli_lval.typeval = TYPENAME_FLOAT;
|
monicelli_lval.typeval = Type::FLOAT;
|
||||||
return TYPENAME;
|
return TYPENAME;
|
||||||
}
|
}
|
||||||
"Melandri" {
|
"Melandri" {
|
||||||
monicelli_lval.typeval = TYPENAME_BOOL;
|
monicelli_lval.typeval = Type::BOOL;
|
||||||
return TYPENAME;
|
return TYPENAME;
|
||||||
}
|
}
|
||||||
"Sassaroli" {
|
"Sassaroli" {
|
||||||
monicelli_lval.typeval = TYPENAME_DOUBLE;
|
monicelli_lval.typeval = Type::DOUBLE;
|
||||||
return TYPENAME;
|
return TYPENAME;
|
||||||
}
|
}
|
||||||
"conte" {
|
"conte" {
|
||||||
|
|
10
Nodes.cpp
10
Nodes.cpp
|
@ -97,19 +97,19 @@ void Branch::emit(std::ostream &stream, int indent) {
|
||||||
|
|
||||||
void VarDeclaration::emit(std::ostream &stream, int indent) {
|
void VarDeclaration::emit(std::ostream &stream, int indent) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case TYPENAME_INT:
|
case Type::INT:
|
||||||
stream << "int";
|
stream << "int";
|
||||||
break;
|
break;
|
||||||
case TYPENAME_CHAR:
|
case Type::CHAR:
|
||||||
stream << "char";
|
stream << "char";
|
||||||
break;
|
break;
|
||||||
case TYPENAME_FLOAT:
|
case Type::FLOAT:
|
||||||
stream << "float";
|
stream << "float";
|
||||||
break;
|
break;
|
||||||
case TYPENAME_BOOL:
|
case Type::BOOL:
|
||||||
stream << "bool";
|
stream << "bool";
|
||||||
break;
|
break;
|
||||||
case TYPENAME_DOUBLE:
|
case Type::DOUBLE:
|
||||||
stream << "double";
|
stream << "double";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue
Block a user