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

381 Коммитов

Автор SHA1 Сообщение Дата
Kevin Newton 24f48382bc [ruby/prism] (parser) Fix up tokens for empty symbol
https://github.com/ruby/prism/commit/5985ab7687
2024-06-18 21:18:39 -04:00
Kevin Newton d827d32527 [ruby/prism] Provide ability to lock encoding while parsing
https://github.com/ruby/prism/commit/f7faedfb3f
2024-06-10 17:21:32 -04:00
Kevin Newton c90b5303a2
Sync prism version to latest 2024-06-07 15:54:06 -04:00
Kevin Newton 41a36b6853 [ruby/prism] Handle chomped bytesize with lines without newlines
https://github.com/ruby/prism/commit/1528d3c019
2024-06-07 19:46:27 +00:00
Kevin Newton 79e9dea8de [ruby/prism] Ensure inner heredoc nodes have the correct location
https://github.com/ruby/prism/commit/100340bc6b
2024-06-07 19:46:20 +00:00
Kevin Newton ce0a352e34 [ruby/prism] Use correct newlines for heredoc inner lines
https://github.com/ruby/prism/commit/4a9a7a62af

Co-authored-by: Jason Kim <jasonkim@github.com>
Co-authored-by: Adam Hess <HParker@github.com>
2024-06-07 19:46:16 +00:00
Kevin Newton ac70dd07e6 [ruby/prism] Remove unused string list struct
https://github.com/ruby/prism/commit/36c6851c85
2024-06-05 14:40:03 -04:00
Kevin Newton e440804d7a [ruby/prism] (parser) split up regexp content by lines
https://github.com/ruby/prism/commit/85b4a5f804
2024-06-04 20:28:54 +00:00
Kevin Newton c2d3573c63 [ruby/prism] (parser) handle quoted symbols in hash patterns
https://github.com/ruby/prism/commit/461aa5e658
2024-06-04 20:28:54 +00:00
Kevin Newton 4354e45254 [ruby/prism] (parser) fix up srange_find to anchor at the start of the slice
https://github.com/ruby/prism/commit/aecce571d8
2024-06-04 20:28:54 +00:00
Kevin Newton bbf9b5baad [ruby/prism] (parser) fix up nested multi write
https://github.com/ruby/prism/commit/12e079c97e
2024-06-04 20:28:53 +00:00
Kevin Newton fd517a97be [ruby/prism] Revert "Revert "Properly destructure procarg0 in parser translation""
This reverts commit https://github.com/ruby/prism/commit/d8ae19d0334a.

https://github.com/ruby/prism/commit/df1eda2811
2024-06-04 15:05:52 +00:00
Kevin Newton 89ef1392f8 [ruby/prism] Revert "Properly destructure procarg0 in parser translation"
This reverts commit https://github.com/ruby/prism/commit/823e931ff230.

