Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When running as main, handle leading python #63

Merged
merged 1 commit into from
Oct 27, 2023
Merged

Conversation

akamgm
Copy link
Contributor

@akamgm akamgm commented Oct 19, 2023

Previously, calling the parser directly on a file with leading python would break, eg:

$python aipl/parser.py examples/hanukkah-of-data-5783.aipl
Parsing:  examples/hanukkah-of-data-5783.aipl
Traceback (most recent call last):
...
lark.exceptions.UnexpectedCharacters: No terminal matches '@' in the current parser context, at line 1 col 1

@defop('sql', 0, 1.5)
^
Expected one of: 
        * _EMPTY_LINE
        * __ANON_0

Prepending an explicit !!python\n to the input, as AIPL.run() does, handles it correctly.

@anjakefala
Copy link
Collaborator

I really appreciate you addressing this!

@akamgm
Copy link
Contributor Author

akamgm commented Oct 19, 2023

Happy to! Although I think there's a better long-term fix - see this issue.

@saulpw saulpw merged commit c0c638d into saulpw:develop Oct 27, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants