parse.y: reduce duplicate code
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
fd04ea0adf
commit
e1a60b2db9
12
parse.y
12
parse.y
@ -6280,10 +6280,7 @@ here_document(struct parser_params *p, rb_strterm_heredoc_t *here)
|
|||||||
if (ptr_end < p->lex.pend) rb_str_cat(str, "\n", 1);
|
if (ptr_end < p->lex.pend) rb_str_cat(str, "\n", 1);
|
||||||
lex_goto_eol(p);
|
lex_goto_eol(p);
|
||||||
if (p->heredoc_indent > 0) {
|
if (p->heredoc_indent > 0) {
|
||||||
set_yylval_str(str);
|
goto flush_str;
|
||||||
add_mark_object(p, str);
|
|
||||||
flush_string_content(p, enc);
|
|
||||||
return tSTRING_CONTENT;
|
|
||||||
}
|
}
|
||||||
if (nextc(p) == -1) {
|
if (nextc(p) == -1) {
|
||||||
if (str) {
|
if (str) {
|
||||||
@ -6315,10 +6312,11 @@ here_document(struct parser_params *p, rb_strterm_heredoc_t *here)
|
|||||||
goto restore;
|
goto restore;
|
||||||
}
|
}
|
||||||
if (c != '\n') {
|
if (c != '\n') {
|
||||||
VALUE lit;
|
|
||||||
flush:
|
flush:
|
||||||
add_mark_object(p, lit = STR_NEW3(tok(p), toklen(p), enc, func));
|
str = STR_NEW3(tok(p), toklen(p), enc, func);
|
||||||
set_yylval_str(lit);
|
flush_str:
|
||||||
|
set_yylval_str(str);
|
||||||
|
add_mark_object(p, str);
|
||||||
flush_string_content(p, enc);
|
flush_string_content(p, enc);
|
||||||
return tSTRING_CONTENT;
|
return tSTRING_CONTENT;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user