summaryrefslogtreecommitdiff
path: root/prism
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2023-12-11 08:50:59 -0500
committergit <svn-admin@ruby-lang.org>2023-12-11 16:34:27 +0000
commit261e8f28a0ccc6119fe38189a55388520969d8ff (patch)
treeef38e4cce306b8f84a5fbc994b4f319ff81f5ea6 /prism
parente186cebe420367947b89a5221491429452d724d5 (diff)
[ruby/prism] Correct escapes when ctrl+meta+escape
https://github.com/ruby/prism/commit/ee68b17c01
Diffstat (limited to 'prism')
-rw-r--r--prism/prism.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/prism/prism.c b/prism/prism.c
index 747e1bb978..1cc999e31e 100644
--- a/prism/prism.c
+++ b/prism/prism.c
@@ -7372,57 +7372,57 @@ escape_read(pm_parser_t *parser, pm_buffer_t *buffer, uint8_t flags) {
switch (peek(parser)) {
case '\\': {
parser->current.end++;
- pm_buffer_append_byte(buffer, '\\');
+ escape_write_byte_encoded(parser, buffer, escape_byte('\\', flags));
return;
}
case '\'': {
parser->current.end++;
- pm_buffer_append_byte(buffer, '\'');
+ escape_write_byte_encoded(parser, buffer, escape_byte('\'', flags));
return;
}
case 'a': {
parser->current.end++;
- pm_buffer_append_byte(buffer, '\a');
+ escape_write_byte_encoded(parser, buffer, escape_byte('\a', flags));
return;
}
case 'b': {
parser->current.end++;
- pm_buffer_append_byte(buffer, '\b');
+ escape_write_byte_encoded(parser, buffer, escape_byte('\b', flags));
return;
}
case 'e': {
parser->current.end++;
- pm_buffer_append_byte(buffer, '\033');
+ escape_write_byte_encoded(parser, buffer, escape_byte('\033', flags));
return;
}
case 'f': {
parser->current.end++;
- pm_buffer_append_byte(buffer, '\f');
+ escape_write_byte_encoded(parser, buffer, escape_byte('\f', flags));
return;
}
case 'n': {
parser->current.end++;
- pm_buffer_append_byte(buffer, '\n');
+ escape_write_byte_encoded(parser, buffer, escape_byte('\n', flags));
return;
}
case 'r': {
parser->current.end++;
- pm_buffer_append_byte(buffer, '\r');
+ escape_write_byte_encoded(parser, buffer, escape_byte('\r', flags));
return;
}
case 's': {
parser->current.end++;
- pm_buffer_append_byte(buffer, ' ');
+ escape_write_byte_encoded(parser, buffer, escape_byte(' ', flags));
return;
}
case 't': {
parser->current.end++;
- pm_buffer_append_byte(buffer, '\t');
+ escape_write_byte_encoded(parser, buffer, escape_byte('\t', flags));
return;
}
case 'v': {
parser->current.end++;
- pm_buffer_append_byte(buffer, '\v');
+ escape_write_byte_encoded(parser, buffer, escape_byte('\v', flags));
return;
}
case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': {
@@ -7656,7 +7656,7 @@ escape_read(pm_parser_t *parser, pm_buffer_t *buffer, uint8_t flags) {
case '\r': {
if (peek_offset(parser, 1) == '\n') {
parser->current.end += 2;
- pm_buffer_append_byte(buffer, '\n');
+ escape_write_byte_encoded(parser, buffer, escape_byte('\n', flags));
return;
}
}