[PATCH] D95743: [flang] Fix parsing of WRITE(I+J) with more accurate look-ahead

Peter Klausler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 1 09:08:07 PST 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rGf0ffc690d5bc: [flang] Fix parsing of WRITE(I+J) with more accurate look-ahead (authored by klausler).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95743

Files:
  flang/lib/Parser/Fortran-parsers.cpp
  flang/lib/Parser/io-parsers.cpp


Index: flang/lib/Parser/io-parsers.cpp
===================================================================
--- flang/lib/Parser/io-parsers.cpp
+++ flang/lib/Parser/io-parsers.cpp
@@ -24,7 +24,7 @@
 // R905 char-variable -> variable
 // "char-variable" is attempted first since it's not type constrained but
 // syntactically ambiguous with "file-unit-number", which is constrained.
-TYPE_PARSER(construct<IoUnit>(variable / !"="_tok) ||
+TYPE_PARSER(construct<IoUnit>(variable / lookAhead(space / ",);\n"_ch)) ||
     construct<IoUnit>(fileUnitNumber) || construct<IoUnit>(star))
 
 // R1202 file-unit-number -> scalar-int-expr
Index: flang/lib/Parser/Fortran-parsers.cpp
===================================================================
--- flang/lib/Parser/Fortran-parsers.cpp
+++ flang/lib/Parser/Fortran-parsers.cpp
@@ -1084,7 +1084,8 @@
 // R924 image-selector ->
 //        lbracket cosubscript-list [, image-selector-spec-list] rbracket
 TYPE_CONTEXT_PARSER("image selector"_en_US,
-    construct<ImageSelector>("[" >> nonemptyList(cosubscript / !"="_tok),
+    construct<ImageSelector>(
+        "[" >> nonemptyList(cosubscript / lookAhead(space / ",]"_ch)),
         defaulted("," >> nonemptyList(Parser<ImageSelectorSpec>{})) / "]"))
 
 // R926 image-selector-spec ->


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95743.320493.patch
Type: text/x-patch
Size: 1280 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210201/e8792097/attachment-0001.bin>


More information about the llvm-commits mailing list