[ruby/prism] Remove now-defunct semantic_field from nodes
https://github.com/ruby/prism/commit/c82a9dad64
This commit is contained in:
parent
2de0299839
commit
d06523bc52
@ -1772,7 +1772,6 @@ nodes:
|
|||||||
type: location
|
type: location
|
||||||
- name: content_loc
|
- name: content_loc
|
||||||
type: location
|
type: location
|
||||||
semantic_field: true # https://github.com/ruby/prism/issues/1452
|
|
||||||
- name: closing_loc
|
- name: closing_loc
|
||||||
type: location
|
type: location
|
||||||
- name: unescaped
|
- name: unescaped
|
||||||
@ -2093,7 +2092,6 @@ nodes:
|
|||||||
type: location
|
type: location
|
||||||
- name: content_loc
|
- name: content_loc
|
||||||
type: location
|
type: location
|
||||||
semantic_field: true # https://github.com/ruby/prism/issues/1452
|
|
||||||
- name: closing_loc
|
- name: closing_loc
|
||||||
type: location
|
type: location
|
||||||
- name: unescaped
|
- name: unescaped
|
||||||
@ -2287,10 +2285,8 @@ nodes:
|
|||||||
kind: StringFlags
|
kind: StringFlags
|
||||||
- name: opening_loc
|
- name: opening_loc
|
||||||
type: location?
|
type: location?
|
||||||
semantic_field: true # https://github.com/ruby/prism/issues/1452
|
|
||||||
- name: content_loc
|
- name: content_loc
|
||||||
type: location
|
type: location
|
||||||
semantic_field: true # https://github.com/ruby/prism/issues/1452
|
|
||||||
- name: closing_loc
|
- name: closing_loc
|
||||||
type: location?
|
type: location?
|
||||||
- name: unescaped
|
- name: unescaped
|
||||||
|
@ -6370,16 +6370,8 @@ escape_read(pm_parser_t *parser, pm_buffer_t *buffer, uint8_t flags) {
|
|||||||
extra_codepoints_start = unicode_start;
|
extra_codepoints_start = unicode_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(flags & PM_ESCAPE_FLAG_REGEXP)) {
|
||||||
uint32_t value = escape_unicode(unicode_start, hexadecimal_length);
|
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);
|
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) == '}') {
|
if (peek(parser) == '}') {
|
||||||
parser->current.end++;
|
parser->current.end++;
|
||||||
|
|
||||||
if (flags & PM_ESCAPE_FLAG_REGEXP) {
|
|
||||||
pm_buffer_append_u8(buffer, '}');
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
pm_parser_err(parser, unicode_codepoints_start, parser->current.end, PM_ERR_ESCAPE_INVALID_UNICODE_TERM);
|
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 {
|
} else {
|
||||||
pm_parser_err_current(parser, PM_ERR_ESCAPE_INVALID_UNICODE);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* fallthrough */
|
||||||
default: {
|
default: {
|
||||||
if (parser->current.end < parser->end) {
|
if (parser->current.end < parser->end) {
|
||||||
pm_buffer_append_u8(buffer, *parser->current.end++);
|
pm_buffer_append_u8(buffer, *parser->current.end++);
|
||||||
|
@ -136,7 +136,7 @@ module Prism
|
|||||||
# This represents a field on a node that is a location.
|
# This represents a field on a node that is a location.
|
||||||
class LocationField < Field
|
class LocationField < Field
|
||||||
def semantic_field?
|
def semantic_field?
|
||||||
options[:semantic_field] || false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
def rbs_class
|
def rbs_class
|
||||||
@ -151,7 +151,7 @@ module Prism
|
|||||||
# This represents a field on a node that is a location that is optional.
|
# This represents a field on a node that is a location that is optional.
|
||||||
class OptionalLocationField < Field
|
class OptionalLocationField < Field
|
||||||
def semantic_field?
|
def semantic_field?
|
||||||
options[:semantic_field] || false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
def rbs_class
|
def rbs_class
|
||||||
|
@ -162,8 +162,12 @@ module Prism
|
|||||||
# \u0000 \u0001 \u0002 ...
|
# \u0000 \u0001 \u0002 ...
|
||||||
assert_unescape(context, "u#{["5"].concat(hex.sample(3)).join}")
|
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} ...
|
# \u{00 00} ...
|
||||||
assert_unescape(context, "u{00#{["5"].concat(hex.sample(3)).join} \t\v 00#{["5"].concat(hex.sample(3)).join}}")
|
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|
|
(0...128).each do |ord|
|
||||||
chr = ord.chr
|
chr = ord.chr
|
||||||
|
Loading…
x
Reference in New Issue
Block a user