summaryrefslogtreecommitdiff
path: root/test/Parser
diff options
context:
space:
mode:
authorarphaman <arphaman@gmail.com>2013-07-24 12:47:51 +0100
committerarphaman <arphaman@gmail.com>2013-07-24 12:47:51 +0100
commit23292c947a37c89d024299768f9de4c17211d268 (patch)
treeb6a1e30c2dae4d9ac76e16d9409aaa1fcd196945 /test/Parser
parent4f4ef9f0507810f31a33574f33737ebf02ee8222 (diff)
downloadflang-23292c947a37c89d024299768f9de4c17211d268.tar.gz
improved parsing error recovery for if and do constructs; moved sema for exec stmts to separate file
Diffstat (limited to 'test/Parser')
-rw-r--r--test/Parser/do.f955
-rw-r--r--test/Parser/doRecovery.f9525
-rw-r--r--test/Parser/ifRecovery.f9520
3 files changed, 47 insertions, 3 deletions
diff --git a/test/Parser/do.f95 b/test/Parser/do.f95
index c80b6a37d9..2f3d69a94a 100644
--- a/test/Parser/do.f95
+++ b/test/Parser/do.f95
@@ -33,9 +33,8 @@ PROGRAM dotest
DO 80 I = 1,3, ! expected-error {{expected an expression after ','}}
80 CONTINUE
- ! FIXME:
- !DO 90 I =
- ! 1 , 4
+ DO 90 I = ! expected-error {{expected an expression after '='}}
+ 1 , 4 ! expected-error {{}}
90 CONTINUE
DO 100 I = 1, ! expected-error {{expected an expression after ','}}
diff --git a/test/Parser/doRecovery.f95 b/test/Parser/doRecovery.f95
new file mode 100644
index 0000000000..f2b2d67997
--- /dev/null
+++ b/test/Parser/doRecovery.f95
@@ -0,0 +1,25 @@
+! RUN: %flang -fsyntax-only -verify < %s
+PROGRAM dotest
+ integer i
+
+! The do statement must be processed no matter what, as we want to match the end do
+
+ do 'a' = 1, 10 ! expected-error {{expected identifier}}
+ end do
+
+ do i 1,10 ! expected-error {{expected '='}}
+ end do
+
+ do i = ,10 ! expected-error {{expected an expression}}
+ end do
+
+ do i = 1 ! expected-error {{expected ','}}
+ end do
+
+ do i = 1, ! expected-error {{expected an expression after ','}}
+ end do
+
+ do while( ! expected-error {{expected an expression after '('}}
+ end do
+
+END
diff --git a/test/Parser/ifRecovery.f95 b/test/Parser/ifRecovery.f95
new file mode 100644
index 0000000000..53250c42d5
--- /dev/null
+++ b/test/Parser/ifRecovery.f95
@@ -0,0 +1,20 @@
+! RUN: %flang -fsyntax-only -verify < %s
+PROGRAM dotest
+ integer i
+
+! The if statement must be processed no matter what, as we want to match the end if
+
+ if .true. then ! expected-error {{expected '(' after 'IF'}}
+ end if
+
+ if () ! expected-error {{expected an expression}}
+ end if
+
+ if (.false. ! expected-error {{expected ')'}}
+ end if
+
+ if(.true.) then
+ else if then ! expected-error {{expected '(' after 'ELSE IF'}}
+ end if
+
+END