예제 #1
0
	static bool GroupIsValid(Racr.AstNode n) {
		return n.IsLValid() && n.GetBody().Children().All(x => ((Racr.AstNode)x).IsValid());
	}
예제 #2
0
	static bool FormIsValid(Racr.AstNode n) {
		return n.GetBody().Children(new Racr.Range(2)).All(x => ((Racr.AstNode)x).IsValid());
	}
예제 #3
0
	static Racr.AstNode GroupLLookup(Racr.AstNode n, string name) {
		return findL(name, n.GetBody(), n.GetBody().NumChildren());
	}
예제 #4
0
	static Racr.AstNode FormErrorQuestion(Racr.AstNode n) { return n.GetBody().Child(1); }
예제 #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;
		}
	}
예제 #6
0
	static string GroupSExpr(Racr.AstNode n) {
		return "(If " + n.GetExpression().SExpr() + " " + String.Join(" ", n.GetBody().Children().Select(x => ((Racr.AstNode)x).SExpr())) + ")";
	}
예제 #7
0
	static string FormSExpr(Racr.AstNode n) {
		return "(Form " + String.Join(" ", n.GetBody().Children().Skip(1).Select(x => ((Racr.AstNode)x).SExpr())) + ")";
	}
예제 #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;
	}