diff --git a/pom.xml b/pom.xml
index e52a746..62d0ab5 100755
--- a/pom.xml
+++ b/pom.xml
@@ -70,6 +70,13 @@
maven-resources-plugin
2.6
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ -Xmx2048m -XX:MaxPermSize=256m
+
+
maven-eclipse-plugin
2.9
diff --git a/src/main/antlr4/org/vb6/VisualBasic6.g4 b/src/main/antlr4/org/vb6/VisualBasic6.g4
index 601808d..ce5c275 100755
--- a/src/main/antlr4/org/vb6/VisualBasic6.g4
+++ b/src/main/antlr4/org/vb6/VisualBasic6.g4
@@ -408,8 +408,7 @@ seekStmt : SEEK WS valueStmt WS? ',' WS? valueStmt;
selectCaseStmt :
SELECT WS CASE WS valueStmt NEWLINE+
- sC_Case*
- sC_CaseElse?
+ sC_Case*
WS? END_SELECT
;
@@ -418,17 +417,14 @@ sC_Case :
(block NEWLINE+)?
;
+// ELSE first, so that it is not interpreted as a variable call
sC_Cond :
- IS WS? comparisonOperator WS? valueStmt # caseCondIs
+ ELSE # caseCondElse
+ | IS WS? comparisonOperator WS? valueStmt # caseCondIs
| valueStmt (WS? ',' WS? valueStmt)* # caseCondValue
| INTEGERLITERAL WS TO WS valueStmt (WS? ',' WS? valueStmt)* # caseCondTo
;
-sC_CaseElse :
- CASE WS ELSE WS? (':'? NEWLINE* | NEWLINE+)
- (block NEWLINE+)?
-;
-
sendkeysStmt : SENDKEYS WS valueStmt (WS? ',' WS? valueStmt)?;
setattrStmt : SETATTR WS valueStmt WS? ',' WS? valueStmt;
diff --git a/src/test/resources/org/vb6/gpl/statements/SelectCase.cls b/src/test/resources/org/vb6/gpl/statements/SelectCase.cls
index d58a9f5..86ec41d 100644
--- a/src/test/resources/org/vb6/gpl/statements/SelectCase.cls
+++ b/src/test/resources/org/vb6/gpl/statements/SelectCase.cls
@@ -22,4 +22,15 @@ Select Case Percent
Case 76 To 100
Case Else
Beep
-End Select
\ No newline at end of file
+End Select
+
+Select Case Grade
+ Case "A"
+ Beep
+ Case Else
+ Beep
+ Case "B"
+ Beep
+ Case Else
+ Beep
+End Select
\ No newline at end of file