summaryrefslogtreecommitdiff
path: root/prism/options.h
AgeCommit message (Collapse)Author
2025-12-18[ruby/prism] Add Ruby 4.1 as a version specifierEarlopain
https://github.com/ruby/prism/commit/138db9ccc4
2025-11-08[ruby/prism] Rename Ruby 3.5 to Ruby 4.0Earlopain
See https://github.com/ruby/ruby/commit/6d81969b475262aba251e99b518181bdf7c5a523 It leaves the old variant around. RuboCop for examples accesses `Prism::Translation::Parser35` to test against ruby-head. For now I left these simply as an alias https://github.com/ruby/prism/commit/d0a823f045
2025-11-07Prism update for 4.0Nobuyoshi Nakada
2025-09-12[ruby/prism] Add `\memberof` annotationsAlexander Momchilov
https://github.com/ruby/prism/commit/d1d2161219
2025-07-29[ruby/prism] Do not use `0` to indicate the latest ruby version to parseEarlopain
This makes it hard to do version checks against this value. The current version checks work because there are so few possible values at the moment. As an example, PR 3337 introduces new syntax for ruby 3.5 and uses `PM_OPTIONS_VERSION_LATEST` as its version guard. Because what is considered the latest changes every year, it must later be changed to `parser->version == parser->version == PM_OPTIONS_VERSION_CRUBY_3_5 || parser->version == PM_OPTIONS_VERSION_LATEST`, with one extra version each year. With this change, the PR can instead write `parser->version >= PM_OPTIONS_VERSION_CRUBY_3_5` which is self-explanatory and works for future versions. https://github.com/ruby/prism/commit/8318a113ca
2025-01-14[ruby/prism] Support forwarding flags on scopesKevin Newton
When parent scopes around an eval are forwarding parameters (like *, **, &, or ...) we need to know that information when we are in the parser. As such, we need to support passing that information into the scopes option. In order to do this, unfortunately we need a bunch of changes. The scopes option was previously an array of array of strings. These corresponded to the names of the locals in the parent scopes. We still support this, but now additionally support passing in a Prism::Scope instance at each index in the array. This Prism::Scope class holds both the names of the locals as well as an array of forwarding parameter names (symbols corresponding to the forwarding parameters). There is convenience function on the Prism module that creates a Prism::Scope object using Prism.scope. In JavaScript, we now additionally support an object much the same as the Ruby side. In Java, we now have a ParsingOptions.Scope class that holds that information. In the dump APIs, these objects in all 3 languages will add an additional byte for the forwarding flags in the middle of the scopes serialization. All of this is in service of properly parsing the following code: ```ruby def foo(*) = eval("bar(*)") ``` https://github.com/ruby/prism/commit/21abb6b7c4
2025-01-14[ruby/prism] Freeze AST optionKevin Newton
To make it so that you can pass `freeze: true` to Prism parse methods and get back a deeply-frozen AST that is Ractor- shareable. https://github.com/ruby/prism/commit/8e6a93b2d2
2025-01-11[ruby/prism] Support 3.5 for version optionKevin Newton
https://github.com/ruby/prism/commit/6b6aa05bfb
2024-09-24[ruby/prism] Accept version shorthand like 3.4Kevin Newton
https://github.com/ruby/prism/commit/098f1c4607
2024-09-20[ruby/prism] Introduce partial_script optionKevin Newton
https://github.com/ruby/prism/commit/b28877fa4f
2024-09-13[PRISM] Only parse shebang on main scriptKevin Newton
Fixes [Bug #20730] Notes: Merged: https://github.com/ruby/ruby/pull/11617
2024-08-14[ruby/prism] Callback on shebang switchesKevin Newton
Add the ability to receive a callback when the parser encounters a shebang that contains additional switches after the Ruby engine. This is necessary because some command-line flags may be present there that will alter the parse. https://github.com/ruby/prism/commit/afc5000331
2024-06-10[ruby/prism] Provide ability to lock encoding while parsingKevin Newton
https://github.com/ruby/prism/commit/f7faedfb3f
2024-05-01[ruby/prism] Support passing version 3.3.1Kevin Newton
https://github.com/ruby/prism/commit/445a0f0d22
2024-03-28[ruby/prism] CLI -x flagKevin Newton
https://github.com/ruby/prism/commit/2068e3c30a
2024-03-26[ruby/prism] Fix typosKoichi ITO
After finding the "if if" typo, some additional typos identified by running `codespell` are also being corrected: https://github.com/codespell-project/codespell https://github.com/ruby/prism/commit/e6a34cfeeb
2024-03-13[ruby/prism] Change `frozen_string_literal` to be a tri-stateJean Boussier
An explicit `false` is not equivalent to the comment being missing, because the default can be switched with a runtime flag: ```bash $ ruby --enable-frozen-string-literal -e 'p "foo".frozen?' true ``` https://github.com/ruby/prism/commit/4660f58775
2024-03-11[ruby/prism] Support offsetKevin Newton
https://github.com/ruby/prism/commit/665f533373
2024-02-29[ruby/prism] Command line options as a bitsetKevin Newton
https://github.com/ruby/prism/commit/369ffbd57e
2024-02-27[ruby/prism] Support -p, -n, -a, and -l command line optionsKevin Newton
https://github.com/ruby/prism/commit/959eb506ca
2024-02-17[ruby/prism] Fix up GCC analyzerKevin Newton
https://github.com/ruby/prism/commit/2e8bc17528
2024-02-01Sync to latest prismKevin Newton
2024-01-31[ruby/prism] Fix description of line parsing option and state it's 1-indexedAndrew Konchin
https://github.com/ruby/prism/commit/b2d2b91222
2024-01-17[ruby/prism] Document order of scopes in parsing optionsAndrew Konchin
https://github.com/ruby/prism/commit/908e92a695
2024-01-17[ruby/prism] Remove flag gating for 3.3.0 bug fixesKevin Newton
https://github.com/ruby/prism/commit/64baf94271
2024-01-02[ruby/prism] IndexTargetNode should always have ATTRIBUTE_WRITEKevin Newton
Because this is a user-facing change, we also need to deal with the fact that CRuby 3.3.0 was just released. In order to support workflows that want to parse exactly as CRuby parses in a specific version, this PR introduces a new option to the options struct that is "version". This allows you to specify that you want "3.3.0" parsing. I'm not sure if this is the correct solution. Another solution is to just fork and keep around the old branch for security patches. Or we could keep around a copy of the source files within this repository as another directory and only update when necessary. There are a lot of potential solutions here. Because this change is so small and the check for it is so minimal, I've decided to go with this enum. If this ends up entirely cluttering the codebase with version checks, we'll come up with another solution. But for now this works, so we're going to go in this direction for a bit until we determine it's no longer working. https://github.com/ruby/prism/commit/d8c7e6bd10
2023-11-29[ruby/prism] Convert start line to signed integersJean Boussier
Ruby allows for 0 or negative line start, this is often used with `eval` calls to get a correct offset when prefixing a snippet. e.g. ```ruby caller = caller_locations(1, 1).first class_eval <<~RUBY, caller.path, caller.line - 2 # frozen_string_literal: true def some_method #{caller_provided_code_snippet} end RUBY ``` https://github.com/ruby/prism/commit/0d14ed1452
2023-11-03[ruby/prism] Fix up lintKevin Newton
https://github.com/ruby/prism/commit/4f3a3e3ec1
2023-11-03[ruby/prism] Wire up options through the Java parserKevin Newton
https://github.com/ruby/prism/commit/13fa262669
2023-11-03[ruby/prism] Wire up options through the FFI APIKevin Newton
https://github.com/ruby/prism/commit/f0aa8ad93b
2023-11-03[ruby/prism] Create an options struct for passing all of the possible optionsKevin Newton
https://github.com/ruby/prism/commit/99e81619de