示例#1
0
    [AgRule("Value", "OrdinaryQuestion")] static object OrdinaryQuestionValue(Ast n)
    {
        if (n.Type() == Types.ErrorType)
        {
            return(ErrorValue);
        }
        var acceptor = TypeToAcceptor(n.Type());         // acceptor is never null

        return(acceptor(n.GetValue()) ? n.GetValue() : ErrorValue);
    }
示例#2
0
    static ValueTypes ConstantType(Racr.AstNode n)
    {
        var val = n.GetValue();

        if (val is bool)
        {
            return(ValueTypes.Boolean);
        }
        if (val is double)
        {
            return(ValueTypes.Number);
        }
        if (val is string)
        {
            return(ValueTypes.String);
        }
        return(ValueTypes.ErrorType);
    }
示例#3
0
 private static double EvalNumber(Racr.AstNode node)
 {
     return(node.GetValue());
 }
示例#4
0
 [AgRule("Value", "Constant")] static object ConstantValue(Ast n)
 {
     return(n.Type() == Types.ErrorType ? ErrorValue : n.GetValue());
 }
示例#5
0
 [AgRule("SExpr", "Constant")] static string ConstantSExpr(Ast n)
 {
     return("(~! " + Lexer.EscapeValue(n.GetValue()) + ")");
 }
示例#6
0
 [AgRule("SExpr", "OrdinaryQuestion")] static string OrdinaryQuestionSExpr(Ast n)
 {
     return("(?? '" + n.GetName() + " " + Lexer.EscapeString(n.GetLabel()) + " " + n.Type() + " " +
            (n.GetValue() == ErrorValue ? "" : Lexer.EscapeValue(n.GetValue())) + ")");
 }
示例#7
0
 [AgRule("Type", "Constant")] static Types ConstantType(Ast n)
 {
     return(ValueToType(n.GetValue()));
 }
示例#8
0
 static object ConstantValue(Racr.AstNode n)
 {
     return(n.GetValue());
 }
示例#9
0
 static object OrdinaryQuestionValue(Racr.AstNode n)
 {
     return(n.GetValue());
 }