[vala/0.10] Genie: Report error on print expressions with uneven parentheses



commit 4ea44c3a397752fa87d6f14d382abf655dc6bd50
Author: Jürg Billeter <j bitron ch>
Date:   Sun Oct 24 13:24:28 2010 +0200

    Genie: Report error on print expressions with uneven parentheses

 vala/valagenieparser.vala |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala
index 415a9fe..b132846 100644
--- a/vala/valagenieparser.vala
+++ b/vala/valagenieparser.vala
@@ -853,14 +853,16 @@ public class Vala.Genie.Parser : CodeVisitor {
 		var begin = get_location ();
 	
 		expect (TokenType.PRINT);
-		accept (TokenType.OPEN_PARENS);
-	
+		bool parens = accept (TokenType.OPEN_PARENS);
+
 		var expr = new MemberAccess (null, "print", get_src (begin));
 		
 		var arg_list = parse_print_argument_list ();
-		
-		accept (TokenType.CLOSE_PARENS);
-		
+
+		if (parens) {
+			expect (TokenType.CLOSE_PARENS);
+		}
+
 		var print_expr = new MethodCall (expr, get_src (begin));
 		
 		foreach (Expression arg in arg_list) {
@@ -875,14 +877,16 @@ public class Vala.Genie.Parser : CodeVisitor {
 		var begin = get_location ();
 	
 		expect (TokenType.ASSERT);
-		accept (TokenType.OPEN_PARENS);
-	
+		bool parens = accept (TokenType.OPEN_PARENS);
+
 		var expr = new MemberAccess (null, "assert", get_src (begin));
 		
 		var arg_list = parse_argument_list ();
-		
-		accept (TokenType.CLOSE_PARENS);
-		
+
+		if (parens) {
+			expect (TokenType.CLOSE_PARENS);
+		}
+
 		var assert_expr = new MethodCall (expr, get_src (begin));
 		
 		foreach (Expression arg in arg_list) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]