Open thekevinscott opened 6 months ago
Okay, thanks for reporting it!
It still isn't right, because in Python '0'.isupper() == False
. But you're right that it needs fixing.
Ah, very true. Good catch!
https://docs.python.org/3/library/stdtypes.html#str.isupper
Return True if all cased characters [4] in the string are uppercase and there is at least one cased character, False otherwise.
It sounds like the main edge case is that there must be one cased character.
I opened a PR here that adds test cases that I think covers all the edge cases: https://github.com/lark-parser/Lark.js/pull/45
The javascript definition of
isupper
is defined here:This is slightly different from the Python implementation, with respect to digits:
The regex should be updated to
/^[A-Z0-9_$]*$/