Interface CssScanner

All Known Implementing Classes:
AbstractCssScanner, CharSequenceCssScanner, ReaderCssScanner

public interface CssScanner
The CssScanner preprocesses an input stream of UTF-16 code points for the StreamCssTokenizer.

The scanner filters out the characters '\r', '\f' and '\000' using the following ISO 14977 EBNF productions:

 char          = inline | newline;
 newline       = ( '\r' , ['\n']
                 | '\n' | '\t' | '\f
                 );
 inline        = legalInline | illegalInline ;
 legalInline   = char - ( '\r' | '\n' | '\t' | '\f' | '\000' ) ;
 illegalInline = '\000' ;
 char          = (* the set of unicode UTF-16 characters *) ;
 

Any illegalInline production is replaced with U+FFFD REPLACEMENT CHARACTER. Any newline production is replaced with U+000A LINE FEED CHARACTER.

The scanner also keeps track of the current position and line number and supports lookahead of multiple characters.

References:

Module Level 3, Chapter 3.3. Preprocessing the input stream
w3.org
Author:
Werner Randelshofer
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the current character.
    long
    Returns the line number in the input stream.
    long
    Returns the position in the input stream.
    int
    Phase 2: Processes unicode escape sequences first, and then processes newlines.
    void
    pushBack(int ch)
    Pushes the specified character back into the scanner.
  • Method Details

    • nextChar

      int nextChar() throws IOException
      Phase 2: Processes unicode escape sequences first, and then processes newlines.
      Returns:
      the next character. Returns -1 if EOF.
      Throws:
      IOException - from the underlying input stream
    • currentChar

      int currentChar()
      Returns the current character.
      Returns:
      the current character
    • pushBack

      void pushBack(int ch)
      Pushes the specified character back into the scanner.
      Parameters:
      ch - The character to be pushed back
    • getPosition

      long getPosition()
      Returns the position in the input stream.
      Returns:
      the position
    • getLineNumber

      long getLineNumber()
      Returns the line number in the input stream.
      Returns:
      the line number