| Age | Commit message (Collapse) | Author |
|
https://github.com/ruby/prism/commit/4da514456f
|
|
https://github.com/ruby/prism/commit/de111935fb
|
|
https://github.com/ruby/prism/commit/6a15e475c9
|
|
https://github.com/ruby/prism/commit/7784365d3f
|
|
https://github.com/ruby/prism/commit/168f72b9fe
|
|
over node lists
https://github.com/ruby/prism/commit/5d4da7c69c
|
|
https://github.com/ruby/prism/commit/2752f0b8df
|
|
https://github.com/ruby/prism/commit/a0b978d25b
|
|
https://github.com/ruby/prism/commit/96ca6e51fc
|
|
https://github.com/ruby/prism/commit/892d0f9310
|
|
https://github.com/ruby/prism/commit/c0381b10e4
|
|
https://github.com/ruby/prism/commit/fa7559d40b
|
|
https://github.com/ruby/prism/commit/82fd0599ed
|
|
https://github.com/ruby/prism/commit/f00ae59070
|
|
https://github.com/ruby/prism/commit/1879a9d22e
|
|
https://github.com/ruby/prism/commit/6b594d9d42
|
|
https://github.com/ruby/prism/commit/74bff9e834
|
|
https://github.com/ruby/prism/commit/71ea82f299
|
|
https://github.com/ruby/prism/commit/aa2182f064
|
|
|
|
https://github.com/ruby/prism/commit/9947ab13c0
|
|
https://github.com/ruby/prism/commit/f540e830b5
|
|
https://github.com/ruby/prism/commit/2068e3c30a
|
|
Fixes https://github.com/ruby/prism/pull/2617.
There was an issue with the lexer as follows.
The following are valid regexp options:
```console
$ bundle exec ruby -Ilib -rprism -ve 'p Prism.lex("/x/io").value.map {|token| token[0].type }'
ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22]
[:REGEXP_BEGIN, :STRING_CONTENT, :REGEXP_END, :EOF]
```
The following are invalid regexp options. Unnecessary the `IDENTIFIER` token is appearing:
```console
$ bundle exec ruby -Ilib -rprism -ve 'p Prism.lex("/x/az").value.map {|token| token[0].type }'
ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22]
[:REGEXP_BEGIN, :STRING_CONTENT, :REGEXP_END, :IDENTIFIER, :EOF]
```
As a behavior of Ruby, when given `A` to `Z` and `a` to `z`, they act as invalid regexp options. e.g.,
```console
$ ruby -e '/regexp/az'
-e:1: unknown regexp options - az
/regexp/az
-e: compile error (SyntaxError)
```
Thus, it should probably not be construed as `IDENTIFIER` token.
Therefore, `pm_byte_table` has been adapted to accept those invalid regexp option values.
Whether it is a valid regexp option or not is checked by `pm_regular_expression_flags_create`.
For invalid regexp options, `PM_ERR_REGEXP_UNKNOWN_OPTIONS` is added to diagnostics.
https://github.com/ruby/prism/commit/d2a6096fcf
|
|
https://github.com/ruby/prism/commit/592128de4d
|
|
This PR fixes a diagnostic incompatibility when using no anonymous keyword rest parameter:
```ruby
foo(**)
```
Note, although the actual update applies only to the `foo(**)` case, for reference,
`foo(*)` and `foo(&) are also mentioned below.
## Ruby (Expected)
```console
$ ruby -cve 'foo(*)'
ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22]
-e:1: no anonymous rest parameter
-e: compile error (SyntaxError)
$ ruby -cve 'foo(**)'
ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22]
-e:1: no anonymous keyword rest parameter
-e: compile error (SyntaxError)
$ ruby -cve 'foo(&)'
ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22]
-e:1: no anonymous block parameter
-e: compile error (SyntaxError)
```
## Prism (Actual)
Before:
```console
$ bundle exec ruby -Ilib -rprism -wve 'p Prism.parse("foo(*)").errors'
ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22]
[#<Prism::ParseError @type=:argument_no_forwarding_star @message="unexpected `*` when the parent method is not forwarding"
@location=#<Prism::Location @start_offset=4 @length=1 start_line=1> @level=:fatal>]
$ bundle exec ruby -Ilib -rprism -wve 'p Prism.parse("foo(**)").errors'
ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22]
[#<Prism::ParseError @type=:expect_expression_after_splat_hash @message="expected an expression after `**` in a hash"
@location=#<Prism::Location @start_offset=4 @length=2 start_line=1> @level=:fatal>]
$ bundle exec ruby -Ilib -rprism -wve 'p Prism.parse("foo(&)").errors'
ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22]
[#<Prism::ParseError @type=:argument_no_forwarding_amp @message="unexpected `&` when the parent method is not forwarding"
@location=#<Prism::Location @start_offset=4 @length=1 start_line=1> @level=:fatal>]
```
After:
```console
$ bundle exec ruby -Ilib -rprism -wve 'p Prism.parse("foo(*)").errors'
ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22]
[#<Prism::ParseError @type=:argument_no_forwarding_star @message="unexpected `*` when the parent method is not forwarding"
@location=#<Prism::Location @start_offset=4 @length=1 start_line=1> @level=:fatal>]
$ bundle exec ruby -Ilib -rprism -wve 'p Prism.parse("foo(**)").errors'
ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22]
[#<Prism::ParseError @type=:argument_no_forwarding_star_star @message="unexpected `**` when the parent method is not forwarding"
@location=#<Prism::Location @start_offset=4 @length=2 start_line=1> @level=:fatal>]
$ bundle exec ruby -Ilib -rprism -wve 'p Prism.parse("foo(&)").errors'
ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22]
[#<Prism::ParseError @type=:argument_no_forwarding_amp @message="unexpected `&` when the parent method is not forwarding"
@location=#<Prism::Location @start_offset=4 @length=1 start_line=1> @level=:fatal>]
```
https://github.com/ruby/prism/commit/633c9d9fd4
|
|
https://github.com/ruby/prism/commit/edece87801
|
|
https://github.com/ruby/prism/commit/1219a709e4
|
|
If there are many searches in the `$LOAD_PATH` in the user environment,
require will perform unnecessary searches that are not needed.
In contrast, `require_relative` is efficient because it uses a relative path.
https://github.com/ruby/prism/commit/438ccc67bd
|
|
https://github.com/ruby/prism/commit/473cfed6d0
|
|
https://github.com/ruby/prism/commit/2cdbf81c95
|
|
This PR makes `Prism` warn `&` interpreted as argument prefix.
This carries a similar meaning to the following Ruby warning:
```console
$ ruby -cwe "foo &bar"
-e:1: warning: `&' interpreted as argument prefix
Syntax OK
```
Previously, it did not issue a warning:
```console
$ bundle exec ruby -rprism -ve "p Prism.parse('foo &bar').warnings"
ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22]
[]
```
From now on, it will issue a warning similar to Ruby's:
```console
$ bundle exec ruby -rprism -ve "p Prism.parse('foo &bar').warnings"
ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22]
[#<Prism::ParseWarning @type=:ambiguous_prefix_amp @message="ambiguous `&` has been interpreted as an argument prefix"
@location=#<Prism::Location @start_offset=4 @length=1 start_line=1> @level=:verbose>]
```
https://github.com/ruby/prism/commit/312f99cd1e
|
|
This PR makes Prism warn `**` interpreted as argument prefix.
This carries a similar meaning to the following Ruby warning:
```console
$ ruby -cwe "foo **bar"
-e:1: warning: `**' interpreted as argument prefix
Syntax OK
```
Previously, it did not issue a warning:
```console
$ bundle exec ruby -rprism -ve "p Prism.parse('foo **bar').warnings"
ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22]
[]
```
From now on, it will issue a warning similar to Ruby's:
```console
$ bundle exec ruby -rprism -ve "p Prism.parse('foo **bar').warnings"
ruby 3.3.0 (2023-12-25 revision https://github.com/ruby/prism/commit/5124f9ac75) [x86_64-darwin22]
[#<Prism::ParseWarning @type=:ambiguous_prefix_star_star @message="ambiguous `**` has been interpreted as an argument prefix"
@location=#<Prism::Location @start_offset=4 @length=2 start_line=1> @level=:verbose>]
```
https://github.com/ruby/prism/commit/f6cb5c314c
|
|
https://github.com/ruby/prism/commit/f9f3620d44
|
|
https://github.com/ruby/prism/commit/01d137a0cb
|
|
https://github.com/ruby/prism/commit/909508296e
|
|
* Also add warnings for literals in predicates
* Also create flip-flops in while/until
https://github.com/ruby/prism/commit/a6b5c523c2
|
|
https://github.com/ruby/prism/commit/4dc58a533a
|
|
https://github.com/ruby/prism/commit/6bf1b8edf0
|
|
https://github.com/ruby/prism/commit/a2594a23c1
|
|
https://github.com/ruby/prism/commit/588acf823f
|
|
https://github.com/ruby/prism/commit/47601e7928
|
|
https://github.com/ruby/prism/commit/31b8c6142f
|
|
https://github.com/ruby/prism/commit/1a8a0063dc
|
|
https://github.com/ruby/prism/commit/a735c2262f
|
|
https://github.com/ruby/prism/commit/2a583b041b
|
|
https://github.com/ruby/prism/commit/a01d6a4e32
|
|
https://github.com/ruby/prism/commit/1d87b8c46c
|
|
namespace
https://github.com/ruby/prism/commit/0e4dbcd3e4
|
|
https://github.com/ruby/prism/commit/537947aa5c
|