summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y8
1 files changed, 5 insertions, 3 deletions
diff --git a/parse.y b/parse.y
index 8a800bbd50..5169c58d4d 100644
--- a/parse.y
+++ b/parse.y
@@ -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;
}