Ejemplo n.º 1
0
/*
template<>
std::string deparseVector<Call>(State const& state, Call const& v, Value const& names) {
	return state.deparse(Call(v)[0]) + "(" + deparseVectorBody(state, Subset(v, 1, v.length-1), names) + ")";
}

template<>
std::string deparseVector<Expression>(State const& state, Expression const& v, Value const& names) {
	return "expression(" + deparseVectorBody(state, v, names) + ")";
}
*/
std::string deparse(State const& state, Value const& value) {
	switch(value.type)
	{
		case Type::Null:
			return "NULL";
		#define CASE(Name) case Type::Name: return deparseVector(state, (Name const&)value); break;
		VECTOR_TYPES_NOT_NULL(CASE)
		#undef CASE
		case Type::Function:
			return state.externStr(((Function const&)value).prototype()->string);
		case Type::Environment:
			return "environment";
		case Type::Object:
			return deparse(state, ((Object const&)value).base());
		default:
			return Type::toString(value.type);
	};
}
Ejemplo n.º 2
0
void Parser::setCatcodes(cat_type t)
{
	theCatcodesType_ = t;
	deparse();
}
Ejemplo n.º 3
0
void Parser::popPosition()
{
	pos_ = positions_.back();
	positions_.pop_back();
	deparse();
}
Ejemplo n.º 4
0
void Parser::setCatcode(char c, CatCode cat)
{
	theCatcode_[(unsigned char)c] = cat;
	deparse();
}