summaryrefslogtreecommitdiff
path: root/test/prism
AgeCommit message (Collapse)Author
2025-12-08Interpolated strings must not be frozenAaron Patterson
Strings concatenated with backslash may end up being frozen when they shouldn't be. This commit fixes the issue. It required a change upstream in Prism, but also a change to the Prism compiler in CRuby. https://github.com/ruby/prism/pull/3606 [Bug #21187]
2025-12-08Bump Prism to v1.5.2Takashi Kokubun
[Backport #21187]
2025-09-12Revert "[ruby/prism] Clear flags on interpolated strings"Hiroshi SHIBATA
This reverts commit a495e6a44ce8cff17461b250e32ab63e409a642d. This break extension builds: ``` /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:321:in 'String#replace': can't modify frozen String: "$(SDKROOT)$(prefix)/include" (FrozenError) from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:321:in 'RbConfig.expand' from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:314:in 'block in RbConfig.expand' from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:307:in 'String#gsub' from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:307:in 'RbConfig.expand' from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:314:in 'block in RbConfig.expand' from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:307:in 'String#gsub' from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:307:in 'RbConfig.expand' from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:314:in 'block in RbConfig.expand' from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:307:in 'String#gsub' from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:307:in 'RbConfig.expand' from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:325:in 'block in <module:RbConfig>' from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:324:in 'Hash#each_value' from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:324:in '<module:RbConfig>' from /Users/hsbt/Documents/github.com/ruby/ruby/rbconfig.rb:11:in '<top (required)>' from ./ext/extmk.rb:42:in 'Kernel#require' from ./ext/extmk.rb:42:in '<main>' make[1]: *** [ext/configure-ext.mk:70: ext/json/exts.mk] Error 1 ```
2025-09-12Bump Prism version to 1.5.0Takashi Kokubun
2025-07-09[ruby/prism] Accept a newline after the defined? keyword [Backport #21197] ↵Takashi Kokubun
(#13327) * [ruby/prism] Accept a newline after the defined? keyword [Bug #21197] https://github.com/ruby/prism/commit/22be955ce9 * Fix a compilation error Co-authored-by: Stan Lo <stan001212@gmail.com> --------- Co-authored-by: Kevin Newton <kddnewton@gmail.com> Co-authored-by: Stan Lo <stan001212@gmail.com>
2025-04-14Revert "merge revision(s) 052794bfe1970e90f4f4f9e37fc362dd27903a8d: ↵Takashi Kokubun
[Backport #21197]" This reverts commit e630a0f7ae909dafe2e1dbc47baf90cd795b4a5f.
2025-04-14merge revision(s) 052794bfe1970e90f4f4f9e37fc362dd27903a8d: [Backport #21197]Takashi Kokubun
[ruby/prism] Accept a newline after the defined? keyword [Bug #21197] https://github.com/ruby/prism/commit/22be955ce9
2025-02-18[ruby/prism] Fix escape unicode curly inline whitespaceKevin Newton
Fixes [Bug #21145] https://github.com/ruby/prism/commit/be2d845639
2025-02-14Fix locals_test based on previous backportsKevin Newton
2025-02-14Backport Bug #21137Kevin Newton
2025-02-13merge revision(s) b21e1aed2ed5b22b50efc658289a403eeed581df: [Backport #21114]Takashi Kokubun
[ruby/prism] Fix infinite loop in error recovery When recovering from a depth error that occurs at the end of the file, we need to break out of parsing statements. Fixes [Bug #21114] https://github.com/ruby/prism/commit/a32e268787
2025-02-13merge revision(s) 127325a4bad409ee5da91084fac768934a8fd9e3: [Backport #21117]Takashi Kokubun
[ruby/prism] No writing to numbered parameters Fixes [Bug #21117] https://github.com/ruby/prism/commit/19d4bab5a0
2025-02-13merge revision(s) c2908613368b2ae404d094a15df61d830fc46dc9: [Backport #21048]Takashi Kokubun
[ruby/prism] Fix rescue modifier precedence Fixes [Bug #21048] https://github.com/ruby/prism/commit/07202005cb
2025-02-13merge revision(s) ad96c5a72908042489357b73dc936c4bc38d919b, ↵Takashi Kokubun
ca81142eff98cccb03ff523322aefe4e7346fd0e: [Backport #21010] [ruby/prism] Throw syntax error for endless method with `[]=` Prism shoudld throw a syntax error for endless methods when the method name uses brackets. Previously it would not. This matches the behavior of parse.y. Fixes https://bugs.ruby-lang.org/issues/21010 https://github.com/ruby/prism/commit/43c16a89ef [ruby/prism] [Bug #21010] Reject endless method definition of `[]=` Fixes: https://bugs.ruby-lang.org/issues/20785 https://github.com/ruby/prism/commit/192960ce5d
2024-12-16[ruby/prism] [Bug #20785] Allow `, and` and `, or` after patternsydah
Partially: https://bugs.ruby-lang.org/issues/20785 https://github.com/ruby/prism/commit/71c9102d02 Notes: Merged: https://github.com/ruby/ruby/pull/12358
2024-12-16[ruby/prism] Ignore newlines in labelled lambda argumentsHaldun Bayhantopcu
https://github.com/ruby/prism/commit/4ce6bcf182 Notes: Merged: https://github.com/ruby/ruby/pull/12358
2024-12-16[ruby/prism] Fix 3112 - disallow commas after block argeileencodes
Prism was already disallowing arguments after block args, but in parse.y, any comma after a block arg is a syntax error. This moves the error handling into `PM_TOKEN_UAMPERSAND` where we can check if the current type is `PM_TOKEN_COMMA`then raise an error. I've also updated the tests to include the examplesfrom ruby/prism#3112. Fixes: ruby/prism#3112 https://github.com/ruby/prism/commit/754cf8eddc Notes: Merged: https://github.com/ruby/ruby/pull/12358
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-12-16[ruby/prism] Blocks & kwargs are not valid in index assignmentsMatt Valentine-House
Ruby feature: https://bugs.ruby-lang.org/issues/20952 https://github.com/ruby/prism/commit/e612df5f36
2024-12-13[PRISM] Blocks are also a syntax error in array assignmentMatt Valentine-House
Actually close [Bug #20952] Notes: Merged: https://github.com/ruby/ruby/pull/12343
2024-12-13[PRISM] using []= to set kwargs is a syntax errorMatt Valentine-House
Fixes [Bug #20952] Notes: Merged: https://github.com/ruby/ruby/pull/12342
2024-12-12[ruby/prism] Decode %r like % stringsAaron Patterson
%r regular expressions need to be decoded like strings. This commit fixes %r decoding so it works like strings. https://github.com/ruby/prism/commit/85bfd9c0cd
2024-12-12[ruby/prism] Same numbered param cannot be used in child blocksAaron Patterson
Raise an exception when the same numbered param is used inside a child block. For example, the following code should be a syntax error: ```ruby -> { _1 + -> { _1 } } ``` Fixes https://github.com/ruby/prism/pull/3291 https://github.com/ruby/prism/commit/d4fc441838
2024-12-11[ruby/prism] Fix percent delimiter strings with crlfseileencodes
parse.y treats CRLF as a LF and basically "normalizes" them before parsing. That means a string like `%\nfoo\r\n` is actually treated as `%\nfoo\n` for the purposes of parsing. This happens on both the opening side of the percent string as well as on the closing side. So for example `%\r\nfoo\n` must be treated as `%\nfoo\n`. To handle this in Prism, when we start a % string, we check if it starts with `\r\n`, and then consider the terminator to actually be `\n`. Then we check if there are `\r\n` as we lex the string and treat those as `\n`, but only in the case the start was a `\n`. Fixes: #3230 [Bug #20938] https://github.com/ruby/prism/commit/e573ceaad6 Co-authored-by: John Hawthorn <jhawthorn@github.com> Co-authored-by: eileencodes <eileencodes@gmail.com> Co-authored-by: Kevin Newton <kddnewton@gmail.com>
2024-12-05[ruby/prism] Fix error messages for unterminated ( and {Aaron Patterson
If we hit an EOF token, and the character before the EOF is a newline, we should make EOF token start at the previous newline. That way any errors reported will occur on that line. For example "foo(\n" should report an error on line 1 even though the EOF technically occurs on line 2. [Bug #20918] https://bugs.ruby-lang.org/issues/20918 https://github.com/ruby/prism/commit/60bc43de8e
2024-12-02[ruby/prism] Reject invalid operator after match predicate or after match ↵ydah
required Partially fixes: #3171 https://github.com/ruby/prism/commit/d0d9699c27
2024-12-02[ruby/prism] Reject invalid dot method call after match predicate or after ↵ydah
match required Partially fixes: https://github.com/ruby/prism/issues/3171 https://github.com/ruby/prism/commit/5c33fa5a1a
2024-12-02[ruby/prism] Reject extra comma in array after keyword argumentydah
Fixes: https://github.com/ruby/prism/issues/3109 https://github.com/ruby/prism/commit/9ed989c30d
2024-11-12[ruby/prism] Fix use of uninitialized value when parsing regexpPeter Zhu
Parsing the regexp /\A{/ causes uses an uninitialized value because it tries to parse it as a range quantifier, so it reads the character after the closing curly bracket. This is using uninitialized values because prism strings are not null terminated. This can be seen in the Valgrind output: ==834710== Conditional jump or move depends on uninitialised value(s) ==834710== at 0x5DA010: pm_regexp_parse_range_quantifier (regexp.c:163) ==834710== by 0x5DA010: pm_regexp_parse_quantifier (regexp.c:243) ==834710== by 0x5DAD69: pm_regexp_parse_expression (regexp.c:738) ==834710== by 0x5DAD69: pm_regexp_parse_pattern (regexp.c:761) ==834710== by 0x5DAD69: pm_regexp_parse (regexp.c:773) ==834710== by 0x5A2EE7: parse_regular_expression_named_captures (prism.c:20886) ==834710== by 0x5A2EE7: parse_expression_infix (prism.c:21388) ==834710== by 0x5A5FA5: parse_expression (prism.c:21804) ==834710== by 0x5A64F3: parse_statements (prism.c:13858) ==834710== by 0x5A9730: parse_program (prism.c:22011) ==834710== by 0x576F0D: parse_input_success_p (extension.c:1062) ==834710== by 0x576F0D: parse_success_p (extension.c:1084) This commit adds checks for the end of the string to pm_regexp_parse_range_quantifier. https://github.com/ruby/prism/commit/be6cbc23ef
2024-11-08[ruby/prism] Fix splat after kwsplatHaldun Bayhantopcu
https://github.com/ruby/prism/commit/70c1cd480f
2024-11-03[ruby/prism] Error for def ivarKevin Newton
https://github.com/ruby/prism/commit/232a02acef
2024-11-01Removed accidentally sync fileHiroshi SHIBATA
2024-10-16[ruby/prism] RelocationKevin Newton
https://github.com/ruby/prism/commit/5ea6042408
2024-10-11[ruby/prism] Prism::StringQueryKevin Newton
Introduce StringQuery to provide methods to access some metadata about the Ruby lexer. https://github.com/ruby/prism/commit/d3f55b67b9
2024-10-10[ruby/prism] Prism::CodeUnitsCacheKevin Newton
Calculating code unit offsets for a source can be very expensive, especially when the source is large. This commit introduces a new class that wraps the source and desired encoding into a cache that reuses pre-computed offsets. It performs quite a bit better. There are still some problems with this approach, namely character boundaries and the fact that the cache is unbounded, but both of these may be addressed in subsequent commits. https://github.com/ruby/prism/commit/2e3e1a4d4d
2024-10-10[ruby/prism] Do not warn for unused variables on negative linesKevin Newton
Fixes [Bug #20788] https://github.com/ruby/prism/commit/27e91f21af
2024-10-10[ruby/prism] Reject invalid splat as last statement of parenthesesKevin Newton
https://github.com/ruby/prism/commit/3a0b1c6110
2024-10-09[ruby/prism] Attempt to assume binary is UTF-8Kevin Newton
https://github.com/ruby/prism/commit/343197e4ff
2024-10-09[ruby/prism] Avoid breaking code units offset on binary encodingVinicius Stock
https://github.com/ruby/prism/commit/25a4cf6794 Co-authored-by: Kevin Newton <kddnewton@users.noreply.github.com>
2024-10-07[ruby/prism] Properly handle non-assoc operatorsKevin Newton
https://github.com/ruby/prism/commit/dbd5c929d6
2024-10-07[ruby/prism] Handle invalid commas in arguments, parameters, and arraysKevin Newton
https://github.com/ruby/prism/commit/023e894b74
2024-10-07[ruby/prism] Set contains_keywords flag for implicit gets($/, chomp: true) ↵Andrew Konchin
method call to handle -l CLI option https://github.com/ruby/prism/commit/717e41c87d
2024-10-04[ruby/prism] Fix up multi target parsingKevin Newton
https://github.com/ruby/prism/commit/80cd335222
2024-10-03[ruby/prism] Handle single global variable character nameKevin Newton
https://github.com/ruby/prism/commit/7a0af49997
2024-10-03[ruby/prism] Pop lex mode for heredocs in the lexer, not the parserKevin Newton
https://github.com/ruby/prism/commit/5dd36b979e
2024-10-02[ruby/prism] Fix up doubled range in argumentsKevin Newton
https://github.com/ruby/prism/commit/aee2de91a3
2024-10-02[ruby/prism] Fix up beginless ranges in method definitionsKevin Newton
https://github.com/ruby/prism/commit/ab9d80987a
2024-10-01[ruby/prism] Disallow dynamic patterns in labels at top level followed by pipesKevin Newton
https://github.com/ruby/prism/commit/ccc746f918
2024-10-01Resync to latest PrismKevin Newton
Notes: Merged: https://github.com/ruby/ruby/pull/11753
2024-10-01[ruby/prism] Disallow &. after endless rangeKevin Newton
https://github.com/ruby/prism/commit/498dd922d4