Skip to content

Commit 2976415

Browse files
Earlopainmatzbot
authored andcommitted
[ruby/prism] Fix multibyte non-alphanumeric chars for bare percent string literals
Alphanumerics are correctly handled in the check below by simply discarding the `%`. The same was not true for the other types, which caused some assumption to no longer hold. ruby/prism@69a9a36a6a
1 parent 99b9983 commit 2976415

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

prism/prism.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11094,6 +11094,7 @@ parser_lex(pm_parser_t *parser) {
1109411094
if (!parser->encoding->alnum_char(parser->current.end, parser->end - parser->current.end)) {
1109511095
if (*parser->current.end >= 0x80) {
1109611096
pm_parser_err_current(parser, PM_ERR_INVALID_PERCENT);
11097+
goto lex_next_token;
1109711098
}
1109811099

1109911100
const uint8_t delimiter = pm_lex_percent_delimiter(parser);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
^ unknown type of %string
3+
â
4+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
%💎
2+
^ unknown type of %string
3+
💎
4+

0 commit comments

Comments
 (0)