Mike Dalessio
dcc8afe9a4
[ruby/yarp] prefactor: extract yp_newline_list_check_append
...
https://github.com/ruby/yarp/commit/149c74291b
2023-08-21 10:33:43 -07:00
Mike Dalessio
ac819f4db9
[ruby/yarp] fix: support newline-terminated regular expressions
...
Previously, parsing a snippet like this:
%r\nfoo\n
would result in tracking the second newline twice, resulting in a
failed runtime assertion.
Fixing that issue reveals another bug, which is that the _first_
newline was not being tracked at all. So we introduce a call to
yp_newline_list right when we construct the REGEXP_BEGIN token.
https://github.com/ruby/yarp/commit/0d5d759091
2023-08-21 12:22:53 -04:00
Kevin Newton
1d0b627b70
[ruby/yarp] Rename statements to body where appropriate
...
https://github.com/ruby/yarp/commit/0aa7d9d10c
2023-08-19 01:04:04 +00:00
Kevin Newton
07833049df
[ruby/yarp] Consolidate operator write nodes
...
https://github.com/ruby/yarp/commit/22b287e2b1
2023-08-18 20:25:00 +00:00
Kevin Newton
ec47fc9539
[ruby/yarp] Consolidate OperatorAndWrite and OperatorOrWrite nodes
...
https://github.com/ruby/yarp/commit/9e680a7598
2023-08-18 20:24:56 +00:00
Mike Dalessio
e1505aebf2
[ruby/yarp] fix: multiple heredocs with embedded expressions with newlines
...
Set heredoc_end to NULL at the start of lexing a heredoc, to avoid
having state from the previous heredoc confuse the parser's current
location.
https://github.com/ruby/yarp/commit/21ee304f0e
2023-08-18 18:30:49 +00:00
HParker
db076d8e84
[ruby/yarp] handle missing HEREDOC endline at start of heredoc
...
https://github.com/ruby/yarp/commit/7b72493b6d
2023-08-18 18:05:09 +00:00
Mike Dalessio
2800d1fd37
[ruby/yarp] fix: unterminated % in arguments
...
https://github.com/ruby/yarp/commit/efb3102369
2023-08-18 12:51:14 +00:00
Takashi Kokubun
f50e814dae
Resync YARP to https://github.com/ruby/yarp/commit/11ad3fb590
2023-08-17 10:01:57 -07:00
Takashi Kokubun
40002dd7dc
Resync YARP
2023-08-17 09:58:56 -07:00
Takashi Kokubun
3873b1eb39
Resync YARP
2023-08-16 17:47:32 -07:00
HParker
a8c70ed2b4
[ruby/yarp] add a diagnostic for *rest in order after optional state
...
https://github.com/ruby/yarp/commit/908244ba12
2023-08-16 17:47:32 -07:00
Kevin Newton
bf723b21cc
[ruby/yarp] More flip flop flags
...
Whenever you see a `not` or a `!`, the receiver of that method should
potentially be marked as a flip-flop.
https://github.com/ruby/yarp/commit/ba5977a40a
2023-08-16 17:47:32 -07:00
Kevin Newton
fb287fa425
[ruby/yarp] Support the flipflop flag
...
https://github.com/ruby/yarp/commit/6315890390
2023-08-16 17:47:32 -07:00
Jemma Issroff
86cc82a1ab
[ruby/yarp] Improved comments, moved flags after type
...
https://github.com/ruby/yarp/commit/4815d77e82
2023-08-16 17:47:32 -07:00
Jemma Issroff
383c47f538
[ruby/yarp] Separate yp_node_flags_t from yp_node_type_t
...
Prior to this commit, we folded the flags into the type. This created
extra overhead when calculating the type and setting the flags. This
commit separates them.
https://github.com/ruby/yarp/commit/b783a5678c
2023-08-16 17:47:32 -07:00
Kevin Newton
89de544442
[ruby/yarp] Set constant path write node target type
...
https://github.com/ruby/yarp/commit/771f7ed789
2023-08-16 17:47:32 -07:00
Kevin Newton
ee885237f6
[ruby/yarp] Fix string concat parsing
...
https://github.com/ruby/yarp/commit/58f839a3eb
2023-08-16 17:47:32 -07:00
Kevin Newton
77e52735f0
[ruby/yarp] Fix warnings found from gcc-analyzer and clang-analyzer
...
https://github.com/ruby/yarp/commit/1f9a6e05c4
2023-08-16 17:47:32 -07:00
Thomas E. Enebo
96aebb4265
[ruby/yarp] Address PR comments
...
- odd whitespace
- a couple of name changes
- properly read uint32_t when not properly aligned
https://github.com/ruby/yarp/commit/3208ee3983
2023-08-16 17:47:32 -07:00
Kevin Newton
d6f9f3e498
[ruby/yarp] Rename RescueNode#exception to RescueNode#reference
...
https://github.com/ruby/yarp/commit/ad0eb4b2c3
2023-08-16 17:47:32 -07:00
Kevin Newton
a793260c15
[ruby/yarp] Also rework regexp lexer to check terminators properly
...
https://github.com/ruby/yarp/commit/4b157a8352
2023-08-16 17:47:32 -07:00
Kevin Newton
2ef54d3855
[ruby/yarp] Rework the list lexer to check terminators properly
...
https://github.com/ruby/yarp/commit/60315d0f13
2023-08-16 17:47:32 -07:00
Thomas E. Enebo
7257145320
[ruby/yarp] Clang beats gcc in pedantry
...
Accidentally declared int32_t and not uint32_t and it was caught
on macos.
https://github.com/ruby/yarp/commit/6581520793
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
3f64defe13
[ruby/yarp] Make sure lexing ? does not read off the end
...
https://github.com/ruby/yarp/commit/d694e3ebf2
2023-08-16 17:47:32 -07:00
Kevin Newton
1ea9e444ec
[ruby/yarp] Fix memory leak from constant write node creation
...
https://github.com/ruby/yarp/commit/0071bee0bb
2023-08-16 17:47:32 -07:00
Kevin Newton
e66e60cf69
[ruby/yarp] Handle invalid multiple parameters
...
https://github.com/ruby/yarp/commit/2f83265653
2023-08-16 17:47:32 -07:00
Kevin Newton
7a1c497426
[ruby/yarp] Add constant write node
...
https://github.com/ruby/yarp/commit/a62f2f0153
2023-08-16 17:47:32 -07:00
Kevin Newton
9c61e0c831
[ruby/yarp] Ensure token cannot begin an expression
...
https://github.com/ruby/yarp/commit/837522217c
2023-08-16 17:47:32 -07:00
Kevin Newton
3d032cf3e8
[ruby/yarp] Simplify creation of numerics
...
https://github.com/ruby/yarp/commit/e5f6ffa23a
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.
https://github.com/ruby/yarp/commit/7dc41ee803
2023-08-16 17:47:32 -07:00
Kevin Newton
31960a9627
[ruby/yarp] Handle missing block parameters
...
https://github.com/ruby/yarp/commit/bc9049418d
2023-08-16 17:47:32 -07:00
Kevin Newton
eca3b93437
[ruby/yarp] **nil can be a STAR_STAR token
...
https://github.com/ruby/yarp/commit/33b06f252c
2023-08-16 17:47:32 -07:00
Kevin Newton
e56da35637
[ruby/yarp] Handle invalid regexps more gracefully
...
https://github.com/ruby/yarp/commit/584a49f123
2023-08-16 17:47:32 -07:00
Kevin Newton
4c4e75c0de
[ruby/yarp] Add error cases for ustar appearing in infix position
...
https://github.com/ruby/yarp/commit/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
...
https://github.com/ruby/yarp/commit/2ec671fe1e
2023-08-16 17:47:32 -07:00
Kevin Newton
242f3c3a77
[ruby/yarp] Don't read off the end when parsing % literals
...
https://github.com/ruby/yarp/commit/aff40871e6
2023-08-16 17:47:32 -07:00
Kevin Newton
45efbadba5
[ruby/yarp] Enable all of -wconversion
...
https://github.com/ruby/yarp/commit/638163f6c6
2023-08-16 17:47:32 -07:00
Kevin Newton
41e8ba01ae
[ruby/yarp] Mark locations in the tree where newlines can occur
...
https://github.com/ruby/yarp/commit/479e835756
2023-08-16 17:47:32 -07:00
Kevin Newton
86b32dac92
[ruby/yarp] Handle pound terminator in isolation
...
https://github.com/ruby/yarp/commit/1cfce46107
2023-08-16 17:47:32 -07:00
Thomas E. Enebo
ede55edbd5
[ruby/yarp] Remove trailing whitespace
...
https://github.com/ruby/yarp/commit/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?
https://github.com/ruby/yarp/commit/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.
https://github.com/ruby/yarp/commit/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
...
https://github.com/ruby/yarp/commit/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
https://github.com/ruby/yarp/commit/75e06016a7
2023-07-07 17:46:47 +00:00