Skip to content

Commit a9237d1

Browse files
Earlopainfroydnj
authored andcommitted
Rename pm_newline_list_t to pm_line_offset_list_t
Co-Authored-By: Nathan Froyd <froydnj@gmail.com>
1 parent 4f5805f commit a9237d1

File tree

17 files changed

+188
-188
lines changed

17 files changed

+188
-188
lines changed

common.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ PRISM_FILES = prism/api_node.$(OBJEXT) \
105105
prism/util/pm_char.$(OBJEXT) \
106106
prism/util/pm_constant_pool.$(OBJEXT) \
107107
prism/util/pm_integer.$(OBJEXT) \
108+
prism/util/pm_line_offset_list.$(OBJEXT) \
108109
prism/util/pm_list.$(OBJEXT) \
109110
prism/util/pm_memchr.$(OBJEXT) \
110-
prism/util/pm_newline_list.$(OBJEXT) \
111111
prism/util/pm_string.$(OBJEXT) \
112112
prism/util/pm_strncasecmp.$(OBJEXT) \
113113
prism/util/pm_strpbrk.$(OBJEXT) \

depend

Lines changed: 42 additions & 42 deletions
Large diffs are not rendered by default.

iseq.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ rb_iseq_new_top(const VALUE ast_value, VALUE name, VALUE path, VALUE realpath, c
982982
rb_iseq_t *
983983
pm_iseq_new_top(pm_scope_node_t *node, VALUE name, VALUE path, VALUE realpath, const rb_iseq_t *parent, int *error_state)
984984
{
985-
iseq_new_setup_coverage(path, (int) (node->parser->newline_list.size - 1));
985+
iseq_new_setup_coverage(path, (int) (node->parser->line_offsets.size - 1));
986986

987987
return pm_iseq_new_with_opt(node, name, path, realpath, 0, parent, 0,
988988
ISEQ_TYPE_TOP, &COMPILE_OPTION_DEFAULT, error_state);
@@ -1006,7 +1006,7 @@ rb_iseq_new_main(const VALUE ast_value, VALUE path, VALUE realpath, const rb_ise
10061006
rb_iseq_t *
10071007
pm_iseq_new_main(pm_scope_node_t *node, VALUE path, VALUE realpath, const rb_iseq_t *parent, int opt, int *error_state)
10081008
{
1009-
iseq_new_setup_coverage(path, (int) (node->parser->newline_list.size - 1));
1009+
iseq_new_setup_coverage(path, (int) (node->parser->line_offsets.size - 1));
10101010

10111011
return pm_iseq_new_with_opt(node, rb_fstring_lit("<main>"),
10121012
path, realpath, 0,
@@ -1035,7 +1035,7 @@ pm_iseq_new_eval(pm_scope_node_t *node, VALUE name, VALUE path, VALUE realpath,
10351035
if (rb_get_coverage_mode() & COVERAGE_TARGET_EVAL) {
10361036
VALUE coverages = rb_get_coverages();
10371037
if (RTEST(coverages) && RTEST(path) && !RTEST(rb_hash_has_key(coverages, path))) {
1038-
iseq_setup_coverage(coverages, path, ((int) (node->parser->newline_list.size - 1)) + first_lineno - 1);
1038+
iseq_setup_coverage(coverages, path, ((int) (node->parser->line_offsets.size - 1)) + first_lineno - 1);
10391039
}
10401040
}
10411041

@@ -1145,8 +1145,8 @@ pm_iseq_new_with_opt(pm_scope_node_t *node, VALUE name, VALUE path, VALUE realpa
11451145
pm_location_t *location = &node->base.location;
11461146
int32_t start_line = node->parser->start_line;
11471147

1148-
pm_line_column_t start = pm_newline_list_line_column(&node->parser->newline_list, location->start, start_line);
1149-
pm_line_column_t end = pm_newline_list_line_column(&node->parser->newline_list, location->start + location->length, start_line);
1148+
pm_line_column_t start = pm_line_offset_list_line_column(&node->parser->line_offsets, location->start, start_line);
1149+
pm_line_column_t end = pm_line_offset_list_line_column(&node->parser->line_offsets, location->start + location->length, start_line);
11501150

11511151
rb_code_location_t code_location = (rb_code_location_t) {
11521152
.beg_pos = { .lineno = (int) start.line, .column = (int) start.column },

lib/prism/prism.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Gem::Specification.new do |spec|
6161
"include/prism/util/pm_integer.h",
6262
"include/prism/util/pm_list.h",
6363
"include/prism/util/pm_memchr.h",
64-
"include/prism/util/pm_newline_list.h",
64+
"include/prism/util/pm_line_offset_list.h",
6565
"include/prism/util/pm_strncasecmp.h",
6666
"include/prism/util/pm_string.h",
6767
"include/prism/util/pm_strpbrk.h",
@@ -154,7 +154,7 @@ Gem::Specification.new do |spec|
154154
"src/util/pm_integer.c",
155155
"src/util/pm_list.c",
156156
"src/util/pm_memchr.c",
157-
"src/util/pm_newline_list.c",
157+
"src/util/pm_line_offset_list.c",
158158
"src/util/pm_string.c",
159159
"src/util/pm_strncasecmp.c",
160160
"src/util/pm_strpbrk.c"

prism/extension.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ parse_lex_input(pm_string_t *input, const pm_options_t *options, bool return_nod
741741
pm_parser_register_encoding_changed_callback(&parser, parse_lex_encoding_changed_callback);
742742

743743
VALUE source_string = rb_str_new((const char *) pm_string_source(input), pm_string_length(input));
744-
VALUE offsets = rb_ary_new_capa(parser.newline_list.size);
744+
VALUE offsets = rb_ary_new_capa(parser.line_offsets.size);
745745
VALUE source = rb_funcall(rb_cPrismSource, rb_id_source_for, 3, source_string, LONG2NUM(parser.start_line), offsets);
746746

747747
parse_lex_data_t parse_lex_data = {
@@ -767,8 +767,8 @@ parse_lex_input(pm_string_t *input, const pm_options_t *options, bool return_nod
767767
rb_encoding *encoding = rb_enc_find(parser.encoding->name);
768768
rb_enc_associate(source_string, encoding);
769769

770-
for (size_t index = 0; index < parser.newline_list.size; index++) {
771-
rb_ary_push(offsets, ULONG2NUM(parser.newline_list.offsets[index]));
770+
for (size_t index = 0; index < parser.line_offsets.size; index++) {
771+
rb_ary_push(offsets, ULONG2NUM(parser.line_offsets.offsets[index]));
772772
}
773773

774774
if (options->freeze) {

prism/parser.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "prism/static_literals.h"
1414
#include "prism/util/pm_constant_pool.h"
1515
#include "prism/util/pm_list.h"
16-
#include "prism/util/pm_newline_list.h"
16+
#include "prism/util/pm_line_offset_list.h"
1717
#include "prism/util/pm_string.h"
1818

1919
#include <stdbool.h>
@@ -782,8 +782,8 @@ struct pm_parser {
782782
*/
783783
pm_constant_pool_t constant_pool;
784784

785-
/** This is the list of newline offsets in the source file. */
786-
pm_newline_list_t newline_list;
785+
/** This is the list of line offsets in the source file. */
786+
pm_line_offset_list_t line_offsets;
787787

788788
/**
789789
* We want to add a flag to integer nodes that indicates their base. We only

0 commit comments

Comments
 (0)