Skip to content

[PRISM] Add --dump=prism mode#8643

Merged
jemmaissroff merged 2 commits intoruby:masterfrom
jemmaissroff:add-dump-prism
Oct 13, 2023
Merged

[PRISM] Add --dump=prism mode#8643
jemmaissroff merged 2 commits intoruby:masterfrom
jemmaissroff:add-dump-prism

Conversation

@jemmaissroff
Copy link
Copy Markdown
Contributor

@jemmaissroff jemmaissroff commented Oct 12, 2023

Similar to --dump=parsetree, --dump=prism will dump the Prism AST for a given file. It is also compatible with -e <code> syntax.

I have also created this issue ruby/prism#1681 to make the Prism AST printing nicer in the C API.

@jemmaissroff jemmaissroff merged commit d705885 into ruby:master Oct 13, 2023
@jemmaissroff jemmaissroff deleted the add-dump-prism branch October 13, 2023 19:24
@ko1
Copy link
Copy Markdown
Contributor

ko1 commented Oct 15, 2023

How about to rename prisim_parsetree or similar to make clear it is parse tree?
It will help documentation.

Maybe you can use --dump=prism for the command line option because shorthand will be accepted.

@faraazahmad
Copy link
Copy Markdown
Contributor

Just curious, If/when Prism becomes the default parser for Ruby, will --dump=parsetree and --dump=prism return the same output?

@kddnewton
Copy link
Copy Markdown
Contributor

@faraazahmad From my understanding either way they will become the same, because CRuby has committed to prism's node structure (regardless of the internals of the parser itself)

@kddnewton
Copy link
Copy Markdown
Contributor

@ko1 happy to change this to prism_parsetree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants