Граф коммитов

289 Коммитов

Автор SHA1 Сообщение Дата
Kevin Newton e08c128417 [ruby/prism] Error messages closer to CRuby
https://github.com/ruby/prism/commit/19ffa0b980
2024-02-12 18:01:45 +00:00
Kevin Newton 94bc5ad30a [ruby/prism] ruby_parser translator
https://github.com/ruby/prism/commit/1925b970c7
2024-02-12 17:54:54 +00:00
Kevin Newton c3886c12dc [ruby/prism] Fix unary not location
https://github.com/ruby/prism/commit/861689f6d1
2024-02-12 16:27:49 +00:00
Noah Gibbs 16b39072a5 [ruby/prism] Move Prism::RipperCompat to Prism::Translation::Ripper
https://github.com/ruby/prism/commit/c0331abe4f
2024-02-12 15:57:57 +00:00
Kevin Newton 78deba1aa1 [ruby/prism] Unary not name location
https://github.com/ruby/prism/commit/78190d2999
2024-02-12 15:57:17 +00:00
Noah Gibbs f635b4dd0e [ruby/prism] RipperCompat: add array-refs, assigns, symbols, strings
https://github.com/ruby/prism/commit/b771c7f2ec
2024-02-09 19:49:27 +00:00
Noah Gibbs 366af4679e [ruby/prism] RipperCompat: support for more features.
* add bin/prism ripper to compare Ripper output
* block arg handling is quirky, do it per-call-site
* block required params
* boolean values
* various assign-operator support
* breaks, early fragile begin/rescue/end
* more fixtures being checked

https://github.com/ruby/prism/commit/31732cb720
2024-02-08 16:02:04 +00:00
Noah Gibbs 5b7baa0486 [ruby/prism] More different block-call syntaxes, support more types of method calls
https://github.com/ruby/prism/commit/40cf114a24
2024-02-07 19:42:13 +00:00
Noah Gibbs 73d222e1ef [ruby/prism] Support &. calls and calling with blocks, test with fixtures
https://github.com/ruby/prism/commit/e346fa583a
2024-02-07 19:42:13 +00:00
Noah Gibbs b1310940e3 [ruby/prism] RipperCompat: support more kinds of method calls and operators.
Add tests. Start parsing some simpler fixture code.

https://github.com/ruby/prism/commit/997f4191d8
2024-02-07 19:42:13 +00:00
Kevin Newton aad3c36bdf [ruby/prism] Support for Ruby 2.7
https://github.com/ruby/prism/commit/1a15b70a8e
2024-02-07 16:54:34 +00:00
Kevin Newton 2dba441397 [ruby/prism] Even more ripper compat
https://github.com/ruby/prism/commit/47a602dc1c
2024-02-07 03:21:02 +00:00
Noah Gibbs e34505c631 [ruby/prism] More visitors and tests for RipperCompat
Part of issue #2354

https://github.com/ruby/prism/commit/cb28edae34
2024-02-07 01:49:54 +00:00
eileencodes 936c0ab5e8 [ruby/prism] Implement file parsing error handling
This PR implements proper file parsing error handling. Previously
`file_options` would call `pm_string_mapped_init` which would print an
error from `perror`. However this wouldn't raise a proper Ruby error so
it was just a string output. I've done the following:

- Raise an error from `rb_syserr_fail` with the filepath in
`file_options`.
- No longer return `Qnil` if `file_options` returns false (because now
it will raise)
- Update `file_options` to return `static void` instead of `static
bool`.
- Update `file_options` and `profile_file` to check the type so when
passing `nil` we see a `TypeError`.
- Delete `perror` from `pm_string_mapped_init`
- Update `FFI` backend to raise appropriate errors when calling
`pm_string_mapped_init`.
- Add tests for `dump_file`, `lex_file`, `parse_file`,
`parse_file_comments`, `parse_lex_file`, and `parse_file_success?`
when a file doesn't exist and for `nil`.
- Updates the `bin/parse` script to no longer raise it's own
`ArgumentError` now that we raise a proper error.

Fixes: ruby/prism#2207

