Package org.htmlunit.cssparser.parser
Class CssCharStream
- java.lang.Object
-
- org.htmlunit.cssparser.parser.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 Summary
Fields Modifier and Type Field Description (package private) int
available
private int[]
bufcolumn
private char[]
buffer
private static int
BUFFER_SIZE
private int[]
bufline
int
bufpos
Position in buffer.(package private) int
bufsize
private int
column
private int
inBuf
private java.io.Reader
inputStream
private int
line
private int
maxNextCharInd
private boolean
prevCharIsCR
private boolean
prevCharIsLF
static boolean
staticFlag
Whether parser is static.private int
tabSize
(package private) int
tokenBegin
private boolean
trackLineColumn
-
Constructor Summary
Constructors Constructor Description CssCharStream(java.io.Reader dstream, int startline, int startcolumn)
Constructor.CssCharStream(java.io.Reader dstream, int startline, int startcolumn, int buffersize)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
adjustBeginLineColumn(int newLine, int newCol)
Method to adjust line and column numbers for the start of a token.void
backup(int amount)
Backup a number of characters.char
BeginToken()
Start.void
Done()
Reset buffer when finished.private void
ExpandBuff(boolean wrapAround)
private void
FillBuff()
int
getBeginColumn()
Get token beginning column number.int
getBeginLine()
Get token beginning line number.int
getColumn()
Deprecated.int
getEndColumn()
Get token end column number.int
getEndLine()
Get token end line number.java.lang.String
GetImage()
Get token literal value.int
getLine()
Deprecated.char[]
GetSuffix(int len)
Get the suffix.int
getTabSize()
boolean
getTrackLineColumn()
char
readChar()
Read a character.void
setTabSize(int i)
void
setTrackLineColumn(boolean tlc)
private void
UpdateLineColumn(char c)
-
-
-
Field Detail
-
staticFlag
public static final boolean staticFlag
Whether parser is static.- See Also:
- Constant Field Values
-
BUFFER_SIZE
private static final int BUFFER_SIZE
- 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 fromstartline
- startlinestartcolumn
- startcolumnbuffersize
- buffersize
-
CssCharStream
public CssCharStream(java.io.Reader dstream, int startline, int startcolumn)
Constructor.- Parameters:
dstream
- the stream to read fromstartline
- startlinestartcolumn
- 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 interfaceCharStream
- 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 interfaceCharStream
- Throws:
java.io.IOException
-
getColumn
@Deprecated public final int getColumn()
Deprecated.Description copied from interface:CharStream
Returns the column position of the character last read.- Specified by:
getColumn
in interfaceCharStream
- See Also:
CharStream.getEndColumn()
-
getLine
@Deprecated public final int getLine()
Deprecated.Description copied from interface:CharStream
Returns the line number of the character last read.- Specified by:
getLine
in interfaceCharStream
- See Also:
CharStream.getEndLine()
-
getEndColumn
public final int getEndColumn()
Get token end column number.- Specified by:
getEndColumn
in interfaceCharStream
-
getEndLine
public final int getEndLine()
Get token end line number.- Specified by:
getEndLine
in interfaceCharStream
-
getBeginColumn
public final int getBeginColumn()
Get token beginning column number.- Specified by:
getBeginColumn
in interfaceCharStream
-
getBeginLine
public final int getBeginLine()
Get token beginning line number.- Specified by:
getBeginLine
in interfaceCharStream
-
backup
public final void backup(int amount)
Backup a number of characters.- Specified by:
backup
in interfaceCharStream
-
GetImage
public final java.lang.String GetImage()
Get token literal value.- Specified by:
GetImage
in interfaceCharStream
-
GetSuffix
public final char[] GetSuffix(int len)
Get the suffix.- Specified by:
GetSuffix
in interfaceCharStream
-
Done
public void Done()
Reset buffer when finished.- Specified by:
Done
in interfaceCharStream
-
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 linenewCol
- the new column
-
setTabSize
public void setTabSize(int i)
- Specified by:
setTabSize
in interfaceCharStream
-
getTabSize
public int getTabSize()
- Specified by:
getTabSize
in interfaceCharStream
-
getTrackLineColumn
public boolean getTrackLineColumn()
- Specified by:
getTrackLineColumn
in interfaceCharStream
-
setTrackLineColumn
public void setTrackLineColumn(boolean tlc)
- Specified by:
setTrackLineColumn
in interfaceCharStream
-
-