瀏覽代碼

Code review #2

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.11.2
julienmalard 3 年之前
父節點
當前提交
1b2fc2bda4
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. +2
    -1
      lark/utils.py

+ 2
- 1
lark/utils.py 查看文件

@@ -16,7 +16,7 @@ logger.setLevel(logging.CRITICAL)
def is_id_continue(x):
"""
Checks if all characters in `x` are alphanumeric characters (Unicode standard, so diactrics, Indian vowels, non-latin
numbers, etc. all pass). Synonymous with a Python `ID_CONTINUE` identifier.
numbers, etc. all pass). Synonymous with a Python `ID_CONTINUE` identifier. See PEP 3131 for details.
"""
if len(x) != 1:
return all(is_id_continue(y) for y in x)
@@ -24,6 +24,7 @@ def is_id_continue(x):


def isalpha(x):
"""See PEP 3131 for details."""
if len(x) != 1:
return all(isalpha(y) for y in x)
return unicodedata.category(x) in ['Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Mn', 'Mc', 'Pc']


Loading…
取消
儲存