| Age | Commit message (Collapse) | Author |
|
Also make them lazy to allocate the array, and also expose ParseResult#encoding.
https://github.com/ruby/prism/commit/08ec7683ae
|
|
* The #visit method is no longer called for every node since 2e6baa3.
* As a consequence EnsureEveryNodeOnceInAST was only visiting ProgramNode
for `visitor.visit(ast)` and no nodes at all for `ast.accept(visitor)`.
https://github.com/ruby/prism/commit/683513620a
|
|
https://github.com/ruby/prism/commit/d1094ac232
|
|
https://github.com/ruby/prism/commit/bf79206220
|
|
https://github.com/ruby/prism/commit/207f579e70
|
|
https://github.com/ruby/prism/commit/ee87ed08fb
|
|
https://github.com/ruby/prism/commit/7597aca76a
|
|
When creating the Ruby AST, we were previously allocating Location
objects for every node and every inner location. Instead, this
commit changes it to pack both the start offset and length into a
single u64 and pass that into the nodes. Then, when the locations
are requested via a reader method, we lazily allocate the Location
objects.
https://github.com/ruby/prism/commit/de203dca83
Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
|
|
https://github.com/ruby/prism/commit/241d0169da
|
|
test for it.
https://github.com/ruby/prism/commit/cfd4f28cb3
|
|
https://github.com/ruby/prism/commit/b7407ae3c0
|
|
|
|
* Faster that way:
$ ruby -Ilib -rprism -rbenchmark/ips -e 'Benchmark.ips { |x| x.report("parse") { Prism.parse("1 + 2") } }'
195.722k (± 0.5%) i/s
rb_iv_set():
179.609k (± 0.5%) i/s
rb_funcall():
190.030k (± 0.3%) i/s
before this PR:
183.319k (± 0.4%) i/s
|
|
LSPs need this because the protocol dictates that you return code
units for offsets. None of our existing APIs provided that
information, and since we hid the source it's not nearly as useful
for them. Now they can pass an encoding directly to:
* Location#start_code_units_offset
* Location#end_code_units_offset
* Location#start_code_units_column
* Location#end_code_units_column
https://github.com/ruby/prism/commit/4757a2cc06
Co-Authored-By: Vinicius Stock <vinicius.stock@shopify.com>
|
|
This is effectively an alias for "latest" right now. In the future
it will change to be its own enum value.
https://github.com/ruby/prism/commit/2c86036022
|
|
This PR fixes following error when using `version: latest` argument.
```console
$ ruby -rprism -e "p Prism.parse('-> { it }', version: 'latest')"
-e:1:in `parse': invalid version: latest (ArgumentError)
p Prism.parse('-> { it }', version: 'latest')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
from -e:1:in `<main>'
```
The argument `version: latest` in the added test is commented as potentially being
better replaced with `version: 3.4.0` in the future.
https://github.com/ruby/prism/commit/27b5c933cb
|
|
https://github.com/ruby/prism/commit/84c10f3a2d
|
|
https://github.com/ruby/prism/commit/19ffa0b980
|
|
https://github.com/ruby/prism/commit/1925b970c7
|
|
https://github.com/ruby/prism/commit/861689f6d1
|
|
https://github.com/ruby/prism/commit/c0331abe4f
|
|
https://github.com/ruby/prism/commit/78190d2999
|
|
https://github.com/ruby/prism/commit/b771c7f2ec
|
|
* 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
|
|
method calls
https://github.com/ruby/prism/commit/40cf114a24
|
|
https://github.com/ruby/prism/commit/e346fa583a
|
|
Add tests. Start parsing some simpler fixture code.
https://github.com/ruby/prism/commit/997f4191d8
|
|
https://github.com/ruby/prism/commit/1a15b70a8e
|
|
https://github.com/ruby/prism/commit/47a602dc1c
|
|
Part of issue #2354
https://github.com/ruby/prism/commit/cb28edae34
|
|
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
|
|
https://github.com/ruby/prism/commit/8c9bed2a4d
|
|
https://github.com/ruby/prism/commit/d08e140859
|
|
|
|
https://github.com/ruby/prism/commit/836a35f4af
|
|
https://github.com/ruby/prism/commit/6e432f3de5
|
|
This assert used to trip in the included test:
```
./miniruby --parser=prism -e ' "%W"\u" '
```
https://github.com/ruby/prism/commit/8c0f84db4f
|
|
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
|
|
https://github.com/ruby/prism/commit/56441b08e7
|
|
|
|
https://github.com/ruby/prism/commit/a35b8e45ee
|
|
https://github.com/ruby/prism/commit/f614863d79
|
|
https://github.com/ruby/prism/commit/8cdec8070c
|
|
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>
|
|
* Fixes https://github.com/ruby/prism/issues/2082
https://github.com/ruby/prism/commit/7a74576357
|
|
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
|
|
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
|
|
https://github.com/ruby/prism/commit/b4ba41bdcd
|
|
https://github.com/ruby/prism/commit/b9ebf987bd
|
|
https://github.com/ruby/prism/commit/c31eeba54c
|