Error/informational message reporter. You should only need to edit the file TidyMessages.properties to localize HTML tidy. (c) 1998-2000 (W3C) MIT, INRIA, Keio University Derived from HTML Tidy Release 4 Aug 2000
Exemplo n.º 1
0
        public override int ReadChar()
        {
            int character;

            if (Pushed)
            {
                Pushed    = false;
                character = Character;

                if (character == '\n')
                {
                    CursorColumn = 1;
                    CursorLine++;
                    return(character);
                }

                CursorColumn++;
                return(character);
            }

            LastColumn = CursorColumn;

            if (Tabs > 0)
            {
                CursorColumn++;
                Tabs--;
                return(' ');
            }

            for (;;)
            {
                character = ReadCharFromStream();
                if (character < 0)
                {
                    return(END_OF_STREAM);
                }

                if (character == '\n')
                {
                    CursorColumn = 1;
                    CursorLine++;
                    break;
                }

                if (character == '\r')
                {
                    character = ReadCharFromStream();
                    if (character != '\n')
                    {
                        UngetChar(character);
                        character = '\n';
                    }
                    CursorColumn = 1;
                    CursorLine++;
                    break;
                }

                if (character == '\t')
                {
                    Tabs = TabSize - ((CursorColumn - 1) % TabSize) - 1;
                    CursorColumn++;
                    character = ' ';
                    break;
                }

                /* strip control characters, except for Esc */

                if (character == '\x001B')
                {
                    break;
                }

                if (0 < character && character < 32)
                {
                    continue;
                }

                /* watch out for IS02022 */

                if (Encoding == CharEncoding.Raw || Encoding == CharEncoding.Iso2022)
                {
                    CursorColumn++;
                    break;
                }

                if (Encoding == CharEncoding.MacroMan)
                {
                    character = Mac2Unicode[character];
                }

                /* produced e.g. as a side-effect of smart quotes in Word */
                if (127 < character && character < 160)
                {
                    Report.EncodingError((Lexer)Lexer, Report.WINDOWS_CHARS, character);

                    character = Win2Unicode[character - 128];
                    if (character == 0)
                    {
                        continue;
                    }
                }

                CursorColumn++;
                break;
            }

            return(character);
        }