Commit graph

45 commits

Author SHA1 Message Date
Kevin Newton
5f905026bc [ruby/yarp] Move node ext and parse result to their own files
916828767c
2023-09-27 12:10:23 -04:00
Kevin Newton
7d11f58b6e [ruby/yarp] Move lex compat into its own file
e90f88f21f
2023-09-27 12:10:23 -04:00
Kevin Newton
3e8aa3d1cc [ruby/yarp] Move node inspector into its own file
1c843d2f22
2023-09-27 12:10:23 -04:00
Kevin Newton
978f91a10c [ruby/yarp] Move debug into its own file
139362c90a
2023-09-27 12:10:23 -04:00
Kevin Newton
b18e05b18f [ruby/yarp] Split up compiler versus visitor
2e6baa3f19
2023-09-27 12:10:23 -04:00
Kevin Newton
2a4a55f896 [ruby/yarp] Move DSL into its own file
3d34404d80
2023-09-27 12:10:23 -04:00
Kevin Newton
1c049c64c0 [ruby/yarp] Move BasicVisitor below ParseResult in yarp.rb
d51014582a
2023-09-27 12:10:23 -04:00
Kevin Newton
28cc144b63 [ruby/yarp] Move more features under autoload
2f1f3fa448
2023-09-27 12:10:23 -04:00
Kevin Newton
af8d475281 [ruby/yarp] Move dispatcher into its own autoload
52bd001ea2
2023-09-27 12:10:23 -04:00
Kevin Newton
be861053c5 [ruby/yarp] Use less magical numbers for regular expression flags
c6a0abdd24
2023-09-27 12:10:23 -04:00
Jemma Issroff
d6abca459f [ruby/yarp] Print locations using line / col instead of offsets
This commit changes printing of locations to use the format
(start_line,start_column)-(end_line,end_column) instead of using
offsets.

c078696e22
2023-09-20 18:30:34 +00:00
Kevin Newton
4da53fd3a7 [ruby/yarp] Better Node#pretty_print
Respect the current indentation

068333ef49
2023-09-19 16:57:46 +00:00
Kevin Newton
1636f6abd6 [ruby/yarp] Use compact_child_nodes where possible
c1911fa9b1
2023-09-18 17:48:52 +00:00
Tim Morgan
4e8869c663 [ruby/yarp] Use templated constants for Regexp options
38e1769c2e
2023-09-15 21:47:28 +00:00
Tim Morgan
101ac364a5 [ruby/yarp] Return Regexp options that match MRI for e, u, s, and n
17dbf4ec46
2023-09-15 21:47:27 +00:00
Kevin Newton
6031ab18c7 [ruby/yarp] Support parsing numbered parameters
ffc8f35e56
2023-09-15 15:14:34 +00:00
Kevin Newton
14a83e0879 [ruby/yarp] Update pretty_print to use inspect
c2b9b780c7
2023-09-11 21:32:15 +00:00
Kevin Newton
719f834466 [ruby/yarp] Mark flags as private
The flags integer is an implementation detail. We want people to
use the query methods to access the individual fields so we are
freed from having to maintain a specific order. As such, this
commit changes the Ruby API to mark all flags fields as private
attr_readers.

The only one that has a clear use case is returning the set of
options given to regular expressions, to mirror the Regexp#options
API. So, to support this use case, this commit introduces
RegularExpressionNode#options and InterpolatedRegularExpressionNode#options.
These APIs provide back the same integer so that they can be used
interchangeably.

4e6d5dd99f
2023-09-11 16:18:32 +00:00
Kevin Newton
5d73c0f3df [ruby/yarp] Move parse result mutations into their own files
3be8272fa2
2023-09-08 19:38:17 +00:00
Vinicius Stock
6050b5a4e8 [ruby/yarp] Add ParseResult#attach_comments! to tie comments to their locations
ddc699156f

Co-authored-by: Kevin Newton <kddnewton@users.noreply.github.com>
2023-09-08 18:10:26 +00:00
Kevin Newton
9343ef2504 [ruby/yarp] Constants on rest parameter nodes
a6fdb8aae9
2023-09-07 12:42:02 +00:00
Kevin Newton
9e21b33ece [ruby/yarp] Constants on keyword parameters
d2d4f25a23
2023-09-07 12:42:00 +00:00
Andy Waite
fdf7aad902 [ruby/yarp] Fix Location#end_column
00e4711026
2023-09-06 18:37:41 +00:00
Kevin Newton
dae6a0a295 [ruby/yarp] Introduce YARP::Pattern
2a12e9637b
2023-09-06 14:19:58 +00:00
Kevin Newton
e8ef5b1281 [ruby/yarp] Provide a better inspect
ef14ae66e4
2023-09-01 16:18:11 -07:00
Benoit Daloze
5937d01f7f [ruby/yarp] Rename constant pool fields to name or operator
* `constant_id` and `operator_id` are confusing.
* See https://github.com/ruby/yarp/issues/1296

09d0a144df
2023-08-27 16:18:15 +00:00
Kevin Newton
ca9a44795b Remove version templating in YARP 2023-08-25 18:20:51 -04:00
Kevin Newton
76512d78fc [ruby/yarp] Rename Location#to to Location#join, include checks
de8924e3ec
2023-08-25 21:10:17 +00:00
Kevin Newton
20cf9e3ae8 [ruby/yarp] Add a Location#to method for combining them
1db2de98ac
2023-08-25 21:10:15 +00:00
Kevin Newton
55a8add304 [ruby/yarp] Fix rational parsing
c8f31eb5b6
2023-08-25 21:10:15 +00:00
Benoit Daloze
f603497105 [ruby/yarp] Use templating to avoid duplicating the YARP version in many places
9c359fd92e
2023-08-25 19:37:17 +00:00
Kevin Newton
2ebaf077f6 [ruby/yarp] Provide a desugar visitor
9fad513089
2023-08-25 19:31:30 +00:00
Kevin Newton
649aba28f4 [ruby/yarp] Add Node#copy and MutationVisitor
3693091661
2023-08-25 19:31:28 +00:00
Benoit Daloze
2d75069779 [ruby/yarp] Use require_relative for yarp/ffi
c0598f8805
2023-08-22 21:19:09 +00:00
Kevin Newton
0fd57ee01d [ruby/yarp] Handle interpolated regular expressions with the o flag for locals checking
db95191207
2023-08-21 10:43:12 -07:00
Benoit Daloze
2929c47243 [ruby/yarp] Add a convenience value method for numeric literals
a328f27d8f
2023-08-21 15:25:28 +00:00
Kevin Newton
995fd11bde [ruby/yarp] Remove strange :"#arg_rest" local
66ecec218d
2023-08-18 00:06:57 +00:00
Takashi Kokubun
3873b1eb39 Resync YARP 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
Mike Dalessio
0f8091947d [ruby/yarp] Move the gem's C extension into lib/yarp/
and change the require from "yarp.so" to "yarp/yarp", which is more
aligned with existing community conventions for gems.

64b70e2658
2023-08-16 17:47:32 -07:00
Jemma Issroff
6d2174477b [ruby/yarp] Remove pattern matching pinning to enable support for <= Ruby 3.0
Pattern matching variable pinning was introduced in Ruby 3.1. We
need to remove it from YARP to support earlier rubies.

b792c58e3b
2023-07-14 21:00:51 +00:00
Jemma Issroff
31f83a6fea [ruby/yarp] Add source to ParseResult
f3802e03e0
2023-07-07 17:46:46 +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
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