Package com.helger.css.parser
Class CSSCharStream
java.lang.Object
com.helger.css.parser.CSSCharStream
- All Implemented Interfaces:
CharStream
This class is only used internally as the source for the generated parsers.
An implementation of interface
An implementation of interface
CharStream, where the stream is
assumed to contain only ASCII characters (with java-like unicode escape
processing).- Author:
- Philip Helger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadjustBeginLineColumn(int nNewLine, int nNewCol) Method to adjust line and column numbers for the start of a token.voidbackup(int nAmount) Retreat.charvoiddone()Set buffers back to null when finished.intintintintgetImage()char[]getSuffix(int len) intbooleancharreadChar()Read a character.voidsetTabSize(int nTabSize) Set the tab size to use.voidsetTrackLineColumn(boolean bTrackLineColumn) Enable or disable line number and column number tracking.
-
Constructor Details
-
CSSCharStream
-
-
Method Details
-
getTabSize
public int getTabSize()- Specified by:
getTabSizein interfaceCharStream- Returns:
- Current tab size.
-
setTabSize
public void setTabSize(int nTabSize) Description copied from interface:CharStreamSet the tab size to use.- Specified by:
setTabSizein interfaceCharStream- Parameters:
nTabSize- spaces per tab
-
beginToken
- Specified by:
beginTokenin interfaceCharStream- Returns:
- starting character for token.
- Throws:
IOException- from readChar
-
readChar
Read a character.- Specified by:
readCharin interfaceCharStream- Returns:
- The read character
- Throws:
IOException- if an I/O error occurs
-
getBeginColumn
public int getBeginColumn()- Specified by:
getBeginColumnin interfaceCharStream- Returns:
- column of token start
-
getBeginLine
public int getBeginLine()- Specified by:
getBeginLinein interfaceCharStream- Returns:
- line number of token start
-
getEndColumn
public int getEndColumn()- Specified by:
getEndColumnin interfaceCharStream- Returns:
- end column.
-
getEndLine
public int getEndLine()- Specified by:
getEndLinein interfaceCharStream- Returns:
- end line.
-
backup
public void backup(int nAmount) Retreat.- Specified by:
backupin interfaceCharStream- Parameters:
nAmount- Number of chars to back up.
-
getImage
- Specified by:
getImagein interfaceCharStream- Returns:
- token image as String
-
getSuffix
public char[] getSuffix(int len) - Specified by:
getSuffixin interfaceCharStream- Returns:
- suffix
-
done
public void done()Set buffers back to null when finished.- Specified by:
donein interfaceCharStream
-
adjustBeginLineColumn
public void adjustBeginLineColumn(int nNewLine, int nNewCol) Method to adjust line and column numbers for the start of a token.- Parameters:
nNewLine- line indexnewCol- column index
-
isTrackLineColumn
public boolean isTrackLineColumn()- Specified by:
isTrackLineColumnin interfaceCharStream- Returns:
trueif line number and column numbers should be tracked.
-
setTrackLineColumn
public void setTrackLineColumn(boolean bTrackLineColumn) Description copied from interface:CharStreamEnable or disable line number and column number tracking.- Specified by:
setTrackLineColumnin interfaceCharStream- Parameters:
bTrackLineColumn-trueto track it,falseto not do it.
-