https://github.com/ruby/prism/commit/d8ae19d033
2024-06-03 21:31:29 +00:00
Kevin Newton 5502890a2f [ruby/prism] Properly destructure procarg0 in parser translation
https://github.com/ruby/prism/commit/823e931ff2
2024-06-03 21:12:36 +00:00
Kevin Newton 77581dd45b [ruby/prism] Fix up steep issues
https://github.com/ruby/prism/commit/21d314eb2e
2024-06-03 20:57:48 +00:00
Kevin Newton b5c8fb9a3f [ruby/prism] Fix up heredoc location translation for parser
https://github.com/ruby/prism/commit/a4e164e22b
2024-05-31 19:31:53 +00:00
Kevin Newton 63ea77916a [ruby/prism] Match % strings in parser
https://github.com/ruby/prism/commit/840185110f
2024-05-31 19:31:53 +00:00
Kevin Newton 1b392ba7c6 [ruby/prism] Use correct opening and closing parenthesis for array pattern in parser
https://github.com/ruby/prism/commit/beed43922c
2024-05-31 19:31:53 +00:00
Kevin Newton 47f05dffa1 [ruby/prism] Match match_hash_var when quotes are used
https://github.com/ruby/prism/commit/f2a327449a
2024-05-31 19:31:52 +00:00
Kevin Newton 02b27aca50 [ruby/prism] Match parser for match_rest in pattern
https://github.com/ruby/prism/commit/785de2c39d
2024-05-31 19:31:52 +00:00
Kevin Newton 72452f4387 [ruby/prism] Tests overhaul
https://github.com/ruby/prism/commit/6f886be0a4
2024-05-30 15:18:20 -04:00
Kevin Newton c7281e2d67 [ruby/prism] Fix up ruby_parser string concat
https://github.com/ruby/prism/commit/4b06eae0df
2024-05-24 19:27:44 +00:00
Kevin Newton f8b750370e [ruby/prism] Remove Debug module
https://github.com/ruby/prism/commit/4d8929ff6a
2024-05-24 17:19:38 +00:00
Kevin Newton 745a948b6d [ruby/prism] Remove dynamic Debug module methods
https://github.com/ruby/prism/commit/b850794db9
2024-05-24 17:19:36 +00:00
Kevin Newton e575954887 [ruby/prism] Fix support for 'it' implicit local variable
https://github.com/ruby/prism/commit/53bbcfe513
2024-05-22 16:34:04 -04:00
Kevin Newton b20adf90e3 [ruby/prism] Fix up ruby_parser interpolation concatenation
https://github.com/ruby/prism/commit/79cec4be22
2024-05-21 18:45:16 +00:00
Kevin Newton 12386d36f0 [ruby/prism] Provide deprecated numeric method
https://github.com/ruby/prism/commit/77bf9038a2
2024-05-21 18:43:56 +00:00
Kevin Newton 89efb94fec [ruby/prism] Reconfigure rationals
This eliminates the subnode on RationalNode and replaces it with two
integer fields, which represent the ratio for the rational. It also
reduces those two integers if they both fit into 32 bits.

Importantly, this PR does not implement bignum reduction. That's something
I'd like to consider for the future, but it's simple enough for now to
leave them unreduced, which makes it more useful than it used to be.

https://github.com/ruby/prism/commit/86e06c7068
2024-05-21 14:27:46 -04:00
Kevin Newton b5e53e2f32 [ruby/prism] Rescue LoadError for ruby_parser as well
https://github.com/ruby/prism/commit/d4eb13e703
2024-05-13 16:31:55 +00:00
Koichi ITO 5931f857ab [ruby/prism] Add error handling for missing `parser` gem in `Prism::Translation`
Resolves https://github.com/ruby/prism/pull/2803.

This PR adds error handling for missing `parser` gem in `Prism::Translation`.

The `parser` gem is a required runtime dependency when using `Prism::Translation::Parser`.
But it is not required for other uses of Prism. To avoid unnecessary dependencies,
it is not added as a `runtime_dependency` in the prism.gemspec. Instead, if the dependency is missing,
instructions are given to add it to Gemfile.

## Before

