Closed maxfischer2781 closed 4 years ago
I've left the parser.py
and CLI unchanged for now. The current parse/unparse pair can "only" do a roundtrip, which isn't that useful for the CLI.
I'll add a typing.unparse(:Steno) -> str
if time permits. Feel free to decide whether you want to wait for that.
Turns out it wasn't quite as much work as expected. CLI now supports steno to typing conversions:
$ stenotype 'A or [1 or 2]'
typing.Union[A, typing.List[typing.Union[typing.Literal[1], typing.Literal[2]]]]
Ok, tests are fine with me now. I tried to reduce the amount of assert statements in every single test function to one, and used pytest.mark.parametrize
to feed in the generic test case data. I also moved one folder in between so that the tests mirror the src directory structure. Everything else that came to mind while running the tests and playing around should imo be handled in different PRs, and this one be merged now. Unless there is something that you'd like to change or add.
This pull request adds a basic grammar/parser based on
pyparsing
. The pull request includes:stenotype.backend.elements
to represent stenotype primitives,stenotype.backend.grammar.TYPE
to parse basic stenotypes,This is currently a draft to allow discussion of the approach.