Commit graph

72 commits

Author SHA1 Message Date
Kevin Newton
e56da35637 [ruby/yarp] Handle invalid regexps more gracefully
584a49f123
2023-08-16 17:47:32 -07:00
Kevin Newton
4c4e75c0de [ruby/yarp] Add error cases for ustar appearing in infix position
8736c17359
2023-08-16 17:47:32 -07:00
Kevin Newton
cededf73dc [ruby/yarp] For errored % characters, use TOKEN_PERCENT and not TOKEN_STRING_BEGIN
2ec671fe1e
2023-08-16 17:47:32 -07:00
Kevin Newton
242f3c3a77 [ruby/yarp] Don't read off the end when parsing % literals
aff40871e6
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
Kevin Newton
41e8ba01ae [ruby/yarp] Mark locations in the tree where newlines can occur
479e835756
2023-08-16 17:47:32 -07:00
Kevin Newton
86b32dac92 [ruby/yarp] Handle pound terminator in isolation
1cfce46107
2023-08-16 17:47:32 -07:00
Thomas E. Enebo
ede55edbd5 [ruby/yarp] Remove trailing whitespace
04de272383
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?

f441b6fd2c
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
a02f5eb56a
YARP resync (#8059) 2023-07-12 12:46:38 -04:00
Jemma Issroff
d62328251d [ruby/yarp] Remove yp_location_for_node in preference of yp_newline_list_line_column
55aa813909
2023-07-11 15:49:42 +00:00
Jemma Issroff
53c5601565
[ruby/yarp] Fix endless method definitions binding power to accept args (#8051) 2023-07-10 10:54:12 -04:00
Jemma Issroff
9e3a5cc54f [ruby/yarp] Add a yp_location_for_node function to the C API
yp_location_for_node takes a parser and a node and returns the
location in a way that can be punned into ruby/ruby types

75e06016a7
2023-07-07 17:46:47 +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
Takashi Kokubun
711cabec26 Sync ruby/yarp to 89a00203af 2023-06-22 09:23:07 -07:00
Jemma Issroff
e8fb84265c [ruby/yarp] Allow for block statements after elsif and else
4560cab235
2023-06-22 09:20:40 -07:00
Kevin Newton
b879528e24 [ruby/yarp] Do not leak memory from lex modes
df6661740c
2023-06-22 09:19:36 -07:00
Jemma Issroff
b0a3a6ade0 [ruby/yarp] Fix invalid unescape sequence error for lower w
5a2c78367a
2023-06-21 18:40:25 +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