public IfElseParseNode(Token t, IEnumerator<Token> tokens) { Column = t.Column; Line = t.Line; Value = t.Value.Substring(t.Value.IndexOf(" ")).Trim(); _block = new BlockParseNode(tokens); if (tokens.Current.Type == TokenType.Else) { _elseBlock = new BlockParseNode(tokens); } else if (tokens.Current.Type == TokenType.ElseIf) { _elseBlock = new IfElseParseNode(tokens.Current, tokens); } else if (tokens.Current.Type != TokenType.End) { // Nothing; } else { throw new TemplateParseException(tokens.Current.Line, tokens.Current.Column, "Invalid If else block"); } }
public Template(TextReader source) { _root = new BlockParseNode(new Tokenizer(new Scanner(source.ReadToEnd()))); }
public ForeachParseNode(Token current, IEnumerator<Token> tokens) { Value = current.Value.Substring(current.Value.IndexOf(" ")).Trim(); Line = current.Line; Column = current.Column; _listToken = current; _block = new BlockParseNode(tokens); }