org.apache.batik.css.parser

Class Scanner

public class Scanner extends Object

This class represents a CSS scanner - an object which decodes CSS lexical units.
Field Summary
protected intblankCharacters
The characters to skip to create the string which represents the current token.
protected char[]buffer
The recording buffer.
protected intcurrent
The current char.
protected intend
The end offset of the last lexical unit.
protected intposition
The current position in the buffer.
protected NormalizingReaderreader
The reader.
protected intstart
The start offset of the last lexical unit.
protected inttype
The type of the current lexical unit.
Constructor Summary
Scanner(Reader r)
Creates a new Scanner object.
Scanner(InputStream is, String enc)
Creates a new Scanner object.
Scanner(String s)
Creates a new Scanner object.
Method Summary
voidclearBuffer()
Clears the buffer.
protected intdotNumber()
Scans 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[]getBuffer()
Returns the buffer used to store the chars.
intgetColumn()
Returns 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.
StringgetStringValue()
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 voidnextToken()
Returns the next token.
protected intnumber()
Scans a number.
protected intnumberUnit(boolean integer)
Scans the unit of a number.
voidscanAtRule()
Scans a @rule value.
protected intstring1()
Scans a single quoted string.
protected intstring2()
Scans a double quoted string.

Field Detail

blankCharacters

protected int blankCharacters
The characters to skip to create the string which represents the current token.

buffer

protected char[] buffer
The recording buffer.

current

protected int current
The current char.

end

protected int end
The end offset of the last lexical unit.

position

protected int position
The current position in the buffer.

reader

protected NormalizingReader reader
The reader.

start

protected int start
The start offset of the last lexical unit.

type

protected int type
The type of the current lexical unit.

Constructor Detail

Scanner

public Scanner(Reader r)
Creates a new Scanner object.

Parameters: r The reader to scan.

Scanner

public Scanner(InputStream is, String enc)
Creates a new Scanner object.

Parameters: is The input stream to scan. enc The encoding to use to decode the input stream, or null.

Scanner

public Scanner(String s)
Creates a new Scanner object.

Parameters: s The string to scan.

Method Detail

clearBuffer

public void clearBuffer()
Clears the buffer.

dotNumber

protected int dotNumber()
Scans the decimal part of a number.

endGap

protected int endGap()
Returns the end gap of the current lexical unit.

escape

protected void escape()
Scans an escape sequence, if one.

getBuffer

public char[] getBuffer()
Returns the buffer used to store the chars.

getColumn

public int getColumn()
Returns the current column.

getEnd

public int getEnd()
Returns the end offset of the last lexical unit.

getLine

public int getLine()
Returns the current line.

getStart

public int getStart()
Returns the start offset of the last lexical unit.

getStringValue

public String getStringValue()
Returns the string representation of the current lexical unit.

getType

public int getType()
The current lexical unit type like defined in LexicalUnits.

isEqualIgnoreCase

protected static boolean isEqualIgnoreCase(int i, char c)
Compares the given int with the given character, ignoring case.

next

public int next()
Returns the next token.

nextChar

protected int nextChar()
Sets the value of the current char to the next character or -1 if the end of stream has been reached.

nextToken

protected void nextToken()
Returns the next token.

number

protected int number()
Scans a number.

numberUnit

protected int numberUnit(boolean integer)
Scans the unit of a number.

scanAtRule

public void scanAtRule()
Scans a @rule value. This method assumes that the current lexical unit is a at keyword.

string1

protected int string1()
Scans a single quoted string.

string2

protected int string2()
Scans a double quoted string.
Copyright B) 2007 Apache Software Foundation. All Rights Reserved.