Skip to content

Commit

Permalink
parse.y: STR_TERM_END
Browse files Browse the repository at this point in the history
* parse.y (parser_parse_string): store the end of string literal
  mark in nd_term instead of nd_func.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Aug 26, 2016
1 parent 0e512b4 commit 70da28c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions parse.y
Expand Up @@ -5577,6 +5577,7 @@ rb_parser_compile_file_path(VALUE vparser, VALUE fname, VALUE file, int start)
#define STR_FUNC_SYMBOL 0x10
#define STR_FUNC_INDENT 0x20
#define STR_FUNC_LABEL 0x40
#define STR_TERM_END -1

enum string_type {
str_label = STR_FUNC_LABEL,
Expand Down Expand Up @@ -6349,15 +6350,15 @@ parser_parse_string(struct parser_params *parser, NODE *quote)
int c, space = 0;
rb_encoding *enc = current_enc;

if (func == -1) return tSTRING_END;
if (term == STR_TERM_END) return tSTRING_END;
c = nextc();
if ((func & STR_FUNC_QWORDS) && ISSPACE(c)) {
do {c = nextc();} while (ISSPACE(c));
space = 1;
}
if (c == term && !quote->nd_nest) {
if (func & STR_FUNC_QWORDS) {
quote->nd_func = -1;
quote->u2.id = STR_TERM_END;
return ' ';
}
return parser_string_term(parser, func);
Expand Down Expand Up @@ -6794,7 +6795,7 @@ parser_here_document(struct parser_params *parser, NODE *here)
yylval.val, str);
#endif
heredoc_restore(lex_strterm);
lex_strterm = NEW_STRTERM(-1, 0, 0);
lex_strterm = NEW_STRTERM(func, STR_TERM_END, 0);
set_yylval_str(str);
return tSTRING_CONTENT;
}
Expand Down

0 comments on commit 70da28c

Please sign in to comment.