[flang-commits] [flang] [Flang] Give a more specific error message for expressions where an IO Unit is expected (PR #126970)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Mon Feb 24 11:19:00 PST 2025
================
@@ -23,8 +23,12 @@ namespace Fortran::parser {
// 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.
+// Note, "file-unit-number" is replaced by "expr" to allow for better
+// error messages.
TYPE_PARSER(construct<IoUnit>(variable / lookAhead(space / ",);\n"_ch)) ||
- construct<IoUnit>(fileUnitNumber) || construct<IoUnit>(star))
+ construct<IoUnit>(
----------------
klausler wrote:
Would not the other uses of `fileUnitNumber` in this file also benefit from this change? If so, consider modifying the parser for `FileUnitNumber` itself.
https://github.com/llvm/llvm-project/pull/126970
More information about the flang-commits
mailing list