PushNewScope() public method

public PushNewScope ( BlockNode blockNode ) : void
blockNode Veil.Parser.Nodes.BlockNode
return void
 private static void HandlePositiveConditional(SuperSimpleTemplateParserState state)
 {
     var condition = SyntaxTree.Conditional(
         state.ParseCurrentTokenExpression(),
         SyntaxTree.Block()
     );
     state.AddNodeToCurrentBlock(condition);
     state.PushNewScope(condition.TrueBlock);
 }
 private static void HandleEachOverExpression(SuperSimpleTemplateParserState state)
 {
     var each = SyntaxTree.Iterate(
         state.ParseCurrentTokenExpression(),
         SyntaxTree.Block()
     );
     state.AddNodeToCurrentBlock(each);
     state.PushNewScope(each.Body, each.ItemType);
 }
Exemplo n.º 3
0
        private static void HandlePositiveConditional(SuperSimpleTemplateParserState state)
        {
            var condition = SyntaxTree.Conditional(
                state.ParseCurrentTokenExpression(),
                SyntaxTree.Block()
                );

            state.AddNodeToCurrentBlock(condition);
            state.PushNewScope(condition.TrueBlock);
        }
Exemplo n.º 4
0
        private static void HandleEachOverExpression(SuperSimpleTemplateParserState state)
        {
            var each = SyntaxTree.Iterate(
                state.ParseCurrentTokenExpression(),
                SyntaxTree.Block()
                );

            state.AddNodeToCurrentBlock(each);
            state.PushNewScope(each.Body, each.ItemType);
        }
        public static SyntaxTreeNode Parse(IEnumerable<SuperSimpleToken> tokens, Type modelType)
        {
            var state = new SuperSimpleTemplateParserState();
            state.PushNewScope(modelType);

            foreach (var token in tokens)
            {
                state.CurrentToken = token;

                foreach (var handler in handlers)
                {
                    if (handler.Key(token))
                    {
                        handler.Value(state);
                        break;
                    }
                }
            }

            state.AssertScopeStackIsBackToASingleScope();
            return state.CurrentBlock;
        }
Exemplo n.º 6
0
        public static SyntaxTreeNode Parse(IEnumerable <SuperSimpleToken> tokens, Type modelType)
        {
            var state = new SuperSimpleTemplateParserState();

            state.PushNewScope(modelType);

            foreach (var token in tokens)
            {
                state.CurrentToken = token;

                foreach (var handler in handlers)
                {
                    if (handler.Key(token))
                    {
                        handler.Value(state);
                        break;
                    }
                }
            }

            state.AssertScopeStackIsBackToASingleScope();
            return(state.CurrentBlock);
        }