Jade.Parser.JadeParser.parseTextBlock C# (CSharp) Method

parseTextBlock() private method

private parseTextBlock ( ) : Node
return Jade.Parser.Nodes.Node
        private Node parseTextBlock()
        {
            TextNode textNode = new TextNode();
            textNode.setLineNumber(line());
            textNode.setFileName(filename);
            Token token = expect(typeof (Indent));
            Indent indentToken = (Indent) token;
            int spaces = indentToken.getIndents();
            if (null == this._spaces)
                this._spaces = spaces;
            String indentStr = StringUtils.repeat(" ", spaces - this._spaces.Value);
            while (!(peek() is Outdent))
            {
                if (peek() is Eos)
                    break;

                if (peek() is Newline)
                {
                    textNode.appendText("\n");
                    this.nextToken();
                }
                else if (peek() is Indent)
                {
                    textNode.appendText("\n");
                    textNode.appendText(this.parseTextBlock().getValue());
                    textNode.appendText("\n");
                }
                else
                {
                    textNode.appendText(indentStr + this.nextToken().getValue());
                }
            }

            if (spaces == this._spaces)
                this._spaces = null;

            if (peek() is Eos)
                return textNode;
            token = expect(typeof(Outdent));
            return textNode;
        }