diff --git a/test/parsing_test.py b/test/parsing_test.py index 70b79e35..00f446f0 100644 --- a/test/parsing_test.py +++ b/test/parsing_test.py @@ -115,6 +115,19 @@ def test_startrule_issue62(self): model = tatsu.compile(grammar=grammar) model.parse('4 + 5') + def test_skip_whitespace(self): + grammar = ''' + statement = 'FOO' subject $ ; + subject = name:id ; + id = /[a-z]+/ ; + ''' + model = tatsu.compile(grammar=grammar) + ast = model.parse('FOO bar', parseinfo=True) + subject = ast[1] + assert subject['name'] == 'bar' + parseinfo = subject['parseinfo'] + assert parseinfo.pos == parseinfo.tokenizer.text.index('bar') + def suite(): return unittest.TestLoader().loadTestsFromTestCase(ParsingTests)