Skip to content

Commit

Permalink
[ruby/prism] Correct escapes when ctrl+meta+escape
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton authored and matzbot committed Dec 11, 2023
1 parent e186ceb commit 261e8f2
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions prism/prism.c
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 261e8f2

Please sign in to comment.