Package com.helger.css.parser
Class CSSCharStream
- java.lang.Object
-
- com.helger.css.parser.CSSCharStream
-
- All Implemented Interfaces:
CharStream
public final class CSSCharStream extends Object implements CharStream
This class is only used internally as the source for the generated parsers.
An implementation of interfaceCharStream, where the stream is assumed to contain only ASCII characters (with java-like unicode escape processing).- Author:
- Philip Helger
-
-
Constructor Summary
Constructors Constructor Description CSSCharStream(Reader aReader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadjustBeginLineColumn(int nNewLine, int newCol)Method to adjust line and column numbers for the start of a token.voidbackup(int nAmount)Retreat.charbeginToken()voiddone()Set buffers back to null when finished.intgetBeginColumn()intgetBeginLine()intgetEndColumn()intgetEndLine()StringgetImage()char[]getSuffix(int len)intgetTabSize()booleanisTrackLineColumn()charreadChar()Read a character.voidsetTabSize(int i)Set the tab size to use.voidsetTrackLineColumn(boolean tlc)Enable or disable line number and column number tracking.
-
-
-
Method Detail
-
setTabSize
public void setTabSize(int i)
Description copied from interface:CharStreamSet the tab size to use.- Specified by:
setTabSizein interfaceCharStream- Parameters:
i- spaces per tab
-
getTabSize
public int getTabSize()
- Specified by:
getTabSizein interfaceCharStream- Returns:
- Current tab size.
-
beginToken
public char beginToken() throws IOException- Specified by:
beginTokenin interfaceCharStream- Returns:
- starting character for token.
- Throws:
IOException- from readChar
-
readChar
public char readChar() throws IOExceptionRead 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
public String 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 newCol)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 tlc)
Description copied from interface:CharStreamEnable or disable line number and column number tracking.- Specified by:
setTrackLineColumnin interfaceCharStream- Parameters:
tlc-trueto track it,falseto not do it.
-
-