Skip to content

Commit

Permalink
[test] add unit test on advancing over whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
apalala committed Oct 11, 2023
1 parent 8320adb commit 0538b98
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/parsing_test.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# -*- coding: utf-8 -*-
import json
import unittest
import tempfile

import tatsu
from tatsu.util import trim, eval_escapes
from tatsu.util import trim, eval_escapes, asjson
from tatsu.grammars import EBNFBuffer


Expand Down Expand Up @@ -122,7 +123,8 @@ def test_skip_whitespace(self):
id = /[a-z]+/ ;
'''
model = tatsu.compile(grammar=grammar)
ast = model.parse('FOO bar', parseinfo=True)
ast = model.parse('FOO' + ' ' * 3 + 'bar', parseinfo=True)
print(json.dumps(asjson(ast), indent=2))
subject = ast[1]
assert subject['name'] == 'bar'
parseinfo = subject['parseinfo']
Expand Down

0 comments on commit 0538b98

Please sign in to comment.