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.
- Make INDENT/DEDENT dummy tokens more readable instead of outputting an
empty string for them.
- Sort the "expected" list to make testing easier.
- Don't show the list of expected values if there are > 10
possibilities. The output becomes impossible to read at that point.
- Try to avoid using an empty line for the displayed contextual line of
source code. Instead, point at the line above it, or just don't output
any context.
This removes the hard-coded logic about encountered/expected, and moves
it into a separate helper method.
Line and column can now be initialized lazily. We'll use this later to
raise `ParserSyntaxError`s inside of conversion functions, backfilling
the positions inside `_base_parser`, since conversion functions don't
always have access to position information.
Adds details about how various configuration options can be used, and
updates some details to reflect reality (e.g. we don't currently infer
the python version from your execution environment).
We only support parsing code as 3.7 right now.
This raises a descriptive error message if we receive an unsupported
version number, instead of silently trying to use it with the tokenizer
and failing in potentially strange ways.
These were referred to by other parts of the documentation, and they
provide core parts of our functionality, so we should have explicit
documentation for them.
It doesn't look like we need:
- `sphinx.ext.githubpages`
- `sphinx.ext.todo`
- `sphinx.ext.mathjax`
So I removed these and then sorted the list of extensions.
I noticed this while working on the documentation. I think this predated
pyre's Literal support.
I only did this for `end` and not `start`, because there's a large
combinatorial set of valid `start` values. If we wanted to better type
`start`, we should probably first separate the prefix from the opening
quotes.
This commit mostly focuses on f-strings, collections, comprehensions,
and subscripts/slices.
I added intersphinx support to the sphinx config so I could link to
`ast.literal_eval`.
I exported BaseSimpleComp, since I felt it had some documentation value.