Commit graph

337 commits

Author SHA1 Message Date
Haldun Bayhantopcu
32b5f5be7c [ruby/prism] Introduce char_is_identifier_utf8
5f43e57b0f
2023-11-28 02:53:31 +00:00
TSUYUSATO Kitsune
3af56e87ca [ruby/prism] Check void expressions for constant paths
Fix https://github.com/ruby/prism/pull/1920

ee8e03bac7
2023-11-27 17:35:38 +00:00
TSUYUSATO Kitsune
8654859dbd [ruby/prism] Fix and reuse pm_call_node_index_p
Fix https://github.com/ruby/prism/pull/1925
Fix https://github.com/ruby/prism/pull/1927

Previously pm_call_node_index_p does not check about a block argument
correctly and is not used in parse_write to check an index call node.

This commit fixes these problems.

92bab044ff
2023-11-27 17:33:31 +00:00
Kevin Newton
285a41d793 [ruby/prism] Remove blank line
6e5258938a
2023-11-23 14:39:30 +00:00
TSUYUSATO Kitsune
7b20dd9f91 [ruby/prism] Fix LocalVariableTargetNode depth in patterns
Fix https://github.com/ruby/prism/pull/1821

7d023a26b4
2023-11-23 14:39:30 +00:00
TSUYUSATO Kitsune
6968b289e7 [ruby/prism] Check void values in singleton class (class <<)
Follow up the ruby/ruby#8917 change.

f6bac4d3bf
2023-11-22 15:45:33 +00:00
Kevin Newton
8f707e8030 [ruby/prism] Join range checks into the main parse_expression switch
ed4523464b
2023-11-22 14:53:29 +00:00
TSUYUSATO Kitsune
8794836bf2 [ruby/prism] Fix associativity of binary range with begin-less range
Fix https://github.com/ruby/prism/pull/1828

22c0640e48
2023-11-22 14:53:28 +00:00
Kevin Newton
2aefbbaab9 [ruby/prism] Combine expression checks into a single switch
825d5d7bd4
2023-11-22 14:53:28 +00:00
TSUYUSATO Kitsune
cdd07781b0 [ruby/prism] Remove TODO
d6d718487d
2023-11-22 14:53:27 +00:00
TSUYUSATO Kitsune
76f9abced7 [ruby/prism] Reject statements at non-statement posisions
Fix https://github.com/ruby/prism/pull/1547

cdb643aeab
2023-11-22 14:53:27 +00:00
TSUYUSATO Kitsune
cc7a5dcd06 [ruby/prism] Add and use pm_parser_local_depth_constant_id
https://github.com/ruby/prism/pull/1877#discussion_r1398974248

