Commit graph

23 commits

Author SHA1 Message Date
Kevin Newton
439f069b4b [ruby/yarp] Move tests from test/* to test/yarp/* to match CRuby
This should make it easier on the sync to determine what changed
and hopefully result in fewer merge conflicts that have to be
manually resolved.

17d82afbfc
2023-08-25 21:15:49 +00:00
Kevin Newton
9b8602dd90 [ruby/yarp] Introduce parse_lex instead of asking for a block
7e70339fe1
2023-08-25 21:10:19 +00:00
Mike Dalessio
3525c460f9 [ruby/yarp] fix: regexes and strings with escaped newline around a heredoc
Found via the fuzzer.

501757135a

Co-authored-by: Kevin Newton <kddnewton@gmail.com>
2023-08-25 18:20:49 +00:00
Kevin Newton
4fb2b3b6bf [ruby/yarp] Ensure correct location with if/elsif, allow FOCUS env var, fix newlines on __END__
9da0bc4452
2023-08-21 10:43:13 -07:00
Mike Dalessio
ac819f4db9 [ruby/yarp] fix: support newline-terminated regular expressions
Previously, parsing a snippet like this:

    %r\nfoo\n

would result in tracking the second newline twice, resulting in a
failed runtime assertion.

Fixing that issue reveals another bug, which is that the _first_
newline was not being tracked at all. So we introduce a call to
yp_newline_list right when we construct the REGEXP_BEGIN token.

0d5d759091
2023-08-21 12:22:53 -04:00
Takashi Kokubun
40002dd7dc Resync YARP 2023-08-17 09:58:56 -07:00
Takashi Kokubun
3873b1eb39 Resync YARP 2023-08-16 17:47:32 -07:00
Benoit Daloze
3536cad902 [ruby/yarp] Fixes so bundle exec rake can run on JRuby and TruffleRuby
e6cea4fa08
2023-08-16 17:47:32 -07:00
Benoit Daloze
1ad0d19876 [ruby/yarp] Parse individual snippets of test/fixtures/*.txt
* To ensure the parser does not try to read bytes further than the end of each snippet.

1c4438bdde
2023-08-16 17:47:32 -07:00
Kevin Newton
820a58c228 [ruby/yarp] Hide debug methods
aa0dc2f301
2023-08-16 17:47:32 -07:00
Jemma Issroff
25267fdd69 [ruby/yarp] Exclude heredoc_nested test for Rubies < 3.3
Ripper's lexemes were slightly different in Ruby 3.2 for Heredocs.
We ignored this complex heredoc test in this case because
Ripper's output has changed

59d3d4a899
2023-07-21 15:48:19 +00:00
Aaron Patterson
abce8583e2 [ruby/yarp] Fix heredocs inside %W and %w lists
The problem was that we were treating heredoc bodies as part of the %W
list because we didn't push the scanning cursor past the heredoc after
lexing out the here doc.  To fix this, we changed the whitespace
scanning function to quit scanning when it reaches a newline but only in
the case that a heredoc is present.

Additionally, we need to prevent double counting newlines in the case of
a heredoc.  For example:

```ruby
%W(<<foo 123)
foo
```

The newline after the `)` is counted as part of scanning the heredoc, so
we added logic to prevent double counting the newline when scanning the
rest of the %W list.

eb090d8126

Co-authored-by: Jemma Issroff <jemmaissroff@gmail.com>
2023-07-20 14:58:11 +00:00
Jemma Issroff
06c2d3e0a0
Resync YARP (#8036)
It got out of sync again. After this re-sync, it should happen
cherry-picking automatically.
2023-07-06 13:26:26 -04:00
Jemma Issroff
bfb933371d Manual YARP resync 2023-07-05 16:58:55 -04:00
Nobuyoshi Nakada
97152d44dc [ruby/yarp] Name test methods from relative paths
Full path name of the source directory is a useless noise as tests.

44a7ae2e64
2023-06-24 15:32:11 +09:00
Takashi Kokubun
711cabec26 Sync ruby/yarp to 89a00203af 2023-06-22 09:23:07 -07:00
Takashi Kokubun
edd488109f Sync ruby/yarp with sync_default_gems 2023-06-22 08:59:04 -07:00
Kevin Newton
010b8a29dc [ruby/yarp] Set default external encoding for parse tests
e757fde3ed
2023-06-21 22:05:10 +00:00
Kevin Newton
39a40af14f [ruby/yarp] Truly fix snapshot testing on Ruby CI
c4e835711e
2023-06-21 21:28:30 +00:00
Kevin Newton
51ff9cd747 [ruby/yarp] Actually fix snapshot tests
ba9e5b447e
2023-06-21 21:23:17 +00:00
Kevin Newton
23e1c69717 [ruby/yarp] Fix snapshot checking
05a60a0774
2023-06-21 20:30:40 +00:00
Kevin Newton
585dbccb51 [ruby/yarp] Use binary for normalizing printed ASTs
814326de34
2023-06-21 19:55:45 +00:00
Jemma Issroff
cc7f765f2c [Feature #19741] Sync all files in yarp
This commit is the initial sync of all files from ruby/yarp
into ruby/ruby. Notably, it does the following:

* Sync all ruby/yarp/lib/ files to ruby/ruby/lib/yarp
* Sync all ruby/yarp/src/ files to ruby/ruby/yarp/
* Sync all ruby/yarp/test/ files to ruby/ruby/test/yarp
2023-06-21 11:25:39 -07:00