예제 #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()));
 }