[Bug 29323] New: Consume a name, unclear?

https://www.w3.org/Bugs/Public/show_bug.cgi?id=29323

            Bug ID: 29323
           Summary: Consume a name, unclear?
           Product: CSS
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Syntax
          Assignee: jackalmage@gmail.com
          Reporter: hhp400@student.vu.nl
        QA Contact: public-css-bugzilla@w3.org
  Target Milestone: ---

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();
                }

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Sunday, 6 December 2015 19:16:58 UTC