diff options
author | Kevin Newton <kddnewton@gmail.com> | 2023-10-12 11:10:17 -0400 |
---|---|---|
committer | Kevin Newton <kddnewton@gmail.com> | 2023-10-13 15:31:30 -0400 |
commit | d06523bc52a4486db4193d7a6771e76c31157777 (patch) | |
tree | 02ae9cc3e89c4f98fbc3640c1c7f8e8d4d764925 /prism | |
parent | 2de0299839e01f3f96554dc55ed20437553326ac (diff) | |
download | ruby-d06523bc52a4486db4193d7a6771e76c31157777.tar.gz |
[ruby/prism] Remove now-defunct semantic_field from nodes
https://github.com/ruby/prism/commit/c82a9dad64
Diffstat (limited to 'prism')
-rw-r--r-- | prism/config.yml | 4 | ||||
-rw-r--r-- | prism/prism.c | 21 | ||||
-rw-r--r-- | prism/templates/lib/prism/compiler.rb.erb | 2 | ||||
-rwxr-xr-x | prism/templates/template.rb | 4 |
4 files changed, 10 insertions, 21 deletions
diff --git a/prism/config.yml b/prism/config.yml index 3b402b617b..ad6ec1b707 100644 --- a/prism/config.yml +++ b/prism/config.yml @@ -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 diff --git a/prism/prism.c b/prism/prism.c index f3b9404358..ef1fff147a 100644 --- a/prism/prism.c +++ b/prism/prism.c @@ -6370,16 +6370,8 @@ escape_read(pm_parser_t *parser, pm_buffer_t *buffer, uint8_t flags) { extra_codepoints_start = unicode_start; } - 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 { + if (!(flags & PM_ESCAPE_FLAG_REGEXP)) { + uint32_t value = escape_unicode(unicode_start, hexadecimal_length); 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++); diff --git a/prism/templates/lib/prism/compiler.rb.erb b/prism/templates/lib/prism/compiler.rb.erb index 03b8dfbb92..2c947f6ed2 100644 --- a/prism/templates/lib/prism/compiler.rb.erb +++ b/prism/templates/lib/prism/compiler.rb.erb @@ -33,7 +33,7 @@ module Prism end <%- nodes.each_with_index do |node, index| -%> - <%= "\n" if index != 0 -%> +<%= "\n" if index != 0 -%> # Compile a <%= node.name %> node alias visit_<%= node.human %> visit_child_nodes <%- end -%> diff --git a/prism/templates/template.rb b/prism/templates/template.rb index b2f6525eec..ac71191d77 100755 --- a/prism/templates/template.rb +++ b/prism/templates/template.rb @@ -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 |