summaryrefslogtreecommitdiff
path: root/test/prism/ruby/ripper_test.rb
AgeCommit message (Collapse)Author
5 hours[ruby/prism] Also handle `BasicObject` as a return valueEarlopain
We should touch these as little as possible and just pass them along https://github.com/ruby/prism/commit/52c4fa785e
5 hours[ruby/prism] Check using Prism nodes if a command call has any arguments in ↵Benoit Daloze
Ripper translator * We don't know what `on_*` events might return so we cannot assume it's an Array. * See https://github.com/ruby/prism/issues/3838#issuecomment-3774702396 https://github.com/ruby/prism/commit/bed4271ce2
22 hours[ruby/prism] Fix `on_*` return value of ripper translatorEarlopain
You're supposed to return the first argument. ```rb # Before [[:stmts_new], [:rescue_mod, nil, nil], [:stmts_add, nil, nil], [:program, nil]] # After [[:stmts_new], [:rescue_mod, "1", "2"], [:stmts_add, nil, "1"], [:program, nil]] ``` The correct result would be: `[[:rescue_mod, "1", "2"], [:stmts_new], [:stmts_add, nil, "1"], [:program, nil]]` But the order depends on the prism AST so it seems very difficult to match. https://github.com/ruby/prism/commit/94e0107729
29 hoursReapply "[ruby/prism] Add Ripper :on_sp events for Prism.lex_compat and ↵Earlopain
Prism::Translation::Ripper" This reverts commit 58f1127b51cf4fbb1f334f8701a041f40701dca2.
32 hoursRevert "[ruby/prism] Add Ripper :on_sp events for Prism.lex_compat and ↵Hiroshi SHIBATA
Prism::Translation::Ripper" This reverts commit 35a7b5159f39de2cac848c072674e5350cc41aa4. This broke syntax_suggest. https://github.com/ruby/ruby/actions/runs/21167011751/job/60874111912
32 hours[ruby/prism] Add Ripper :on_sp events for Prism.lex_compat and ↵Benoit Daloze
Prism::Translation::Ripper * Handle line continuations. * Handle space at the end of file in LexCompat. https://github.com/ruby/prism/commit/32bd13eb7d Co-authored-by: Earlopain <14981592+Earlopain@users.noreply.github.com>
5 days[ruby/prism] Make the ripper shim work with rdocEarlopain
The filter class is a 1:1 copy of ruby. rdoc has 32 test failures. It seems to expect `on_sp` in some cases to render code as written. https://github.com/ruby/prism/commit/74bb12c825
5 days[ruby/prism] Add `Ripper.tokenize` to translation layerEarlopain
It's public API and trivial to implement. https://github.com/ruby/prism/commit/e77545f8b5
6 days[ruby/prism] Make irb work with the ripper shimEarlopain
This is everything that `irb` uses. It works in their test-suite, but there are 20 failures when using the shim that I haven't looked into at all. `parse` is not used by `irb`. `scan` is, and it's basically `parse` but also including errors. `irb` doesn't seem to care about the errors, so I didn't implement that. https://github.com/ruby/prism/commit/2c5826b39f
9 days[ruby/prism] Correctly expose ripper stateEarlopain
It is for example used by `irb`, `rdoc`, `syntax_suggest` https://github.com/ruby/prism/commit/255aeb2485
13 days[ruby/prism] Decouple ripper translator from ripper libraryEarlopain
Ripper exposes Ripper::Lexer:State in its output, which is a bit of a problem. To make this work, I basically copy-pasted the implementation. I'm unsure if that is acceptable and added a test to make sure that these values never go out of sync. I don't imagine them changing often, prism maps them 1:1 for its own usage. This also fixed the shim by accident. `Ripper.lex` went to `Translation::Ripper.lex` when it should have been the original. Removing the need for the original resolves that issue. https://github.com/ruby/prism/commit/2c0bea076d
13 days[ruby/prism] Remove unneeded `ripper` requiresEarlopain
Ripper is either not used or loaded where it is actually needed https://github.com/ruby/prism/commit/a73a4fb00c
2025-12-02[ruby/prism] Clean up test excludesEarlopain
Mostly not having to list version-specific excludes when testing against ripper/parse.y Also don't test new syntax additions against the parser gems. The version support for them may (or may not) be expanded but we shouldn't bother while the ruby version hasn't even released yet. (ruby_parser translation is not versioned, so let as is for now) I also removed excludes that have since been implemented by parse.y https://github.com/ruby/prism/commit/e5a0221c37
2025-11-08[ruby/prism] Rename Ruby 3.5 to Ruby 4.0Earlopain
See https://github.com/ruby/ruby/commit/6d81969b475262aba251e99b518181bdf7c5a523 It leaves the old variant around. RuboCop for examples accesses `Prism::Translation::Parser35` to test against ruby-head. For now I left these simply as an alias https://github.com/ruby/prism/commit/d0a823f045
2025-10-22[ruby/prism] Make error and snapshot tests multi-version awareEarlopain
This one has been on my mind for a while now. Currently, there are only tests against the latest syntax version. This changes the snapshot structure as follows: * Snapshots at their current location are tested against all syntax versions * Snapshots inside a version folder like "3.3" are tested against all versions starting from that version * Snapshots inside a version folder like "3.3-4.2" are tested against all versions in the given range. This makes sure that as new syntax is added, older versions still work as expected. I also added a few tests for now valid syntax that should be invalid in older versions (and the other way around as well) These tests run really fast. So even though it does 3x the work for these, I am still able to run the whole test suite in just 11 seconds. https://github.com/ruby/prism/commit/5191b1aa68
2025-09-19[ruby/prism] Reject argument command call taking a block with more trailing ↵Earlopain
arguments https://bugs.ruby-lang.org/issues/21168#note-5 The added code samples align with `parse.y`, except for `foo(bar baz do end)` which `parse.y` currently rejects but shouldn't. https://github.com/ruby/prism/commit/3a4e102d80
2025-09-12[ruby/prism] [Bug #17398] Allow `private def hello = puts "Hello"`Earlopain
This was a limitation of parse.y that prism intentionally replicated. https://github.com/ruby/prism/commit/8fd12d594c
2025-09-12[ruby/prism] Support leading logical operatorsKevin Newton
https://github.com/ruby/prism/commit/3f58fa7705
2025-08-05[ruby/prism] Bump JRuby versionKevin Newton
https://github.com/ruby/prism/commit/27d284bbb8
2025-03-18[ruby/prism] Update truffleruby versionKevin Newton
https://github.com/ruby/prism/commit/2afe89f8ce
2025-03-18[ruby/prism] Further refine string handling in the parser translatorEarlopain
Mostly around newlines and line continuation. * percent arrays need special backslash handling in the ast * Fix offset issue for heredocs with many line continuations (used wrong variable as index access) * More refined rules on when to simplify string tokens * Handle line continuations in squiggly heredocs * Correctly dedent squiggly heredocs with interpolation * Consider `':foo:` and `%s[foo]` to not be interpolation https://github.com/ruby/prism/commit/4edfe9d981
2025-01-11[ruby/prism] Import code samples for Ruby 3.3 from the parser gemEarlopain
Slightly tweaking the import script becaues of backtrace format changes in Ruby 3.4 Most tests pass in all parsers, with only a handful of failures overall https://github.com/ruby/prism/commit/9b5b785aa4
2024-05-30[ruby/prism] Tests overhaulKevin Newton
https://github.com/ruby/prism/commit/6f886be0a4