| Age | Commit message (Collapse) | Author |
|
[Bug #19619] Preserve numbered parameters context
Preserve numbered parameters context across method definitions
|
|
[Bug #20517] Make a multibyte character one token at meta escape
|
|
[Bug #20030] dispatch invalid escaped character without ignoring it
|
|
[Backport #19973]"
This reverts commit 24dd529750c08b5603fb418a4f34998b9bf6c8f9.
|
|
[Bug #19973] Warn duplicated keyword arguments after keyword splat
---
parse.y | 11 +++++++----
test/ruby/test_syntax.rb | 6 ++++++
2 files changed, 13 insertions(+), 4 deletions(-)
|
|
[Bug #19924] Source code should be unsigned char stream
Use `peekc` or `nextc` to fetch the next character, instead of reading
from `lex.pcur` directly, for compilers that plain char is signed.
---
parse.y | 10 +++++-----
test/ruby/test_parse.rb | 2 ++
2 files changed, 7 insertions(+), 5 deletions(-)
|
|
[Bug #19788] Use the result of `tCOLON2` event
---
parse.y | 16 ++++++++--------
test/ripper/test_parser_events.rb | 17 +++++++++++++++++
test/ripper/test_scanner_events.rb | 5 +++++
3 files changed, 30 insertions(+), 8 deletions(-)
|
|
Fix memory leak for incomplete lambdas
[Bug #19836]
The parser does not free the chain of `struct vtable`, which causes
memory leaks.
The following script reproduces this issue:
```
10.times do
100_000.times do
Ripper.parse("-> {")
end
puts `ps -o rss= -p #{$$}`
end
```
---
parse.y | 24 ++++++++++++++----------
test/ripper/test_ripper.rb | 7 +++++++
2 files changed, 21 insertions(+), 10 deletions(-)
|
|
Fix memory leak in parser for incomplete tokens
[Bug #19835]
The parser does not free the `tbl` of the `struct vtable` when there are
leftover `lvtbl` in the parser. This causes a memory leak.
The following script reproduces this issue:
```
10.times do
100_000.times do
Ripper.parse("class Foo")
end
puts `ps -o rss= -p #{$$}`
end
```
---
parse.y | 42 ++++++++++++++++++++++++++++--------------
test/ripper/test_ripper.rb | 7 +++++++
2 files changed, 35 insertions(+), 14 deletions(-)
|
|
[Bug #19025] Numbered parameter names are always local variables
---
parse.y | 2 +-
test/ruby/test_syntax.rb | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
|
|
Handle unterminated unicode escapes in regexps
This fixes an infinite loop possible after ec3542229b29ec93062e9d90e877ea29d3c19472.
For \u{} escapes in regexps, skip validation in the parser, and rely on the regexp
code to handle validation. This is necessary so that invalid unicode escapes in
comments in extended regexps are allowed.
Fixes [Bug #19750]
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
---
parse.y | 97 ++++++++++++++++++++++++++++++++-----------------
test/ruby/test_parse.rb | 16 ++++++++
2 files changed, 79 insertions(+), 34 deletions(-)
|
|
[Feature #19134]
Notes:
Merged: https://github.com/ruby/ruby/pull/6934
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6916
|
|
```
1) Failure:
TestAst#test_ranges:test/fiber/scheduler.rb [/home/runner/work/ruby/ruby/src/test/ruby/test_ast.rb:122]:
<[]> expected but was
<[{:type=>:max_validation_error,
:max=>
#<RubyVM::AbstractSyntaxTree::Node::CodePosition:0x00007f80d630b598
@column=20,
@lineno=203>,
:end_pos=>
#<RubyVM::AbstractSyntaxTree::Node::CodePosition:0x00007f80d630b778
@column=19,
@lineno=203>,
:node=>
(BLOCK_PASS@203:15-203:19
(ARGSPUSH@203:15-203:20 (SPLAT@203:16-203:19 (LVAR@203:16-203:19 :*))
(HASH@203:16-203:19
(LIST@203:16-203:19 nil (LVAR@203:16-203:19 :**) nil)))
(LVAR@203:16-203:19 :&))}]>.
```
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6700
|
|
This was introduced by b609bdeb5307e280137b4b2838af0fe4e4b46f1c
to suppress warnings. However these warngins were deleted by
beae6cbf0fd8b6619e5212552de98022d4c4d4d4. Therefore these codes
are not needed anymore.
Notes:
Merged: https://github.com/ruby/ruby/pull/6826
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6818
|
|
[Feature #19134]
Notes:
Merged: https://github.com/ruby/ruby/pull/6818
|
|
If the rescue clause has only exc_var and not exc_list, use the
exc_var position instead of the rescue body position.
This issue appears to have been introduced in
688169fd83b24564b653c03977c168cea50ccd35 when "opt_list" was split
into "exc_list exc_var".
Fixes [Bug #18974]
Notes:
Merged: https://github.com/ruby/ruby/pull/6283
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6776
|
|
Implementation for Language Server Protocol (LSP) sometimes needs token information.
For example both `m(1)` and `m(1, )` has same AST structure other than node locations
then it's impossible to check the existence of `,` from AST. However in later case,
it might be better to suggest variables list for the second argument.
Token information is important for such case.
This commit adds these methods.
* Add `keep_tokens` option for `RubyVM::AbstractSyntaxTree.parse`, `.parse_file` and `.of`
* Add `RubyVM::AbstractSyntaxTree::Node#tokens` which returns tokens for the node including tokens for descendants nodes.
* Add `RubyVM::AbstractSyntaxTree::Node#all_tokens` which returns all tokens for the input script regardless the receiver node.
[Feature #19070]
Impacts on memory usage and performance are below:
Memory usage:
```
$ cat test.rb
root = RubyVM::AbstractSyntaxTree.parse_file(File.expand_path('../test/ruby/test_keyword.rb', __FILE__), keep_tokens: true)
$ /usr/bin/time -f %Mkb /usr/local/bin/ruby -v
ruby 3.2.0dev (2022-11-19T09:41:54Z 19070-keep_tokens d3af1b8057) [x86_64-linux]
11408kb
# keep_tokens :false
$ /usr/bin/time -f %Mkb /usr/local/bin/ruby test.rb
17508kb
# keep_tokens :true
$ /usr/bin/time -f %Mkb /usr/local/bin/ruby test.rb
30960kb
```
Performance:
```
$ cat ../ast_keep_tokens.yml
prelude: |
src = <<~SRC
module M
class C
def m1(a, b)
1 + a + b
end
end
end
SRC
benchmark:
without_keep_tokens: |
RubyVM::AbstractSyntaxTree.parse(src, keep_tokens: false)
with_keep_tokens: |
RubyVM::AbstractSyntaxTree.parse(src, keep_tokens: true)
$ make benchmark COMPARE_RUBY="./ruby" ARGS=../ast_keep_tokens.yml
/home/kaneko.y/.rbenv/shims/ruby --disable=gems -rrubygems -I../benchmark/lib ../benchmark/benchmark-driver/exe/benchmark-driver \
--executables="compare-ruby::./ruby -I.ext/common --disable-gem" \
--executables="built-ruby::./miniruby -I../lib -I. -I.ext/common ../tool/runruby.rb --extout=.ext -- --disable-gems --disable-gem" \
--output=markdown --output-compare -v ../ast_keep_tokens.yml
compare-ruby: ruby 3.2.0dev (2022-11-19T09:41:54Z 19070-keep_tokens d3af1b8057) [x86_64-linux]
built-ruby: ruby 3.2.0dev (2022-11-19T09:41:54Z 19070-keep_tokens d3af1b8057) [x86_64-linux]
warming up..
| |compare-ruby|built-ruby|
|:--------------------|-----------:|---------:|
|without_keep_tokens | 21.659k| 21.303k|
| | 1.02x| -|
|with_keep_tokens | 6.220k| 5.691k|
| | 1.09x| -|
```
Notes:
Merged: https://github.com/ruby/ruby/pull/6770
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6760
|
|
Fixes [Bug #19132]
Notes:
Merged: https://github.com/ruby/ruby/pull/6743
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6721
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6698
|
|
Before:
```
Reducing stack by rule 639 (line 5062):
$1 = token "integer literal" (1.0-1.1: 1)
-> $$ = nterm simple_numeric (1.0-1.1: )
```
After:
```
Reducing stack by rule 641 (line 5078):
$1 = token "integer literal" (1.0-1.1: 1)
-> $$ = nterm simple_numeric (1.0-1.1: NODE_LIT)
```
`"<*>"` is supported by Bison 2.3b (2008-05-27) or later.
https://git.savannah.gnu.org/cgit/bison.git/commit/?id=12e3584054c16ab255672c07af0ffc7bb220e8bc
Therefore developers need to install Bison 2.3b+ to build ruby from
source codes if their Bison is older.
Minimum version requirement for Bison is changed to 3.0.
See: https://bugs.ruby-lang.org/issues/19068 [Feature #19068]
Notes:
Merged: https://github.com/ruby/ruby/pull/6579
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6517
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6515
|
|
Assign internal_id to semantic value so that dump parsetree option
can render the tree for these codes without SEGV.
* `def m(&); end`
* `def m(*); end`
* `def m(**); end`
Notes:
Merged: https://github.com/ruby/ruby/pull/6514
|
|
So that "IF" node is kept in the case below
```
def m
if
end
```
[Feature #19013]
Notes:
Merged: https://github.com/ruby/ruby/pull/6512
|
|
By this change, syntax error is recovered smaller units.
In the case below, "DEFN :bar" is same level with "CLASS :Foo"
now.
```
module Z
class Foo
foo.
end
def bar
end
end
```
[Feature #19013]
Notes:
Merged: https://github.com/ruby/ruby/pull/6512
|
|
"end" after "." or "::" is treated as local variable or method,
see `EXPR_DOT_bit` for detail.
However this "changes" where `bar` method is defined. In the example
below it is not module Z but class Foo.
```
module Z
class Foo
foo.
end
def bar
end
end
```
[Feature #19013]
Notes:
Merged: https://github.com/ruby/ruby/pull/6512
|
|
but "end" tokens are needed for correct language.
[Feature #19013]
Notes:
Merged: https://github.com/ruby/ruby/pull/6512
|
|
If this option is enabled, SyntaxError is not raised and Node is
returned even if passed script is broken.
[Feature #19013]
Notes:
Merged: https://github.com/ruby/ruby/pull/6512
|
|
The following warning appears without this fix:
```
parse.y:78:1: warning: unknown warning group '-Wpsabi', ignored
[-Wunknown-warning-option]
RBIMPL_WARNING_IGNORED(-Wpsabi)
^
./include/ruby/internal/warning_push.h:103:39: note: expanded from macro
'RBIMPL_WARNING_IGNORED'
^
./include/ruby/internal/warning_push.h:99:39: note: expanded from macro
'RBIMPL_WARNING_PRAGMA2'
^
./include/ruby/internal/warning_push.h:98:39: note: expanded from macro
'RBIMPL_WARNING_PRAGMA1'
^
./include/ruby/internal/warning_push.h:97:39: note: expanded from macro
'RBIMPL_WARNING_PRAGMA0'
^
<scratch space>:49:27: note: expanded from here
clang diagnostic ignored "-Wpsabi"
^
1 warning generated.
```
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6373
Merged-By: nobu <nobu@ruby-lang.org>
|
|
matching
[Bug #18990]
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6292
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6263
Merged-By: nobu <nobu@ruby-lang.org>
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/5977
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6073
|
|
`Ripper::Lexer#parse` re-parses the source code with syntax errors
when `raise_errors: false`.
Co-Authored-By: tompng <tomoyapenguin@gmail.com>
Notes:
Merged: https://github.com/ruby/ruby/pull/6233
|
|
* Fix some UBSAN false positives.
* ruby tool/update-deps --fix
Notes:
Merged-By: jhawthorn <john@hawthorn.email>
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6087
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6065
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6064
Merged-By: nobu <nobu@ruby-lang.org>
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/5867
|
|
Do not override the input string encoding at the time of preparation,
the source encoding is not determined from the input yet.
Notes:
Merged: https://github.com/ruby/ruby/pull/6015
|