Skip to content

Commit ce39b42

Browse files
committed
add more descriptive error message and remove newlines
1 parent 0d69f83 commit ce39b42

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

flang/lib/Parser/openacc-parsers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace Fortran::parser {
2323
// other types of line comments from fixed form.
2424
constexpr auto startAccLine{skipStuffBeforeStatement >>
2525
withMessage(
26-
"expected OpenACC comment '!$ACC' (free-form), 'C$ACC', or '*$ACC' (fixed-form)"_err_en_US,
26+
"expected OpenACC directive sentinal: '!$ACC' (free-form), 'C$ACC', or '*$ACC' (fixed-form)"_err_en_US,
2727
"!$ACC "_sptok)};
2828
constexpr auto endAccLine{space >> endOfLine};
2929

flang/lib/Parser/stmt-parser.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ constexpr auto progUnitEndStmt{
9898
"PROCEDURE"_tok || "MODULE"_tok || "SUBMODULE"_tok ||
9999
"PROGRAM"_tok || "BLOCK DATA"_tok)};
100100
constexpr auto constructEndStmtErrorRecovery{
101-
!progUnitEndStmt >> ("END"_tok >> SkipTo<'\n'>{} || ok)};
101+
!progUnitEndStmt >> (("!$ACC "_sptok >> "END"_tok) || "END"_tok >> SkipTo<'\n'>{} || ok)};
102102
constexpr auto namedConstructEndStmtErrorRecovery{
103103
constructEndStmtErrorRecovery >> missingOptionalName};
104104

flang/test/Driver/debug-parsing-log.f90

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,14 @@
22

33
! Below are just few lines extracted from the dump. The actual output is much _much_ bigger.
44

5-
! CHECK: {{.*[/\\]}}debug-parsing-log.f90:25:1: IMPLICIT statement
5+
! CHECK: {{.*[/\\]}}debug-parsing-log.f90:15:1: IMPLICIT statement
66
! CHECK-NEXT: END PROGRAM
77
! CHECK-NEXT: ^
88
! CHECK-NEXT: fail 3
9-
! CHECK-NEXT: {{.*[/\\]}}debug-parsing-log.f90:25:1: error: expected 'IMPLICIT NONE'
9+
! CHECK-NEXT: {{.*[/\\]}}debug-parsing-log.f90:15:1: error: expected 'IMPLICIT NONE'
1010
! CHECK-NEXT: END PROGRAM
1111
! CHECK-NEXT: ^
12-
! CHECK-NEXT: {{.*[/\\]}}debug-parsing-log.f90:25:1: in the context: IMPLICIT statement
12+
! CHECK-NEXT: {{.*[/\\]}}debug-parsing-log.f90:15:1: in the context: IMPLICIT statement
1313
! CHECK-NEXT: END PROGRAM
1414
! CHECK-NEXT: ^
15-
16-
17-
18-
19-
20-
21-
22-
23-
24-
2515
END PROGRAM

0 commit comments

Comments
 (0)