Class Scanner
java.lang.Object
org.apache.batik.css.parser.Scanner
This class represents a CSS scanner - an object which decodes CSS lexical
units.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intThe characters to skip to create the string which represents the current token.protected char[]The recording buffer.protected intThe current char.protected intThe end offset of the last lexical unit.protected intThe current position in the buffer.protected NormalizingReaderThe reader.protected intThe start offset of the last lexical unit.protected intThe type of the current lexical unit. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the buffer.voidclose()Closes the underlying stream used by the scanner.protected intScans the decimal part of a number.protected intendGap()Returns the end gap of the current lexical unit.protected voidescape()Scans an escape sequence, if one.char[]Returns the buffer used to store the chars.intReturns the current column.intgetEnd()Returns the end offset of the last lexical unit.intgetLine()Returns the current line.intgetStart()Returns the start offset of the last lexical unit.Returns the string representation of the current lexical unit.intgetType()The current lexical unit type like defined in LexicalUnits.protected static booleanisEqualIgnoreCase(int i, char c) Compares the given int with the given character, ignoring case.intnext()Returns the next token.protected intnextChar()Sets the value of the current char to the next character or -1 if the end of stream has been reached.protected voidReturns the next token.protected intnumber()Scans a number.protected intnumberUnit(boolean integer) Scans the unit of a number.voidScans a @rule value.protected intstring1()Scans a single quoted string.protected intstring2()Scans a double quoted string.
-
Field Details
-
reader
The reader. -
current
protected int currentThe current char. -
buffer
protected char[] bufferThe recording buffer. -
position
protected int positionThe current position in the buffer. -
type
protected int typeThe type of the current lexical unit. -
start
protected int startThe start offset of the last lexical unit. -
end
protected int endThe end offset of the last lexical unit. -
blankCharacters
protected int blankCharactersThe characters to skip to create the string which represents the current token.
-
-
Constructor Details
-
Scanner
Creates a new Scanner object.- Parameters:
r- The reader to scan.- Throws:
ParseException
-
Scanner
Creates a new Scanner object.- Parameters:
is- The input stream to scan.enc- The encoding to use to decode the input stream, or null.- Throws:
ParseException
-
Scanner
Creates a new Scanner object.- Parameters:
s- The string to scan.- Throws:
ParseException
-
-
Method Details
-
getLine
public int getLine()Returns the current line. -
getColumn
public int getColumn()Returns the current column. -
getBuffer
public char[] getBuffer()Returns the buffer used to store the chars. -
getStart
public int getStart()Returns the start offset of the last lexical unit. -
getEnd
public int getEnd()Returns the end offset of the last lexical unit. -
clearBuffer
public void clearBuffer()Clears the buffer. -
getType
public int getType()The current lexical unit type like defined in LexicalUnits. -
getStringValue
Returns the string representation of the current lexical unit. -
scanAtRule
Scans a @rule value. This method assumes that the current lexical unit is a at keyword.- Throws:
ParseException
-
next
-
close
public void close()Closes the underlying stream used by the scanner. -
endGap
protected int endGap()Returns the end gap of the current lexical unit. -
nextToken
-
string1
-
string2
-
number
-
dotNumber
Scans the decimal part of a number.- Throws:
IOException
-
numberUnit
Scans the unit of a number.- Throws:
IOException
-
escape
-
isEqualIgnoreCase
protected static boolean isEqualIgnoreCase(int i, char c) Compares the given int with the given character, ignoring case. -
nextChar
Sets the value of the current char to the next character or -1 if the end of stream has been reached.- Throws:
IOException
-