Commit graph

6 commits

Author SHA1 Message Date
Benjamin Woodruff
aac5103592 Add PartialParserSyntaxError, simplify ParserSyntaxError
Because the parser conversion functions may not understand their current
position in the code, we instead need to construct a `ParserSyntaxError`
without the current line and column information, filling it in later.

Originally I did this by allowing ParserSyntaxError to be partially
initialized, but this wasn't very type-safe, and required some ugly
assertions.

Instead, I now construct and raise a PartialParserSyntaxError. The
BaseParser class is responsible for catching that partial error object
and constructing a full ParserSyntaxError.
2019-08-22 13:35:11 -07:00
Benjamin Woodruff
283a736173 Make conversion functions use ParserSyntaxError
For anything that's not an internal logic error, conversion functions
should raise a ParserSyntaxError.

Internal logic errors should probably use an AssertionError or an assert
statement, but that's not as important and is out of scope for this PR.
2019-08-22 13:35:11 -07:00
Jennifer Taylor
d3ce7da7ce Drop annotation indicator attribute.
We pass down the correct default annotation indicator to use in 100% of code rendering places, so this becomes a useless bit of initialization. We already set this to a sentinel by default, and the only thing that having an explicit str gives us is the inability to copy an annotation from a param to a return or vice versa. So, out it goes. This means we can't render Annotation by itself, so the test that was using this behavior is out too.
2019-08-05 17:13:17 -07:00
Jennifer Taylor
9ca3d39fb6 Rename Ellipses to Ellipsis to match AST and Python stuff. 2019-08-02 17:17:38 -07:00
Benjamin Woodruff
c7fa739087 Add parser for Dict and DictComp
This finishes the parser! 🎉

A few related changes were made:
- `DummyNode` was removed, as it's no longer needed.
- `lpar`/`rpar` was removed from `StarredDictElement`, because I found
  out that it's not valid syntax while developing the parsing logic.
2019-07-31 13:07:01 -07:00
Jennifer Taylor
3fb60b9706 Make parser package private
Now that this is imported from the top level, make it private.
2019-07-26 12:48:22 -07:00