Tree Templates (first draft) + py3to2 example#1006
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1006 +/- ##
==========================================
- Coverage 87.66% 86.74% -0.92%
==========================================
Files 49 50 +1
Lines 6973 7055 +82
==========================================
+ Hits 6113 6120 +7
- Misses 860 935 +75
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
MegaIng
left a comment
There was a problem hiding this comment.
There are a few more things that might be useful, but that should be done in the future. (e.g. some kind of repeated vars).
| # 1. Define a Python parser that also accepts template vars in the code (in the form of $var) | ||
| # | ||
| TEMPLATED_PYTHON = r""" | ||
| %import python (single_input, file_input, eval_input, atom, var, stmt, expr, testlist_star_expr, _NEWLINE, _INDENT, _DEDENT, COMMENT, NAME) |
There was a problem hiding this comment.
Seems like a perfect usecase for an %include statement.
There was a problem hiding this comment.
You didn't submit a PR for this, right?
There was a problem hiding this comment.
It is part of #998, but that is not a finished implementation.
There was a problem hiding this comment.
Hmm okay. Anyway, we can change it to %include when it's ready.
| from python_parser import PythonIndenter | ||
|
|
||
| # Official Python grammar by Lark | ||
| python_parser3 = Lark.open_from_package('lark', 'python.lark', ['grammars'], |
There was a problem hiding this comment.
Do we need to manually add the extension .lark
There was a problem hiding this comment.
It doesn't work without it, so I'll go with yes
No description provided.