Parse() public static method

public static Parse ( IEnumerable tokens, Type modelType ) : SyntaxTreeNode
tokens IEnumerable
modelType System.Type
return Veil.Parser.SyntaxTreeNode
Esempio n. 1
0
        public SyntaxTreeNode Parse(TextReader templateReader, Type modelType)
        {
            var tokens     = SuperSimpleTokenizer.Tokenize(templateReader).ToArray();
            var firstToken = tokens.First();

            if (firstToken.IsSyntaxToken && firstToken.Content.StartsWith("Master"))
            {
                return(SuperSimpleMasterPageParser.Parse(tokens, modelType));
            }

            return(SuperSimpleTemplateParser.Parse(tokens, modelType));
        }
        internal void FinalizeCurrentSection()
        {
            if (!this.IsProcessingASection)
            {
                throw new VeilParserException("Found token @EndSection without a matching @Section");
            }

            var node = SuperSimpleTemplateParser.Parse(this.tokensInCurrentSection, this.ModelType);

            this.sections.Add(this.CurrentSectionName, node);
            this.IsProcessingASection = false;
            this.CurrentSectionName   = "";
            this.tokensInCurrentSection.Clear();
        }