summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-24 16:10:59 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-24 16:12:17 +0900
commit2893550452f6f3cadb17c670da185813d7d0a835 (patch)
treea19bc3bd37f155cb2155fc1311f85fa851f77b55 /parse.y
parent45ad375acccca2bb0852613b1e809a7af556f5e6 (diff)
Mixed encoding error can continue to parse
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y19
1 files changed, 8 insertions, 11 deletions
diff --git a/parse.y b/parse.y
index 92e4d05113..2b34e8ac2f 100644
--- a/parse.y
+++ b/parse.y
@@ -6180,7 +6180,7 @@ tokadd_codepoint(struct parser_params *p, rb_encoding **encp,
}
/* return value is for ?\u3042 */
-static int
+static void
parser_tokadd_utf8(struct parser_params *p, rb_encoding **encp,
int string_literal, int symbol_literal, int regexp_literal)
{
@@ -6214,7 +6214,7 @@ parser_tokadd_utf8(struct parser_params *p, rb_encoding **encp,
unterminated:
literal_flush(p, p->lex.pcur);
yyerror0("unterminated Unicode escape");
- return 0;
+ return;
}
if (regexp_literal) tokadd(p, close_brace);
@@ -6222,11 +6222,11 @@ parser_tokadd_utf8(struct parser_params *p, rb_encoding **encp,
}
else { /* handle \uxxxx form */
if (!tokadd_codepoint(p, encp, regexp_literal, FALSE)) {
- return 0;
+ return;
}
}
- return TRUE;
+ return;
}
#define ESCAPE_CONTROL 1
@@ -6568,11 +6568,9 @@ tokadd_string(struct parser_params *p,
tokadd(p, '\\');
break;
}
- if (!parser_tokadd_utf8(p, enc, term,
- func & STR_FUNC_SYMBOL,
- func & STR_FUNC_REGEXP)) {
- continue;
- }
+ parser_tokadd_utf8(p, enc, term,
+ func & STR_FUNC_SYMBOL,
+ func & STR_FUNC_REGEXP);
continue;
default:
@@ -8070,8 +8068,7 @@ parse_qmark(struct parser_params *p, int space_seen)
if (peek(p, 'u')) {
nextc(p);
enc = rb_utf8_encoding();
- if (!parser_tokadd_utf8(p, &enc, -1, 0, 0))
- return 0;
+ parser_tokadd_utf8(p, &enc, -1, 0, 0);
}
else if (!lex_eol_p(p) && !(c = *p->lex.pcur, ISASCII(c))) {
nextc(p);