Commit graph

346 commits

Author SHA1 Message Date
Kevin Newton
03a73fdc3d [ruby/prism] Add then keyword loc to when nodes
e1e613df16
2024-03-04 16:40:37 +00:00
HASUMI Hitoshi
c4bd6da298 [ruby/prism] Make alloc interface replaceable
- Add `x` prefix to malloc, calloc, realloc, and free
  (eg: malloc -> xmalloc)
- By default, they are replaced with stdlib's functions at build
- You can use custom functions by defining `PRISM_CUSTOM_ALLOCATOR` macro

7a878af619
2024-03-04 16:40:23 +00:00
Kevin Newton
1c0c490aa0 [ruby/prism] Warn on integers in flip-flops
500099e896
2024-02-29 17:32:37 +00:00
Kevin Newton
50e999c56d [ruby/prism] Command line options as a bitset
369ffbd57e
2024-02-29 12:05:19 -05:00
Kevin Newton
e14a68a1bf [ruby/prism] Disallow it implicit in eval
6fcb8fc974
2024-02-27 18:00:43 +00:00
Kevin Newton
f67c9d001a [ruby/prism] Switch invalid _1 targeting even on syntax error
40dec909b7
2024-02-27 16:05:03 +00:00
Kevin Newton
fc36882713 [ruby/prism] Ensure symbol nodes not in interpolated symbol
e1a9a1d478
2024-02-27 16:05:02 +00:00
Kevin Newton
3ca8b4aee0 [ruby/prism] Support -p, -n, -a, and -l command line options
959eb506ca
2024-02-27 04:22:39 +00:00
Kevin Newton
1a57fee7af [ruby/prism] Fix multi write with modifier rescue
8ea7a3270f
2024-02-26 13:58:57 +00:00
Kevin Newton
fc656acee9
[PRISM] Sync to latest prism 2024-02-23 21:56:56 -05:00
Kevin Newton
a38cc177d2 [ruby/prism] Duplicated when clauses
865b0d5fbe
2024-02-23 13:25:31 -05:00
Kevin Newton
d1ce989829 [ruby/prism] Duplicated hash keys
3e10c46c14
2024-02-23 13:25:31 -05:00
Mike Shaver
32f8ed7afd Typo fix. 2024-02-23 12:54:31 -05:00
Kevin Newton
a154ea0c91 [ruby/prism] Ignore other ERANGE errors for floats
4267161ca7
2024-02-22 22:42:44 -05:00
Kevin Newton
5e0589cf52 [ruby/prism] Parse float values
9137226a52
2024-02-22 22:42:44 -05:00
Kevin Newton
3b3def5db7 [ruby/prism] Regenerate snapshots using integer values 2024-02-22 22:42:44 -05:00
Kevin Newton
af0a6ea1d5 [ruby/prism] Add an IntegerField for parsing integer values
120d8c0479
2024-02-22 22:42:44 -05:00
Kevin Newton
31735d77c5 [ruby/prism] Update for Ruby 3.4 errors
20fea2cf2b
2024-02-21 17:55:11 -05:00
Kevin Newton
90c5393f9f [ruby/prism] Support ItParametersNode
So that compilers know they need to add to add an anonymous
variable to the local table.

