summaryrefslogtreecommitdiff
path: root/test/prism
AgeCommit message (Collapse)Author
104 min.[ruby/prism] Fix parser translation when escaped newline with trailing contentKevin Newton
https://github.com/ruby/prism/commit/81e07f3cdb
3 hours[ruby/prism] Don't replicate unary method bug in parser translatorEarlopain
Closes https://github.com/ruby/prism/issues/4112 Also see https://github.com/ruby/prism/issues/2501, for which this was done. The expectation in rubocop is incorrect (produces code with semantic difference), so the test should be updated instead. In any way, it should also have applied to `+`, where the same happens https://github.com/ruby/prism/commit/1f8cae2a75
11 daysReject `END { next } ` as wellEarlopain
Followup for https://bugs.ruby-lang.org/issues/20409
2026-05-08[ruby/prism] Take the strings encoding as the initial encoding in the ripper ↵Earlopain
translator When no magic encoding comment is present, it does not default to utf-8, and takes the encoding of the string that contains the source code instead. Most of the time that will be utf-8, but not always. https://github.com/ruby/prism/commit/1a273db780
2026-05-08[ruby/prism] Respect `encoding` option in `Prism.lex` and friendsEarlopain
utf-8 is the default for source files but can be overwritten via options https://github.com/ruby/prism/commit/355f451528
2026-04-30[ruby/prism] Fix UTF-8 code units to match the number of bytesVinicius Stock
(https://github.com/ruby/prism/pull/4098) https://github.com/ruby/prism/commit/442bd904ed
2026-04-27[ruby/prism] Reject `END { break }` for Ruby 4.0Earlopain
For [Bug #20409] https://github.com/ruby/prism/commit/4848eb344e
2026-04-24[ruby/prism] Implement `on_label_end` for ripperEarlopain
It is emitted for string-like symbols only https://github.com/ruby/prism/commit/6d63302c7b
2026-04-23[ruby/prism] Fix incompatibilities for `on_word_sep` in ripperEarlopain
It was mostly good, just a few edgecases: * word_sep always only contains a single line. if there are multiple lines, it is also multiple word_sep * Handle trailing whitespace The excluded testcase is interpolation mixed with heredoc. That is not currently handled properly and word_sep contains the content of the heredoc I also switched start/end_offset names in the method, they seem to be backwards https://github.com/ruby/prism/commit/2e151ad41b
2026-04-14[ruby/prism] Implement bracket/braces events for ripperEarlopain
Drops the check against order. Very often ripper emits events in a order that is not easy to mimic. It's only getting worse now that most events are implemented. Perhaps the test can be brought back at a later time. For now, I used it while making this commit but adding all these exceptions makes not much sense. It already was a pretty long list. https://github.com/ruby/prism/commit/f43299a18b
2026-04-09[ruby/prism] Reject `return` and similar with block pass argumentEarlopain
Same handling as for `yield`. Fixes [Bug #21988] https://github.com/ruby/prism/commit/2dd20183ad
2026-04-06[ruby/prism] Implement `on_op` for ripperEarlopain
Mostly the same as for `on_kw`. Stop comparing order for a handful of events. They are emitted by ripper in a order that is not easy for prism to replicate. For example in`foo, bar, baz = 123`, `op` for `=` is emitted before the last mass assign identifier (so `foo`, `bar`, `=`, `baz`. I don't want to replicate that if I don't have to. Same for `::` in `A::B = 123` etc. https://github.com/ruby/prism/commit/4d88aed5e9
2026-04-05[ruby/prism] Adapt `ParametersNode#signature` to `ErrorRecoveryNode`Earlopain
No need to list them all out anymore, it's just a single possibility now https://github.com/ruby/prism/commit/893f2734cb
2026-04-01[ruby/prism] Emit `on_kw` for ripperEarlopain
`yard` uses it Start checking against the ordering of the events and also their location. I didn't fix any of the preexisting failures and just ignored them. Some are easy to fix, others look like particularities of ripper that I don't think anyone would rely on. https://github.com/ruby/prism/commit/4cba29d282
2026-03-27[ruby/prism] Remove unused variable in testsBenoit Daloze
https://github.com/ruby/prism/commit/5bb64a246d
2026-03-27[ruby/prism] Also handle string conversion in `Ripper.lex`Earlopain
In `ripper`, both go through the same converion logic. Needed for rspec, no other failures in their own tests https://github.com/ruby/prism/commit/510258aa2b
2026-03-27[ruby/prism] Implement various string start/end events for ripperEarlopain
`tstring_beg` in particular is needed by `yard`. Before: > 1980 examples, 606 failures, 15 pending After: > 1980 examples, 582 failures, 15 pending Thought it would be more, but oh well. It needs `on_sp` which I guess is why there are not many new passes https://github.com/ruby/prism/commit/e1b18cb582
2026-03-26[ruby/prism] Fix `Source.offsets` with `freeze: true`Earlopain
We still need to do it eagerly when the result will be frozen, same as for locations. Fixes the following error for the added test: > FrozenError: can't modify frozen Prism::ASCIISource: #<Prism::ASCIISource:0x00007ff9d57586f0 @source="1 + 2", @start_line=1, @offsets="\x00\x00\x00\x00"> https://github.com/ruby/prism/commit/0667d23f4f
2026-03-24[ruby/prism] More gracefully handle interpolated keys in hpnKevin Newton
https://github.com/ruby/prism/commit/31c71e7a40
2026-03-24[PRISM] Replace MissingNode with ErrorRecoveryNodeKevin Newton
2026-03-24[ruby/prism] Visit block locals in lambda definitionsEarlopain
They may not be part of `on_param` but ripper still calls `on_ident` for them https://github.com/ruby/prism/commit/fb5303f2b8
2026-03-24[ruby/prism] Fix double-visiting on some constant path node typesEarlopain
`::X &&= 1` for example emitted `on_int` twice https://github.com/ruby/prism/commit/44d064c2bc
2026-03-24[ruby/prism] Emit `on_comment` with a newline when availableEarlopain
https://github.com/ruby/prism/commit/894f395449
2026-03-24[ruby/prism] Add a test for ripper eventsEarlopain
Currently there is just one very basic one. https://github.com/ruby/prism/commit/5a184b8085
2026-03-20[ruby/prism] Prism.findKevin Newton
Take a method, unbound method, proc, or thread backtrace location. This is our equivalent to RubyVM::AbstractSyntaxTree.of, and could be leveraged in something like error highlight. Note that this uses CRuby-specific APIs on CRuby, and falls back to using location-based APIs when those aren't available. https://github.com/ruby/prism/commit/02a93356a3
2026-03-18Manually sync prismEarlopain
2026-03-11[ruby/prism] Track newlines in character escape sequencesKevin Newton
https://github.com/ruby/prism/commit/2e58c52196
2026-03-11[ruby/prism] Restructure regexp encoding validationKevin Newton
Move all the logic from prism.c into regexp.c. Now regexp.c does two passes. The first pass scans the raw source to track escape types, non-ASCII literals, and multibyte validity for encoding validation. The second pass scans the unescaped content for named capture extraction (needed because escape sequences like line continuations alter group names). Fixed a couple of things along the way. ascii_only was previously computed from unescaped content, but we can do that as we go to avoid scanning again. Unicode properties also now properly error for regexp with modifiers. https://github.com/ruby/prism/commit/0944c7fba2
2026-03-10[ruby/prism] Fix binding for `in`, `not`, and `do` on/after command callsKevin Newton
https://github.com/ruby/prism/commit/fd0a20f8d8
2026-03-09[ruby/prism] Refine continuable? with algorithm in CKevin Newton
https://github.com/ruby/prism/commit/c28810fe93
2026-03-06[ruby/prism] Fix not without parentheses binding powerKevin Newton
https://github.com/ruby/prism/commit/7d21e564ac
2026-03-06[ruby/prism] Fix precedence of infix operators after commandKevin Newton
https://github.com/ruby/prism/commit/35470bb90d
2026-03-06[ruby/prism] Fix the handling of `do` on commandsKevin Newton
Introduce PM_TOKEN_KEYWORD_DO_BLOCK to distinguish do-blocks on command-style calls from regular `do` keywords. Add parse_command_do_block to attach these blocks to call nodes. Track in_endless_def_body to prevent do-block consumption inside endless method definitions, allowing blocks to correctly bubble up to outer contexts like `private def f = puts "Hello" do end`. https://github.com/ruby/prism/commit/7d17fd254b
2026-03-05[ruby/prism] Correctly handle `and?` and similar on ruby 4.0Earlopain
It gets confused for syntax introduced in https://bugs.ruby-lang.org/issues/20925 But it actually should be a plain method call. `!`/`?` are not valid as part of an identifier, methods however allow them as the last character. Fixes [Bug #21946] https://github.com/ruby/prism/commit/5d80bc5e1a
2026-03-04[ruby/prism] Revert "Reject infix operators on command call onEarlopain
writes" (https://github.com/ruby/prism/pull/3960) This reverts commit https://github.com/ruby/prism/commit/4e71dbfc7bd9. And also add a regression test. Seems like currently prism parses these the same that parse.y does. https://github.com/ruby/prism/commit/03993421f2
2026-03-03[ruby/prism] Fix modifier rescue pattern matchingKevin Newton
[Bug #21713] https://github.com/ruby/prism/commit/02c944c055
2026-03-02[ruby/prism] Fix up endless method definition with do/endKevin Newton
[Bug #21714] https://github.com/ruby/prism/commit/0f47e18335
2026-03-02[ruby/prism] Prism::ParseResult#continuable?Kevin Newton
An API to determine if more input could fix the existing syntax errors. https://github.com/ruby/prism/commit/6701ffe0f5
2026-03-02[ruby/prism] Reject infix operators on command call on writesKevin Newton
https://github.com/ruby/prism/commit/4e71dbfc7b
2026-03-02[ruby/prism] Fix in handlingKevin Newton
in is a unique keyword because it can be the start of a clause or an infix keyword. We need to be explicitly sure that even though in _could_ close an expression context (the body of another in clause) that we are not also parsing an inline in. The exception is the case of a command call, which can never be the LHS of an expression, and so we must immediately exit. [Bug #21925] [Bug #21674] https://github.com/ruby/prism/commit/20374ced51
2026-02-27[ruby/prism] Fix error message for block/lambda with `...` argumentEarlopain
They currently complain that the parent method is not forwarding. But the actual problem is that these types of arguments simply don't accept `...` Fixes [Bug #21927] https://github.com/ruby/prism/commit/0aa2363331
2026-02-22[ruby/prism] Preserve line-continuation only in dedent heredocsEarlopain
Closes https://github.com/ruby/prism/issues/3837 While these lines are whitespace only from a runtime perspective, the line continuation is significant for AST consumers. Sort of a followup to https://github.com/ruby/prism/commit/faab217d9382186133862ce4d5ba9a9e090a9550 https://github.com/ruby/prism/commit/a8a7c6b77d
2026-02-22[ruby/prism] [Feature #19107] Allow trailing comma in method signatureEarlopain
https://github.com/ruby/prism/commit/b7e247ce6a
2026-02-19[ruby/prism] Implement noblock for the ripper/ruby_parser translatorEarlopain
In ripper, compared to `**nil` it is not a new event https://github.com/ruby/prism/commit/7f5782392e
2026-02-16[ruby/prism] Add a test for multiple `&nil` blocks/mixing themEarlopain
https://github.com/ruby/prism/commit/e5fb0e192b
2026-02-16[ruby/prism] Only accept noblock in Ruby 4.1+Kevin Newton
https://github.com/ruby/prism/commit/fb88c72dce
2026-02-16[ruby/prism] Only compare &nil syntax on rubies that support itEarlopain
https://github.com/ruby/prism/commit/8aad2480ab
2026-02-15[PRISM] [Feature #19979] Method definition with `&nil`Nobuyoshi Nakada
2026-02-13[ruby/prism] Fix lexing for unterminated strings/heredocs etc.Earlopain
When we hit EOF and still have lex modes left, it means some content was unterminated. Heredocs specifically have logic that needs to happen when the body finished lexing. If we don't reset the mode back to how it was before, it will not continue lexing at the correct place. Followup to https://github.com/ruby/prism/pull/3918. We can't call into `parser_lex` since it resets token locations. https://github.com/ruby/prism/commit/27c24fdc0d
2026-02-12[ruby/prism] Revert "Fix lexing for unterminated strings/heredocs etc."Earlopain
This reverts commit https://github.com/ruby/prism/commit/8f35e8ef255b. https://github.com/ruby/prism/commit/ed48f6dbfb