summaryrefslogtreecommitdiff
path: root/lib/prism/translation/ruby_parser.rb
AgeCommit message (Collapse)Author
2025-12-29[ruby/prism] Optimize ruby visitorEarlopain
`compact_child_nodes` allocates an array. We can skip that step by simply yielding the nodes. Benchmark for visiting the rails codebase: ```rb require "prism" require "benchmark/ips" files = Dir.glob("../rails/**/*.rb") results = files.map { Prism.parse_file(it) } visitor = Prism::Visitor.new Benchmark.ips do |x| x.config(warmup: 3, time: 10) x.report do results.each do visitor.visit(it.value) end end end RubyVM::YJIT.enable Benchmark.ips do |x| x.config(warmup: 3, time: 10) x.report do results.each do visitor.visit(it.value) end end end ``` Before: ``` ruby 3.4.8 (2025-12-17 revision https://github.com/ruby/prism/commit/995b59f666) +PRISM [x86_64-linux] Warming up -------------------------------------- 1.000 i/100ms Calculating ------------------------------------- 2.691 (± 0.0%) i/s (371.55 ms/i) - 27.000 in 10.089422s ruby 3.4.8 (2025-12-17 revision https://github.com/ruby/prism/commit/995b59f666) +YJIT +PRISM [x86_64-linux] Warming up -------------------------------------- 1.000 i/100ms Calculating ------------------------------------- 7.278 (±13.7%) i/s (137.39 ms/i) - 70.000 in 10.071568s ``` After: ``` ruby 3.4.8 (2025-12-17 revision https://github.com/ruby/prism/commit/995b59f666) +PRISM [x86_64-linux] Warming up -------------------------------------- 1.000 i/100ms Calculating ------------------------------------- 3.429 (± 0.0%) i/s (291.65 ms/i) - 35.000 in 10.208580s ruby 3.4.8 (2025-12-17 revision https://github.com/ruby/prism/commit/995b59f666) +YJIT +PRISM [x86_64-linux] Warming up -------------------------------------- 1.000 i/100ms Calculating ------------------------------------- 16.815 (± 0.0%) i/s (59.47 ms/i) - 169.000 in 10.054668s ``` ~21% faster on the interpreter, ~56% with YJIT https://github.com/ruby/prism/commit/bf631750cf
2025-12-14[ruby/prism] Fix `sexp_processor` gem referenceEarlopain
It's https://rubygems.org/gems/sexp_processor, not https://rubygems.org/gems/sexp https://github.com/ruby/prism/commit/b8a00a5f15
2025-12-14[ruby/prism] Define RubyParser::SyntaxError directly and drop require for ↵Ryan Davis
ruby_parser. Had to add a require of sexp since that came in indirectly via ruby_parser. https://github.com/ruby/prism/commit/df677c324f
2025-12-12[ruby/prism] Fixed Prism::Translation::RubyParser's comment processingRyan Davis
Tests were failing in Flay under Prism. https://github.com/ruby/prism/commit/af9b3640a8
2025-09-15[ruby/prism] Fix back reference for ruby_parser on Ruby 2.7Earlopain
Symbol#name is only a thing since Ruby 3.0 https://github.com/ruby/prism/commit/2de82b15fc
2025-08-01[ruby/prism] Match RubyParser behavior for -> lambda argsJustin Collins
https://github.com/ruby/prism/commit/9f55551b09
2025-08-01[ruby/prism] RubyParser translation for stabby lambdas with `it`Justin Collins
https://github.com/ruby/prism/commit/c2e372a8d8
2025-05-29[ruby/prism] [DOC] Markup `__FILE__` as code, not emphasisNobuyoshi Nakada
https://github.com/ruby/prism/commit/571ba378f5
2025-05-29[ruby/prism] [DOC] Add code fencesNobuyoshi Nakada
https://github.com/ruby/prism/commit/641775e5fe
2025-05-29[ruby/prism] [DOC] Specify markdown mode to RDocNobuyoshi Nakada
https://github.com/ruby/prism/commit/12af4e144e
2025-01-14[ruby/prism] Fix block parameters and it for RubyParserJustin Collins
https://github.com/ruby/prism/commit/7a93a307ac
2025-01-12[ruby/prism] Frozen strings in the ASTKevin Newton
https://github.com/ruby/prism/commit/8d9d429155
2024-12-16[ruby/prism] Fix up regression in ruby parser translationKevin Newton
https://github.com/ruby/prism/commit/b283a72c88 Notes: Merged: https://github.com/ruby/ruby/pull/12358
2024-10-03[ruby/prism] Use `partial_script` for the parser translatorsEarlopain
Followup to https://github.com/ruby/prism/pull/3079 https://github.com/ruby/prism/commit/68f434e356
2024-09-16[ruby/prism] Do not leak explicit encodingKevin Newton
Fixes [Bug #20744] https://github.com/ruby/prism/commit/f1b8b1b2a2
2024-08-28[PRISM] Field renamingKevin Newton
Rename some fields that do not quite make sense. * CaseMatchNode#consequent -> CaseMatchNode#else_clause * CaseNode#consequent -> CaseNode#else_clause * IfNode#consequent -> IfNode#subsequent * RescueNode#consequent -> RescueNode#subsequent * UnlessNode#consequent -> UnlessNode#else_clause Notes: Merged: https://github.com/ruby/ruby/pull/11480
2024-07-11[ruby/prism] (ruby_parser) Handle bare string in implicit concatKevin Newton
https://github.com/ruby/prism/commit/afc7c9344a
2024-07-11[ruby/prism] (ruby_parser) Match match3 nodes for regular expressionsKevin Newton
https://github.com/ruby/prism/commit/47cb73ce69
2024-07-11[ruby/prism] (ruby_parser) Reverse associativity of and and or nodesKevin Newton
https://github.com/ruby/prism/commit/073e8ba307
2024-05-30[ruby/prism] Tests overhaulKevin Newton
https://github.com/ruby/prism/commit/6f886be0a4
2024-05-24[ruby/prism] Fix up ruby_parser string concatKevin Newton
https://github.com/ruby/prism/commit/4b06eae0df
2024-05-22[ruby/prism] Fix support for 'it' implicit local variableKevin Newton
https://github.com/ruby/prism/commit/53bbcfe513
2024-05-21[ruby/prism] Fix up ruby_parser interpolation concatenationKevin Newton
https://github.com/ruby/prism/commit/79cec4be22
2024-05-13[ruby/prism] Rescue LoadError for ruby_parser as wellKevin Newton
https://github.com/ruby/prism/commit/d4eb13e703
2024-05-10[ruby/prism] operator renameKevin Newton
https://github.com/ruby/prism/commit/b5e47f5c42
2024-05-03[ruby/prism] Change ConstantPathNode#child to ConstantPathNode#{name,name_loc}Kevin Newton
This has been requested for a long time, and I'm finally doing it now. Unfortunately this is a breaking change for all of the APIs. I've added in a Ruby method for `#child` that is deprecated so that existing usage doesn't break, but for everyone else this is going to be a bit of a pain. https://github.com/ruby/prism/commit/9cbe74464e
2024-05-03[ruby/prism] Assume eval context for ruby_parser and ripperKevin Newton
https://github.com/ruby/prism/commit/e4d6984892
2024-04-19[ruby/prism] Fix up ruby_parser translation for dstrKevin Newton
https://github.com/ruby/prism/commit/b0fa4b7cd8
2024-03-25[ruby/prism] Use Sexp#line_max not Sexp#max_lineJustin Collins
for RubyParser translation https://github.com/ruby/prism/commit/a37169621a
2024-03-15[ruby/prism] Shareable constant nodesKevin Newton
https://github.com/ruby/prism/commit/473cfed6d0
2024-03-06[ruby/prism] Fix up linting in ripper translationKevin Newton
https://github.com/ruby/prism/commit/5cf5f15ee7
2024-02-12[ruby/prism] ruby_parser translatorKevin Newton
https://github.com/ruby/prism/commit/1925b970c7