summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-30 13:09:50 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-30 13:09:50 +0000
commit94715bc666f212b3303b4ed23689d8d14b347057 (patch)
tree49d6a08c9c2567b97f867c1c30ca4c41713d3b3c /parse.y
parent87b937bdfd017ed710d1b547ef42b2a0c7e92592 (diff)
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.y7
1 files changed, 4 insertions, 3 deletions
diff --git a/parse.y b/parse.y
index fb5a923cbe..a06f061388 100644
--- a/parse.y
+++ b/parse.y
@@ -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 */