Veil.SuperSimple.SuperSimpleTemplateParserState.AssertScopeStackIsBackToASingleScope C# (CSharp) Method

AssertScopeStackIsBackToASingleScope() public method

public AssertScopeStackIsBackToASingleScope ( ) : void
return void
        public void AssertScopeStackIsBackToASingleScope()
        {
            if (this.scopeStack.Count > 1)
            {
                throw new VeilParserException("Template ended with an open block");
            }
        }
    }

Usage Example

        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;
        }
All Usage Examples Of Veil.SuperSimple.SuperSimpleTemplateParserState::AssertScopeStackIsBackToASingleScope