[vala] Genie: Report error on print expressions with uneven parentheses
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] Genie: Report error on print expressions with uneven parentheses
- Date: Sun, 24 Oct 2010 11:26:17 +0000 (UTC)
commit dd373213f908e55fac421178528af3bb37f3b3e6
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 cf250ee..fdff7f1 100644
--- a/vala/valagenieparser.vala
+++ b/vala/valagenieparser.vala
@@ -855,14 +855,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) {
@@ -877,14 +879,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]