Beispiel #1
0
        private Token ReadElement()
        {
            switch (Current.TokenKind) {
            case TokenKind.EOF:
                return null;

            case TokenKind.TagStart:
                return ReadTag();

            case TokenKind.StatementClose:
                return ReadCloseTag();

            case TokenKind.ExpStart:
                return ReadExpression();

            case TokenKind.TextData:
                Text text = new Text(Current.Line, Current.Col, Current.Data);
                Consume();
                return text;

            default:
                throw new TmplException("Invalid token: " + Current.TokenKind.ToString() + " " + Current.Line + "," + Current.Col, Current.Line, Current.Col);
            }
        }
Beispiel #2
0
        private void visitText(Text text)
        {
            string str = text.Data.Replace("\r\n", " ");

            if (str.Length > 25)
                WriteLine(str.Substring(0, 25) + "...");
            else
                WriteLine(str);
        }