Fixed recursion bug in expression calculator

git-svn-id: svn://ultimatepp.org/upp/trunk@1596 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
rylek 2009-10-01 09:07:34 +00:00
parent 04de8d9434
commit d0e87f3549
3 changed files with 20 additions and 10 deletions

View file

@ -10,6 +10,9 @@ NAMESPACE_UPP
String CalcType<const CalcNode *>::Describe() { return "lambda-výraz"; }
RegisterStdCalcTypeName(const CalcNode *)
String CalcType<CalcNodePtr>::Describe() { return t_("lambda-expression"); }
RegisterStdCalcTypeName(CalcNodePtr)
int CharFilterCalcIdent(int c) { return IsIdent(c) ? c : 0; }
int CharFilterCalcUpperIdent(int c) { return IsIdent(c) ? ToUpper(c) : 0; }

View file

@ -395,6 +395,14 @@ struct CalcType<const CalcNode *> : public CalcRawType<const CalcNode *>
static String Describe();
};
template <>
struct CalcType<CalcNodePtr> : public CalcRawType<CalcNodePtr>
{
static Value ToValue(CalcNodePtr cn) { return !!cn ? RawToValue(cn) : Value(); }
static CalcNodePtr ValueTo(Value v) { return IsTypeRaw<CalcNodePtr>(v) ? UPP::ValueTo<CalcNodePtr>(v) : NULL; }
static String Describe();
};
class CalcParser
{
public:

View file

@ -3,16 +3,16 @@
NAMESPACE_UPP
String CalcTypeDescribeInt() { return t_("integer"); }
String CalcTypeDescribeInt() { return t_("integer"); }
String CalcType<double>::Describe() { return t_("real number"); }
String CalcType<String>::Describe() { return t_("string"); }
String CalcType<Date>::Describe() { return t_("date"); }
String CalcType<Time>::Describe() { return t_("date/time"); }
String CalcType<bool>::Describe() { return t_("logical value"); }
String CalcType<Value>::Describe() { return t_("any data type"); }
String CalcType<ValueArray>::Describe() { return t_("array"); }
String CalcType<Nuller>::Describe() { return t_("null value"); }
String CalcType<double>::Describe() { return t_("real number"); }
String CalcType<String>::Describe() { return t_("string"); }
String CalcType<Date>::Describe() { return t_("date"); }
String CalcType<Time>::Describe() { return t_("date/time"); }
String CalcType<bool>::Describe() { return t_("logical value"); }
String CalcType<Value>::Describe() { return t_("any data type"); }
String CalcType<ValueArray>::Describe() { return t_("array"); }
String CalcType<Nuller>::Describe() { return t_("null value"); }
RegisterStdCalcTypeName(double)
RegisterStdCalcTypeName(String)
@ -22,7 +22,6 @@ RegisterStdCalcTypeName(Time)
RegisterStdCalcTypeName(bool)
RegisterStdCalcTypeName(Value)
RegisterStdCalcTypeName(ValueArray)
RegisterStdCalcTypeName(CalcNodePtr)
const char *CalcNanError()
{