summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-27 00:07:05 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-27 00:40:30 +0900
commita43c637660cd3c893401e899014d721d2fa2a5b4 (patch)
treeb796e2c8dbb07a7166405c8a21ea618ea7cf1898 /parse.y
parent4f2a7b800110346292890e3bed41b37f3f58ab0b (diff)
parse.y: broke the terminator condition down
* parse.y (here_document): broke the terminator condition down into each piece, the positional condition, resetting the dedented here-document indentation, and matching identifier. suppress a false warning by icc.
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y18
1 files changed, 11 insertions, 7 deletions
diff --git a/parse.y b/parse.y
index 9036f58a59..f22b862cef 100644
--- a/parse.y
+++ b/parse.y
@@ -7201,13 +7201,17 @@ here_document(struct parser_params *p, rb_strterm_heredoc_t *here)
return 0;
}
bol = was_bol(p);
- /* `heredoc_line_indent == -1` means
- * - "after an interpolation in the same line", or
- * - "in a continuing line"
- */
- if (bol &&
- (p->heredoc_line_indent != -1 || (p->heredoc_line_indent = 0)) &&
- whole_match_p(p, eos, len, indent)) {
+ if (!bol) {
+ /* not beginning of line, cannot be the terminater */
+ }
+ else if (p->heredoc_line_indent == -1) {
+ /* `heredoc_line_indent == -1` means
+ * - "after an interpolation in the same line", or
+ * - "in a continuing line"
+ */
+ p->heredoc_line_indent = 0;
+ }
+ else if (whole_match_p(p, eos, len, indent)) {
dispatch_heredoc_end(p);
heredoc_restore(p, &p->lex.strterm->u.heredoc);
p->lex.strterm = 0;