Open kddnewton opened 9 months ago
Very curious what the two of you think of the ordering of nodes for nested or
s and and
s (e.g. 1 or 2 or 3
).
As noted above, RP puts the shallower nesting on the left, while Prism puts the deeper nesting on the left. I don't think this makes a difference in interpretation (a depth-first, left-to-right visitor will process nodes in the same order). But the s-exps are different, which means for Brakeman the "fingerprints" for warnings will be different.
So should Prism match what RP does? Or should RP change?
For that, I'm okay changing Prism to match the RP AST when it does the translation, but I will keep the AST to have the same structure for other use cases (it matches the ASTs for parse.y and whitequark/parser).
Cool - I took a cut at it last night but didn't quite get it there π
π Hey there! In writing the prism translator, I've come across a couple of things that look like they might be bugs in ruby_parser. I wanted to flag them in case you wanted to fix them. I don't imagine they're common at all. They're listed below.
These raise errors:
These should be flip-flops:
This should be a match node:
These should be arrays not array patterns:
These should introduce local variables:
This one I'm a little unsure of, but I think that the following should be
s(:and, s(:and, s(:true), s(:call, s(:false), :!)), s(:true))
and nots(:and, s(:true), s(:and, s(:call, s(:false), :!), s(:true)))
:This one is dropping a value from the rescued expression:
This heredoc is counting an escaped newline as if it were a real newline:
This heredoc should have not dedent:
This heredoc should only dedent by 2:
This should be a constant declaration, not a call:
These should have UTF-8 as the encoding of the string, not ASCII-8BIT:
This heredoc should be
beforeafter\r\n
notbefore\nafter\n
(there's a \r\n after the ):These are all horrible heredoc behavior that I'm sorry to even bring up:
This has a line number that is very odd (the xstring is saying it's starting on line 2, maybe the
\\
isn't incrementing a line count?):And then just to mention, I basically turned off support for numbered parameters, e.g., marking the following as a call instead of a local variable read: