summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-30 14:36:19 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-30 14:36:19 +0000
commit4d12807e308cb75de328db0b7a064978e0e04f13 (patch)
treefaaeb51dd422212bf2b3591a342cc36aeb14d5fc /parse.y
parent7132479960cff87e0d7e3fb5cb3919b791edfecc (diff)
parse.y: %-string cannot be a label
* parse.y (parser_yylex): %-string cannot be a label even if terminated by single/double quotes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50409 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 75b3d48213..63c8d45480 100644
--- a/parse.y
+++ b/parse.y
@@ -5686,6 +5686,7 @@ rb_parser_compile_file_path(volatile VALUE vparser, VALUE fname, VALUE file, int
#define STR_FUNC_QWORDS 0x08
#define STR_FUNC_SYMBOL 0x10
#define STR_FUNC_INDENT 0x20
+#define STR_FUNC_LABEL 0x40
enum string_type {
str_squote = (0),
@@ -7858,7 +7859,7 @@ parser_yylex(struct parser_params *parser)
}
else {
token = parse_string(lex_strterm);
- if (token == tSTRING_END && (peek_n('\'', -1) || peek_n('"', -1))) {
+ if ((token == tSTRING_END) && (lex_strterm->nd_func & STR_FUNC_LABEL)) {
if (((IS_lex_state(EXPR_BEG | EXPR_ENDFN) && !COND_P()) || IS_ARG()) &&
IS_LABEL_SUFFIX(0)) {
nextc();
@@ -8139,7 +8140,7 @@ parser_yylex(struct parser_params *parser)
return '>';
case '"':
- lex_strterm = NEW_STRTERM(str_dquote, '"', 0);
+ lex_strterm = NEW_STRTERM(str_dquote|STR_FUNC_LABEL, '"', 0);
return tSTRING_BEG;
case '`':
@@ -8158,7 +8159,7 @@ parser_yylex(struct parser_params *parser)
return tXSTRING_BEG;
case '\'':
- lex_strterm = NEW_STRTERM(str_squote, '\'', 0);
+ lex_strterm = NEW_STRTERM(str_squote|STR_FUNC_LABEL, '\'', 0);
return tSTRING_BEG;
case '?':