```console
$ bundle exec ruby -e 'require "prism"; require "prism/translation/parser33"'
/Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require': cannot load such file -- parser (LoadError)
from /Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser.rb:3:in `<top (required)>'
from /Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
from /Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser33.rb:6:in `<module:Translation>'
from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser33.rb:4:in `<module:Prism>'
from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser33.rb:3:in `<top (required)>'
from /Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
from /Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
from -e:1:in `<main>'
```

## After

```console
$ bundle exec ruby -e 'require "prism"; require "prism/translation/parser33"'
Error: Unable to load parser. Add `gem "parser"` to your Gemfile.
```

https://github.com/ruby/prism/commit/4880aec22d
2024-05-13 16:29:27 +00:00
Kevin Newton e6340258f8 [ruby/prism] Autoload newlines and comment visitors
Having the @newline instance variable in every node adds up, and
since it is so rarely used, we only want to add it when necessary.

Moving this into an autoloaded file and moving the instance variable
out of the default initializers reduces allocated memory because the
nodes are now smaller and some fit into the compact list. On my
machine, I'm seeing about an 8% drop.

https://github.com/ruby/prism/commit/eea92c07d2
2024-05-13 15:34:47 +00:00
Kevin Newton afdfff933f
[PRISM] Bump to version 0.29.0 2024-05-10 13:09:45 -04:00
Kevin Newton 2e44664547 [ruby/prism] operator rename
https://github.com/ruby/prism/commit/b5e47f5c42
2024-05-10 11:47:48 -04:00
Kevin Newton 34e0b5b2d4 [ruby/prism] Fix tapioca require order
https://github.com/ruby/prism/commit/15bf727881
2024-05-10 14:47:21 +00:00
Kevin Newton 2bc309e7f3 [ruby/prism] Fix RBS outside of prism
https://github.com/ruby/prism/commit/ee73ad757f
2024-05-10 13:58:09 +00:00
Kevin Newton 3f664c3738 [ruby/prism] Prism::CallNode#full_message_loc
https://github.com/ruby/prism/commit/fa6fe9be84
2024-05-10 13:40:04 +00:00
Kevin Newton 548a72e537
[PRISM] Sync prism version bump 2024-05-08 10:20:48 -04:00
Koichi ITO b181ba7400 [ruby/prism] Use `version: 3.3.1` against `Translation::Parser`
Follow up https://github.com/ruby/prism/pull/2760.

This PR updates the `Translation::Parser` to use version 3.3.1 when the version 3.3 is specified.
The Parser gem is structured to support the latest patch versions, hence this aligns with Parser-compatible versioning.
As noted in https://github.com/ruby/prism/pull/2760, the behavior remains unchanged with this switch from 3.3.0 to 3.3.1.

https://github.com/ruby/prism/commit/efde09d318
2024-05-04 16:31:58 +00:00
Kevin Newton d4a6d0c177 [ruby/prism] Prism::Location#adjoin
https://github.com/ruby/prism/commit/a298db68e3
2024-05-03 19:14:03 +00:00
Kevin Newton 7a49edcf1f [ruby/prism] Prism::Node#tunnel
https://github.com/ruby/prism/commit/0bf5d651da
2024-05-03 18:37:19 +00:00
Vinicius Stock 4fbb208185 [ruby/prism] Create specialized `ASCIISource` with asciionly optimizations
https://github.com/ruby/prism/commit/40993166a8
2024-05-03 18:10:21 +00:00
Kevin Newton 97654bee49 [ruby/prism] Remove deprecated #child usage
https://github.com/ruby/prism/commit/14d9b431e2
2024-05-03 16:02:13 +00:00
Kevin Newton 5758e45657 [ruby/prism] Change ConstantPathNode#child to ConstantPathNode#{name,name_loc}
This has been requested for a long time, and I'm finally doing it
now. Unfortunately this is a breaking change for all of the APIs.

I've added in a Ruby method for `#child` that is deprecated so that
existing usage doesn't break, but for everyone else this is going
to be a bit of a pain.

https://github.com/ruby/prism/commit/9cbe74464e
2024-05-03 11:11:57 -04:00
Kevin Newton 1d51e929b1 [ruby/prism] Assume eval context for ruby_parser and ripper
https://github.com/ruby/prism/commit/e4d6984892
2024-05-03 13:12:27 +00:00
Earlopain 32b1dea566 [ruby/prism] Assume an eval context for `Prism::Translation::Parser`
This is similar to https://github.com/davidwessman/syntax_tree-erb/issues/81 but for RuboCop
The parser gem doesn't support these types of checks,
see https://github.com/whitequark/parser?tab=readme-ov-file#syntax-check-of-block-exits

While this is technically a bug in the parser gem, it does increase compatibility
and allows prism to be used when linting erb or haml with a RuboCop extension.

https://github.com/ruby/prism/commit/6c59ae6a00
2024-05-03 12:53:01 +00:00
Kevin Newton 7c029f612f [ruby/prism] Remove generics from sorbet types
https://github.com/ruby/prism/commit/080d84fd03
2024-05-03 12:36:57 +00:00
Kevin Newton 7c0cf71049 [ruby/prism] Node#script_lines and supporting infra
https://github.com/ruby/prism/commit/cb4a8ab772
2024-05-02 15:27:18 +00:00
Kevin Newton 8e1647c3aa [ruby/prism] Support passing version 3.3.1
https://github.com/ruby/prism/commit/445a0f0d22
2024-05-01 23:03:25 +00:00
Kevin Newton 3872e54039 [ruby/prism] Bump to v0.27.0
https://github.com/ruby/prism/commit/c9edeef91a
2024-04-26 17:01:03 -04:00
Kevin Newton 9688093124 [ruby/prism] Location#slice_lines, Node#slice_lines
https://github.com/ruby/prism/commit/9b61f6fdb3
2024-04-26 19:05:32 +00:00