| Age | Commit message (Collapse) | Author | |
|---|---|---|---|
| 2024-02-23 | [Bug #20234] Fix segv when parsing begin statement in method definition | eileencodes | |
| In a method definition, the `begin` may not have an `nd_body`. When that happens we get a null expr back from `last_expr_node` which causes a segv for the following examples: ```ruby def (begin;end).foo; end def (begin;else;end).foo; end def (begin;ensure;else;end).foo; end ``` In addition, I've added tests for other cases that weren't causing a segv but appeared untested.` Fixes https://bugs.ruby-lang.org/issues/20234 | |||
| 2024-02-23 | Use rb_str_to_interned_str in parse.y | Peter Zhu | |
| This commit changes rb_fstring to rb_str_to_interned_str in parse.y. rb_fstring is private so it shouldn't be used by ripper. | |||
| 2024-02-23 | [Bug #20295] Fix SEGV when parsing invalid regexp | yui-knk | |
| 2024-02-22 | Use `rb_encoding *` as literal hash of NODE_ENCODING | yui-knk | |
| This reduces dependency on VALUE. | |||
| 2024-02-22 | Use `terms?` instead of `opt_terms` | ydah | |
| 2024-02-21 | Remove not used universal parser macros and functions | yui-knk | |
| 2024-02-21 | `rb_parser_warn_duplicate_keys` doesn't need to take care of NODE_LIT anymore | yui-knk | |
| NODE_LIT is created only for `shareable_constant_value`. This means hash key node is never NODE_LIT. | |||
| 2024-02-21 | Remove hack for ripper.y generation | yui-knk | |
| Before Rearchitect Ripper (89cfc15), parser and ripper used different semantic value data type for same symbols. "ext/ripper/tools/preproc.rb" replaced these types when it generated ripper.y. Starting the line with other than `%token` suppressed the type replacement. However, after Rearchitect Ripper, both parser and ripper use same semantic value data type. Therefore these comments are not needed anymore. | |||
| 2024-02-21 | Introduce NODE_REGX to manage regexp literal | yui-knk | |
| 2024-02-20 | Move ripper_validate_object to ripper_init.c.tmpl | yui-knk | |
| 2024-02-20 | Suppress unused function warning for UNIVERSAL_PARSER build | yui-knk | |
| Suppress the warning: ``` parse.y:2221:1: warning: unused function 'rb_parser_str_hash' [-Wunused-function] 2221 | rb_parser_str_hash(rb_parser_string_t *str) | ^~~~~~~~~~~~~~~~~~ ``` | |||
| 2024-02-20 | Workaround for `Prism::ParseTest#test_filepath` for ↵ | yui-knk | |
| "unparser/corpus/literal/def.txt" See the discussion on https://github.com/ruby/ruby/pull/9923 | |||
| 2024-02-20 | [Feature #20257] Rearchitect Ripper | yui-knk | |
| Introduce another semantic value stack for Ripper so that Ripper can manage both Node and Ruby Object separately. This rearchitectutre of Ripper solves these issues. Therefore adding test cases for them. * [Bug 10436] https://bugs.ruby-lang.org/issues/10436 * [Bug 18988] https://bugs.ruby-lang.org/issues/18988 * [Bug 20055] https://bugs.ruby-lang.org/issues/20055 Checked the differences of `Ripper.sexp` for files under `/test/ruby` are only on test_pattern_matching.rb. The differences comes from the differences between `new_hash_pattern_tail` functions between parser and Ripper. Ripper `new_hash_pattern_tail` didn’t call `assignable` then `kw_rest_arg` wasn’t marked as local variable. This is also fixed by this commit. ``` --- a/./tmp/before/test_pattern_matching.rb +++ b/./tmp/after/test_pattern_matching.rb @@ -3607,7 +3607,7 @@ [:in, [:hshptn, nil, [], [:var_field, [:@ident, “a”, [984, 13]]]], [[:binary, - [:vcall, [:@ident, “a”, [985, 10]]], + [:var_ref, [:@ident, “a”, [985, 10]]], :==, [:hash, nil]]], nil]]], @@ -3662,7 +3662,7 @@ [:in, [:hshptn, nil, [], [:var_field, [:@ident, “a”, [993, 13]]]], [[:binary, - [:vcall, [:@ident, “a”, [994, 10]]], + [:var_ref, [:@ident, “a”, [994, 10]]], :==, [:hash, [:assoclist_from_args, @@ -3813,7 +3813,7 @@ [:command, [:@ident, “raise”, [1022, 10]], [:args_add_block, - [[:vcall, [:@ident, “b”, [1022, 16]]]], + [[:var_ref, [:@ident, “b”, [1022, 16]]]], false]]], [:else, [[:var_ref, [:@kw, “true”, [1024, 10]]]]]]]], nil, @@ -3876,7 +3876,7 @@ [:@int, “0”, [1033, 15]]], :“&&“, [:binary, - [:vcall, [:@ident, “b”, [1033, 20]]], + [:var_ref, [:@ident, “b”, [1033, 20]]], :==, [:hash, nil]]]], nil]]], @@ -3946,7 +3946,7 @@ [:@int, “0”, [1042, 15]]], :“&&“, [:binary, - [:vcall, [:@ident, “b”, [1042, 20]]], + [:var_ref, [:@ident, “b”, [1042, 20]]], :==, [:hash, [:assoclist_from_args, @@ -5206,7 +5206,7 @@ [[:assoc_new, [:@label, “c:“, [1352, 22]], [:@int, “0”, [1352, 25]]]]]], - [:vcall, [:@ident, “r”, [1352, 29]]]], + [:var_ref, [:@ident, “r”, [1352, 29]]]], false]]], [:binary, [:call, @@ -5299,7 +5299,7 @@ [:assoc_new, [:@label, “c:“, [1367, 34]], [:@int, “0”, [1367, 37]]]]]], - [:vcall, [:@ident, “r”, [1367, 41]]]], + [:var_ref, [:@ident, “r”, [1367, 41]]]], false]]], [:binary, [:call, @@ -5931,7 +5931,7 @@ [:in, [:hshptn, nil, [], [:var_field, [:@ident, “r”, [1533, 11]]]], [[:binary, - [:vcall, [:@ident, “r”, [1534, 8]]], + [:var_ref, [:@ident, “r”, [1534, 8]]], :==, [:hash, [:assoclist_from_args, ``` | |||
| 2024-02-19 | [Bug #20280] Check by `rb_parser_enc_str_coderange` | Nobuyoshi Nakada | |
| Co-authored-by: Yuichiro Kaneko <spiketeika@gmail.com> | |||
| 2024-02-19 | [Bug #20280] Raise SyntaxError on invalid encoding symbol | Nobuyoshi Nakada | |
| 2024-02-15 | Do not include a backtick in error messages and backtraces | Yusuke Endoh | |
| [Feature #16495] | |||
| 2024-02-15 | Show the invalid source encoding in messages | Nobuyoshi Nakada | |
| 2024-02-13 | Fix memory leak when parsing invalid hash symbol | Peter Zhu | |
| For example: 10.times do 100_000.times do eval('{"\xC3": 1}') rescue EncodingError end puts `ps -o rss= -p #{$$}` end Before: 32032 48464 66112 84192 100592 117520 134096 150656 167168 183760 After: 17120 17120 17120 17120 18560 18560 18560 18560 18560 18560 | |||
| 2024-02-13 | Use dedicated parser_string hash function | yui-knk | |
| Define and use `rb_parser_str_hash` for `rb_parser_string_t` instead of `rb_str_hash` to remove dependency on `rb_str_hash`. | |||
| 2024-02-13 | Warn duplication of `__ENCODING__` on the hash | yui-knk | |
| ``` $ ruby -e 'h = { __ENCODING__ => 1, __ENCODING__ => 2 }' -e:1: warning: key #<Encoding:UTF-8> is duplicated and overwritten on line 1 ``` | |||
| 2024-02-12 | Use Node for `warn_duplicate_keys` st_table keys | yui-knk | |
| 2024-02-10 | Fix the variable to be checked | yui-knk | |
| It should check the result of `rb_parser_search_nonascii`. | |||
| 2024-02-09 | Remove ruby object from string nodes | yui-knk | |
| String nodes holds ruby string object on `VALUE nd_lit`. This commit changes it to `struct rb_parser_string *string` to reduce dependency on ruby object. Sometimes these strings are concatenated with other string therefore string concatenate functions are needed. | |||
| 2024-02-07 | Fix memory leak when parsing invalid pattern matching | Peter Zhu | |
| If the pattern matching is invalid, then the pvtbl would get leaked. For example: 10.times do 100_000.times do eval(<<~RUBY) case {a: 1} in {"a" => 1} end RUBY rescue SyntaxError end puts `ps -o rss= -p #{$$}` end Before: 28096 44768 61472 78512 94992 111504 128096 144528 161008 177472 After: 14096 14112 14112 14176 14208 14240 14240 14240 14240 14240 | |||
| 2024-02-03 | Use bool to check ascii only in parse_ident | yui-knk | |
| No need to use ENC_CODERANGE to record ascii only or not. | |||
| 2024-01-31 | Introduced `rb_node_const_decl_val` function | S.H | |
| Introduce `rb_node_const_decl_val` function to allow `rb_ary_join` and `rb_ary_reverse` functions to be removed from Universal Parser. | |||
| 2024-01-28 | [Bug #20219] `gettable` returns NULL on error | Nobuyoshi Nakada | |
| 2024-01-28 | [Bug #20217] `rescue` block is void only if all children are void | Nobuyoshi Nakada | |
| 2024-01-28 | [Bug #20217] `return` with `ensure` is a void value expression | Nobuyoshi Nakada | |
| 2024-01-28 | Rename `nd_head` in `RNode_RESBODY` as `nd_next` | Nobuyoshi Nakada | |
| 2024-01-28 | Remove unused `nd_resq` from `RNode_ENSURE` | Nobuyoshi Nakada | |
| 2024-01-27 | Introduce `NODE_ENCODING` | S.H | |
| `__ENCODING__ `was managed by `NODE_LIT` with Encoding object. Introduce `NODE_ENCODING` for 1. `__ENCODING__` is detectable from AST Node. 2. Reduce dependency Ruby object for parse.y | |||
| 2024-01-27 | bvar is not NODE but ID | yui-knk | |
| Before this commit `ruby -y -e 'tap {|;x, y|}'` failed with SEGV. This change fixes it. | |||
| 2024-01-25 | Use `token_seen` and simplify `comment_at_top` | Nobuyoshi Nakada | |
| Instead of scanning before the current comment. | |||
| 2024-01-24 | Do not use ruby2_keywords for ... argument forwarding | Jeremy Evans | |
| This allows ... argument forwarding to benefit from Allocationless Anonymous Splat Forwarding, allowing the `f` call below to not allocate an array or a hash. ```ruby a = [1] kw = {b: 2} def c(a, b:) end def f(...) c(...) end f(*a, **kw) ``` This temporarily skips prism locals tests until prism is changed to use * and ** for ..., instead of using ruby2_keywords. Ignore failures in rbs bundled gems tests, since they fail due to this change. | |||
| 2024-01-23 | Make lastline and nextline to be rb_parser_string | yui-knk | |
| This commit changes `struct parser_params` lastline and nextline from `VALUE` (String object) to `rb_parser_string_t *` so that dependency on Ruby Object is reduced. `parser_string_buffer_t string_buffer` is added to `struct parser_params` to manage `rb_parser_string_t` pointers of each line. All allocated line strings are freed in `rb_ruby_parser_free`. | |||
| 2024-01-22 | Use index for referring to symbols in `args` rule instead of named references | yui-knk | |
| In `args: args ',' arg_splat`, `args` is not unique name. Currently the associated rule is interpreted as `$$ = rest_arg_append(p, $$, $3, &@$);`. The action works as expected because `$$` is initialized with `$1` before each action is executed. However it's misleading then change to use index. | |||
| 2024-01-14 | Constify `rb_global_parser_config` | Nobuyoshi Nakada | |
| 2024-01-13 | Stop using Array to manage dummy `end` token locations | yui-knk | |
| Before this commit, Array is used to store token locations which expect `end` token, e.g. `class` and `module`. This commit introduces dedicated struct to manage them so that dependency on Ruby Object is reduced. | |||
| 2024-01-12 | Suppress warnings in parser_set_encode function | S-H-GAMELINKS | |
| 2024-01-12 | Remove reference counter from rb_parser_config | yui-knk | |
| It's allocated outside of parser then no need to track reference count in rb_parser_config. | |||
| 2024-01-12 | Statically allocate parser config | yui-knk | |
| 2024-01-12 | `set_yylval_literal` is not used | yui-knk | |
| 2024-01-11 | Reject encodings determined at runtime as source code encodings | Nobuyoshi Nakada | |
| The encodings determined at runtime are affected by the runtime environment, such as the OS and locale, while the file contents are not. | |||
| 2024-01-11 | Remove duplicate function `nd_st_key_val` | Nobuyoshi Nakada | |
| 2024-01-11 | Fixed return values for some node types in nd_st_key function | S-H-GAMELINKS | |
| 2024-01-10 | `st_index_t` is not `VALUE` | Nobuyoshi Nakada | |
| 2024-01-09 | Fix memory leak in parser for invalid syntax | Peter Zhu | |
| The strterm is leaked when there is invalid syntax. For example: 10.times do 100_000.times do begin RubyVM::InstructionSequence.compile('private def foo = puts "Hello"') rescue SyntaxError end end puts `ps -o rss= -p #{$$}` end Before: 20384 26256 32592 36720 42016 47888 53248 57456 62928 65936 After: 16720 17488 17616 17616 17616 17616 17616 17616 17616 16032 Co-Authored-By: Kevin Newton <kddnewton@gmail.com> | |||
| 2024-01-09 | Convert a series of `else if` lines to a `switch` | Nobuyoshi Nakada | |
| 2024-01-09 | Introduce NODE_SYM to manage symbol literal | yui-knk | |
| `:sym` was managed by `NODE_LIT` with `Symbol` object. This commit introduces `NODE_SYM` so that 1. Symbol literal is detectable from AST Node 2. Reduce dependency on ruby object | |||
