-
Notifications
You must be signed in to change notification settings - Fork 222
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
feat(Lezer grammar): Rework grammar with semantic parse tree #3588
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is excellent @vanillajonathan ! Nice work! It is much better, and I see you've standardized things.
I didn't quite understand all the @
— that's OK though, I see the tests and the results look good.
I asked a couple of questions, and then we can merge...
Co-authored-by: Maximilian Roos <[email protected]>
Thanks. Yes, I looked at upstream grammars and tried to adopt to their convention about naming, syntax and structure.
The The
|
OK great — this was the one I wasn't familiar with. Thanks for the explanation... |
Thanks again @vanillajonathan ! |
We have the We should have a We should handle the Right now The statement We need triple-quoted f-strings, r-strings and s-strings. We need an |
Fine to rename
Yes, having these as keywords would be good. We don't necessarily need to distinguish them in more detail than "keyword", but it's OK to do so if you like.
No strong view — I think it could be highlighted the same as an
Great! If these can be generic, even better... I had mixed success when I originally tried to do that.
Nice, yes. Also feel free to take a swing at the change suggested at the bottom of #3571 — it would touch a lot of places, but I don't think it's that hard. It would be a nice next-PR to the rust parser. |
Previously the tests passed because they were crafted to pass, not because they reflected what the parse tree ought to look like. This patch reworks the grammar to output a more idiomatic parse tree.
Previously the parse tree looked like
Expr(Integer,Op_bin,Integer)
and now looks likeBinaryExpression(Integer,ArithOp,Integer)
orBinaryExpression(Integer,CompareOp,Integer)
.Docblock
token is introduced.TimeUnit
token.highlight.js
file now maps theDocblock
andTimeUnit
token tot.docString
andt.unit
respectively.@precedence
block has been moved up to the top of the file as per upstream convention.Query_def
is nowQueryDefinition
. I am unsure about the name and considerMetaDeclaration
orPragmaDeclaration
. Named args are no longer optional.Def
is nowVariableDeclaration
as per upstream convention.Named_arg
is nowNamedArg
.Pipeline_stmt
is nowPipelineStatement
. The "Statement" suffix is by upstream convention.Tuple
andArray
have been renamed toTupleExpression
andArrayExpression
respectively as are the names in the Python grammar.Range
have been renamed toRangeExpression
.Func_call
has been renamed toCallExpression
as per upstream convention.commaSep
is introduced as a internal generic token, it is currently only used by theArrayExpression
token. This token is a conventional token found in upstream grammars.BinaryExpression
token have been introduced along with theLogicOp
andCompareOp
tokens. TheOp_bin
token is gone. This is per upstream convention.expression
token as per upstream convention.Interpolated_string
have been renamed tointerpolatedString
and is now a internal token.@token
block have been moved up as per upstream convention.#!
'''
"""