summaryrefslogtreecommitdiff
path: root/test/ripper
AgeCommit message (Collapse)Author
10 daysEmit `warn` event for duplicated hash keys on ripperyui-knk
Need to use `rb_warn` macro instead of calling `rb_compile_warn` directly to emit `warn` event on ripper.
14 daysFix segv when parsing `command` by ripperyui-knk
89cfc152071 made this event dispatch to pass `Qundef` to user defined callback method by mistake. This commit fix it to be `nil`.
2024-04-07Fix ripper to dispatch warning event for duplicated when clauseyui-knk
Need to separate `check_literal_when` function for parser and ripper otherwise warning event is not dispatched because parser `rb_warning1` is used in ripper.
2024-02-20[Feature #20257] Rearchitect Ripperyui-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-15Do not include a backtick in error messages and backtracesYusuke Endoh
[Feature #16495]
2023-12-02[Bug #19838] Flush delayed token nonconsecutive with the next tokenNobuyoshi Nakada
2023-12-01Dispatch invalid hex escape content tooNobuyoshi Nakada
2023-12-01[Bug #20030] dispatch invalid escaped character without ignoring itNobuyoshi Nakada
2023-11-02Added TestRipper namespace to test_call_colon2Hiroshi SHIBATA
2023-11-02test/ripper: nest helper classes under TestRipper modulelukeg
Generic names like Node and NodeList should be namespaced properly.
2023-08-26[Bug #19851] Ripper: Hide internal block argument IDNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8293
2023-08-09Fix memory leak for incomplete lambdasPeter Zhu
[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 ``` Notes: Merged: https://github.com/ruby/ruby/pull/8192
2023-08-09Fix memory leak in parser for incomplete tokensPeter Zhu
[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 ``` Notes: Merged: https://github.com/ruby/ruby/pull/8192
2023-08-03Remove --disable-gems for assert_separatelyPeter Zhu
assert_separately adds --disable=gems so we don't need to add --disable-gems when calling assert_separately. Notes: Merged: https://github.com/ruby/ruby/pull/8162
2023-08-01[Bug #19788] Use the result of `tCOLON2` eventNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8144
2023-07-16Fix null pointer access in Ripper#initializeNobuyoshi Nakada
In `rb_ruby_ripper_parser_allocate`, `r->p` is NULL between creating `self` and `parser_params` assignment. As GC can happen there, the typed-data functions for it need to consider the case. Notes: Merged: https://github.com/ruby/ruby/pull/8085
2023-06-28Increase memory leak test timeoutPeter Zhu
The test times out on some platforms, so increase the timeout. Notes: Merged: https://github.com/ruby/ruby/pull/7992
2023-06-28Fix memory leak in RipperPeter Zhu
The following script leaks memory in Ripper: ```ruby require "ripper" 20.times do 100_000.times do Ripper.parse("") end puts `ps -o rss= -p #{$$}` end ``` Notes: Merged: https://github.com/ruby/ruby/pull/7985
2023-06-20[Bug #19736] Recover after unterminated interpolationNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7963
2023-04-07[Bug #19563] Yield words separators per linesNobuyoshi Nakada
So that newlines across a here-doc terminator will be separated tokens. Cf. https://github.com/ruby/irb/pull/558 Notes: Merged: https://github.com/ruby/ruby/pull/7675 Merged-By: nobu <nobu@ruby-lang.org>
2023-04-01`*` in an array pattern should not be parsed as nil in ripperKazuki Tsujimoto
After 6c0925ba7017efde6091e2ec4f1a6be268166696, it was impossible to distinguish between the presence or absence of `*`. # Before the commit Ripper.sexp('0 in []')[1][0][2][1] #=> [:aryptn, nil, nil, nil, nil] Ripper.sexp('0 in [*]')[1][0][2][1] #=> [:aryptn, nil, nil, [:var_field, nil], nil] # After the commit Ripper.sexp('0 in []')[1][0][2][1] #=> [:aryptn, nil, nil, nil, nil] Ripper.sexp('0 in [*]')[1][0][2][1] #=> [:aryptn, nil, nil, nil, nil] This commit reverts it.
2023-03-28Ripper: Add keyword options to `assert_parse_files`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7602
2023-03-26[Bug #19175] p_kw without a sub pattern should be `assignable'Kazuki Tsujimoto
2023-03-26[Bug #19175] p_rest should be `assignable'Kazuki Tsujimoto
It should also check for duplicate names.
2023-02-02[Bug #19399] Parsing invalid heredoc inside block parameterNobuyoshi Nakada
Although this is of course invalid as Ruby code, allow to just parse and tokenize. Notes: Merged: https://github.com/ruby/ruby/pull/7229
2023-01-02[Bug #19291] Rewind to the previous lineNobuyoshi Nakada
When rewinding looking ahead after newline token, also reset the last line string, the pointers to it, and the location, not only the line number. Notes: Merged: https://github.com/ruby/ruby/pull/7054
2023-01-02Adjut indent [ci skip]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7054
2022-08-28[Bug #18963] Separate string contents by here document terminatorNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6292
2022-08-12[Bug #18962] Do not read again once reached EOFNobuyoshi Nakada
`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
2022-06-14ripper: Check if anonymous parameters defined [Bug #18828]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6016
2021-12-14ripper: refine test to show expected statesNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/5264
2021-09-11Hash values should be omitted in Ripper resultsShugo Maeda
2021-08-15Extract the wrapped value when yydebug [Bug #18075]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4742
2021-05-21ripper: wrap endless method in bodystmt [Bug #17869]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4516
2021-05-21ripper: assertions for rescue/ensure in method bodyNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4516
2021-03-21Pattern matching pin operator against expression [Feature #17411]Kazuki Tsujimoto
This commit is based on the patch by @nobu.
2021-02-19Fix typo [ci skip]Shugo Maeda
2021-02-19ripper: fix a bug of Ripper::Lexer with syntax error and heredoc [Bug #17644]Shugo Maeda
2021-01-17Fix Ripper with heredoc.manga_osyo
Notes: Merged: https://github.com/ruby/ruby/pull/4083
2021-01-09parse.y: handle "duplicated argument name" appropriately on ripper.yNobuhiro IMAI
refs: 733ed1e184
2020-12-23ripper: fix bad label parameter handling [Bug #17425]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3977
2020-12-19ripper: fix `#tok` on some error events [Bug 17345]Nobuhiro IMAI
sorting alias target by event arity, and setup suitable `Elem` for error. Notes: Merged: https://github.com/ruby/ruby/pull/3936
2020-12-16Ripper: Fixed erred token on wrong alias [Bug #17345]Nobuyoshi Nakada
2020-12-15Ripper: Refined error callbacks [Bug #17345]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/3909
2020-11-26Store all kinds of syntax errors [Bug #17345]Nobuyoshi Nakada
2020-11-26Removed a duplicate assertionNobuyoshi Nakada
2020-11-20Ripper.{lex,tokenize} return full tokens even if syntax errorNobuhiro IMAI
yet another implements [Feature #17276]
2020-11-17Support raise_errors keyword for Ripper.{lex,tokenize,sexp,sexp_raw}Jeremy Evans
Implements [Feature #17276] Notes: Merged: https://github.com/ruby/ruby/pull/3774 Merged-By: jeremyevans <code@jeremyevans.net>
2020-11-02ripper: Invalid pragma value warningNobuyoshi Nakada
2020-10-26Assoc pattern matching (#3703)Nobuyoshi Nakada
[Feature #17260] One-line pattern matching using tASSOC R-assignment is rejected instead. Notes: Merged-By: nobu <nobu@ruby-lang.org>