summaryrefslogtreecommitdiff
path: root/prism/parser.h
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2024-01-02 11:18:29 -0500
committergit <svn-admin@ruby-lang.org>2024-01-02 18:51:18 +0000
commit23beceedb76a47b3f4497809eefb7338690df191 (patch)
treee482db37df537fe2548b906c29b3f376b365555c /prism/parser.h
parent04f64608e8bfb50f62633864e68f83b2a6099714 (diff)
[ruby/prism] IndexTargetNode should always have ATTRIBUTE_WRITE
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
Diffstat (limited to 'prism/parser.h')
-rw-r--r--prism/parser.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/prism/parser.h b/prism/parser.h
index 2c58131b19..9f38dc5830 100644
--- a/prism/parser.h
+++ b/prism/parser.h
@@ -9,6 +9,7 @@
#include "prism/ast.h"
#include "prism/defines.h"
#include "prism/encoding.h"
+#include "prism/options.h"
#include "prism/util/pm_constant_pool.h"
#include "prism/util/pm_list.h"
#include "prism/util/pm_newline_list.h"
@@ -662,6 +663,12 @@ struct pm_parser {
*/
const pm_encoding_t *explicit_encoding;
+ /** The current parameter name id on parsing its default value. */
+ pm_constant_id_t current_param_name;
+
+ /** The version of prism that we should use to parse. */
+ pm_options_version_t version;
+
/** Whether or not we're at the beginning of a command. */
bool command_start;
@@ -684,9 +691,6 @@ struct pm_parser {
/** This flag indicates that we are currently parsing a keyword argument. */
bool in_keyword_arg;
- /** The current parameter name id on parsing its default value. */
- pm_constant_id_t current_param_name;
-
/**
* Whether or not the parser has seen a token that has semantic meaning
* (i.e., a token that is not a comment or whitespace).