static bool GroupIsActive(Racr.AstNode n) { var v = n.GetExpression().Value(); if (v == null) { return(false); } return((bool)v); }
[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); }
private static double EvalRoot(Racr.AstNode node) { return(node.GetExpression().Eval()); }
[AgRule("Value", "ComputedQuestion")] static object ComputedQuestionValue(Ast n) { return(n.GetExpression().Value()); }
[AgRule("IsActive", "Group")] static bool GroupIsActive(Ast n) { var v = n.GetExpression().Value(); return((v is bool) ? (bool)v : false); }
[AgRule("SExpr", "ComputedQuestion")] static string ComputedQuestionSExpr(Ast n) { return("(~? '" + n.GetName() + " " + Lexer.EscapeString(n.GetLabel()) + " " + n.GetExpression().SExpr() + ")"); }
[AgRule("SExpr", "Group")] static string GroupSExpr(Ast n) { return("(If " + n.GetExpression().SExpr() + " " + String.Join(" ", n.GetBody().Children().Select(x => ((Ast)x).SExpr())) + ")"); }
[AgRule("IsLValid", "Group")] static bool GroupIsLValid(Ast n) { return(n.GetExpression().Type() == Types.Boolean); }
[AgRule("Type", "ComputedQuestion")] static Types ComputedQuestionType(Ast n) { return(n.GetExpression().Type()); }
static string ComputedQuestionSExpr(Racr.AstNode n) { return("(~? '" + n.GetName() + " " + Lexer.EscapeString(n.GetLabel()) + " " + n.GetExpression().SExpr() + ")"); }
static string GroupSExpr(Racr.AstNode n) { return("(If " + n.GetExpression().SExpr() + " " + String.Join(" ", n.GetBody().Children().Select(x => ((Racr.AstNode)x).SExpr())) + ")"); }
static object ComputedQuestionValue(Racr.AstNode n) { return(n.GetExpression().Value()); }
static ValueTypes ComputedQuestionType(Racr.AstNode n) { return(n.GetExpression().Type()); }
static bool GroupIsLValid(Racr.AstNode n) { return(n.GetExpression().Type() == ValueTypes.Boolean); }