-
Notifications
You must be signed in to change notification settings - Fork 171
Closed
Description
I propose to take some in inspiration from this config. There are two things that are different from whitequark/parser and right now I think it was my mistake to introduce them: IfMod
and IfTernary
should go away, If
node is enough to cover all cases.
Apart from this it makes a lot of sense to me. Thoughts on current config:
Assignment
- in static analysis from my experience people never look for "an abstract assignment", there's always a need to find a certain type of assignment, like lvar assignment (to track local variables) or ivar assignment. I think it makes sense to introduce separate nodes for all types of assignment like it's done in whitequark/parser, ruby_parser and all parsers derived from them.Binary
- I think it's too generic and complex at the same time.2 + 2
is aBinary
, right? I think it should have the same type asfoo.bar
, because it is a method call. On the other side all types of "real" binary operators need their own node types because they have special behaviour.CharacterLiteral
- it should be just aString
, there's no different between them.FloatLiteral
- let's keep it.Identifier
- this node has no value on its own and it always requires tracking current context to understand the meaning.IfModifier
- like I described above a singleIf
node is enough. If there's a need to track a modifier version source maps can be used, but there's no different in how "normal if" works vs "if modifier". AST should represent meaning, not layout.ImaginaryLiteral
- let's keep itIntegerLiteral
- keepOperatorAssignment
- keep, there's an equivalent in whitequark/parserProgram
- ehh, we can keep it, both whitequark/parser, ruby_parser (and IIRC all parsers except parser.y/Ripper) usebegin
node for it, because there's difference in how top-level block of code is treated comparing to let's say block body orbegin..end
.RationalLiteral
- keepRange
- I think it makes sense to split it to..
and...
rangesRedo
/Retry
- keepStatements
- should be justbegin
I guessTernary
- redundant, can be replaced withIf
UnlessModifier
- redundant, can beif
with "inverted" branchesUntilModifier
- redundant, there can be a singleUntil
nodeVariableReference
- sounds a bit verbose,lvar
orlocalvariable
should be enoughWhileModifier
- redundant, there can be a singleWhile
node
@kddnewton PTAL at the document that I linked above and let me know what you think
Metadata
Metadata
Assignees
Labels
No labels