[ruby/prism] Remove now-defunct semantic_field from nodes

https://github.com/ruby/prism/commit/c82a9dad64
This commit is contained in:
Kevin Newton 2023-10-12 11:10:17 -04:00
parent 2de0299839
commit d06523bc52
5 changed files with 18 additions and 25 deletions

View File

@ -1772,7 +1772,6 @@ nodes:
type: location
- name: content_loc
type: location
semantic_field: true # https://github.com/ruby/prism/issues/1452
- name: closing_loc
type: location
- name: unescaped
@ -2093,7 +2092,6 @@ nodes:
type: location
- name: content_loc
type: location
semantic_field: true # https://github.com/ruby/prism/issues/1452
- name: closing_loc
type: location
- name: unescaped
@ -2287,10 +2285,8 @@ nodes:
kind: StringFlags
- name: opening_loc
type: location?
semantic_field: true # https://github.com/ruby/prism/issues/1452
- name: content_loc
type: location
semantic_field: true # https://github.com/ruby/prism/issues/1452
- name: closing_loc
type: location?
- name: unescaped

View File

@ -6370,16 +6370,8 @@ escape_read(pm_parser_t *parser, pm_buffer_t *buffer, uint8_t flags) {
extra_codepoints_start = unicode_start;
}
if (!(flags & PM_ESCAPE_FLAG_REGEXP)) {
uint32_t value = escape_unicode(unicode_start, hexadecimal_length);
if (flags & PM_ESCAPE_FLAG_REGEXP) {
if (codepoints_count == 1) {
pm_buffer_append_bytes(buffer, (const uint8_t *) "\\u{", 3);
} else {
pm_buffer_append_u8(buffer, ' ');
}
pm_buffer_append_bytes(buffer, unicode_start, hexadecimal_length);
} else {
escape_write_unicode(parser, buffer, unicode_start, parser->current.end, value);
}
@ -6393,13 +6385,13 @@ escape_read(pm_parser_t *parser, pm_buffer_t *buffer, uint8_t flags) {
if (peek(parser) == '}') {
parser->current.end++;
if (flags & PM_ESCAPE_FLAG_REGEXP) {
pm_buffer_append_u8(buffer, '}');
}
} else {
pm_parser_err(parser, unicode_codepoints_start, parser->current.end, PM_ERR_ESCAPE_INVALID_UNICODE_TERM);
}
if (flags & PM_ESCAPE_FLAG_REGEXP) {
pm_buffer_append_bytes(buffer, unicode_codepoints_start, (size_t) (parser->current.end - unicode_codepoints_start));
}
} else {
pm_parser_err_current(parser, PM_ERR_ESCAPE_INVALID_UNICODE);
}
@ -6508,6 +6500,7 @@ escape_read(pm_parser_t *parser, pm_buffer_t *buffer, uint8_t flags) {
return;
}
}
/* fallthrough */
default: {
if (parser->current.end < parser->end) {
pm_buffer_append_u8(buffer, *parser->current.end++);

View File

@ -136,7 +136,7 @@ module Prism
# This represents a field on a node that is a location.
class LocationField < Field
def semantic_field?
options[:semantic_field] || false
false
end
def rbs_class
@ -151,7 +151,7 @@ module Prism
# This represents a field on a node that is a location that is optional.
class OptionalLocationField < Field
def semantic_field?
options[:semantic_field] || false
false
end
def rbs_class

View File

@ -162,8 +162,12 @@ module Prism
# \u0000 \u0001 \u0002 ...
assert_unescape(context, "u#{["5"].concat(hex.sample(3)).join}")
# The behavior of whitespace in the middle of these escape sequences
# changed in Ruby 3.3.0, so we only want to test against latest.
if RUBY_VERSION >= "3.3.0"
# \u{00 00} ...
assert_unescape(context, "u{00#{["5"].concat(hex.sample(3)).join} \t\v 00#{["5"].concat(hex.sample(3)).join}}")
end
(0...128).each do |ord|
chr = ord.chr