A node that contains a sequence of other nodes
Inheritance: SyntaxTreeNode
コード例 #1
0
 public void PushNewScope(BlockNode blockNode, Type modelType)
 {
     this.scopeStack.AddFirst(new SuperSimpleTemplateParserScope
     {
         Block = blockNode,
         ModelType = modelType
     });
 }
コード例 #2
0
ファイル: SyntaxTree.cs プロジェクト: MetaMicrocode/Veil
 /// <summary>
 /// Iterate a collection and execute the body block scoped to each item in the collection.
 /// Optionally execute an empty block when there are no items to iterate
 /// </summary>
 /// <param name="collectionExpression">expression to load the collection</param>
 /// <param name="body">Block to execute in the scope of each item</param>
 /// <param name="emptyBody">Block to execute when there are no items in the collection</param>
 public static IterateNode Iterate(ExpressionNode collectionExpression, BlockNode body, BlockNode emptyBody = null)
 {
     return new IterateNode
     {
         Collection = collectionExpression,
         Body = body,
         EmptyBody = emptyBody ?? SyntaxTree.Block()
     };
 }
コード例 #3
0
ファイル: SyntaxTree.cs プロジェクト: MetaMicrocode/Veil
 /// <summary>
 /// Evaluates an expression and chooses between two blocks based on the truthy-ness of the result
 /// </summary>
 /// <param name="expression">The expression to evaluate</param>
 /// <param name="trueBlock">The block to execute when the expression is true</param>
 /// <param name="falseBlock">The block to evaluate when the expression is false</param>
 /// <returns></returns>
 public static ConditionalNode Conditional(ExpressionNode expression, BlockNode trueBlock, BlockNode falseBlock = null)
 {
     return new ConditionalNode
     {
         Expression = expression,
         TrueBlock = trueBlock,
         FalseBlock = falseBlock
     };
 }
コード例 #4
0
ファイル: SyntaxTree.cs プロジェクト: namics/TerrificNet
        /// <summary>
        /// Create a sequential block of nodes
        /// </summary>
        public static BlockNode Block(SourceLocation location, params SyntaxTreeNode[] nodes)
        {
            var block = new BlockNode
            {
	            Location = location
            };
            block.AddRange(nodes);
            return block;
        }
コード例 #5
0
 public void PushNewScope(BlockNode blockNode)
 {
     this.PushNewScope(blockNode, this.CurrentTypeInScope());
 }
コード例 #6
0
ファイル: SyntaxTree.cs プロジェクト: MetaMicrocode/Veil
 /// <summary>
 /// Create a sequential block of nodes
 /// </summary>
 public static BlockNode Block(params SyntaxTreeNode[] nodes)
 {
     var block = new BlockNode();
     block.AddRange(nodes);
     return block;
 }
コード例 #7
0
ファイル: SyntaxTree.cs プロジェクト: namics/TerrificNet
	    public static SyntaxTreeNode Helper(HelperExpressionNode helperExpression, BlockNode block, SourceLocation location)
	    {
		    return new HelperBlockNode
		    {
				Location = location,
				HelperExpression = helperExpression,
				Block = block
		    };
	    }