summaryrefslogtreecommitdiff
path: root/prism
AgeCommit message (Collapse)Author
2025-12-08Bump Prism to v1.5.2Takashi Kokubun
[Backport #21187]
2025-09-13Bump Prism version to 1.5.1 (#14549)Takashi Kokubun
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-08-27When reading from stdin, put a wrapper around the IO objectAaron Patterson
The purpose of this commit is to fix Bug #21188. We need to detect when stdin has run in to an EOF case. Unfortunately we can't _call_ the eof function on IO because it will block. Here is a short script to demonstrate the issue: ```ruby x = STDIN.gets puts x puts x.eof? ``` If you run the script, then type some characters (but _NOT_ a newline), then hit Ctrl-D twice, it will print the input string. Unfortunately, calling `eof?` will try to read from STDIN again causing us to need a 3rd Ctrl-D to exit the program. Before introducing the EOF callback to Prism, the input loop looked kind of like this: ```ruby loop do str = STDIN.gets process(str) if str.nil? p :DONE end end ``` Which required 3 Ctrl-D to exit. If we naively changed it to something like this: ```ruby loop do str = STDIN.gets process(str) if STDIN.eof? p :DONE end end ``` It would still require 3 Ctrl-D because `eof?` would block. In this patch, we're wrapping the IO object, checking the buffer for a newline and length, and then using that to simulate a non-blocking eof? method. This commit wraps STDIN and emulates a non-blocking `eof` function. [Backport #21188]
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) f27ed98effff9891d28edc7119d45811bcedd510: [Backport #21183]Takashi Kokubun
[ruby/prism] Freeze `Prism::VERSION` Closes https://github.com/ruby/prism/pull/3422 https://github.com/ruby/prism/commit/b488a84253
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-03-03[ruby/prism] Use a locale-insensitive version of tolowerJean Boussier
[Bug #21161] The `tolower` function provided by the libc is locale dependent and can behave in ways you wouldn't expect for some value of `LC_CTYPE`. https://github.com/ruby/prism/commit/e3488256b4 Co-Authored-By: Nobuyoshi Nakada <nobu@ruby-lang.org>
2025-02-18[ruby/prism] Fix escape unicode curly inline whitespaceKevin Newton
Fixes [Bug #21145] https://github.com/ruby/prism/commit/be2d845639
2025-02-14Backport Bug #21137Kevin Newton
2025-02-14Backport Bug #21031Kevin 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) 241ada7b1ca4fd71dc47a83d912ee25162a555d9: [Backport #21085]Takashi Kokubun
[ruby/prism] Do not put empty statements in while because of -n Fixes [Bug #21085] https://github.com/ruby/prism/commit/ebb9c36a10
2025-02-13merge revision(s) 931a870606f4e286a1c7bacf022940994f3c431b: [Backport #21044]Takashi Kokubun
[ruby/prism] Increase value of PRISM_DEPTH_MAXIMUM to 10000 The previous value of 1_000 was added with a reference to the Bison parser[^1], but the value of YYMAXDEPTH in the Bison docs is 10_000, not 1_000. [^1]: https://www.gnu.org/software/bison/manual/html_node/Memory-Management.html Fixes [Bug #21044] https://github.com/ruby/prism/commit/e098533ab4 Co-authored-by: Nony Dutton <nonydutton@gmail.com>
2025-02-13merge revision(s) 117d6e145a0270ab8fc9134403519ef13b9ebb24: [Backport #21027]Takashi Kokubun
[ruby/prism] Fix `not` receiver `not foo` should be `!foo` `not()` should be `!nil` Fixes [Bug #21027] https://github.com/ruby/prism/commit/871ed4b462
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] Update src/prism.cKevin Newton
https://github.com/ruby/prism/commit/544df5835f Notes: Merged: https://github.com/ruby/ruby/pull/12358
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] Add do keyword tracking for While/UntilKevin Newton
https://github.com/ruby/prism/commit/9686897290 Notes: Merged: https://github.com/ruby/ruby/pull/12358
2024-12-16[ruby/prism] Bump to v1.2.0Kevin Newton
https://github.com/ruby/prism/commit/817a8e39d9 Notes: Merged: https://github.com/ruby/ruby/pull/12358
2024-12-16[ruby/prism] Bump to v1.1.0Kevin Newton
https://github.com/ruby/prism/commit/f80026883d Notes: Merged: https://github.com/ruby/ruby/pull/12358
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] Use isinf on non-mingw windowsv3_4_0_rc1Kevin Newton
https://github.com/ruby/prism/commit/2f903d7865
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-11[ruby/prism] Bump typechecking depsKevin Newton
https://github.com/ruby/prism/commit/230c8b8a48
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-04[ruby/prism] Add document CapturePatternNode fieldsydah
Partially: https://github.com/ruby/prism/issues/2123 https://github.com/ruby/prism/commit/1ffd693f9b
2024-12-04[ruby/prism] Add document CaseMatchNode fieldsydah
Partially: https://github.com/ruby/prism/issues/2123 https://github.com/ruby/prism/commit/a78da01ef6
2024-12-04[ruby/prism] Add document CaseNode fieldsydah
Partially: https://github.com/ruby/prism/issues/2123 https://github.com/ruby/prism/commit/2f473b0713
2024-12-04[ruby/prism] Add document ClassVariableAndWriteNode fieldsydah
Partially: https://github.com/ruby/prism/issues/2123 https://github.com/ruby/prism/commit/7be164e0b7
2024-12-03[ruby/prism] Add document CallOperatorWriteNode fieldsydah
Partially fixes: https://github.com/ruby/prism/issues/2123 https://github.com/ruby/prism/commit/f1f8776973
2024-12-03[ruby/prism] Add document CallOrWriteNode fieldsydah
Partially: https://github.com/ruby/prism/issues/2123 https://github.com/ruby/prism/commit/3c01cc7c77
2024-12-03[ruby/prism] Add document CallTargetNode fieldsydah
Partially: https://github.com/ruby/prism/issues/2123 https://github.com/ruby/prism/commit/649ef29c29
2024-12-03Added missing header file for _finiteHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/12232
2024-12-02[ruby/prism] _finitef is unavailable on Windows x86Kevin Newton
Instead cast it inline to a double on Windows. https://github.com/ruby/prism/commit/9064d872aa
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-12-02Fix example of array pattern that results in a SyntaxErrorydah
``` ❯ ruby --parser=prism --dump=parsetree -e "foo in *1" ruby: -e:1: syntax error found (SyntaxError) > 1 | foo in *1 | ^ unexpected integer, expecting end-of-input 2 | ```
2024-12-02[ruby/prism] Add document BeginNode fieldsydah
Partially fixes: https://github.com/ruby/prism/issues/2123 https://github.com/ruby/prism/commit/b8f40988ab
2024-12-02[ruby/prism] Add document ArrayPatternNode fieldsydah
Partially fixes: https://github.com/ruby/prism/issues/2123 https://github.com/ruby/prism/commit/396c6d4340