Selaa lähdekoodia

Tests: Added a test case demonstrating the need for calculating containers

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.12.0
Erez Sh 3 vuotta sitten
vanhempi
commit
c953dd9505
1 muutettua tiedostoa jossa 20 lisäystä ja 0 poistoa
  1. +20
    -0
      tests/test_parser.py

+ 20
- 0
tests/test_parser.py Näytä tiedosto

@@ -94,6 +94,26 @@ class TestParsers(unittest.TestCase):
r = g.parse('a')
self.assertEqual( r.children[0].meta.line, 1 )

def test_propagate_positions2(self):
g = Lark("""start: a
a: b
?b: "(" t ")"
!t: "t"
""", propagate_positions=True)

start = g.parse("(t)")
a ,= start.children
t ,= a.children
assert t.children[0] == "t"

assert t.meta.column == 2
assert t.meta.end_column == 3

assert start.column == a.column == 1
assert start.end_column == a.end_column == 4



def test_expand1(self):

g = Lark("""start: a


Ladataan…
Peruuta
Tallenna