Exemplo n.º 1
0
	static bool GroupIsValid(Racr.AstNode n) {
		return n.IsLValid() && n.GetBody().Children().All(x => ((Racr.AstNode)x).IsValid());
	}
Exemplo n.º 2
0
	static bool FormIsValid(Racr.AstNode n) {
		return n.GetBody().Children(new Racr.Range(2)).All(x => ((Racr.AstNode)x).IsValid());
	}
Exemplo n.º 3
0
	static Racr.AstNode GroupLLookup(Racr.AstNode n, string name) {
		return findL(name, n.GetBody(), n.GetBody().NumChildren());
	}
Exemplo n.º 4
0
	static Racr.AstNode FormErrorQuestion(Racr.AstNode n) { return n.GetBody().Child(1); }
Exemplo n.º 5
0
	static public void UpdateQuestions(Racr.AstNode n) {
		switch (n.NodeType()) {
		case "Form":
		case "Group":
			foreach (var c in n.GetBody().Children()) UpdateQuestions(c as Racr.AstNode);
			break;
		case "ComputedQuestion":
			break;
		default:
			(n.Widget() as Widget).Set(n.Value());
			break;
		}
	}
Exemplo n.º 6
0
	static string GroupSExpr(Racr.AstNode n) {
		return "(If " + n.GetExpression().SExpr() + " " + String.Join(" ", n.GetBody().Children().Select(x => ((Racr.AstNode)x).SExpr())) + ")";
	}
Exemplo n.º 7
0
	static string FormSExpr(Racr.AstNode n) {
		return "(Form " + String.Join(" ", n.GetBody().Children().Skip(1).Select(x => ((Racr.AstNode)x).SExpr())) + ")";
	}
Exemplo n.º 8
0
	static bool GroupRender(Racr.AstNode n) {
		foreach (var c in n.GetBody().Children()) {
			var child = c as Racr.AstNode;
			var w = child.Widget();
			child.Render();
			if (child.IsShown()) w.Show();
			else child.Widget().Hide();
		}
		return true;
	}