Tidy.Core.Lexer.UngetToken C# (CSharp) Method

UngetToken() public method

public UngetToken ( ) : void
return void
        public virtual void UngetToken()
        {
            Pushed = true;
        }

Usage Example

Beispiel #1
0
            public virtual void Parse(Lexer lexer, Node field, short mode)
            {
                TagCollection tt = lexer.Options.TagTable;

                lexer.Insert = - 1; /* defer implicit inline start tags */

                if (field.Tag == tt.TagTextarea)
                    mode = Lexer.PREFORMATTED;

                while (true)
                {
                    Node node = lexer.GetToken(mode);
                    if (node == null)
                        break;
                    if (node.Tag == field.Tag && node.Type == Node.END_TAG)
                    {
                        field.Closed = true;
                        Node.TrimSpaces(lexer, field);
                        return;
                    }

                    /* deal with comments etc. */
                    if (Node.InsertMisc(field, node))
                        continue;

                    if (node.Type == Node.TEXT_NODE)
                    {
                        /* only called for 1st child */
                        if (field.Content == null && (mode & Lexer.PREFORMATTED) == 0)
                            Node.TrimSpaces(lexer, field);

                        if (node.Start >= node.End)
                        {
                            continue;
                        }

                        Node.InsertNodeAtEnd(field, node);
                        continue;
                    }

                    if (node.Tag == tt.TagFont)
                    {
                        Report.Warning(lexer, field, node, Report.DISCARDING_UNEXPECTED);
                        continue;
                    }

                    /* terminate element on other tags */
                    if ((field.Tag.Model & ContentModel.OPT) == 0)
                        Report.Warning(lexer, field, node, Report.MISSING_ENDTAG_BEFORE);

                    lexer.UngetToken();
                    Node.TrimSpaces(lexer, field);
                    return;
                }

                if ((field.Tag.Model & ContentModel.OPT) == 0)
                    Report.Warning(lexer, field, null, Report.MISSING_ENDTAG_FOR);
            }
All Usage Examples Of Tidy.Core.Lexer::UngetToken