summaryrefslogtreecommitdiff
path: root/prism
AgeCommit message (Collapse)Author
2025-02-13[ruby/prism] Fix infinite loop in error recoveryKevin Newton
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-13[ruby/prism] Split assertion per expressionsNobuyoshi Nakada
Expressions joined with `&&` are better asserted separately, so that it is clear from the failure message which expression is false. Also, `unsigned long` may not be enough for `ptrdiff_t`, e.g., Windows. Saying that `ptrdiff_t` can be larger than `SIZE_MAX` means that `PTRDIFF_MAX` is larger than `SIZE_MAX` and `ptrdiff_t` is sufficient to represent `SIZE_MAX`, otherwise if `PTRDIFF_MAX` is smaller than `SIZE_MAX`, `diff` will always be smaller than `SIZE_MAX` as well. `diff` could be equal to `SIZE_MAX` only if `PTRDIFF_MAX` is equal to `SIZE_MAX` and these assertions would pass, but I don't think there is any platform where that is the case. https://github.com/ruby/prism/commit/1fc6dfcada
2025-01-22[ruby/prism] Fix rescue modifier precedenceKevin Newton
Fixes [Bug #21048] https://github.com/ruby/prism/commit/07202005cb
2025-01-22[ruby/prism] Do not put empty statements in while because of -nKevin Newton
Fixes [Bug #21085] https://github.com/ruby/prism/commit/ebb9c36a10
2025-01-19[ruby/prism] Freeze `Prism::VERSION`Earlopain
Closes https://github.com/ruby/prism/pull/3422 https://github.com/ruby/prism/commit/b488a84253
2025-01-16[ruby/prism] Increase value of PRISM_DEPTH_MAXIMUM to 10000Benjamin Quorning
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-01-14[ruby/prism] Support forwarding flags on scopesKevin Newton
When parent scopes around an eval are forwarding parameters (like *, **, &, or ...) we need to know that information when we are in the parser. As such, we need to support passing that information into the scopes option. In order to do this, unfortunately we need a bunch of changes. The scopes option was previously an array of array of strings. These corresponded to the names of the locals in the parent scopes. We still support this, but now additionally support passing in a Prism::Scope instance at each index in the array. This Prism::Scope class holds both the names of the locals as well as an array of forwarding parameter names (symbols corresponding to the forwarding parameters). There is convenience function on the Prism module that creates a Prism::Scope object using Prism.scope. In JavaScript, we now additionally support an object much the same as the Ruby side. In Java, we now have a ParsingOptions.Scope class that holds that information. In the dump APIs, these objects in all 3 languages will add an additional byte for the forwarding flags in the middle of the scopes serialization. All of this is in service of properly parsing the following code: ```ruby def foo(*) = eval("bar(*)") ``` https://github.com/ruby/prism/commit/21abb6b7c4
2025-01-14[ruby/prism] Refactor serializerKevin Newton
https://github.com/ruby/prism/commit/8ab2532f09
2025-01-14[ruby/prism] Freeze AST optionKevin Newton
To make it so that you can pass `freeze: true` to Prism parse methods and get back a deeply-frozen AST that is Ractor- shareable. https://github.com/ruby/prism/commit/8e6a93b2d2
2025-01-12[ruby/prism] Frozen strings in the ASTKevin Newton
https://github.com/ruby/prism/commit/8d9d429155
2025-01-11[ruby/prism] Fix `not` receiverKevin Newton
`not foo` should be `!foo` `not()` should be `!nil` Fixes [Bug #21027] https://github.com/ruby/prism/commit/871ed4b462
2025-01-11[ruby/prism] Fallthrough fallback for unknown compilersKevin Newton
https://github.com/ruby/prism/commit/cc810b1e06
2025-01-11[ruby/prism] Enable implicit fall-through errorsAlexander Momchilov
https://github.com/ruby/prism/commit/03797b84d3
2025-01-11[ruby/prism] Bump to v1.3.0Kevin Newton
https://github.com/ruby/prism/commit/a679ee0e5c
2025-01-11[ruby/prism] Support 3.5 for version optionKevin Newton
https://github.com/ruby/prism/commit/6b6aa05bfb
2025-01-08[ruby/prism] Revert "Reject pattern match with unexpected double splat ↵Kevin Newton
inside array" https://github.com/ruby/prism/commit/51e7c84124
2025-01-08[ruby/prism] Handle escapes in named capture namesKevin Newton
https://github.com/ruby/prism/commit/b4b7a69ce7
2025-01-08[ruby/prism] Reject pattern match with unexpected double splat inside arrayydah
`a => [-2**b]` should be SyntaxError Fixes: https://github.com/ruby/prism/issues/3381 https://github.com/ruby/prism/commit/ae8e83b389
2025-01-07[ruby/prism] Throw syntax error for endless method with `[]=`eileencodes
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
2025-01-05Use a single quote instead of a backtick for error messagesJunichi Ito
Fix https://bugs.ruby-lang.org/issues/20977 Notes: Merged: https://github.com/ruby/ruby/pull/12424
2025-01-05[ruby/prism] Fix global variable read off endKevin Newton
https://github.com/ruby/prism/commit/3f2c34b53d
2025-01-02[ruby/prism] Fix cross-compile issue with newlib on Ubuntu 24.04Masataka Pocke Kuwabara
https://github.com/ruby/prism/commit/61ebe51233
2024-12-29[Bug #20988] [prism] Fix escaped octal character literalsNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12487
2024-12-28[Bug #20990] Reject escaped multibyte char with control/meta prefixNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12485
2024-12-27[Bug #20986] [Prism] Allow escaped multibyte characterNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/12477
2024-12-26[ruby/prism] Handle escaped characters after controlsKevin Newton
Fixes [Bug #20986] https://github.com/ruby/prism/commit/fd0c563e9e
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