This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 29323 - Consume a name, unclear?
Summary: Consume a name, unclear?
Status: RESOLVED FIXED
Alias: None
Product: CSS
Classification: Unclassified
Component: Syntax (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Tab Atkins Jr.
QA Contact: public-css-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-06 19:16 UTC by hhp400
Modified: 2015-12-09 17:41 UTC (History)
0 users

See Also:


Attachments

Description hhp400 2015-12-06 19:16:54 UTC
I've sent an e-mail to the Working Group, but it never delivered. So I repost it here:

To: www-style@w3.org
Subject: [css-syntax] 4.3.11. Consume a name?

The specification reads:

``Repeatedly consume the next input code point from the stream:''

And whenever the code point does not match the two clauses mentioned below,

``anything else
    Return result.''

I believe that this description wrong. The current code point should be reconsumed, before returning the result, thereby preventing that a non-matching symbol from the input stream is eaten by the algorithm. A counter-example:

#ident{
}

would then first consume the "#", which triggers the `Consume a name'-algorithm. It then continues with the `name code point'-path, all the way up to "{". Here it returns result, while "{" is still consumed.

If I may suggest a better wording, it would be:

``anything else
    Reconsume the current input code point and return result.''

See:
http://www.w3.org/TR/css-syntax-3/#reconsume-the-current-input-code-point
http://www.w3.org/TR/css-syntax-3/#consume-a-name


Background:
While implementing Java tokenizer/parser for CSS, my relevant piece of code is:

		String consumeName() {
			StringBuilder result = new StringBuilder();
			int code, next;
			while (true) {
				code = preprocess();
				if (isName(code)) {
					result.appendCodePoint(code);
					continue;
				}
				next = preprocess();
				if (isValidEscape(code, next)) {
					result.appendCodePoint(consumeEscape(next));
					continue;
				}
				break;
			}
			pushback(next); // note these pushbacks!
			pushback(code); // they are not specified
			return result.toString();
		}
Comment 1 Tab Atkins Jr. 2015-12-09 17:41:45 UTC
Nah, it delivered. I just haven't gotten to it yet - I'll do so in a few minutes.  (I took November off and am very slowly working my way through my email backlog.)

I'll close this bug in the meantime.