< prev index next >
src/java.desktop/share/classes/javax/swing/text/html/CSSParser.java
Print this page
*** 29,49 ****
/**
* A CSS parser. This works by way of a delegate that implements the
* CSSParserCallback interface. The delegate is notified of the following
* events:
* <ul>
! * <li>Import statement: <code>handleImport</code>
! * <li>Selectors <code>handleSelector</code>. 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'.
! * <li>When a rule starts, <code>startRule</code>
! * <li>Properties in the rule via the <code>handleProperty</code>. This
* is invoked one per property/value key, eg font size: foo;, would
* cause the delegate to be notified once with a value of 'font size'.
! * <li>Values in the rule via the <code>handleValue</code>, this is notified
* for the total value.
! * <li>When a rule ends, <code>endRule</code>
* </ul>
* This will parse much more than CSS 1, and loosely implements the
* recommendation for <i>Forward-compatible parsing</i> in section
* 7.1 of the CSS spec found at:
* <a href=http://www.w3.org/TR/REC-CSS1>http://www.w3.org/TR/REC-CSS1</a>.
--- 29,49 ----
/**
* A CSS parser. This works by way of a delegate that implements the
* CSSParserCallback interface. The delegate is notified of the following
* events:
* <ul>
! * <li>Import statement: {@code handleImport}
! * <li>Selectors {@code 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'.
! * <li>When a rule starts, {@code startRule}
! * <li>Properties in the rule via the {@code handleProperty}. This
* is invoked one per property/value key, eg font size: foo;, would
* cause the delegate to be notified once with a value of 'font size'.
! * <li>Values in the rule via the {@code handleValue}, this is notified
* for the total value.
! * <li>When a rule ends, {@code endRule}
* </ul>
* This will parse much more than CSS 1, and loosely implements the
* recommendation for <i>Forward-compatible parsing</i> in section
* 7.1 of the CSS spec found at:
* <a href=http://www.w3.org/TR/REC-CSS1>http://www.w3.org/TR/REC-CSS1</a>.
*** 358,368 ****
callback.handleValue(unitBuffer.toString());
return token;
}
/**
! * Parses identifiers until <code>extraChar</code> is encountered,
* returning the ending token, which will be IDENTIFIER if extraChar
* is found.
*/
private int parseIdentifiers(char extraChar,
boolean wantsBlocks) throws IOException {
--- 358,368 ----
callback.handleValue(unitBuffer.toString());
return token;
}
/**
! * Parses identifiers until {@code extraChar} is encountered,
* returning the ending token, which will be IDENTIFIER if extraChar
* is found.
*/
private int parseIdentifiers(char extraChar,
boolean wantsBlocks) throws IOException {
*** 507,517 ****
}
}
/**
* Gets an identifier, returning true if the length of the string is greater than 0,
! * stopping when <code>stopChar</code>, whitespace, or one of {}()[] is
* hit.
*/
// NOTE: this could be combined with readTill, as they contain somewhat
// similar functionality.
private boolean getIdentifier(char stopChar) throws IOException {
--- 507,517 ----
}
}
/**
* Gets an identifier, returning true if the length of the string is greater than 0,
! * stopping when {@code stopChar}, whitespace, or one of {}()[] is
* hit.
*/
// NOTE: this could be combined with readTill, as they contain somewhat
// similar functionality.
private boolean getIdentifier(char stopChar) throws IOException {
*** 629,639 ****
}
return (tokenBufferLength > 0);
}
/**
! * Reads till a <code>stopChar</code> is encountered, escaping characters
* as necessary.
*/
private void readTill(char stopChar) throws IOException {
boolean lastWasEscape = false;
int escapeCount = 0;
--- 629,639 ----
}
return (tokenBufferLength > 0);
}
/**
! * Reads till a {@code stopChar} is encountered, escaping characters
* as necessary.
*/
private void readTill(char stopChar) throws IOException {
boolean lastWasEscape = false;
int escapeCount = 0;
< prev index next >