25 Commits

Author SHA1 Message Date
Kevin Newton
ca9a44795b Remove version templating in YARP 2023-08-25 18:20:51 -04:00
Kevin Newton
9b8602dd90 [ruby/yarp] Introduce parse_lex instead of asking for a block
https://github.com/ruby/yarp/commit/7e70339fe1
2023-08-25 21:10:19 +00:00
Kevin Newton
4813887694 [ruby/yarp] Accept a block to parse and parse_file to get lexer output as well
https://github.com/ruby/yarp/commit/40fbf61a8d
2023-08-25 21:10:17 +00:00
Benoit Daloze
f603497105 [ruby/yarp] Use templating to avoid duplicating the YARP version in many places
https://github.com/ruby/yarp/commit/9c359fd92e
2023-08-25 19:37:17 +00:00
Kevin Newton
0e3dc5a056 [ruby/yarp] Fix lex compat with BOM
* BOM should not impact looking for the encoding string
* We should re-encode tokens when the encoding changes
* BOM should change the column of comments only

https://github.com/ruby/yarp/commit/119fc2d7b2
2023-08-24 21:30:01 +00: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.

https://github.com/ruby/yarp/commit/878d845eff
2023-08-17 09:58:56 -07:00
Takashi Kokubun
3873b1eb39 Resync YARP 2023-08-16 17:47:32 -07:00
Kevin Newton
9b952670bb [ruby/yarp] Less const_get
Right now whenever you go to create a Ruby object from a C struct
we dynamically look up the constants. This is not great for
performance. Now instead we template out a constant for each VALUE
that holds the classes, and then directly reference it.

https://github.com/ruby/yarp/commit/f4756cda77
2023-08-16 17:47:32 -07:00
Thomas E. Enebo
1e0749e032 [ruby/yarp] Addressed review comments.
Missing any tests and in fact this is untested so still a WIP.

https://github.com/ruby/yarp/commit/5411abd651
2023-08-16 17:47:32 -07:00
Kevin Newton
0004565a91 [ruby/yarp] Use yp_memchr in regexp parsing
https://github.com/ruby/yarp/commit/08081dd24f
2023-08-16 17:47:32 -07:00
Kevin Newton
820a58c228 [ruby/yarp] Hide debug methods
https://github.com/ruby/yarp/commit/aa0dc2f301
2023-08-16 17:47:32 -07:00
Benoit Daloze
7cc5b22bbc [ruby/yarp] Add comment that extension.c should not contain non-trivial logic
https://github.com/ruby/yarp/commit/638f6849be
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

https://github.com/ruby/yarp/commit/e40bc35801
2023-08-16 17:47:32 -07:00
Benoit Daloze
2ccaaaa101 [ruby/yarp] Add simpler exported unescape function to librubyparser
* Moves logic from the C extension to librubyparser which can be shared with the Fiddle backend.

https://github.com/ruby/yarp/commit/aa48d5e444
2023-08-16 17:47:32 -07:00
Thomas E. Enebo
76c77b5eca [ruby/yarp] WIP - Introduce contextually parsing programs vs evals
This is more or less the code I used in my POC in JRuby
to parse evals.  Evals depend on parent variable scopes
and will produce a different syntax tree.

Questions:
  1. How does MRI compile evals currently?  I cannot find anything.
  2. This passes in a char * of data.  It does not encode the
     variables we pass in because the system calling this already
     knows.  Is this adequate though?
  3. Can I get guidance on how best to test this?

https://github.com/ruby/yarp/commit/f441b6fd2c
2023-08-16 17:47:32 -07:00
Haldun Bayhantopcu
47ff17a413 [ruby/yarp] Fix error and warning locations
https://github.com/ruby/yarp/commit/b91317ab39
2023-07-26 14:46:19 +00:00
Haldun Bayhantopcu
59e5bf2d1f [ruby/yarp] Fix comment locations
https://github.com/ruby/yarp/commit/7d2a1f8f1f
2023-07-26 14:46:17 +00:00
Jemma Issroff
31f83a6fea [ruby/yarp] Add source to ParseResult
https://github.com/ruby/yarp/commit/f3802e03e0
2023-07-07 17:46:46 +00:00
Jemma Issroff
61efa9c823 [ruby/yarp] Remove bin/newlines
Since newlines are working, this bin/newlines is less helpful, and
we can remove the API for newlines

https://github.com/ruby/yarp/commit/b538460b99
2023-07-07 17:46:45 +00:00
Jemma Issroff
bfb933371d Manual YARP resync 2023-07-05 16:58:55 -04:00
Takashi Kokubun
711cabec26 Sync ruby/yarp to 89a00203af 2023-06-22 09:23:07 -07:00
Kevin Newton
7fad7d345a [ruby/yarp] Do not leak file descriptors
https://github.com/ruby/yarp/commit/83c2c45b28
2023-06-22 09:19:39 -07:00
Takashi Kokubun
edd488109f Sync ruby/yarp with sync_default_gems 2023-06-22 08:59:04 -07:00
Nobuyoshi Nakada
ddb431c960
Fix leaked FD for an empty file 2023-06-22 13:21:30 +09: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