[flang-commits] [flang] [flang] Accept multiple spaces after compiler directive sentinel (PR #76541)

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Thu Dec 28 14:57:01 PST 2023


================
@@ -139,16 +139,18 @@ void Prescanner::Statement() {
         SkipSpaces();
       }
     } else {
-      // Compiler directive.  Emit normalized sentinel.
+      // Compiler directive.  Emit normalized sentinel, squash following spaces.
       EmitChar(tokens, '!');
       ++at_, ++column_;
       for (const char *sp{directiveSentinel_}; *sp != '\0';
            ++sp, ++at_, ++column_) {
         EmitChar(tokens, *sp);
       }
-      if (*at_ == ' ') {
+      if (*at_ == ' ' || *at_ == '\t') {
         EmitChar(tokens, ' ');
-        ++at_, ++column_;
+        while (*at_ == ' ' || *at_ == '\t') {
----------------
vzakhari wrote:

nit: I wonder if using `SkipSpaces` would look more consistent.

https://github.com/llvm/llvm-project/pull/76541


More information about the flang-commits mailing list