def test_issue_22():
    current_dir = os.path.dirname(__file__)

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

    grammar2 = open(os.path.join(current_dir, 'grammar2.peg')).read()
    parser2 = ParserPEG(grammar2, 'belang', debug=True)
    parser2.parse('a [0](1)[2]')
Infinite recursion during resolving of a grammar given in a clean PEG
dataset/ETHPy150Open igordejanovic/Arpeggio/tests/unit/regressions/issue_22/test_issue_22.py/test_issue_22