[flang] Improve error recovery for bad/missing construct END statements
authorPeter Klausler <pklausler@nvidia.com>
Mon, 10 Oct 2022 20:47:12 +0000 (13:47 -0700)
committerPeter Klausler <pklausler@nvidia.com>
Sat, 29 Oct 2022 19:45:29 +0000 (12:45 -0700)
commit619b5bfc8dfa90fff327956cc8cf5bb9d4029bab
treedfa60be7955a726ffc97bbcd1a320bdb3aa419ef
parentb203511c4fc131c8010ff7c699ea6fb3b8d6326e
[flang] Improve error recovery for bad/missing construct END statements

When a multi-statement construct should end with a particular END statement
like "END SELECT", and that construct's END statement is missing or
unrecognizable, the error recovery productions should not misinterpret
a program unit END statement that follows and consume it as a misspelled
construct END statement. Doing so leads to cascading errors or a failed parse.

Differential Revision: https://reviews.llvm.org/D136896
flang/lib/Parser/Fortran-parsers.cpp
flang/lib/Parser/executable-parsers.cpp
flang/lib/Parser/expr-parsers.cpp
flang/lib/Parser/io-parsers.cpp
flang/lib/Parser/program-parsers.cpp
flang/lib/Parser/stmt-parser.h