https://github.com/ruby/prism/commit/b2f7494ff5
2024-02-06 20:49:33 +00:00
Kevin Newton f5b368df0c [ruby/prism] Better invalid token messages
https://github.com/ruby/prism/commit/8c9bed2a4d
2024-02-06 18:10:50 +00:00
Kevin Newton c42b1029d9 [ruby/prism] Change the location of an implicit begin to method
https://github.com/ruby/prism/commit/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 7695ab3bce [ruby/prism] Fix up multibyte escapes
https://github.com/ruby/prism/commit/836a35f4af
2024-02-02 20:09:01 +00:00
Kevin Newton 520987c6d7 [ruby/prism] Turn off LibrarySymbolsTest on powerpc64le
https://github.com/ruby/prism/commit/6e432f3de5
2024-02-02 19:43:14 +00:00
Alan Wu 770b5499a5 [ruby/prism] Amend assert in pm_utf_8_codepoint(), n=0 is fine
This assert used to trip in the included test:
```
./miniruby --parser=prism -e ' "%W"\u" '
```

https://github.com/ruby/prism/commit/8c0f84db4f
2024-02-01 22:04:46 +00: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.

https://github.com/ruby/prism/commit/5edbd9c25b
2024-02-01 16:48:55 +00:00
Haldun Bayhantopcu 67c5690a6d [ruby/prism] Check literals for receiver
https://github.com/ruby/prism/commit/56441b08e7
2024-02-01 16:48:09 +00:00
Aaron Patterson 8e708e4a07 Update forwarding locals for prism 2024-01-30 13:19:06 -05:00
Kevin Newton ba06a8259a [ruby/prism] Better error messages for unexpected tokens in prefix
https://github.com/ruby/prism/commit/a35b8e45ee
2024-01-30 16:10:08 +00:00
Kevin Newton d39d9e066f [ruby/prism] Fix binding power for modifier rescue
https://github.com/ruby/prism/commit/f614863d79
2024-01-29 18:42:47 +00:00
Kevin Newton f12ebe1188 [ruby/prism] Add parser translation
https://github.com/ruby/prism/commit/8cdec8070c
2024-01-27 19:59:42 +00:00
Kevin Newton e337c9478a [ruby/prism] Error follow-up
Split up the diagnostic levels so that error and warning levels
aren't mixed. Also fix up deconstruct_keys implementation.

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

Co-authored-by: Benoit Daloze <eregontp@gmail.com>
2024-01-27 18:46:16 +00:00
Benoit Daloze de135bc247 [ruby/prism] Add level to warnings and errors to categorize them
* Fixes https://github.com/ruby/prism/issues/2082

https://github.com/ruby/prism/commit/7a74576357
2024-01-26 21:34:34 +00:00
Kevin Newton bcafd28a3e [ruby/prism] Symbol encoding follow-up
Ensure we don't accidentally parse the symbol encoding twice, and
ensure we parse it in every circumstance we need to by requiring
it as a parameter.

https://github.com/ruby/prism/commit/9cea31c785
2024-01-26 21:14:59 +00:00
Kevin Menard 2a509787cb [ruby/prism] Track whether a Symbol should have its encoding changed from the source encoding.
Ruby sets a Symbol literal's encoding to US-ASCII if the symbols consists only of US ASCII code points. Character escapes can also lead a Symbol to have a different encoding than its source's encoding.

https://github.com/ruby/prism/commit/f315660b31
2024-01-26 20:15:19 +00:00
Haldun Bayhantopcu 7d356b8f0e [ruby/prism] Fix multiple assigns with newlines
https://github.com/ruby/prism/commit/b4ba41bdcd
2024-01-26 18:35:54 +00:00
Haldun Bayhantopcu 9a7637da2d [ruby/prism] Add tests
https://github.com/ruby/prism/commit/b9ebf987bd
2024-01-26 18:32:31 +00:00
Max Prokopiev 8e5bc8f7c2 [ruby/prism] Change binding power for modifiers in case-in nodes
https://github.com/ruby/prism/commit/c31eeba54c
2024-01-26 18:32:02 +00:00
Kevin Newton 1301422dfe [PRISM] Fix VM_CALL_ARGS_SPLAT_MUT failures 2024-01-25 11:11:50 -05:00
Kevin Newton ebf803aa19 [ruby/prism] Fix Ruby head build
https://github.com/ruby/prism/commit/149e2ff7f6
2024-01-25 13:58:07 +00:00
Jeremy Evans 4f77d8d328 Do not use ruby2_keywords for ... argument forwarding
This allows ... argument forwarding to benefit from Allocationless
Anonymous Splat Forwarding, allowing the `f` call below to not
allocate an array or a hash.

