Class CssCharStream

  • All Implemented Interfaces:
    CharStream

    public final class CssCharStream
    extends java.lang.Object
    implements CharStream
    An implementation of interface CharStream. There is no processing of escaping in this class because the escaping is part of the parser. CSS has some strange rules about that, so processing unicode escapes in this class is too early.
    • Field Detail

      • staticFlag

        public static final boolean staticFlag
        Whether parser is static.
        See Also:
        Constant Field Values
      • bufsize

        int bufsize
      • available

        int available
      • tokenBegin

        int tokenBegin
      • bufpos

        public int bufpos
        Position in buffer.
      • bufline

        private int[] bufline
      • bufcolumn

        private int[] bufcolumn
      • column

        private int column
      • line

        private int line
      • prevCharIsCR

        private boolean prevCharIsCR
      • prevCharIsLF

        private boolean prevCharIsLF
      • inputStream

        private java.io.Reader inputStream
      • buffer

        private char[] buffer
      • maxNextCharInd

        private int maxNextCharInd
      • inBuf

        private int inBuf
      • tabSize

        private int tabSize
      • trackLineColumn

        private boolean trackLineColumn
    • Constructor Detail

      • CssCharStream

        public CssCharStream​(java.io.Reader dstream,
                             int startline,
                             int startcolumn,
                             int buffersize)
        Constructor.
        Parameters:
        dstream - the stream to read from
        startline - startline
        startcolumn - startcolumn
        buffersize - buffersize
      • CssCharStream

        public CssCharStream​(java.io.Reader dstream,
                             int startline,
                             int startcolumn)
        Constructor.
        Parameters:
        dstream - the stream to read from
        startline - startline
        startcolumn - startcolumn
    • Method Detail

      • ExpandBuff

        private void ExpandBuff​(boolean wrapAround)
      • FillBuff

        private final void FillBuff()
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • BeginToken

        public final char BeginToken()
                              throws java.io.IOException
        Start.
        Specified by:
        BeginToken in interface CharStream
        Throws:
        java.io.IOException
      • UpdateLineColumn

        private final void UpdateLineColumn​(char c)
      • readChar

        public final char readChar()
                            throws java.io.IOException
        Read a character.
        Specified by:
        readChar in interface CharStream
        Throws:
        java.io.IOException
      • getEndColumn

        public final int getEndColumn()
        Get token end column number.
        Specified by:
        getEndColumn in interface CharStream
      • getEndLine

        public final int getEndLine()
        Get token end line number.
        Specified by:
        getEndLine in interface CharStream
      • getBeginColumn

        public final int getBeginColumn()
        Get token beginning column number.
        Specified by:
        getBeginColumn in interface CharStream
      • getBeginLine

        public final int getBeginLine()
        Get token beginning line number.
        Specified by:
        getBeginLine in interface CharStream
      • backup

        public final void backup​(int amount)
        Backup a number of characters.
        Specified by:
        backup in interface CharStream
      • GetImage

        public final java.lang.String GetImage()
        Get token literal value.
        Specified by:
        GetImage in interface CharStream
      • GetSuffix

        public final char[] GetSuffix​(int len)
        Get the suffix.
        Specified by:
        GetSuffix in interface CharStream
      • Done

        public void Done()
        Reset buffer when finished.
        Specified by:
        Done in interface CharStream
      • adjustBeginLineColumn

        public void adjustBeginLineColumn​(int newLine,
                                          int newCol)
        Method to adjust line and column numbers for the start of a token.
        Parameters:
        newLine - the new line
        newCol - the new column