-
Notifications
You must be signed in to change notification settings - Fork 47
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
Quoter #64
base: master
Are you sure you want to change the base?
Quoter #64
Conversation
there is now a quasi quoter for expressions (modules, statements, python expression) in version 3 Todo: parser is initializied at location 0,0, hence multi-line quotes need to be left-aligned -> todo: use internal parser initialization and set start location
This looks great. Can you please show some examples of its use? Maybe some examples can be put in the header documentation for Language.Python.Common.Quoter? |
Like so? |
Looks great thanks! Would it be possible to add some test cases to the test suite as well? |
I thought about how to test this. I could compare a) quotes to parse results from files using the test python already there or b) compare quotes to 'handcrafted' (sub)AST.
|
Hi @Pagolin. I would like to pull this code into the repository. I do prefer to have some test cases to use when doing the pull. Your suggested approach sounds reasonable. I find that testing against hand written ASTs can be a bit laborious, and thus few tests get written this way. Another approach is to do a kind of "round trip" testing, by quoting some code, then pretty printing it back to a rendered string, and then comparing that string to the expected code. This is not perfect, because it relies on the pretty printer being stable, and it is not in the spirit of a unit test. However, it tends to be easier to do, and therefore more tests can get written, which has its own advantages. |
I needed a Quasiquoter, so I added a simple one (basically a wrapper for dataToExp.
I had the existing test running through, with obviously no error, but didn't manage to add tests yet.
However I thought it might be useful for someone.