예제 #1
0
/*Type* DeclarationNode::buildType(DeclarationSpecifiersNode::TypeInfo tInfo) const
{
	Type* type = NULL;

	bool unsignedSpecified = tInfo.unsignedSpecified;
	int  integral = tInfo.integral;
	bool longSpecified = tInfo.longLongSpecified;
	bool longLongSpecified = tInfo.longLongSpecified;

	if (unsignedSpecified) {
		if (integral==Char) 
			type = new BuiltinType<char>(Type::uChar);
		else if (integral==Short)
			type = new BuiltinType<short>(Type::uShort);
		else if (integral==Int)
			type = new BuiltinType<int>(Type::uInt);
		else if (longLongSpecified)
			type = new BuiltinType<unsigned long long>(Type::uLongLong);
		else if (longSpecified)
			type = new BuiltinType<unsigned long>(Type::uLong);
	}
	else {
		if (integral==Int) {
			if (longLongSpecified)
				type = new BuiltinType<long long>(Type::Long);
			else if (longSpecified)
				type = new BuiltinType<long>(Type::Long);
			else
				type = new BuiltinType<int>(Type::Int);
		}
		else {
			if (integral==Char)
				type = new BuiltinType<char>(Type::Char);
			else if (Short)
				type = new BuiltinType<short>(Type::Short);
			else if (integral==Float)
				type = new BuiltinType<float>(Type::Float);
			else if (integral==Double)
				type = new BuiltinType<double>(Type::Double);
		}
	}

	return type;
}
*/
std::string DeclarationNode::toString() const
{
	std::string s="DeclarationNode: \n" ;
	TypeInfo t = declSpecifier->getTypeInfo();
	s+= "\t" + t.toString() + "\n";
	return s;
}
예제 #2
0
 auto operator()(const TypeInfo& type_info) { return type_info.toString(); }
예제 #3
0
void doType(TypeInfo type)
{
	cout << type.toString().toStdString();
}