about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
-rw-r--r--lib/Expr/Parser.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Expr/Parser.cpp b/lib/Expr/Parser.cpp
index f6487674..a5c6123f 100644
--- a/lib/Expr/Parser.cpp
+++ b/lib/Expr/Parser.cpp
@@ -589,6 +589,12 @@ DeclResult ParserImpl::ParseQueryCommand() {
     return DeclResult();
   }
 
+  if (Tok.kind != Token::LSquare) {
+    Error("malformed query, expected expression list.");
+    SkipUntilRParen();
+    return DeclResult();
+  }
+
   ConsumeLSquare();
   // FIXME: Should avoid reading past unbalanced parens here.
   while (Tok.kind != Token::RSquare) {
@@ -611,6 +617,12 @@ DeclResult ParserImpl::ParseQueryCommand() {
   // Return if there are no optional lists of things to evaluate.
   if (Tok.kind == Token::RParen)
     goto exit;
+
+  if (Tok.kind != Token::LSquare) {
+    Error("malformed query, expected expression list.");
+    SkipUntilRParen();
+    return DeclResult();
+  }
   
   ConsumeLSquare();
   // FIXME: Should avoid reading past unbalanced parens here.