ICU-23509 Update the UnicodeSet parser to match the grammar that has the right precedence (no functional change) - #4174
Conversation
|
@markusicu I have no idea what ticket to use here (ICU-23297 would fit nicely but went into 78, all the others listed in #4030 seem irrelevant to the basic grammar). |
|
I guess the ticket question will also arise for the UnicodeSet documentation PR, and this fits the same theme (this is just internal documentation, I am changing comments and renaming internal identifiers). |
|
once you have a ticket, i could excavate my rubber stamp |
|
I filed ICU-23509. |
I think in order to make this easier to follow, I should make the parseMeow functions where Meow actually is represents an expression static, returning a set. (If I had done that, my parser from last year would have correctly parsed the grammar that gave - and & higher precedence, this would probably have broken everything, and I would have noticed the bug in the grammar a year earlier.) Then the weird functions that parse a non-expression can remain mutating member functions, and the distinction will be much more obvious. This might also make the code more concise, as a lot of the usages of expression-parsing functions are UnicodeSet blah; blah.parseMeow(). But I will do that in a separate PR, so that this one only changes comments and renames stuff but preserves the logic. |
|
(This will get a couple more changes, Roozbeh spotted a mistake in the grammar. The comments will actually get simpler, for a change.) |
|
Should match the grammar in https://github.com/unicode-org/unicode-reports/pull/330 now. |
sg -- please create a ticket |
| // those to this set, and we end up with the UnicodeSet of the Union following by any right | ||
| // hand sides. In the LL grammar from the note, this is: | ||
| // those to this object, and we end up with the UnicodeSet of the Union following by any | ||
| // right hand sides. In the LL grammar from the note, this is: |
There was a problem hiding this comment.
optional: please avoid dot space space...
|
oh, spotless wants to wrap another line -- whose overflow then wants to be merged into the following stuff |
…the right precedence (no functional change)
f19cd16 to
113da44
Compare
|
Hooray! The files in the branch are the same across the force-push. 😃 ~ Your Friendly Jira-GitHub PR Checker Bot |
I might reuse ICU-23257. |
sgtm |
|
all checks have passed, ready to merge (approver not encouraged to do so) |
The existing parser did not actually do what UTS61 said, so going back to a grammar that has the desired precedence (equal between union, intersection, and difference, instead of difference and intersection having higher precedence) has no effect.
How did the parser fail to implement the bad grammar?
See
icu/icu4c/source/common/uniset_props.cpp
Lines 1181 to 1192 in 2ebc705
icu/icu4c/source/common/uniset_props.cpp
Lines 1201 to 1203 in 2ebc705
icu/icu4c/source/common/uniset_props.cpp
Lines 1212 to 1215 in 2ebc705
icu/icu4c/source/common/uniset_props.cpp
Lines 1229 to 1232 in 2ebc705
Checklist