protected override void Visit(ElementNode element) { var binding = MatchElementBinding(element); if (binding == null) { base.Visit(element); return; } var snippets = binding.Nodes.SelectMany(bindingNode => BuildSnippetsForNode(binding, bindingNode, element)); var expression = new ExpressionNode(snippets); Accept(expression); }
private void GivenACodeExpressionNodeWrapping(ExpressionNode node) { Context.Target = new SparkCodeExpressionNodeWrapper(node); }
protected override void Visit(ExpressionNode node) { Chunks.Add(new SendExpressionChunk { Code = node.Code, Position = Locate(node), SilentNulls = node.SilentNulls, AutomaticallyEncode = node.AutomaticEncoding }); }
protected abstract void Visit(ExpressionNode node);
protected override void Visit(ExpressionNode node) { Nodes.Add(node); }
private void Transform(ElementNode node, IList<Node> body) { AttributeNode forAttribute = node.GetAttribute("for"); AttributeNode forType = node.GetAttribute("fortype"); AttributeNode forProperty = node.GetAttribute("forproperty"); if(forAttribute!=null) { // put in as content property node.Attributes.Remove(forAttribute); node.RemoveAttributesByName("name"); node.RemoveAttributesByName("value"); var nameNode = new ExpressionNode(forAttribute.Value.GetPropertyNameSnippet()); var valueNode = new ConditionNode("resource!=null") { Nodes = new List<Node>() { new ExpressionNode(forAttribute.Value) } }; SetNodeNameAndValue(node, valueNode, nameNode, body, forAttribute); } else if(forType!=null) { if(forProperty==null) { throw new Exception("Must have both a forProperty attribute if using the forType attribute."); } node.Attributes.Remove(forType); node.Attributes.Remove(forProperty); node.RemoveAttributesByName("name"); SetNodeNameAndValue(node, null, new TextNode(string.Concat(forType.Value, ".", forProperty.Value)), body, forAttribute); } }
protected void WhenParsingForIncompleteCode() { TheParsedExpressionNode = null; ParseResult<ExpressionNode> result = _grammar.IncompleteCode(_sourceContent); TheParsedExpressionNode = result == null ? null : result.Value; }
protected void WhenParsingForAnyNode() { TheParsedExpressionNode = _grammar.AnyNode(_sourceContent).Value as ExpressionNode; }