diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-30 13:09:50 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-30 13:09:50 +0000 |
commit | d99099928801314a4c15c998c93b8d6ee29d1724 (patch) | |
tree | 49d6a08c9c2567b97f867c1c30ca4c41713d3b3c /parse.y | |
parent | 143ce7f7eee59116e4e23015cf469a899572c6fb (diff) | |
download | ruby-d99099928801314a4c15c998c93b8d6ee29d1724.tar.gz |
parse.y: brace constants
* parse.y (parser_tokadd_utf8): make open/close braces constant.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56942 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -5771,10 +5771,11 @@ parser_tokadd_utf8(struct parser_params *parser, rb_encoding **encp, int codepoint; size_t numlen; + const int open_brace = '{', close_brace = '}'; if (regexp_literal) { tokadd('\\'); tokadd('u'); } - if (peek('{')) { /* handle \u{...} form */ + if (peek(open_brace)) { /* handle \u{...} form */ do { if (regexp_literal) { tokadd(*lex_p); } nextc(); @@ -5800,12 +5801,12 @@ parser_tokadd_utf8(struct parser_params *parser, rb_encoding **encp, } } while (string_literal && (peek(' ') || peek('\t'))); - if (!peek('}')) { + if (!peek(close_brace)) { yyerror("unterminated Unicode escape"); return 0; } - if (regexp_literal) { tokadd('}'); } + if (regexp_literal) tokadd(close_brace); nextc(); } else { /* handle \uxxxx form */ |