Add a more API focused grammar.

This makes it so we don't have to expose all the details of a pgen grammar to the user.
This commit is contained in:
Dave Halter
2017-05-21 17:02:15 -04:00
parent 973f7c5f61
commit 23d1470618
8 changed files with 81 additions and 57 deletions

View File

@@ -9,14 +9,15 @@ test_grammar.py files from both Python 2 and Python 3.
from textwrap import dedent
from parso._compatibility import py_version
from parso.python import parse as _parse, load_grammar
from parso import load_python_grammar
from parso.python import parse as _parse
from parso import ParserSyntaxError
import pytest
def parse(code, version='3.4'):
code = dedent(code) + "\n\n"
grammar = load_grammar(version=version)
grammar = load_python_grammar(version=version)
return _parse(code, grammar=grammar, error_recovery=False)