浏览代码

Added a test for empty rules

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.5.1
Erez Shinan 7 年前
父节点
当前提交
2973167cf0
共有 1 个文件被更改,包括 11 次插入0 次删除
  1. +11
    -0
      tests/test_parser.py

+ 11
- 0
tests/test_parser.py 查看文件

@@ -389,6 +389,17 @@ def _make_parser_test(LEXER, PARSER):
# B: A
# """)

def test_empty(self):
# Fails an Earley implementation without special handling for empty rules,
# or re-processing of already completed rules.
g = _Lark(r"""start: _empty a "B"
a: _empty "A"
_empty: _empty2
_empty2: _empty3
_empty3:
""")
x = g.parse('AB')

def test_lexer_token_limit(self):
"Python has a stupid limit of 100 groups in a regular expression. Test that we handle this limitation"
tokens = {'A%d'%i:'"%d"'%i for i in range(300)}


正在加载...
取消
保存