| Age | Commit message (Collapse) | Author |
|
[Backport #21187]
|
|
|
|
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
```
|
|
|
|
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]
|
|
(#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>
|
|
[Backport #21197]"
This reverts commit e630a0f7ae909dafe2e1dbc47baf90cd795b4a5f.
|
|
[ruby/prism] Freeze `Prism::VERSION`
Closes https://github.com/ruby/prism/pull/3422
https://github.com/ruby/prism/commit/b488a84253
|
|
[ruby/prism] Accept a newline after the defined? keyword
[Bug #21197]
https://github.com/ruby/prism/commit/22be955ce9
|
|
[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>
|
|
Fixes [Bug #21145]
https://github.com/ruby/prism/commit/be2d845639
|
|
|
|
|
|
[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
|
|
[ruby/prism] No writing to numbered parameters
Fixes [Bug #21117]
https://github.com/ruby/prism/commit/19d4bab5a0
|
|
[ruby/prism] Fix rescue modifier precedence
Fixes [Bug #21048]
https://github.com/ruby/prism/commit/07202005cb
|
|
[ruby/prism] Do not put empty statements in while because of -n
Fixes [Bug #21085]
https://github.com/ruby/prism/commit/ebb9c36a10
|
|
[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>
|
|
[ruby/prism] Fix `not` receiver
`not foo` should be `!foo`
`not()` should be `!nil`
Fixes [Bug #21027]
https://github.com/ruby/prism/commit/871ed4b462
|
|
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
|
|
https://github.com/ruby/prism/commit/544df5835f
Notes:
Merged: https://github.com/ruby/ruby/pull/12358
|
|
Partially: https://bugs.ruby-lang.org/issues/20785
https://github.com/ruby/prism/commit/71c9102d02
Notes:
Merged: https://github.com/ruby/ruby/pull/12358
|
|
https://github.com/ruby/prism/commit/4ce6bcf182
Notes:
Merged: https://github.com/ruby/ruby/pull/12358
|
|
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
|
|
https://github.com/ruby/prism/commit/9686897290
Notes:
Merged: https://github.com/ruby/ruby/pull/12358
|
|
https://github.com/ruby/prism/commit/817a8e39d9
Notes:
Merged: https://github.com/ruby/ruby/pull/12358
|
|
https://github.com/ruby/prism/commit/f80026883d
Notes:
Merged: https://github.com/ruby/ruby/pull/12358
|
|
Actually close [Bug #20952]
Notes:
Merged: https://github.com/ruby/ruby/pull/12343
|
|
Fixes [Bug #20952]
Notes:
Merged: https://github.com/ruby/ruby/pull/12342
|
|
https://github.com/ruby/prism/commit/2f903d7865
|
|
%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
|
|
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
|
|
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>
|
|
https://github.com/ruby/prism/commit/230c8b8a48
|
|
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
|
|
Partially: https://github.com/ruby/prism/issues/2123
https://github.com/ruby/prism/commit/1ffd693f9b
|
|
Partially: https://github.com/ruby/prism/issues/2123
https://github.com/ruby/prism/commit/a78da01ef6
|
|
Partially: https://github.com/ruby/prism/issues/2123
https://github.com/ruby/prism/commit/2f473b0713
|
|
Partially: https://github.com/ruby/prism/issues/2123
https://github.com/ruby/prism/commit/7be164e0b7
|
|
Partially fixes: https://github.com/ruby/prism/issues/2123
https://github.com/ruby/prism/commit/f1f8776973
|
|
Partially: https://github.com/ruby/prism/issues/2123
https://github.com/ruby/prism/commit/3c01cc7c77
|
|
Partially: https://github.com/ruby/prism/issues/2123
https://github.com/ruby/prism/commit/649ef29c29
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/12232
|
|
Instead cast it inline to a double on Windows.
https://github.com/ruby/prism/commit/9064d872aa
|
|
required
Partially fixes: #3171
https://github.com/ruby/prism/commit/d0d9699c27
|
|
match required
Partially fixes: https://github.com/ruby/prism/issues/3171
https://github.com/ruby/prism/commit/5c33fa5a1a
|
|
Fixes: https://github.com/ruby/prism/issues/3109
https://github.com/ruby/prism/commit/9ed989c30d
|
|
```
❯ 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 |
```
|
|
Partially fixes: https://github.com/ruby/prism/issues/2123
https://github.com/ruby/prism/commit/b8f40988ab
|
|
Partially fixes: https://github.com/ruby/prism/issues/2123
https://github.com/ruby/prism/commit/396c6d4340
|