net.sf.jett.parser
Class StyleScanner

java.lang.Object
  extended by net.sf.jett.parser.StyleScanner

public class StyleScanner
extends java.lang.Object

A StyleScanner scans CSS text and returns tokens.

Since:
0.5.0
Author:
Randy Gettman

Nested Class Summary
static class StyleScanner.Token
          Enumeration for the different types of Tokens in "CSS".
 
Constructor Summary
StyleScanner()
          Construct a StyleScanner object, with empty input.
StyleScanner(java.lang.String cssText)
          Construct a StyleScanner object, with the given input.
 
Method Summary
 java.lang.String getCurrLexeme()
          Returns the current lexeme after a call to getNextToken.
 int getNextPosition()
          Returns the current position of the next token.
 StyleScanner.Token getNextToken()
          Returns the Token.
 void reset()
          Resets the scanner to the beginning of the CSS text.
 void setCssText(java.lang.String cssText)
          Give the StyleScanner another CSS text to scan.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StyleScanner

public StyleScanner()
Construct a StyleScanner object, with empty input.


StyleScanner

public StyleScanner(java.lang.String cssText)
Construct a StyleScanner object, with the given input.

Parameters:
cssText - The CSS text to scan.
Method Detail

getNextToken

public StyleScanner.Token getNextToken()
Returns the Token. After this call completes, the current lexeme is available via a call to getCurrLexeme. Starts looking at the current offset, and once the token is found, then the offset is advanced to the start of the next token.

Returns:
A Token.
See Also:
getCurrLexeme()

getCurrLexeme

public java.lang.String getCurrLexeme()
Returns the current lexeme after a call to getNextToken.

Returns:
The current lexeme, or null if getNextToken hasn't been called yet after a reset.
See Also:
getNextToken(), reset()

getNextPosition

public int getNextPosition()
Returns the current position of the next token.

Returns:
The current position of the next token.

reset

public void reset()
Resets the scanner to the beginning of the CSS text.


setCssText

public void setCssText(java.lang.String cssText)
Give the StyleScanner another CSS text to scan. Resets to the beginning of the string.

Parameters:
cssText - The css Text to scan.


Copyright © 2012-2013 Jett Team. All Rights Reserved.