fix: parsing local version with digit followed by non-digits#3032
Conversation
6e85b32 to
f655a46
Compare
|
The commit 9d5360b in this PR fixes it, but it's not obvious to me how. I had an AI churn away on it for a bit and that's what it came up with. (it might have also fixed a bug with comparing int and non-int segments ?) It did give me an idea of what might be going wrong, though:
I'm assuming intended behavior is:
i.e. segment of all digits gets converted to an integer, otherwise its a literal string So, I think the proper fix would be to change the segment parsing to something like:
If I squint, I the AI code looks like it's sort of doing that. It sort of unrolled it in a weird, way, though, which I don't like. |
9d5360b to
ba2d225
Compare
|
PTAL. My analysis was correct. Switched it to consume alnum and detect if it was all-digits afterwards. |
When parsing the local identifier segment of
<digit><letter>the parser wouldgive an error saying the letter was unexpected.
What was happening was
accept_digits()consumed up to the first non-digit, andconsidered this success, which prevented calling
accept_alnum()to finishthe parsing.
To fix, only call
accept_alnum(), then post-process the value to normalizean all-digit segment.
I'm guessing
accept_digits()stopping at the first non-digit is WAI becauseit expects to parse e.g. "3.14b", where the caller handles subsequent
characters.
Along the way, some minor doc improvements to the parser code.
Fixes #3030