summaryrefslogtreecommitdiff
path: root/internal/parse.h
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2024-10-02 19:08:54 +0900
committerNobuyoshi Nakada <[email protected]>2024-10-02 20:43:40 +0900
commit3e1021b1448a5820d387795e065ae25b9da5abdf (patch)
treecc6aa2d9241c7fb18531add8f859a8b01e43da28 /internal/parse.h
parent4e219d8f7d3e76cf60e747dc16deb3452f297442 (diff)
Make default parser enum and define getter/setter
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11761
Diffstat (limited to 'internal/parse.h')
-rw-r--r--internal/parse.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/internal/parse.h b/internal/parse.h
index e0c81f4f96..de42acbed9 100644
--- a/internal/parse.h
+++ b/internal/parse.h
@@ -13,11 +13,15 @@
#include "internal/static_assert.h"
// The default parser to use for Ruby code.
-// 0: parse.y
-// 1: Prism
-#ifndef RB_DEFAULT_PARSER
-#define RB_DEFAULT_PARSER 1
-#endif
+typedef enum {
+ RB_DEFAULT_PARSER_PARSE_Y,
+ RB_DEFAULT_PARSER_PRISM,
+} ruby_default_parser_enum;
+
+ruby_default_parser_enum rb_ruby_default_parser(void);
+void rb_ruby_default_parser_set(ruby_default_parser_enum parser);
+
+#define rb_ruby_prism_p() (rb_ruby_default_parser() == RB_DEFAULT_PARSER_PRISM)
#ifdef UNIVERSAL_PARSER
#define rb_encoding const void