0f545fe636
2023-11-22 14:53:27 +00:00
heyogrady
e3ef05a434 [ruby/prism] Add CP949 encoding
9e78dfdf69
2023-11-22 09:12:35 -05:00
Patrick O'Grady
e9ccceab11 [ruby/prism] Add KOI8-U encoding
(https://github.com/ruby/prism/pull/1906)

* Add test for KOI8-U

* Rename koi8 char_width function

- Rename function for use with any KOI8-based encoding

* Add KOI8-U encoding

* Add encoding to encoding.md

6cad4552f7
2023-11-22 13:21:15 +00:00
Jemma Issroff
8e80cad9e9 [ruby/prism] Add SPLAT flag on ArrayNode indicating if it contains splat element(s)
This commit puts a SPLAT flag on any ArrayNodes which contain
SplatNode elements

2fc1e7f181
2023-11-21 22:30:53 +00:00
Jemma Issroff
3db21d2d4c [PRISM] Rename flag to CONTAINS_KEYWORD_SPLAT
We need to do this change first on ruby/ruby before merging to
ruby/prism to avoid breaking ruby/ruby CI
2023-11-21 17:29:07 -05:00
Haldun Bayhantopcu
f397650cda [ruby/prism] Fix lex_state_beg_p
(https://github.com/ruby/prism/pull/1591)

46b8576dd0
2023-11-21 17:22:18 +00:00
Thiago Araujo
91685c01d3 [ruby/prism] feat: adds encoding for TIS-620
(https://github.com/ruby/prism/pull/1901)

2c308e6697
2023-11-21 17:12:00 +00:00
Hiroya Fujinami
ad25313ca8 [ruby/prism] Fix .. and ... to be non-associative
(https://github.com/ruby/prism/pull/1837)

Fix https://github.com/ruby/prism/pull/1829

90b0b1974c

Co-authored-by: Kevin Newton <kddnewton@gmail.com>
2023-11-21 17:03:33 +00:00
Haldun Bayhantopcu
8966d06b96 [ruby/prism] Warning for ENDs in methods
(https://github.com/ruby/prism/pull/1899)

1b41c2d56c
2023-11-21 16:36:12 +00:00
Kevin Newton
ddacc08528 [ruby/prism] Remove string concat in favor of a flat list
Right now when you have a lot of string concats it ends up being
difficult to work with because of the depth of the tree. You end
up descending very far for every string literal that is part of the
concat.

There are already times when we use an interpolated string node to
group together two string segments that are part of the same string
(like when they are interupted by the contents of a heredoc). This
commit takes the same approach and replaces string concats with
interpolated string nodes.

Now that they're a flat list, they should be much easier to work
with. There's still some missing information here that would be
useful to consumers: whether or not there is _actually_ any
interpolation contained in the list. We could remedy this with
another node type that is named something like string list, or we
could add a flag to interpolated string node indicating that there
is interpolation. Either way I want to solve that in a follow-up
commit, since this commit is valuable on its own.

1e7ae3ad1b
2023-11-21 11:35:46 -05:00
Hiroya Fujinami
b6b31f673d [ruby/prism] Check a token after targets more strictly
(https://github.com/ruby/prism/pull/1878)

Fix https://github.com/ruby/prism/pull/1832

060bcc81a8
2023-11-21 02:45:12 +00:00
Kevin Newton
5299b4a362 [ruby/prism] Build the ability to format errors
(https://github.com/ruby/prism/pull/1796)

Previously, we only supported error messages that were constant
strings. This works for the most part, but there are some times
where we want to include some part of the source in the error
message to make it better.

For example, instead of "Token is reserved" it's better to write
"_1 is reserved".

To do this, we now support allocating error messages at runtime
that are built around format strings.

7e6aa17deb
2023-11-21 02:43:18 +00:00
Kevin Newton
9fa524dd41 [ruby/prism] Split up CaseNode and CaseMatchNode
(https://github.com/ruby/prism/pull/1801)

4c1391ea56
2023-11-21 02:38:07 +00:00
Ryan Garver
e16ff17374 Rename the big5-hkscs stuff to something more generic and add UAO sharing common code.
Merge the Big5 extensions into pm_big5.c
2023-11-20 21:18:31 -05:00
Haldun Bayhantopcu
36afc11ece [ruby/prism] Fix locations derived from arguments.
(https://github.com/ruby/prism/pull/1897)

00b76ef254
2023-11-20 23:03:23 +00:00
Kevin Newton
e269096d15 [ruby/prism] Replace match write locals with match write targets
eec1862967
2023-11-20 18:00:44 -05:00
Lynne Ashminov
307a5cb20b [ruby/prism] adds encodings for ibm869
(https://github.com/ruby/prism/pull/1886)

41462400b7
2023-11-20 20:06:14 +00:00
Maple Ong
9fbdb26f06 [ruby/prism] Add and test ibm863 encoding
(https://github.com/ruby/prism/pull/1853)

* Add and test ibm863

* Remove dup encoding and add alias

* Update test/prism/encoding_test.rb

Co-authored-by: Kevin Newton <kddnewton@gmail.com>

* Readd bitfield table lol

---------

4cd756d7ff

Co-authored-by: Kevin Newton <kddnewton@gmail.com>
2023-11-20 20:06:00 +00:00
Kevin Newton
5b0256e3c4 [ruby/prism] Disallow defining a numbered parameter method
(https://github.com/ruby/prism/pull/1797)

c13165e6aa
2023-11-20 16:12:50 +00:00
David Wessman
f9fb05f9d0 [ruby/prism] feat: Adds macCroatian encoding
(https://github.com/ruby/prism/pull/1880)

* feat: Adds macCroatian encoding

- Based on:
https://en.wikipedia.org/wiki/Mac_OS_Croatian_encoding
https://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/CROATIAN.TXT

Co-authored-by: Josefine Rost <nijrost@gmail.com>

* Use output from bin/encodings and adds to docs/encoding.md

---------

019a82d8f3

Co-authored-by: Josefine Rost <nijrost@gmail.com>
2023-11-20 16:07:19 +00:00
Hiroya Fujinami
adee7dab3e [ruby/prism] Correctly parse the resuce modifier in the rhs of the
assignments
(https://github.com/ruby/prism/pull/1879)

Fix https://github.com/ruby/prism/pull/1541

9fb276e1f4
2023-11-20 15:58:19 +00:00
Hiroya Fujinami
caa9ae7804 [ruby/prism] Fix parsing ... in arguments
(https://github.com/ruby/prism/pull/1882)

* Fix parsing `...` in arguments

Fix https://github.com/ruby/prism/pull/1830
Fix https://github.com/ruby/prism/pull/1831

* Rename the constant name to PM_ERR_ARGUMENT_FORWARDING_UNBOUND

https://github.com/ruby/prism/pull/1882#discussion_r1398461156

519653aec2
2023-11-20 15:52:44 +00:00
Derek Moore
701b0650de [ruby/prism] feat: add encoding for IBM865
(https://github.com/ruby/prism/pull/1884)

* feat: add encoding for IBM865

* style: fix incorrect autoformat

14c6ae0182
2023-11-20 02:02:55 +00:00
Hiroya Fujinami
8b4b0b7177 [ruby/prism] Don't add an invalid identifier capture to locals
(https://github.com/ruby/prism/pull/1836)

* Don't add an invalid identifier capture to locals

Fix https://github.com/ruby/prism/pull/1815

* Delay creating a MatchWriteNode

https://github.com/ruby/prism/pull/1836#discussion_r1393716600

635f595a36
2023-11-19 02:05:21 +00:00
Syed Faraaz Ahmad
5fea1d08bd [ruby/prism] feat: add encoding for ibm866
(https://github.com/ruby/prism/pull/1864)

Add encoding for ibm866

---------

1a96cc71f7

Co-authored-by: Kevin Newton <kddnewton@gmail.com>
2023-11-19 01:05:41 +00:00
Orhan Toy
5d2d0962cc [ruby/prism] Add GB1988 encoding
78d3fa7172
2023-11-19 01:05:11 +00:00
Orhan Toy
71a30b7596 [ruby/prism] Add macCyrillic encoding
220b40921a
2023-11-19 01:03:19 +00:00
Martin Emde
db6492092f [ruby/prism] Fix typos in comments and docs
16b3d19758
2023-11-19 00:56:27 +00:00
Ryan Garver
cd4316a51f [ruby/prism] Big5 HKSCS encoding
3ca9823eb4
2023-11-18 13:52:17 -05:00
Mike Dalton
bbf14bbba6 [ruby/prism] Add IBM864 encoding
Fixes https://github.com/ruby/prism/pull/1868
Related #1843

abc136dfc9
2023-11-18 18:47:15 +00:00
Haldun Bayhantopcu
fdcb97833c [ruby/prism] Faster lex_keyword
23a68dcda2
2023-11-18 18:43:10 +00:00
Thomas Marshall
a6f9e6add2 [ruby/prism] Add macCentEuro encoding
ff95edbd99
2023-11-18 18:41:03 +00:00
Haldun Bayhantopcu
cbdac2f031 [ruby/prism] Silence clang analyzer warnings for the memory leaks
68112c556e
2023-11-17 20:11:11 +00:00
Peter Cai
585fdfe1f5 [ruby/prism] add Windows-874 encoding
0670dd3b9a
2023-11-17 20:06:48 +00:00
Haldun Bayhantopcu
50b7b927a3 [ruby/prism] Add macThai
f654058f50
2023-11-17 20:06:27 +00:00
Haldun Bayhantopcu
0a081a33eb [ruby/prism] Add macRoman
42b20ee399
2023-11-17 20:06:16 +00:00
Haldun Bayhantopcu
85dcfef23a [ruby/prism] Add macUkraine
440557fddc
2023-11-17 20:04:54 +00:00
Haldun Bayhantopcu
e5d6b4099e [ruby/prism] Do not allow trailing commas in calls without parenthesis
f1d56da58f
2023-11-17 15:48:57 +00:00
Haldun Bayhantopcu
4a26a65e42 [ruby/prism] Add macTurkish
2232d4b6a0
2023-11-17 14:32:40 +00:00