diff options
author | Thomas E. Enebo <[email protected]> | 2023-07-27 14:46:19 -0400 |
---|---|---|
committer | Takashi Kokubun <[email protected]> | 2023-08-16 17:47:32 -0700 |
commit | 76c77b5eca3f02db894819823d3a1ab55455754d (patch) | |
tree | 1719a0bbe3cbe627e240a73d9e7ef479d45810de /yarp/extension.c | |
parent | 0f8091947debc467b58a2b04c150dc7a38026ed3 (diff) |
[ruby/yarp] WIP - Introduce contextually parsing programs vs evals
This is more or less the code I used in my POC in JRuby
to parse evals. Evals depend on parent variable scopes
and will produce a different syntax tree.
Questions:
1. How does MRI compile evals currently? I cannot find anything.
2. This passes in a char * of data. It does not encode the
variables we pass in because the system calling this already
knows. Is this adequate though?
3. Can I get guidance on how best to test this?
https://github.com/ruby/yarp/commit/f441b6fd2c
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/8226
Diffstat (limited to 'yarp/extension.c')
-rw-r--r-- | yarp/extension.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/yarp/extension.c b/yarp/extension.c index 4e801b3b05..7ede50bb0f 100644 --- a/yarp/extension.c +++ b/yarp/extension.c @@ -194,7 +194,7 @@ dump_input(input_t *input, const char *filepath) { yp_parser_t parser; yp_parser_init(&parser, input->source, input->size, filepath); - yp_node_t *node = yp_parse(&parser); + yp_node_t *node = yp_parse(&parser, false); yp_serialize(&parser, node, &buffer); VALUE result = rb_str_new(buffer.value, buffer.length); @@ -378,7 +378,7 @@ lex_input(input_t *input, const char *filepath) { }; parser.lex_callback = &lex_callback; - yp_node_t *node = yp_parse(&parser); + yp_node_t *node = yp_parse(&parser, false); // Here we need to update the source range to have the correct newline // offsets. We do it here because we've already created the object and given @@ -439,7 +439,7 @@ parse_input(input_t *input, const char *filepath) { yp_parser_t parser; yp_parser_init(&parser, input->source, input->size, filepath); - yp_node_t *node = yp_parse(&parser); + yp_node_t *node = yp_parse(&parser, false); rb_encoding *encoding = rb_enc_find(parser.encoding.name); VALUE source = yp_source_new(&parser); @@ -582,7 +582,7 @@ memsize(VALUE self, VALUE string) { size_t length = RSTRING_LEN(string); yp_parser_init(&parser, RSTRING_PTR(string), length, NULL); - yp_node_t *node = yp_parse(&parser); + yp_node_t *node = yp_parse(&parser, false); yp_memsize_t memsize; yp_node_memsize(node, &memsize); @@ -608,7 +608,7 @@ profile_file(VALUE self, VALUE filepath) { yp_parser_t parser; yp_parser_init(&parser, input.source, input.size, checked); - yp_node_t *node = yp_parse(&parser); + yp_node_t *node = yp_parse(&parser, false); yp_node_destroy(&parser, node); yp_parser_free(&parser); |