diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-30 14:43:43 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-30 14:43:43 +0000 |
commit | 88b745f0ca4b4c87d186372d86d7d2589a9e4f6f (patch) | |
tree | 1643f84528fc050a5fd85ca6c296680c0bea8b4b /parse.y | |
parent | aab0d67a1ff5190ff7a951e40cee742210302aed (diff) | |
download | ruby-88b745f0ca4b4c87d186372d86d7d2589a9e4f6f.tar.gz |
parse.y: refine error message
* parse.y (parser_tokadd_utf8): refine error message at bad char
in unicode escape, "invalid" instead of "unterminated".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -5794,9 +5794,9 @@ parser_tokadd_utf8(struct parser_params *parser, rb_encoding **encp, if (regexp_literal) { tokadd('\\'); tokadd('u'); } if (peek(open_brace)) { /* handle \u{...} form */ + int c, last = nextc(); do { - if (regexp_literal) { tokadd(*lex_p); } - nextc(); + if (regexp_literal) tokadd(last); codepoint = scan_hex(lex_p, 6, &numlen); if (numlen == 0) { yyerror("invalid Unicode escape"); @@ -5808,15 +5808,15 @@ parser_tokadd_utf8(struct parser_params *parser, rb_encoding **encp, } parser_tokadd_codepoint(parser, encp,string_literal, regexp_literal, codepoint, (int)numlen); - } while (string_literal && (peek(' ') || peek('\t'))); + if (ISSPACE(c = nextc())) last = c; + } while (string_literal && c != close_brace); - if (!peek(close_brace)) { + if (c != close_brace) { yyerror("unterminated Unicode escape"); return 0; } if (regexp_literal) tokadd(close_brace); - nextc(); } else { /* handle \uxxxx form */ codepoint = scan_hex(lex_p, 4, &numlen); |