Ejemplo n.º 1
0
    static bool GroupIsActive(Racr.AstNode n)
    {
        var v = n.GetExpression().Value();

        if (v == null)
        {
            return(false);
        }
        return((bool)v);
    }
Ejemplo n.º 2
0
    [AgRule("Widget", "Group")] static Box GroupWidget(Ast n)
    {
        VBox  contentBox = new VBox(false, 5);
        Frame frame      = new Frame(n.GetExpression().SExpr());

        frame.BorderWidth = 5;
        frame.Add(contentBox);
        if (!n.IsLValid())
        {
            Gdk.Color col = new Gdk.Color();
            Gdk.Color.Parse("red", ref col);
            frame.ModifyBg(StateType.Normal, col);
        }
        n.Parent().Widget().PackStart(frame, false, false, 5);
        frame.Show();
        return(contentBox);
    }
Ejemplo n.º 3
0
 private static double EvalRoot(Racr.AstNode node)
 {
     return(node.GetExpression().Eval());
 }
Ejemplo n.º 4
0
 [AgRule("Value", "ComputedQuestion")] static object ComputedQuestionValue(Ast n)
 {
     return(n.GetExpression().Value());
 }
Ejemplo n.º 5
0
    [AgRule("IsActive", "Group")] static bool GroupIsActive(Ast n)
    {
        var v = n.GetExpression().Value();

        return((v is bool) ? (bool)v : false);
    }
Ejemplo n.º 6
0
 [AgRule("SExpr", "ComputedQuestion")] static string ComputedQuestionSExpr(Ast n)
 {
     return("(~? '" + n.GetName() + " " + Lexer.EscapeString(n.GetLabel()) +
            " " + n.GetExpression().SExpr() + ")");
 }
Ejemplo n.º 7
0
 [AgRule("SExpr", "Group")] static string GroupSExpr(Ast n)
 {
     return("(If " + n.GetExpression().SExpr() + " " +
            String.Join(" ", n.GetBody().Children().Select(x => ((Ast)x).SExpr())) + ")");
 }
Ejemplo n.º 8
0
 [AgRule("IsLValid", "Group")] static bool GroupIsLValid(Ast n)
 {
     return(n.GetExpression().Type() == Types.Boolean);
 }
Ejemplo n.º 9
0
 [AgRule("Type", "ComputedQuestion")] static Types ComputedQuestionType(Ast n)
 {
     return(n.GetExpression().Type());
 }
Ejemplo n.º 10
0
 static string ComputedQuestionSExpr(Racr.AstNode n)
 {
     return("(~? '" + n.GetName() + " " + Lexer.EscapeString(n.GetLabel()) + " " + n.GetExpression().SExpr() + ")");
 }
Ejemplo n.º 11
0
 static string GroupSExpr(Racr.AstNode n)
 {
     return("(If " + n.GetExpression().SExpr() + " " + String.Join(" ", n.GetBody().Children().Select(x => ((Racr.AstNode)x).SExpr())) + ")");
 }
Ejemplo n.º 12
0
 static object ComputedQuestionValue(Racr.AstNode n)
 {
     return(n.GetExpression().Value());
 }
Ejemplo n.º 13
0
 static ValueTypes ComputedQuestionType(Racr.AstNode n)
 {
     return(n.GetExpression().Type());
 }
Ejemplo n.º 14
0
 static bool GroupIsLValid(Racr.AstNode n)
 {
     return(n.GetExpression().Type() == ValueTypes.Boolean);
 }