Commit graph

13 commits

Author SHA1 Message Date
Mike Dalessio
9c43ec621d [ruby/yarp] fix: newline tracking for a comment at EOF
62fb0bddf5
2023-08-23 15:42:20 +00:00
Mike Dalessio
dcc8afe9a4 [ruby/yarp] prefactor: extract yp_newline_list_check_append
149c74291b
2023-08-21 10:33:43 -07:00
Takashi Kokubun
40002dd7dc Resync YARP 2023-08-17 09:58:56 -07:00
Kevin Newton
81d715099c [ruby/yarp] Treat yp_buffer_t as an opaque pointer
Right now, we have to keep the buffer FFI object in sync with the
definition of yp_buffer_t because we access its fields directly. If
we add more fields or change the order, things will get out of sync.

Instead, let's treat yp_buffer_t as an opaque pointer and access
its fields through accessor functions directly. This is more
consistent with how we handle strings anyway.

878d845eff
2023-08-17 09:58:56 -07:00
Takashi Kokubun
3873b1eb39 Resync YARP 2023-08-16 17:47:32 -07:00
Kevin Newton
77e52735f0 [ruby/yarp] Fix warnings found from gcc-analyzer and clang-analyzer
1f9a6e05c4
2023-08-16 17:47:32 -07:00
Benoit Daloze
b6f26c2e4a [ruby/yarp] Use common fields for yp_string_t
* Otherwise it is undefined behavior to access the field of another `.as`.
* Accessing the right `.as` field according mode would be extra overhead.

7dc41ee803
2023-08-16 17:47:32 -07:00
Benoit Daloze
e712bc9b93 [ruby/yarp] Move efficient file reading using demand paging to librubyparser
* So it can be reused by the Fiddle backend, etc and not just the C extension.
* Add YP_STRING_MAPPED to use a consistent interface for yp_string_t.
  That way yp_string_free() can be used like for other string types.
* Fix handling of empty file for !HAVE_MMAP && !_WIN32

e40bc35801
2023-08-16 17:47:32 -07:00
Kevin Newton
45efbadba5 [ruby/yarp] Enable all of -wconversion
638163f6c6
2023-08-16 17:47:32 -07: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
84b5274143
[ruby/yarp] Resync YARP (#8098) 2023-07-19 16:15:01 -04:00
Jemma Issroff
bfb933371d Manual YARP resync 2023-07-05 16:58:55 -04: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