File: test_issue_22.py

package info (click to toggle)
arpeggio 1.9.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 3,440 kB
  • sloc: python: 3,114; sh: 12; makefile: 10
file content (19 lines) | stat: -rw-r--r-- 706 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import os
from arpeggio.cleanpeg import ParserPEG


def test_issue_22():
    """
    Infinite recursion during resolving of a grammar given in a clean PEG
    notation.
    """
    current_dir = os.path.dirname(__file__)

    grammar1 = open(os.path.join(current_dir, '..', '..', '..', '..', '..', '..', '..', 'arpeggio/tests/regressions/issue_22/grammar1.peg')).read()
    parser1 = ParserPEG(grammar1, 'belang')
    parser1.parse('a [0]')
    parser1.parse('a (0)')

    grammar2 = open(os.path.join(current_dir, '..', '..', '..', '..', '..', '..', '..', 'arpeggio/tests/regressions/issue_22/grammar2.peg')).read()
    parser2 = ParserPEG(grammar2, 'belang', debug=True)
    parser2.parse('a [0](1)[2]')