-
Notifications
You must be signed in to change notification settings - Fork 715
[css-values] ambiguity when matching syntax to value #6695
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
Comments
When a grammar is ambiguous, there's no pre-specified resolution strategy, beyond the one you've already found for assigning Ambiguous grammars fall into three cases:
Order is not important. (It's only relevant for serialization purposes, where you use the grammar order to serialize things that could be in multiple orders, so we have a predictable result without having to specify orders constantly by hand.)
n/a
Don't think so; if there are it's a one-off and should be handled in specific prose.
Yeah def. Having more than one positionally-ambiguous
I'm not entirely sure what you mean here, but I think you're referring to order again? The rule is just that you try your best to satisfy the grammar while ignoring the |
An example is
|
@idoros I think Tab and Oriol have answered your question, is there anything else you need clarification on or anything specific you need clarified in the specs? |
No, sorry for keeping it opened and thanks for the answer |
Uh oh!
There was an error while loading. Please reload this page.
I can't seem to find a place in the spec or a discussion on how ambiguous syntax definition is handled when matched against a value. It might be the case that there is no definite answer and formal syntax is checked to have no edge cases before approval, but I haven't found that criteria either.
for example if a data-type ends with an optional ending that matches the beginning of another data-type:
For the value "1 2 3", does
<A>
matches "1 2 3" ? it seems like<B>
would never be matched (and it is optional).What if the syntax was using all-of:
<A> && <B>
, should the matcher do some kind of negative-lookahead to stop<A>
at "1 2"? or maybe fail when<A>
takes all the value, swap the order so<B>
would match "1" and<A>
would match "2 3"?The other ambiguity is with
<custom-ident>
that the spec states that "When parsing positionally-ambiguous keywords in a property value, a production can only claim the keyword if no other unfulfilled production can claim it."For example:
For the value "abc ccc",
<C>
would match "ccc" and<D>
would match "abc", since it claimed it and have priority. I assume that if the syntax was defined with juxtaposition:<C> <D>
, then for the same value "abc ccc",<D>
wouldn't be able to take the first part of the value and the match would fail.To emphasis the possible order of (mis)matching:
For the value "abc 1", what order of matches/claims should the matcher take?
Just thinking how it might work, maybe the matcher uses the following concepts while matching
<custom-ident>
is matched to a keyword)and claim could be treated in several ways:
<E>
=="abc"<custom-ident>
- "register claim ambiguity"<G>
!="1" - not claimed since there is another option: "match next option" in[<G>|<H>]
<H>
=="1"<number>
<E>
=="abc"<custom-ident>
- "register claim ambiguity"<G>
!="1" - call "force claim" rollback and match next option<F>
<F>
!="abc" - next match option: reorder top level all-of[<G>|<H>] && [<E>|<F>]
<G>
=="abc" (abc keyword)<E>
!="1" - "next match option" in[<E>|<F>]
<F>
=="1" (number)more matching examples:
For the value "abc 1" (notice diff between the way claim is handled):
<I>
-> "abc"<N>
-> "1"<K>
-> "abc"<N>
-> "1"For the value "abc 1" match first
<I>||<M>
, and then preferring<K><N>
in re-claim process:<K>
-> "abc"<N>
-> "1"<K>
-> "abc"<N>
-> "1"So I have some questions:
<custom-ident>
? matches that allow registering match state that can be reclaimed in some way?<custom-ident>
in a syntax?<custom-ident>
is only valid when unclaimed. Does it take affect if the potential keyword in the syntax is never checked against? for example when the keyword is at the end of some optional group and the value is matched completely before reaching it.The text was updated successfully, but these errors were encountered: