[flang-commits] [PATCH] D129679: [flang][runtime] Complete list-directed character input with DECIMAL='COMMA'

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Wed Jul 13 16:43:05 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGcb193931fa05: [flang][runtime] Complete list-directed character input with DECIMAL='COMMA' (authored by klausler).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129679/new/

https://reviews.llvm.org/D129679

Files:
  flang/runtime/edit-input.cpp
  flang/runtime/io-stmt.cpp


Index: flang/runtime/io-stmt.cpp
===================================================================
--- flang/runtime/io-stmt.cpp
+++ flang/runtime/io-stmt.cpp
@@ -630,7 +630,6 @@
         switch (*next) {
         case ' ':
         case '\t':
-        case ';':
         case '/':
         case '(':
         case ')':
@@ -640,11 +639,15 @@
         case '\n': // for stream access
           return std::nullopt;
         case ',':
+          if (!(edit.modes.editingFlags & decimalComma)) {
+            return std::nullopt;
+          }
+          break;
+        case ';':
           if (edit.modes.editingFlags & decimalComma) {
-            break;
-          } else {
             return std::nullopt;
           }
+          break;
         default:
           break;
         }
Index: flang/runtime/edit-input.cpp
===================================================================
--- flang/runtime/edit-input.cpp
+++ flang/runtime/edit-input.cpp
@@ -654,15 +654,25 @@
   // in NextInField.
   std::optional<int> remaining{length > 0 ? maxUTF8Bytes : 0};
   while (std::optional<char32_t> next{io.NextInField(remaining, edit)}) {
+    bool isSep{false};
     switch (*next) {
     case ' ':
     case '\t':
+    case '/':
+      isSep = true;
+      break;
     case ',':
+      isSep = !(edit.modes.editingFlags & decimalComma);
+      break;
     case ';':
-    case '/':
-      remaining = 0; // value separator: stop
+      isSep = !!(edit.modes.editingFlags & decimalComma);
       break;
     default:
+      break;
+    }
+    if (isSep) {
+      remaining = 0;
+    } else {
       *x++ = *next;
       remaining = --length > 0 ? maxUTF8Bytes : 0;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129679.444453.patch
Type: text/x-patch
Size: 1675 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220713/175a5457/attachment.bin>


More information about the flang-commits mailing list