8296661: Typo Found In CSSParser.java
Reviewed-by: angorya, aivanov, prr
This commit is contained in:
parent
ccf2f5837b
commit
9f0887e205
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -28,29 +28,30 @@ import java.io.*;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A CSS parser. This works by way of a delegate that implements the
|
* A CSS parser. This works by way of a delegate that implements the
|
||||||
* CSSParserCallback interface. The delegate is notified of the following
|
* {@code CSSParserCallback} interface. The delegate is notified of the following
|
||||||
* events:
|
* events:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Import statement: <code>handleImport</code>
|
* <li>Import statement: {@code handleImport}.
|
||||||
* <li>Selectors <code>handleSelector</code>. This is invoked for each
|
* <li>Selectors {@code handleSelector}. This is invoked for each
|
||||||
* string. For example if the Reader contained p, bar , a {}, the delegate
|
* string. For example if the Reader contained p, bar , a {}, the delegate
|
||||||
* would be notified 4 times, for 'p,' 'bar' ',' and 'a'.
|
* would be notified 4 times, for 'p,' 'bar' ',' and 'a'.
|
||||||
* <li>When a rule starts, <code>startRule</code>
|
* <li>When a rule starts, {@code startRule}.
|
||||||
* <li>Properties in the rule via the <code>handleProperty</code>. This
|
* <li>Properties in the rule via the {@code handleProperty}. This
|
||||||
* is invoked one per property/value key, eg font size: foo;, would
|
* 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'.
|
* 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
|
* <li>Values in the rule via the {@code handleValue}, this is notified
|
||||||
* for the total value.
|
* for the total value.
|
||||||
* <li>When a rule ends, <code>endRule</code>
|
* <li>When a rule ends, {@code endRule}.
|
||||||
* </ul>
|
* </ul>
|
||||||
* This will parse much more than CSS 1, and loosely implements the
|
* This will parse much more than CSS 1, and loosely implements the
|
||||||
* recommendation for <i>Forward-compatible parsing</i> in section
|
* recommendation for <i>Forward-compatible parsing</i> in section
|
||||||
* 7.1 of the CSS spec found at:
|
* 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>.
|
* <a href=http://www.w3.org/TR/REC-CSS1>http://www.w3.org/TR/REC-CSS1</a>.
|
||||||
* If an error results in parsing, a RuntimeException will be thrown.
|
|
||||||
* <p>
|
* <p>
|
||||||
* This will preserve case. If the callback wishes to treat certain poritions
|
* If parsing results in an error, a {@code RuntimeException} will be thrown.
|
||||||
* case insensitively (such as selectors), it should use toLowerCase, or
|
* <p>
|
||||||
|
* This will preserve case. If the callback wishes to treat certain portions
|
||||||
|
* case-insensitively (such as selectors), it should use {@code toLowerCase}, or
|
||||||
* something similar.
|
* something similar.
|
||||||
*
|
*
|
||||||
* @author Scott Violet
|
* @author Scott Violet
|
||||||
@ -118,7 +119,7 @@ class CSSParser {
|
|||||||
|
|
||||||
// The delegate interface.
|
// The delegate interface.
|
||||||
static interface CSSParserCallback {
|
static interface CSSParserCallback {
|
||||||
/** Called when an @import is encountered. */
|
/** Called when an {@code @import} is encountered. */
|
||||||
void handleImport(String importString);
|
void handleImport(String importString);
|
||||||
// There is currently no way to distinguish between '"foo,"' and
|
// There is currently no way to distinguish between '"foo,"' and
|
||||||
// 'foo,'. But this generally isn't valid CSS. If it becomes
|
// 'foo,'. But this generally isn't valid CSS. If it becomes
|
||||||
@ -360,9 +361,9 @@ class CSSParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses identifiers until <code>extraChar</code> is encountered,
|
* Parses identifiers until {@code extraChar} is encountered,
|
||||||
* returning the ending token, which will be IDENTIFIER if extraChar
|
* returning the ending token, which will be {@code IDENTIFIER} if
|
||||||
* is found.
|
* {@code extraChar} is found.
|
||||||
*/
|
*/
|
||||||
private int parseIdentifiers(char extraChar,
|
private int parseIdentifiers(char extraChar,
|
||||||
boolean wantsBlocks) throws IOException {
|
boolean wantsBlocks) throws IOException {
|
||||||
@ -508,9 +509,9 @@ class CSSParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets an identifier, returning true if the length of the string is greater than 0,
|
* Gets an identifier, returning {@code true} if the length of the string is
|
||||||
* stopping when <code>stopChar</code>, whitespace, or one of {}()[] is
|
* greater than 0, stopping when {@code stopChar}, whitespace, or one of
|
||||||
* hit.
|
* {}()[] is hit.
|
||||||
*/
|
*/
|
||||||
// NOTE: this could be combined with readTill, as they contain somewhat
|
// NOTE: this could be combined with readTill, as they contain somewhat
|
||||||
// similar functionality.
|
// similar functionality.
|
||||||
@ -631,7 +632,7 @@ class CSSParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads till a <code>stopChar</code> is encountered, escaping characters
|
* Reads till a {@code stopChar} is encountered, escaping characters
|
||||||
* as necessary.
|
* as necessary.
|
||||||
*/
|
*/
|
||||||
private void readTill(char stopChar) throws IOException {
|
private void readTill(char stopChar) throws IOException {
|
||||||
|
Loading…
Reference in New Issue
Block a user