CSSParserCallback interface. The delegate is notified of the following
events:
handleImport.
handleSelector. This is invoked for each
string. For example if the Reader contained p, bar , a {}, the delegate
would be notified 4 times, for 'p,' 'bar' ',' and 'a'.
startRule.
handleProperty. This
is invoked once per property/value key, for example font size: foo;, would
cause the delegate to be notified once with a value of 'font size'.
handleValue, this is notified
for the total value.
endRule.
If parsing results in an error, a RuntimeException will be thrown.
This will preserve case. If the callback wishes to treat certain portions
case-insensitively (such as selectors), it should use toLowerCase, or
something similar.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static interface |
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private CSSParser. | callback
Notified of state. |
| private static final char[] | |
| private boolean | didPushChar
Set to true if one character has been read ahead. |
| private boolean | encounteredRuleSet
Set to true when the first non @ rule is encountered. |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private int | pushedChar
The read ahead character. |
| private Reader | reader
Holds the incoming CSS rules. |
| private boolean | readWS
Set to true if any whitespace is read. |
| private int | stackCount
Number of valid blocks. |
| private char[] | tokenBuffer
nextToken() inserts the string here. |
| private int | tokenBufferLength
Current number of chars in tokenBufferLength. |
| private StringBuffer | unitBuffer
Temporary place to hold identifiers. |
| private int[] | unitStack
Used to indicate blocks. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | |
| private boolean | getIdentifier(char stopChar)
Gets an identifier, returning |
| private boolean | |
| private boolean | |
| private int | |
| pack-priv void | |
| private void | |
| private int | |
| private void | |
| private int | parseIdentifiers(char extraChar, boolean wantsBlocks)
Parses identifiers until |
| private void | |
| private boolean | |
| private void | |
| private void | |
| private int | |
| private void | |
| private void | |
| private int | |
| private void |
| BRACE_CLOSE | back to summary |
|---|---|
| private static final int BRACE_CLOSE | |
| BRACE_OPEN | back to summary |
|---|---|
| private static final int BRACE_OPEN | |
| BRACKET_CLOSE | back to summary |
|---|---|
| private static final int BRACKET_CLOSE | |
| BRACKET_OPEN | back to summary |
|---|---|
| private static final int BRACKET_OPEN | |
| callback | back to summary |
|---|---|
| private CSSParser. Notified of state. | |
| charMapping | back to summary |
|---|---|
| private static final char[] charMapping | |
| didPushChar | back to summary |
|---|---|
| private boolean didPushChar Set to true if one character has been read ahead. | |
| encounteredRuleSet | back to summary |
|---|---|
| private boolean encounteredRuleSet Set to true when the first non @ rule is encountered. | |
| END | back to summary |
|---|---|
| private static final int END | |
| IDENTIFIER | back to summary |
|---|---|
| private static final int IDENTIFIER | |
| PAREN_CLOSE | back to summary |
|---|---|
| private static final int PAREN_CLOSE | |
| PAREN_OPEN | back to summary |
|---|---|
| private static final int PAREN_OPEN | |
| pushedChar | back to summary |
|---|---|
| private int pushedChar The read ahead character. | |
| reader | back to summary |
|---|---|
| private Reader reader Holds the incoming CSS rules. | |
| readWS | back to summary |
|---|---|
| private boolean readWS Set to true if any whitespace is read. | |
| stackCount | back to summary |
|---|---|
| private int stackCount Number of valid blocks. | |
| tokenBuffer | back to summary |
|---|---|
| private char[] tokenBuffer nextToken() inserts the string here. | |
| tokenBufferLength | back to summary |
|---|---|
| private int tokenBufferLength Current number of chars in tokenBufferLength. | |
| unitBuffer | back to summary |
|---|---|
| private StringBuffer unitBuffer Temporary place to hold identifiers. | |
| unitStack | back to summary |
|---|---|
| private int[] unitStack Used to indicate blocks. | |
| CSSParser | back to summary |
|---|---|
| pack-priv CSSParser() | |
| append | back to summary |
|---|---|
| private void append(char character) | |
| endBlock | back to summary |
|---|---|
| private void endBlock(int endToken) Called when an end block is encountered )]} | |
| getIdentifier | back to summary |
|---|---|
| private boolean getIdentifier(char stopChar) throws IOException Gets an identifier, returning | |
| getNextStatement | back to summary |
|---|---|
| private boolean getNextStatement() throws IOException Gets the next statement, returning false if the end is reached. A statement is either an @rule, or a ruleset. | |
| inBlock | back to summary |
|---|---|
private boolean inBlock()
| |
| nextToken | back to summary |
|---|---|
| private int nextToken(char idChar) throws IOException Fetches the next token. | |
| parse | back to summary |
|---|---|
| pack-priv void parse(Reader reader, CSSParser. | |
| parseAtRule | back to summary |
|---|---|
| private void parseAtRule() throws IOException Parses an @ rule, stopping at a matching brace pair, or ;. | |
| parseDeclaration | back to summary |
|---|---|
| private int parseDeclaration() throws IOException Parses a single declaration, which is an identifier a : and another identifier. This returns the last token seen. | |
| parseDeclarationBlock | back to summary |
|---|---|
| private void parseDeclarationBlock() throws IOException Parses a declaration block. Which a number of declarations followed by a })]. | |
| parseIdentifiers | back to summary |
|---|---|
| private int parseIdentifiers(char extraChar, boolean wantsBlocks) throws IOException Parses identifiers until | |
| parseRuleSet | back to summary |
|---|---|
| private void parseRuleSet() throws IOException Parses the next rule set, which is a selector followed by a declaration block. | |
| parseSelectors | back to summary |
|---|---|
| private boolean parseSelectors() throws IOException Parses a set of selectors, returning false if the end of the stream is reached. | |
| parseTillClosed | back to summary |
|---|---|
| private void parseTillClosed(int openToken) throws IOException Parses till a matching block close is encountered. This is only appropriate to be called at the top level (no nesting). | |
| pushChar | back to summary |
|---|---|
| private void pushChar(int tempChar) Supports one character look ahead, this will throw if called twice in a row. | |
| readChar | back to summary |
|---|---|
| private int readChar() throws IOException Reads a character from the stream. | |
| readComment | back to summary |
|---|---|
| private void readComment() throws IOException Parses a comment block. | |
| readTill | back to summary |
|---|---|
| private void readTill(char stopChar) throws IOException Reads till a | |
| readWS | back to summary |
|---|---|
| private int readWS() throws IOException Skips any white space, returning the character after the white space. | |
| startBlock | back to summary |
|---|---|
| private void startBlock(int startToken) Called when a block start is encountered ({[. | |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void |
| endRule | back to summary |
|---|---|
| public void endRule() | |
| handleImport | back to summary |
|---|---|
| public void handleImport(String importString) Called when an | |
| handleProperty | back to summary |
|---|---|
| public void handleProperty(String property) | |
| handleSelector | back to summary |
|---|---|
| public void handleSelector(String selector) | |
| handleValue | back to summary |
|---|---|
| public void handleValue(String value) | |
| startRule | back to summary |
|---|---|
| public void startRule() | |