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;
|
||||
}
|
||||
"Necchi" {
|
||||
monicelli_lval.typeval = TYPENAME_INT;
|
||||
monicelli_lval.typeval = Type::INT;
|
||||
return TYPENAME;
|
||||
}
|
||||
"Mascetti" {
|
||||
monicelli_lval.typeval = TYPENAME_CHAR;
|
||||
monicelli_lval.typeval = Type::CHAR;
|
||||
return TYPENAME;
|
||||
}
|
||||
"Perozzi" {
|
||||
monicelli_lval.typeval = TYPENAME_FLOAT;
|
||||
monicelli_lval.typeval = Type::FLOAT;
|
||||
return TYPENAME;
|
||||
}
|
||||
"Melandri" {
|
||||
monicelli_lval.typeval = TYPENAME_BOOL;
|
||||
monicelli_lval.typeval = Type::BOOL;
|
||||
return TYPENAME;
|
||||
}
|
||||
"Sassaroli" {
|
||||
monicelli_lval.typeval = TYPENAME_DOUBLE;
|
||||
monicelli_lval.typeval = Type::DOUBLE;
|
||||
return TYPENAME;
|
||||
}
|
||||
"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) {
|
||||
switch (type) {
|
||||
case TYPENAME_INT:
|
||||
case Type::INT:
|
||||
stream << "int";
|
||||
break;
|
||||
case TYPENAME_CHAR:
|
||||
case Type::CHAR:
|
||||
stream << "char";
|
||||
break;
|
||||
case TYPENAME_FLOAT:
|
||||
case Type::FLOAT:
|
||||
stream << "float";
|
||||
break;
|
||||
case TYPENAME_BOOL:
|
||||
case Type::BOOL:
|
||||
stream << "bool";
|
||||
break;
|
||||
case TYPENAME_DOUBLE:
|
||||
case Type::DOUBLE:
|
||||
stream << "double";
|
||||
break;
|
||||
}
|
||||
|
|
Reference in New Issue
Block a user