示例#1
0
 [AgRule("LLookup", "Question")] static Ast QuestionLLookup(Ast n, string name)
 {
     if (n.GetName() == name)
     {
         return(n);
     }
     return(null);
 }
示例#2
0
 static Racr.AstNode QuestionLLookup(Racr.AstNode n, string name)
 {
     if (n.GetName() == name)
     {
         return(n);
     }
     return(null);
 }
示例#3
0
    [AgRule("Value", "Use")] static object UseValue(Ast n)
    {
        if (n.Type() == Types.ErrorType)
        {
            return(ErrorValue);
        }
        var active = n.FindActive(n.GetName());

        return(active.Type() == n.Type() ? active.Value() : ErrorValue);
    }
示例#4
0
    static bool QuestionIsLValid(Racr.AstNode n)
    {
        if (n.Type() == ValueTypes.ErrorType)
        {
            return(false);
        }
        var prev = n.GLookup(n.GetName());

        return(prev.IsErrorQuestion() || n.Type() == prev.Type());
    }
示例#5
0
    [AgRule("IsLValid", "Question")] static bool QuestionIsLValid(Ast n)
    {
        if (n.Type() == Types.ErrorType)
        {
            return(false);
        }
        var prev = n.GLookup(n.GetName());

        return(prev.IsErrorQuestion() || n.Type() == prev.Type());
    }
示例#6
0
 private static double EvalConst(Racr.AstNode node)
 {
     return(node.Lookup(node.GetName()).GetValue());
 }
示例#7
0
 [AgRule("IsActive", "Question")] static bool QuestionIsActive(Ast n)
 {
     return(n.IsErrorQuestion() || (
                n.Parent().IsActive() &&
                n.FindActive(n.GetName()).IsErrorQuestion()));
 }
示例#8
0
 [AgRule("SExpr", "Use")] static string UseSExpr(Ast n)
 {
     return("(~> '" + n.GetName() + ")");
 }
示例#9
0
 [AgRule("SExpr", "ComputedQuestion")] static string ComputedQuestionSExpr(Ast n)
 {
     return("(~? '" + n.GetName() + " " + Lexer.EscapeString(n.GetLabel()) +
            " " + n.GetExpression().SExpr() + ")");
 }
示例#10
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())) + ")");
 }
示例#11
0
 [AgRule("Type", "Use")] static Types UseType(Ast n)
 {
     return(n.GLookup(n.GetName()).Type());
 }
示例#12
0
 static string UseSExpr(Racr.AstNode n)
 {
     return("(~> '" + n.GetName() + ")");
 }
示例#13
0
 static string ComputedQuestionSExpr(Racr.AstNode n)
 {
     return("(~? '" + n.GetName() + " " + Lexer.EscapeString(n.GetLabel()) + " " + n.GetExpression().SExpr() + ")");
 }
示例#14
0
 static string OrdinaryQuestionSExpr(Racr.AstNode n)
 {
     return("(?? '" + n.GetName() + " " + Lexer.EscapeString(n.GetLabel()) + " " + n.Type() + " " + Lexer.EscapeValue(n.Value()) + ")");
 }
示例#15
0
 static object UseValue(Racr.AstNode n)
 {
     return(n.FindActive(n.GetName()).Value());
 }
示例#16
0
 static ValueTypes UseType(Racr.AstNode n)
 {
     return(n.GLookup(n.GetName()).Type());
 }
示例#17
0
 static bool QuestionIsActive(Racr.AstNode n)
 {
     return(n.IsErrorQuestion() || (n.Parent().IsActive() && n.FindActive(n.GetName()).IsErrorQuestion()));
 }