19 Commits
Author SHA1 Message Date
Kevin Newton 2564ebb3c9 [ruby/prism] Expose pm_node_list_append and pm_parser_constant_insert
https://github.com/ruby/prism/commit/4896c9f025
2026-10-20 20:14:48 +00:00
Kevin Newton 01ef241436 [ruby/prism] Add index and at APIs for constants
So that consumers don't unintentionally encode the fact that a
constant id is actually 1 + its index in the constants table.

Ideally this makes it so that we can change the underlying
implementation if we want to.

https://github.com/ruby/prism/commit/3a7f3cb6d5
2026-10-20 13:20:25 -04:00
Kevin Newton f25e997399 [ruby/prism] Add a first/next API for our iterables
This is as opposed to the *_each APIs we have been using, because
that adds the overhead of a passed around callback.

https://github.com/ruby/prism/commit/671ddb0022
2026-10-20 12:28:27 -04:00
Kevin Newton ae6ef1bfb5 [ruby/prism] Add checksum
CRuby is now hashing the contents of a file and attaching that to
iseqs in order to properly determine if a file has changed since
it was compiled. This is used in a couple places, but namely it is
used for error_highlight to make sure it isn't highlighting stale
locations.

The hashing algorithm doesn't actually matter since it's just used
to compare across parses, so as long as it is consistent it's okay.
I wanted something fast and standard, so this commit implements the
XXH3_64 algorithm from the spec. Noteably it uses the default
secret and a seed of 0 to make things even simpler. With NEON and
SSE2 implementations, this thing flies quite a bit faster than the
upstream FNV-1a implementation.

I figured this could be useful for other consumers as well, in
particular for tools that generate some kind of metadata around
files (type checkers, linters, etc). Eventually a nice extension
may be to hash a minimal version of the contents (i.e., with
context-insensitive whitespace removed) so that changes to docs or
indentation do not change the hash value.

If you're using the C API, you are only charged for this function
if you actually call it since it is computed lazily. For everyone
else it is automatically called, but truthfully it is so fast that
the difference is completely negligible.

https://github.com/ruby/prism/commit/6b7c5773eb
2026-10-19 17:30:05 -04:00
Kevin Newton 98fd04f76c [ruby/prism] attach_comments
Revisit how we attach comments, allowing consumers to do it in C.

https://github.com/ruby/prism/commit/eb3528e580
2026-10-12 13:01:34 -04:00
Kevin Newton ce20d6bf01 [ruby/prism] pm_parser_constant_find
https://github.com/ruby/prism/commit/d4a3ef9e43
2026-03-20 09:37:43 -04:00
Kevin Newton 6397c09f72 [ruby/prism] Add necessary functions for CRuby integration
https://github.com/ruby/prism/commit/6ba2c6424e
2026-03-20 09:37:43 -04:00
Kevin Newton 1ab82d4344 [ruby/prism] Fix up rust side of the build
https://github.com/ruby/prism/commit/cab3fd8c03
2026-03-20 09:37:43 -04:00
Kevin Newton 28441829ce [ruby/prism] Inline comments and magic comments, they do not need their own TUs
https://github.com/ruby/prism/commit/fb0d1369f4
2026-03-20 09:37:43 -04:00
Kevin Newton 367547c113 [ruby/prism] Make the constant pool fully opaque
https://github.com/ruby/prism/commit/250b2c9ac5
2026-03-20 09:37:43 -04:00
Kevin Newton 74ffd72472 [ruby/prism] Code review
https://github.com/ruby/prism/commit/1f4bf83b53
2026-03-20 09:37:43 -04:00
Kevin Newton 5aa2d50532 [ruby/prism] Remove iterators, just use callbacks
https://github.com/ruby/prism/commit/e0d17eb9e7
2026-03-20 09:37:43 -04:00
Kevin Newton 77612f35f9 [ruby/prism] Move magic comments entirely internal
https://github.com/ruby/prism/commit/f2e8648522
2026-03-20 09:37:43 -04:00
Kevin Newton 90dd3fc604 [ruby/prism] Move diagnostics entirely internal
https://github.com/ruby/prism/commit/6f40516041
2026-03-20 09:37:43 -04:00
Kevin Newton 80c51a80cd [ruby/prism] Move more constants internal
https://github.com/ruby/prism/commit/84b08e23d6
2026-03-20 09:37:43 -04:00
Kevin Newton e94f3013f4 [ruby/prism] Move comment into its own section
https://github.com/ruby/prism/commit/1ddff36b54
2026-03-20 09:37:43 -04:00
Kevin Newton 8b1a08e358 [ruby/prism] Make pm_comment_t opaque
https://github.com/ruby/prism/commit/0b17e49b8b
2026-03-20 09:37:43 -04:00
Kevin Newton 0b503f256d [ruby/prism] Make parser an opaque pointer
https://github.com/ruby/prism/commit/3da08fd638
2026-03-20 09:37:43 -04:00
Kevin Newton b834c75a98 [ruby/prism] Move regexp to internal
https://github.com/ruby/prism/commit/8d1df7815e
2026-03-20 09:37:43 -04:00