Skip to content

[css-properties-values-api] Fix syntax string parsing to not treat whitespace between components the same as pipes. #894

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2019

Conversation

emilio
Copy link
Contributor

@emilio emilio commented May 29, 2019

Fixes #893

@emilio
Copy link
Contributor Author

emilio commented May 29, 2019

r? @andruud

@andruud
Copy link
Member

andruud commented May 29, 2019

Oh, nice, thanks @emilio <3

I'm not actually an editor though, so I can't merge it.

--> @tabatkins

(It would be nice to have assign-review-to-people privileges, so I didn't have to ping people in a comment, like a commoner, djeez).

@emilio
Copy link
Contributor Author

emilio commented May 30, 2019

I don't seem to have merge access to this repo, so if you could do that @tabatkins it'd be awesome.

Thanks!

@andruud
Copy link
Member

andruud commented May 31, 2019

@emilio Just discovered that this allows a leading "|", e.g. "|foo" is a valid syntax.

@andruud
Copy link
Member

andruud commented May 31, 2019

Let's rethink step 5 as a whole. Drop the "repeatedly consume" thing and instead do:

Step 5:

  • Consume a syntax component from stream. If failure was returned, return failure; otherwise, append the returned value to descriptor. [Note: Consume a syntax component consumes leading whitespace, which is relevant for repeats of this step].
  • Consume as much whitespace as possible from stream.
  • Consume the next input code point from stream:
    • EOF: Return descriptor. [Note: I don't think we still need the descriptor size check, since we'll now exit early if "Consume a syntax component" fails?]
    • U+007C VERTICAL LINE (|): Repeat this step.
    • Anything else: Return failure.

WDYT?

@emilio
Copy link
Contributor Author

emilio commented May 31, 2019

Err, yes indeed it does.

Or alternatively, also reconsume the current code-point even if it's |, if the output is empty. But yeah, that sounds cleaner.

@emilio
Copy link
Contributor Author

emilio commented May 31, 2019

Your algorithm also needs to skip trailing whitespace after parsing a component, otherwise you stop parsing foo | bar unless it's written foo|bar

@emilio
Copy link
Contributor Author

emilio commented May 31, 2019

Err, you did that already, should learn to read. Yeah, that looks good.

…itespace between components the same as pipes.

Fixes w3c#893
@tabatkins tabatkins merged commit df514bd into w3c:master May 31, 2019
@emilio emilio deleted the fix-893 branch June 1, 2019 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[css-properties-values-api] The fact that "foo bar" and "foo | bar" are equivalent syntax is confusing.
3 participants