```ruby
a = [1]
kw = {b: 2}

def c(a, b:)
end

def f(...)
  c(...)
end

f(*a, **kw)
```

This temporarily skips prism locals tests until prism is changed
to use * and ** for ..., instead of using ruby2_keywords.

Ignore failures in rbs bundled gems tests, since they fail due
to this change.
2024-01-24 18:25:55 -08:00
Max Prokopiev a65b52b57f [ruby/prism] Add missing snapshot for the new file
https://github.com/ruby/prism/commit/459a9f544e
2024-01-24 20:32:02 +00:00
Max Prokopiev e9f936df71 [ruby/prism] Extract snippet into its own file and skip in TruffleRuby
https://github.com/ruby/prism/commit/12649ee74c
2024-01-24 20:32:02 +00:00
Max Prokopiev 91a5093c15 [ruby/prism] Force encoding during deserialization of constants
otherwise we get failing tests if we have non-ascii
characters in fixtures/**/*.txt

https://github.com/ruby/prism/commit/9323243569
2024-01-24 20:32:01 +00:00
Kevin Newton 455fb32038 [ruby/prism] Add an implicit node for the target of a hash pattern
This simplifies compiling it, since you can now compile the value
as if it were always there.

https://github.com/ruby/prism/commit/bcfc74aacb
2024-01-24 18:37:36 +00:00
Kevin Newton eb5797062a [ruby/prism] Reference prism after require
https://github.com/ruby/prism/commit/0a8ff431df
2024-01-22 16:16:33 +00:00
Kevin Newton e00f42e5d3 [ruby/prism] Return 1-indexed line numbers
https://github.com/ruby/prism/commit/ad17f58729
2024-01-22 16:13:36 +00:00
Matt Valentine-House b8495048fb [ruby/prism] Unescape method name for unary methods.
https://github.com/ruby/prism/commit/4386a4c0da
2024-01-22 13:19:57 +00:00
Adam Hess cfabe9c51c [ruby/prism] Handle stovetop start in constant path fullname
https://github.com/ruby/prism/commit/3a216e63fe
2024-01-19 22:57:45 +00:00
Takashi Kokubun de9411c0b9 [ruby/prism] Test version: 3.3.0
https://github.com/ruby/prism/commit/94ecb366c4
2024-01-17 17:47:34 +00:00
Takashi Kokubun e0d60a833b [ruby/prism] Fix => ^it
https://github.com/ruby/prism/commit/24a2872b4e
2024-01-17 17:47:34 +00:00
Takashi Kokubun 603f2ca730 [ruby/prism] Parse `it` default parameter
https://github.com/ruby/prism/commit/a0c5361b9f
2024-01-17 17:47:33 +00:00
Adam Hess 13879fea69 [ruby/prism] Fix prism brace association for constant-like method/local calls
https://github.com/ruby/prism/commit/8ca24f263e
2024-01-17 13:26:05 +00:00
TSUYUSATO Kitsune c5e43da426 [ruby/prism] Correct the "ambiguous first argument" condition
Fix https://github.com/ruby/prism/pull/2182

This change reflects this line:
6283ae8d36/parse.y (L11124).

https://github.com/ruby/prism/commit/a52588ff37
2024-01-16 15:51:09 +00:00
Kevin Newton 242dc537f9 [ruby/prism] Exclude encodings that are dynamic
https://github.com/ruby/prism/commit/6749146c0e
2024-01-11 19:14:25 +00:00