Lark.js
                                
                                 Lark.js copied to clipboard
                                
                                    Lark.js copied to clipboard
                            
                            
                            
                        `isupper` bug
The javascript definition of isupper is defined here:
function isupper(a) {
  return /^[A-Z_$]*$/.test(a);
}
This is slightly different from the Python implementation, with respect to digits:
'__IGNORE_0'.isupper()
# True
/^[A-Z_$]*$/.test('__IGNORE_0');
// false
The regex should be updated to /^[A-Z0-9_$]*$/
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