summaryrefslogtreecommitdiff
path: root/ast.c
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2021-08-20 16:18:36 +0900
committerYusuke Endoh <mame@ruby-lang.org>2021-08-20 16:18:36 +0900
commitcad83fa3c4491153df0561b06bb261e25a831d0f (patch)
treebfd9978fbf6d6971c34cfa40bf2b3ce673377ed3 /ast.c
parent4c93c124c29465e49343b47c935be99ad67a7d83 (diff)
ast.c: Rename "save_script_lines" to "keep_script_lines"
... as per ko1's preference. He is preparing to extend this feature to ISeq for his new debugger. He prefers "keep" to "save" for this wording. This API is internal and not included in any released version, so I change it in advance.
Diffstat (limited to 'ast.c')
-rw-r--r--ast.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/ast.c b/ast.c
index 20c4588cd7..0b6791d221 100644
--- a/ast.c
+++ b/ast.c
@@ -64,8 +64,8 @@ ast_new_internal(rb_ast_t *ast, const NODE *node)
return obj;
}
-static VALUE rb_ast_parse_str(VALUE str, VALUE save_script_lines);
-static VALUE rb_ast_parse_file(VALUE path, VALUE save_script_lines);
+static VALUE rb_ast_parse_str(VALUE str, VALUE keep_script_lines);
+static VALUE rb_ast_parse_file(VALUE path, VALUE keep_script_lines);
static VALUE
ast_parse_new(void)
@@ -85,31 +85,31 @@ ast_parse_done(rb_ast_t *ast)
}
static VALUE
-ast_s_parse(rb_execution_context_t *ec, VALUE module, VALUE str, VALUE save_script_lines)
+ast_s_parse(rb_execution_context_t *ec, VALUE module, VALUE str, VALUE keep_script_lines)
{
- return rb_ast_parse_str(str, save_script_lines);
+ return rb_ast_parse_str(str, keep_script_lines);
}
static VALUE
-rb_ast_parse_str(VALUE str, VALUE save_script_lines)
+rb_ast_parse_str(VALUE str, VALUE keep_script_lines)
{
rb_ast_t *ast = 0;
StringValue(str);
VALUE vparser = ast_parse_new();
- if (RTEST(save_script_lines)) rb_parser_save_script_lines(vparser);
+ if (RTEST(keep_script_lines)) rb_parser_keep_script_lines(vparser);
ast = rb_parser_compile_string_path(vparser, Qnil, str, 1);
return ast_parse_done(ast);
}
static VALUE
-ast_s_parse_file(rb_execution_context_t *ec, VALUE module, VALUE path, VALUE save_script_lines)
+ast_s_parse_file(rb_execution_context_t *ec, VALUE module, VALUE path, VALUE keep_script_lines)
{
- return rb_ast_parse_file(path, save_script_lines);
+ return rb_ast_parse_file(path, keep_script_lines);
}
static VALUE
-rb_ast_parse_file(VALUE path, VALUE save_script_lines)
+rb_ast_parse_file(VALUE path, VALUE keep_script_lines)
{
VALUE f;
rb_ast_t *ast = 0;
@@ -119,7 +119,7 @@ rb_ast_parse_file(VALUE path, VALUE save_script_lines)
f = rb_file_open_str(path, "r");
rb_funcall(f, rb_intern("set_encoding"), 2, rb_enc_from_encoding(enc), rb_str_new_cstr("-"));
VALUE vparser = ast_parse_new();
- if (RTEST(save_script_lines)) rb_parser_save_script_lines(vparser);
+ if (RTEST(keep_script_lines)) rb_parser_keep_script_lines(vparser);
ast = rb_parser_compile_file_path(vparser, Qnil, f, 1);
rb_io_close(f);
return ast_parse_done(ast);
@@ -139,13 +139,13 @@ lex_array(VALUE array, int index)
}
static VALUE
-rb_ast_parse_array(VALUE array, VALUE save_script_lines)
+rb_ast_parse_array(VALUE array, VALUE keep_script_lines)
{
rb_ast_t *ast = 0;
array = rb_check_array_type(array);
VALUE vparser = ast_parse_new();
- if (RTEST(save_script_lines)) rb_parser_save_script_lines(vparser);
+ if (RTEST(keep_script_lines)) rb_parser_keep_script_lines(vparser);
ast = rb_parser_compile_generic(vparser, lex_array, Qnil, array, 1);
return ast_parse_done(ast);
}
@@ -193,7 +193,7 @@ script_lines(VALUE path)
}
static VALUE
-ast_s_of(rb_execution_context_t *ec, VALUE module, VALUE body, VALUE save_script_lines)
+ast_s_of(rb_execution_context_t *ec, VALUE module, VALUE body, VALUE keep_script_lines)
{
VALUE path, node, lines;
int node_id;
@@ -221,13 +221,13 @@ ast_s_of(rb_execution_context_t *ec, VALUE module, VALUE body, VALUE save_script
}
if (!NIL_P(lines = script_lines(path))) {
- node = rb_ast_parse_array(lines, save_script_lines);
+ node = rb_ast_parse_array(lines, keep_script_lines);
}
else if (RSTRING_LEN(path) == 2 && memcmp(RSTRING_PTR(path), "-e", 2) == 0) {
- node = rb_ast_parse_str(rb_e_script, save_script_lines);
+ node = rb_ast_parse_str(rb_e_script, keep_script_lines);
}
else {
- node = rb_ast_parse_file(path, save_script_lines);
+ node = rb_ast_parse_file(path, keep_script_lines);
}
return node_find(node, node_id);