Exemplo n.º 1
0
 private Snippets AsTextOrientedCode(AttributeNode attr)
 {
     if (base.Context.AttributeBehaviour != AttributeBehaviour.CodeOriented)
     {
         return(attr.AsCodeInverted());
     }
     return(this.AsCode(attr));
 }
Exemplo n.º 2
0
        private void VisitIf(SpecialNode specialNode, SpecialNodeInspector inspector)
        {
            AttributeNode attr  = inspector.TakeAttribute("condition") ?? inspector.TakeAttribute("if");
            AttributeNode node2 = inspector.TakeAttribute("once");

            if ((attr == null) && (node2 == null))
            {
                throw new CompilerException("Element must contain an if, condition, or once attribute");
            }
            Frame frame = null;

            if (attr != null)
            {
                ConditionalChunk item = new ConditionalChunk {
                    Type      = ConditionalType.If,
                    Condition = this.AsCode(attr),
                    Position  = this.Locate(inspector.OriginalNode)
                };
                this.Chunks.Add(item);
                frame = new Frame(this, item.Body);
            }
            Frame frame2 = null;

            if (node2 != null)
            {
                ConditionalChunk chunk3 = new ConditionalChunk {
                    Type      = ConditionalType.Once,
                    Condition = node2.AsCodeInverted(),
                    Position  = this.Locate(inspector.OriginalNode)
                };
                this.Chunks.Add(chunk3);
                frame2 = new Frame(this, chunk3.Body);
            }
            base.Accept(specialNode.Body);
            if (frame2 != null)
            {
                frame2.Dispose();
            }
            if (frame != null)
            {
                frame.Dispose();
            }
        }
Exemplo n.º 3
0
 Snippets AsTextOrientedCode(AttributeNode attr)
 {
     return(Context.AttributeBehaviour == AttributeBehaviour.CodeOriented
         ? AsCode(attr)
         : attr.AsCodeInverted());
 }