85 Commits
Author SHA1 Message Date
Kevin Newton 8bbe835cd8 Bump prism to version 0.19.0 2023-12-14 15:06:09 -05:00
Kevin Newton fe6ee5e921 [ruby/prism] Move flag position consistently to front
https://github.com/ruby/prism/commit/6e69a81737
2023-12-06 20:50:02 +00:00
Kevin Newton ea9f89eeb6 [ruby/prism] Ripper compat docs update
https://github.com/ruby/prism/commit/5f70b32b02
2023-12-04 17:00:14 +00:00
Kevin Newton 492c82cb41 [ruby/prism] Prism.parse_success?(source)
A lot of tools use Ripper/RubyVM::AbstractSyntaxTree to determine
if a source is valid. These tools both create an AST instead of
providing an API that will return a boolean only.

This new API only creates the C structs, but doesn't bother
reifying them into Ruby/the serialization API. Instead it only
returns true/false, which is significantly more efficient.

https://github.com/ruby/prism/commit/7014740118
2023-12-01 20:53:34 +00:00
Kevin Newton ec83bd7356 [ruby/prism] Provide heredoc? queries
https://github.com/ruby/prism/commit/e148e8fe6a
2023-12-01 18:46:52 +00:00
Kevin Newton cdb74d74af [ruby/prism] Change numbered parameters
Previously numbered parameters were a field on blocks and lambdas
that indicated the maximum number of numbered parameters in either
the block or lambda, respectively. However they also had a
parameters field that would always be nil in these cases.

This changes it so that we introduce a NumberedParametersNode that
goes in place of parameters, which has a single uint8_t maximum
field on it. That field contains the maximum numbered parameter in
either the block or lambda.

As a part of the PR, I'm introducing a new UInt8Field type that
can be used on nodes, which is just to make it a little more
explicit what the maximum values can be (the maximum is actually 9,
since it only goes up to _9). Plus we can do a couple of nice
things in serialization like just read a single byte.

https://github.com/ruby/prism/commit/2d87303903
2023-12-01 12:03:09 -05:00
Martin Emde cbe57caa24 [ruby/prism] Fix comments after HEREDOCs again.
The problem was deeper than just looking back a single token.
You can push the heredoc_end token way back into the list.
We need to save the last location of a heredoc end to see if
it's the last token in the file.

Fixes https://github.com/ruby/prism/pull/1954

https://github.com/ruby/prism/commit/91dfd4eecd
2023-12-01 15:17:20 +00:00
Kevin Newton abb1fe2868 [PRISM] Consolidate prism encoding files 2023-11-30 21:37:56 -05:00
Kevin Newton 10d3897e13 [PRISM] Big5 encodings 2023-11-30 21:37:56 -05:00
Kevin Newton 7b5bb978fb [PRISM] Alias CP51932 to EUC-JP 2023-11-30 21:37:56 -05:00
Kevin Newton 9ba92327f2 [PRISM] Consolidate SJIS encodings 2023-11-30 21:37:56 -05:00
Martin Emde aac8be8034 [ruby/prism] Fix lex_compat for <<HEREDOC # comment at EOF
Fixes https://github.com/ruby/prism/pull/1874

https://github.com/ruby/prism/commit/304dd78dd2
2023-11-30 14:10:04 +00:00
Matt Boldt 9fc40d2b26 [ruby/prism] Add MacJapanese encoding
MacJapanese (also aliased as MacJapan) is a modified Shift_JIS
encoding, but is implemented identically in Ruby

https://github.com/ruby/prism/commit/9e0a097699
2023-11-29 12:08:15 -05:00
Dhaval 9fada99cb2 [ruby/prism] added CP950 encoding
https://github.com/ruby/prism/commit/9c2d1cf4ba
2023-11-29 11:15:50 -05:00
Kevin Newton 4938390177 [ruby/prism] Implicit rest nodes
Fundamentally, `foo { |bar,| }` is different from `foo { |bar, *| }`
because of arity checks. This PR introduces a new node to handle
that, `ImplicitRestNode`, which goes in the `rest` slot of parameter
nodes instead of `RestParameterNode` instances.

