diff options
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -6407,6 +6407,7 @@ parser_heredoc_identifier(struct parser_params *parser) int token = tSTRING_BEG; long len; int newline = 0; + int indent = 0; if (c == '-') { c = nextc(); @@ -6415,8 +6416,7 @@ parser_heredoc_identifier(struct parser_params *parser) else if (c == '~') { c = nextc(); func = STR_FUNC_INDENT; - heredoc_indent = INT_MAX; - heredoc_line_indent = 0; + indent = INT_MAX; } switch (c) { case '\'': @@ -6455,7 +6455,7 @@ parser_heredoc_identifier(struct parser_params *parser) if (!parser_is_identchar()) { pushback(c); if (func & STR_FUNC_INDENT) { - pushback(heredoc_indent > 0 ? '~' : '-'); + pushback(indent > 0 ? '~' : '-'); } return 0; } @@ -6478,6 +6478,8 @@ parser_heredoc_identifier(struct parser_params *parser) lex_lastline); /* nd_orig */ nd_set_line(lex_strterm, ruby_sourceline); ripper_flush(parser); + heredoc_indent = indent; + heredoc_line_indent = 0; return token; } |