[PATCH] D84078: [flang] Treat tabs like spaces in formatted input.
Peter Klausler via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 17 17:02:07 PDT 2020
klausler created this revision.
klausler added reviewers: sscalpone, schweitz, PeteSteinfeld.
klausler added a project: Flang.
Herald added a reviewer: jdoerfert.
Herald added a reviewer: DavidTruby.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
In formatted input, treat tabs as if they were spaces.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D84078
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
@@ -353,7 +353,7 @@
std::optional<int> &remaining) {
while (!remaining || *remaining > 0) {
if (auto ch{GetCurrentChar()}) {
- if (*ch != ' ') {
+ if (*ch != ' ' && *ch != '\t') {
return ch;
}
HandleRelativePosition(1);
@@ -373,6 +373,7 @@
if (auto next{GetCurrentChar()}) {
switch (*next) {
case ' ':
+ case '\t':
case ',':
case ';':
case '/':
@@ -415,7 +416,7 @@
std::optional<char32_t> IoStatementState::GetNextNonBlank() {
auto ch{GetCurrentChar()};
- while (ch.value_or(' ') == ' ') {
+ while (!ch || *ch == ' ' || *ch == '\t') {
if (ch) {
HandleRelativePosition(1);
} else if (!AdvanceRecord()) {
@@ -485,7 +486,8 @@
if (!imaginaryPart_) {
edit.repeat = std::min<int>(remaining_, maxRepeat);
auto ch{io.GetNextNonBlank()};
- if (!ch || *ch == ' ' || *ch == comma) { // "r*" repeated null
+ if (!ch || *ch == ' ' || *ch == '\t' || *ch == comma) {
+ // "r*" repeated null
edit.descriptor = DataEdit::ListDirectedNullValue;
}
}
@@ -554,7 +556,7 @@
edit.descriptor = DataEdit::ListDirectedNullValue;
return edit;
}
- if (!ch || *ch == ' ' || *ch == comma) { // "r*" null
+ if (!ch || *ch == ' ' || *ch == '\t' || *ch == comma) { // "r*" null
edit.descriptor = DataEdit::ListDirectedNullValue;
}
edit.repeat = std::min<int>(r, maxRepeat);
Index: flang/runtime/edit-input.cpp
===================================================================
--- flang/runtime/edit-input.cpp
+++ flang/runtime/edit-input.cpp
@@ -34,7 +34,7 @@
common::UnsignedInt128 value{0};
for (; next; next = io.NextInField(remaining)) {
char32_t ch{*next};
- if (ch == ' ') {
+ if (ch == ' ' || ch == '\t') {
continue;
}
int digit{0};
@@ -101,7 +101,7 @@
common::UnsignedInt128 value;
for (; next; next = io.NextInField(remaining)) {
char32_t ch{*next};
- if (ch == ' ') {
+ if (ch == ' ' || ch == '\t') {
if (edit.modes.editingFlags & blankZero) {
ch = '0'; // BZ mode - treat blank as if it were zero
} else {
@@ -170,7 +170,7 @@
} else if (*next == decimal || (*next >= '0' && *next <= '9')) {
for (; next; next = io.NextInField(remaining)) {
char32_t ch{*next};
- if (ch == ' ') {
+ if (ch == ' ' || ch == '\t') {
if (edit.modes.editingFlags & blankZero) {
ch = '0'; // BZ mode - treat blank as if it were zero
} else {
@@ -229,7 +229,7 @@
return 0;
}
if (remaining) {
- while (next && *next == ' ') {
+ while (next && (*next == ' ' || *next == '\t')) {
next = io.NextInField(remaining);
}
if (next) {
@@ -386,6 +386,7 @@
next = io.NextInField(remaining)) {
switch (*next) {
case ' ':
+ case '\t':
case ',':
case ';':
case '/':
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84078.278936.patch
Type: text/x-patch
Size: 3095 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200718/44d7f5af/attachment.bin>
More information about the llvm-commits
mailing list