[flang] Better error recovery for missing THEN in ELSE IF
authorpeter klausler <pklausler@nvidia.com>
Thu, 30 Sep 2021 22:58:38 +0000 (15:58 -0700)
committerpeter klausler <pklausler@nvidia.com>
Mon, 4 Oct 2021 16:37:53 +0000 (09:37 -0700)
commit0061e681a3296ac9016891729e03e38ebb235bdc
tree95d4c39186744ef550994fe45734cc42ef3984a0
parent33c526416058cfd41a57a7ff73103127b319d6d1
[flang] Better error recovery for missing THEN in ELSE IF

The THEN keyword in the "ELSE IF (test) THEN" statement is useless
syntactically, and to omit it is a common error (at least for me!)
that has poor error recovery.  This patch changes the parser to
cough up a simple "expected 'THEN'" and still recognize the rest of
the IF construct.

Differential Revision: https://reviews.llvm.org/D110952
flang/lib/Evaluate/check-expression.cpp
flang/lib/Parser/executable-parsers.cpp
flang/test/Parser/elseif-then.f90 [new file with mode: 0644]