summaryrefslogtreecommitdiff
path: root/test/prism
AgeCommit message (Collapse)Author
2024-02-18[ruby/prism] Split up comments between leading and trailingKevin Newton
Also make them lazy to allocate the array, and also expose ParseResult#encoding. https://github.com/ruby/prism/commit/08ec7683ae
2024-02-17[ruby/prism] Fix visitor in desugar testBenoit Daloze
* 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
2024-02-16[ruby/prism] Ignore incorrect filesKevin Newton
https://github.com/ruby/prism/commit/d1094ac232
2024-02-16[ruby/prism] Fix block_pass for []=Kevin Newton
https://github.com/ruby/prism/commit/bf79206220
2024-02-16[ruby/prism] More rescue and ensure; constant handlingNoah Gibbs
https://github.com/ruby/prism/commit/207f579e70
2024-02-16[ruby/prism] Add warning for assignments to literals in conditionalsHaldun Bayhantopcu
https://github.com/ruby/prism/commit/ee87ed08fb
2024-02-16[ruby/prism] Fix lexing of `foo!` when it's a first thing to parseMax Prokopiev
https://github.com/ruby/prism/commit/7597aca76a
2024-02-15[ruby/prism] Speed up creating Ruby ASTKevin Newton
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>
2024-02-15[ruby/prism] Fix opening loc for an empty symbolMax Prokopiev
https://github.com/ruby/prism/commit/241d0169da
2024-02-15[ruby/prism] Handle more aliases. Better testing of prism ripper CLI and a ↵Noah Gibbs
test for it. https://github.com/ruby/prism/commit/cfd4f28cb3
2024-02-15[ruby/prism] Fix parsing rescue modifierHaldun Bayhantopcu
https://github.com/ruby/prism/commit/b7407ae3c0
2024-02-15Temporarily update the error message format in prismYusuke Endoh
2024-02-14Initialize the Prism::Source directly with all 3 fields for the C extensionBenoit Daloze
* 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
2024-02-13[ruby/prism] Add code unit APIs to locationKevin Newton
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>
2024-02-13[ruby/prism] Introduce `version: "3.4.0"`Kevin Newton
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
2024-02-13[ruby/prism] Fix an error when specifying the parsing version `latest`Koichi ITO
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
2024-02-13[ruby/prism] Fix `full_name` for constant path targetsVinicius Stock
https://github.com/ruby/prism/commit/84c10f3a2d
2024-02-12[ruby/prism] Error messages closer to CRubyKevin Newton
https://github.com/ruby/prism/commit/19ffa0b980
2024-02-12[ruby/prism] ruby_parser translatorKevin Newton
https://github.com/ruby/prism/commit/1925b970c7
2024-02-12[ruby/prism] Fix unary not locationKevin Newton
https://github.com/ruby/prism/commit/861689f6d1
2024-02-12[ruby/prism] Move Prism::RipperCompat to Prism::Translation::RipperNoah Gibbs
https://github.com/ruby/prism/commit/c0331abe4f
2024-02-12[ruby/prism] Unary not name locationKevin Newton
https://github.com/ruby/prism/commit/78190d2999
2024-02-09[ruby/prism] RipperCompat: add array-refs, assigns, symbols, stringsNoah Gibbs
https://github.com/ruby/prism/commit/b771c7f2ec
2024-02-08[ruby/prism] RipperCompat: support for more features.Noah Gibbs
* 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-07[ruby/prism] More different block-call syntaxes, support more types of ↵Noah Gibbs
method calls https://github.com/ruby/prism/commit/40cf114a24
2024-02-07[ruby/prism] Support &. calls and calling with blocks, test with fixturesNoah Gibbs
https://github.com/ruby/prism/commit/e346fa583a
2024-02-07[ruby/prism] RipperCompat: support more kinds of method calls and operators.Noah Gibbs
Add tests. Start parsing some simpler fixture code. https://github.com/ruby/prism/commit/997f4191d8
2024-02-07[ruby/prism] Support for Ruby 2.7Kevin Newton
https://github.com/ruby/prism/commit/1a15b70a8e
2024-02-07[ruby/prism] Even more ripper compatKevin Newton
https://github.com/ruby/prism/commit/47a602dc1c
2024-02-07[ruby/prism] More visitors and tests for RipperCompatNoah Gibbs
Part of issue #2354 https://github.com/ruby/prism/commit/cb28edae34
2024-02-06[ruby/prism] Implement file parsing error handlingeileencodes
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[ruby/prism] Better invalid token messagesKevin Newton
https://github.com/ruby/prism/commit/8c9bed2a4d
2024-02-05[ruby/prism] Change the location of an implicit begin to methodKevin Newton
https://github.com/ruby/prism/commit/d08e140859
2024-02-05Sync to latest prismKevin Newton
2024-02-02[ruby/prism] Fix up multibyte escapesKevin Newton
https://github.com/ruby/prism/commit/836a35f4af
2024-02-02[ruby/prism] Turn off LibrarySymbolsTest on powerpc64leKevin Newton
https://github.com/ruby/prism/commit/6e432f3de5
2024-02-01[ruby/prism] Amend assert in pm_utf_8_codepoint(), n=0 is fineAlan Wu
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[ruby/prism] Remove locals_body_indexKevin Newton
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[ruby/prism] Check literals for receiverHaldun Bayhantopcu
https://github.com/ruby/prism/commit/56441b08e7
2024-01-30Update forwarding locals for prismAaron Patterson
2024-01-30[ruby/prism] Better error messages for unexpected tokens in prefixKevin Newton
https://github.com/ruby/prism/commit/a35b8e45ee
2024-01-29[ruby/prism] Fix binding power for modifier rescueKevin Newton
https://github.com/ruby/prism/commit/f614863d79
2024-01-27[ruby/prism] Add parser translationKevin Newton
https://github.com/ruby/prism/commit/8cdec8070c
2024-01-27[ruby/prism] Error follow-upKevin Newton
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-26[ruby/prism] Add level to warnings and errors to categorize themBenoit Daloze
* Fixes https://github.com/ruby/prism/issues/2082 https://github.com/ruby/prism/commit/7a74576357
2024-01-26[ruby/prism] Symbol encoding follow-upKevin Newton
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[ruby/prism] Track whether a Symbol should have its encoding changed from ↵Kevin Menard
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[ruby/prism] Fix multiple assigns with newlinesHaldun Bayhantopcu
https://github.com/ruby/prism/commit/b4ba41bdcd
2024-01-26[ruby/prism] Add testsHaldun Bayhantopcu
https://github.com/ruby/prism/commit/b9ebf987bd
2024-01-26[ruby/prism] Change binding power for modifiers in case-in nodesMax Prokopiev
https://github.com/ruby/prism/commit/c31eeba54c