This is also used in a couple of other places, namely:

* pattern matching: `foo in [bar,]`
* multi target: `for foo, in bar do end`
* multi write: `foo, = bar`

Now the only splat nodes with a `NULL` value are when you're
forwarding, as in: `def foo(*) = bar(*)`.

https://github.com/ruby/prism/commit/dba2a3b652
2023-11-28 22:33:50 +00:00
Kevin Newton c798943a4a [ruby/prism] Move DATA parsing into its own parse result field
https://github.com/ruby/prism/commit/42b60b6e95
2023-11-28 13:25:48 +00:00
Kevin Newton 1f06d168ba [ruby/prism] Add new doc to gemspec
https://github.com/ruby/prism/commit/99dfca6c1d
2023-11-22 15:15:07 +00:00
heyogrady e3ef05a434 [ruby/prism] Add CP949 encoding
https://github.com/ruby/prism/commit/9e78dfdf69
2023-11-22 09:12:35 -05:00
Benoit Daloze 018e6abf85 [ruby/prism] Move CallNode#name field between receiver and arguments
* The same order as in source code.
* CallOrWriteNode, CallOperatorWriteNode, CallAndWriteNode already have
  the correct order so it was also inconsistent with them.

https://github.com/ruby/prism/commit/4434e4bc22
2023-11-22 12:15:20 +00:00
Kevin Newton 7d6f812c31 [ruby/prism] Update to v0.18.0
https://github.com/ruby/prism/commit/1398879d79
2023-11-21 13:59:10 -05:00
Vinicius StockandTim Morgan 7a9bb6d2a7 [ruby/prism] Fix constant path full name when parent is not a
constant
(https://github.com/ruby/prism/pull/1742)

* Raise if constant path parts contains nodes that can't be used to build full name

* Fix typo in constant path error documentation

Co-authored-by: Tim Morgan <tim@timmorgan.org>

---------

https://github.com/ruby/prism/commit/d73a053262

Co-authored-by: Tim Morgan <tim@timmorgan.org>
2023-11-21 16:39:27 +00:00
Haldun Bayhantopcu 8966d06b96 [ruby/prism] Warning for ENDs in methods
(https://github.com/ruby/prism/pull/1899)

https://github.com/ruby/prism/commit/1b41c2d56c
2023-11-21 16:36:12 +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
Kevin Newton f2ed7eaba0 [ruby/prism] Add character APIs for locations
(https://github.com/ruby/prism/pull/1809)

https://github.com/ruby/prism/commit/d493ccd093
2023-11-20 16:07:06 +00:00
Ryan Garver cd4316a51f [ruby/prism] Big5 HKSCS encoding
https://github.com/ruby/prism/commit/3ca9823eb4
2023-11-18 13:52:17 -05:00
Maple Ong d976e7cc4b [ruby/prism] Update gemspec
https://github.com/ruby/prism/commit/1a10f6f9c0
2023-11-16 17:13:17 +00:00
Kevin Newton d2e7a70ee6 [ruby/prism] Track the then keyword for conditionals
https://github.com/ruby/prism/commit/fef0019a25
2023-11-15 23:08:11 +00:00
Kevin Newton ed75518192 [ruby/prism] Rename librubyparser to libprism
librubyparser was an artifact of the prototype that was initially
named ruby-parser. Instead, this renames it to libprism to be
consistent with the actual name.

https://github.com/ruby/prism/commit/8600b06811
2023-11-14 16:22:03 -05:00
Kevin Newton 94f82a65f7 [ruby/prism] Add the ability to convert nodes to dot
https://github.com/ruby/prism/commit/3e4b4fb947
2023-11-12 02:53:33 +00:00
Kevin Newton 85db7baccb [ruby/prism] Remove extra locals added by ...
https://github.com/ruby/prism/commit/b7850f2d30
2023-11-10 21:50:12 +00:00
Mateus Pereira 03aa1092ad [ruby/prism] Add source code and changelog uris
https://github.com/ruby/prism/commit/33a85f7867
2023-11-10 21:49:27 +00:00
Kevin Newton 201853f4e1 [ruby/prism] Provide Parameters#signature for mirroring Method#parameters
https://github.com/ruby/prism/commit/90b3245528
2023-11-08 22:17:43 +00:00
Kevin Newton 5a132c7864 Update prism to v0.17.1 2023-11-03 13:59:07 -04:00
Kevin Newton c44c982c93 [ruby/prism] Bump to version 0.17.0
https://github.com/ruby/prism/commit/61a306cd5c
2023-11-03 11:17:37 -04:00
Kevin Newton 47163f9cf9 [ruby/prism] Rename suppress warnings to verbose
https://github.com/ruby/prism/commit/fbb30216ca
2023-11-03 14:54:13 +00:00
Kevin Newton 4b5f516f2e [ruby/prism] Split comment
We were previously holding a type field on Comment to tell what
kind of comment it was. Instead, let's just use actual classes for
this.

https://github.com/ruby/prism/commit/e76830ca6e
2023-11-03 14:35:08 +00:00
Kevin Newton 8587d9a8bf [ruby/prism] Wire up options through the Java parser
https://github.com/ruby/prism/commit/13fa262669
2023-11-03 10:13:50 -04:00
Kevin Newton d7d3243364 [ruby/prism] Properly support the start line option
https://github.com/ruby/prism/commit/33cc75a4b7
2023-11-03 10:13:50 -04:00
Kevin Newton 6496591194 [ruby/prism] Rename serialization APIs for consistency
https://github.com/ruby/prism/commit/5a2252e3ac
2023-11-03 10:13:49 -04:00
Kevin Newton 05f5c545d2 [ruby/prism] Wire up options through the FFI API
https://github.com/ruby/prism/commit/f0aa8ad93b
2023-11-03 10:13:49 -04:00
Kevin Newton ca7297efd3 [ruby/prism] Wire up options through the Ruby API
https://github.com/ruby/prism/commit/8582d372a3
2023-11-03 10:13:49 -04:00
Kevin Newton 2a0f2b7763 [ruby/prism] Create an options struct for passing all of the possible options
https://github.com/ruby/prism/commit/99e81619de
2023-11-03 10:13:49 -04:00
Kevin Newton 90b21b864d [prism] Updates for sync 2023-11-01 13:10:29 -04:00
Kevin Newton 493439c9ce [ruby/prism] Documentation for pm_strncasecmp
https://github.com/ruby/prism/commit/26934263b7
2023-11-01 13:10:29 -04:00
Kevin Newton 4490979615 [ruby/prism] Finish Ruby documentation
https://github.com/ruby/prism/commit/dfdcc98a3c
2023-11-01 13:10:29 -04:00
Kevin Newton 79034fbd50 [ruby/prism] More Ruby docs
https://github.com/ruby/prism/commit/ca9a660f52
2023-11-01 13:10:29 -04:00
Kevin Newton 953138698e [ruby/prism] Docs for node.rb and parse_result.rb
https://github.com/ruby/prism/commit/085da4feb9
2023-11-01 13:10:29 -04:00
Kevin Newton f12617ec98 [ruby/prism] Fix up Prism and Debug docs
https://github.com/ruby/prism/commit/c2b7724d91
2023-11-01 13:10:29 -04:00
Jemma Issroff e80ca70b9b [ruby/prism] Flip incorrect names of OptionalKeywordParameterNode and RequiredKeywordParameterNode
https://github.com/ruby/prism/commit/c31f61e898
2023-11-01 14:40:45 +00:00
Jemma Issroff d0625099e0 [ruby/prism] Split KeywordParameterNode into Optional and Required
Prior to this commit, KeywordParameterNode included both optional
and required keywords. With this commit, it is split in two, with
`OptionalKeywordParameterNode`s no longer having a value field.

https://github.com/ruby/prism/commit/89084d9af4
2023-11-01 14:40:44 +00:00