From 41aec2d65eb6c0c83c78d1d3e88b7d7910d15da7 Mon Sep 17 00:00:00 2001 From: peter klausler Date: Wed, 9 May 2018 16:06:57 -0700 Subject: [PATCH] [flang] fix previous changes after testing Original-commit: flang-compiler/f18@c088704f135cdb27cf13b5961ee1563ea2389aef Reviewed-on: https://github.com/flang-compiler/f18/pull/85 Tree-same-pre-rewrite: false --- flang/lib/parser/prescan.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/flang/lib/parser/prescan.cc b/flang/lib/parser/prescan.cc index 0896d3546c88..cf76ccbf8258 100644 --- a/flang/lib/parser/prescan.cc +++ b/flang/lib/parser/prescan.cc @@ -735,9 +735,9 @@ const char *Prescanner::FreeFormContinuationLine(bool ampersand) { if (p >= limit_) { return nullptr; } + for (; *p == ' ' || *p == '\t'; ++p) { + } if (directiveSentinel_ != nullptr) { - for (; *p == ' ' || *p == '\t'; ++p) { - } if (*p++ != '!') { return nullptr; } @@ -749,22 +749,26 @@ const char *Prescanner::FreeFormContinuationLine(bool ampersand) { for (; *p == ' ' || *p == '\t'; ++p) { } if (*p == '&') { - ++p; - } else if (!ampersand) { + return p + 1; + } else if (ampersand) { + return p; + } else { return nullptr; } } else { if (*p == '&') { - ++p; + return p + 1; + } else if (*p == '!' || *p == '\n') { + return nullptr; } else if (ampersand || delimiterNesting_ > 0) { if (p > lineStart_) { --p; } + return p; } else { return nullptr; } } - return p; } bool Prescanner::FixedFormContinuation() {