Skip to content

Commit 74b5caa

Browse files
committed
Parse using Ruby 3.3 syntax
1 parent 7fd1860 commit 74b5caa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

parser/prism/Parser.h

+4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@ class Node;
1616

1717
// A backing implemenation detail of `Parser`, which stores a Prism parser and its options in a single allocation.
1818
struct ParserStorage {
19+
// The version of Ruby syntax that we're parsing with Prism. This determines what syntax is supported or not.
20+
static constexpr std::string_view ParsedRubyVersion = "3.3.0";
1921
pm_parser_t parser;
2022
pm_options_t options;
2123

2224
ParserStorage(std::string_view source_code) : parser{}, options{} {
25+
pm_options_version_set(&options, ParsedRubyVersion.data(), ParsedRubyVersion.size());
26+
2327
pm_parser_init(&parser, reinterpret_cast<const uint8_t *>(source_code.data()), source_code.size(), &options);
2428
}
2529

0 commit comments

Comments
 (0)