Age | Commit message (Collapse) | Author |
|
https://github.com/ruby/prism/commit/9c68c01bcd
|
|
Follow up https://github.com/ruby/prism/pull/2558.
This PR removes deprecated lib/prism/translation/parser/rubocop.rb file.
The file was a workaround to allow setting `TargetRubyVersion: 80_82_73_83_77.xx` until Prism (`Prism::Translation::Parser`) is integrated into RuboCop.
RuboCop already supports Prism (`Prism::Translation::Parser`) as of https://github.com/rubocop/rubocop/pull/12724.
It has been several months since the file was deprecated in ruby/prism#2558.
And, yesterday, Prism 1.0.0 was released, but perhaps the file should have been removed before then.
Although this might be seen as incompatible with semver 1.0.0, I think there is no longer a reason to keep the file.
https://github.com/ruby/prism/commit/646a10270e
|
|
|
|
https://github.com/ruby/prism/commit/bc21c9f3ee
|
|
Rename some fields that do not quite make sense.
* CaseMatchNode#consequent -> CaseMatchNode#else_clause
* CaseNode#consequent -> CaseNode#else_clause
* IfNode#consequent -> IfNode#subsequent
* RescueNode#consequent -> RescueNode#subsequent
* UnlessNode#consequent -> UnlessNode#else_clause
Notes:
Merged: https://github.com/ruby/ruby/pull/11480
|
|
This PR tweaks inspect representation of `Prism::Location`.
## Before
During debugging, the meaning of `@location=https://github.com/ruby/prism/commit/21474836481` was unclear:
```console
$ ruby -Ilib -rprism -e 'p Prism.lex("puts :hi").value.map(&:first)[1]'
#<Prism::Token:0x000000010cd74e40 @source=#<Prism::ASCIISource:0x000000010cb5f808 @source="puts :hi", @start_line=1, @offsets=[0]>,
@type=:SYMBOL_BEGIN, @value=":", @location=https://github.com/ruby/prism/commit/21474836481>
```
## After
This PR clarifies the contents of the location object, aligning with what I think user expects:
```console
$ ruby -Ilib -rprism -e 'p Prism.lex("puts :hi").value.map(&:first)[1]'
#<Prism::Token:0x000000010e174d50 @source=#<Prism::ASCIISource:0x000000010df5efe8 @source="puts :hi", @start_line=1, @offsets=[0]>,
@type=:SYMBOL_BEGIN, @value=":", @location=#<Prism::Location @start_offset=5 @length=1 start_line=1>>
```
Although it is uncertain whether Prism will accept this change in the inspect representation, it is submitted here as a suggestion.
https://github.com/ruby/prism/commit/e7421ce1c5
|
|
https://github.com/ruby/prism/commit/afc7c9344a
|
|
https://github.com/ruby/prism/commit/47cb73ce69
|
|
https://github.com/ruby/prism/commit/073e8ba307
|
|
https://github.com/ruby/prism/commit/86cf82794a
|
|
https://github.com/ruby/prism/commit/bf16ade7f9
|
|
https://github.com/ruby/prism/commit/08a71f6259
|
|
https://github.com/ruby/prism/commit/9f12a56fd6
|
|
https://github.com/ruby/prism/commit/4cc0eda4ca
|
|
https://github.com/ruby/prism/commit/fb7e1ebb7f
|
|
https://github.com/ruby/prism/commit/5985ab7687
|
|
https://github.com/ruby/prism/commit/f7faedfb3f
|
|
|
|
https://github.com/ruby/prism/commit/1528d3c019
|
|
https://github.com/ruby/prism/commit/100340bc6b
|
|
https://github.com/ruby/prism/commit/4a9a7a62af
Co-authored-by: Jason Kim <[email protected]>
Co-authored-by: Adam Hess <[email protected]>
|
|
https://github.com/ruby/prism/commit/36c6851c85
|
|
https://github.com/ruby/prism/commit/85b4a5f804
|
|
https://github.com/ruby/prism/commit/461aa5e658
|
|
https://github.com/ruby/prism/commit/aecce571d8
|
|
https://github.com/ruby/prism/commit/12e079c97e
|
|
translation""
This reverts commit https://github.com/ruby/prism/commit/d8ae19d0334a.
https://github.com/ruby/prism/commit/df1eda2811
|
|
This reverts commit https://github.com/ruby/prism/commit/823e931ff230.
https://github.com/ruby/prism/commit/d8ae19d033
|
|
https://github.com/ruby/prism/commit/823e931ff2
|
|
https://github.com/ruby/prism/commit/21d314eb2e
|
|
https://github.com/ruby/prism/commit/a4e164e22b
|
|
https://github.com/ruby/prism/commit/840185110f
|
|
in parser
https://github.com/ruby/prism/commit/beed43922c
|
|
https://github.com/ruby/prism/commit/f2a327449a
|
|
https://github.com/ruby/prism/commit/785de2c39d
|
|
https://github.com/ruby/prism/commit/6f886be0a4
|
|
https://github.com/ruby/prism/commit/4b06eae0df
|
|
https://github.com/ruby/prism/commit/4d8929ff6a
|
|
https://github.com/ruby/prism/commit/b850794db9
|
|
https://github.com/ruby/prism/commit/53bbcfe513
|
|
https://github.com/ruby/prism/commit/79cec4be22
|
|
https://github.com/ruby/prism/commit/77bf9038a2
|
|
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
|
|
https://github.com/ruby/prism/commit/d4eb13e703
|
|
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
|
|
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
|
|
|
|
https://github.com/ruby/prism/commit/b5e47f5c42
|
|
https://github.com/ruby/prism/commit/15bf727881
|
|
https://github.com/ruby/prism/commit/ee73ad757f
|