7f1aadd057
2024-02-21 17:55:11 -05:00
Kevin Newton
2b2e61e6f9 [ruby/prism] Only call encoding_changed callback on change
7d0bea3ce0
2024-02-21 15:47:05 +00:00
Kevin Newton
20f03100d5 [ruby/prism] Fix eval encoding switching to UTF-8
24e3ff5d6d
2024-02-20 15:36:35 +00:00
Kevin Newton
00bda2aa3b [ruby/prism] Fix up GCC analyzer
2e8bc17528
2024-02-17 21:53:54 +00:00
Kevin Newton
429338a20c [ruby/prism] Accept newlines before ) in patterns
e5ffb7bdf8
2024-02-16 20:41:40 +00:00
Kevin Newton
8e4d1ff5da [ruby/prism] Disallow numbered parameters within given scopes
a218a0f265
2024-02-16 17:50:32 +00:00
Kevin Newton
ff4f5c0cdd [ruby/prism] Style/renaming
53763d67d5
2024-02-16 15:49:50 +00:00
Kevin Newton
04e7c5749b [ruby/prism] Fix pattern with constant, (, and newlines
d69d1b6f17
2024-02-16 15:35:58 +00:00
Haldun Bayhantopcu
f4f57e1162 [ruby/prism] Add warning for assignments to literals in conditionals
ee87ed08fb
2024-02-16 15:33:07 +00:00
Max Prokopiev
49ddbbf39f [ruby/prism] Fix opening loc for an empty symbol
241d0169da
2024-02-15 20:28:17 +00:00
Haldun Bayhantopcu
a6bcd3aa70 [ruby/prism] Fix debug logging
01af2d4f39
2024-02-15 16:41:05 +00:00
Haldun Bayhantopcu
a021702596 [ruby/prism] Fix parsing rescue modifier
b7407ae3c0
2024-02-15 16:40:36 +00:00
Kevin Newton
9933377c34 [PRISM] Correctly hook up line numbers for eval 2024-02-14 15:29:26 -05:00
Kevin Newton
2fa051f627 [ruby/prism] Validate multibyte characters in strings
Check that multibyte characters are valid using pm_strpbrk. We need
to add a couple of codepaths to ensure all encodings are covered.

Importantly this doesn't check regular expressions, because
apparently you're allowed to have invalid multibyte characters
inside regular expression comment groups/extended mode.

2857d3e1b5
2024-02-14 01:01:37 +00:00
Kevin Newton
a96110f7ef [ruby/prism] Convert more error messages to match specs
7987b7aa20
2024-02-13 20:35:02 +00:00
Kevin Newton
e08c128417 [ruby/prism] Error messages closer to CRuby
19ffa0b980
2024-02-12 18:01:45 +00:00
Kevin Newton
c3886c12dc [ruby/prism] Fix unary not location
861689f6d1
2024-02-12 16:27:49 +00:00
Kevin Newton
78deba1aa1 [ruby/prism] Unary not name location
78190d2999
2024-02-12 15:57:17 +00:00
Kevin Newton
3ecfc3e33e [PRISM] Support the DATA constant 2024-02-08 14:36:29 -05:00
Kevin Newton
f5b368df0c [ruby/prism] Better invalid token messages
8c9bed2a4d
2024-02-06 18:10:50 +00:00
Kevin Newton
c42b1029d9 [ruby/prism] Change the location of an implicit begin to method
d08e140859
2024-02-05 20:40:24 +00:00
Kevin Newton
0b5be2f9e9 Sync to latest prism 2024-02-05 11:07:07 -05:00
Kevin Newton
6afccdf449 [ruby/prism] Provide APIs for finding value in constant pool
be9e2abfa3
2024-02-02 21:45:50 +00:00
Kevin Newton
eaea53b836 [ruby/prism] Handle missing begin body
7e54818b17
2024-02-02 20:43:30 +00:00
Kevin Newton
7695ab3bce [ruby/prism] Fix up multibyte escapes
836a35f4af
2024-02-02 20:09:01 +00:00
Alan Wu
8f9d999d59 [ruby/prism] Fix overlapping memcpy
It's UB to use memcpy with overlapping source and destination. This
might be causing crashes on 32 bit platforms and on OpenBSD. Use memmove
instead. Add a bounds check while we're at it since it's unclear whether
one-past-end pointer with n=0 is UB.

719f54ff5e
2024-02-02 16:35:43 +00:00
Kevin Newton
332d2c92d8 [PRISM] Emit parse warnings 2024-02-01 15:52:19 -05:00
Kevin Newton
29b7c31b08 [ruby/prism] Reject operator writes on operator methods
78bd142e71
2024-02-01 19:45:37 +00:00
Kevin Newton
e9f1324464 Sync to latest prism 2024-02-01 12:52:16 -05:00
Kevin Newton
494778c663 [ruby/prism] Remove locals_body_index
We're not using this anymore, and it doesn't make a lot of sense
outside the context of a compiler anyway, and in anyway it's wrong
when you have local variables written in default values.

5edbd9c25b
2024-02-01 16:48:55 +00:00
Haldun Bayhantopcu
67c5690a6d [ruby/prism] Check literals for receiver
56441b08e7
2024-02-01 16:48:09 +00:00
Kevin Newton
6ad585bd68 [ruby/prism] Only warn for unary + on spcarg
db0e5ce1ce
2024-02-01 16:13:46 +00:00