[vala] Report error on unexpected closing brace at end of file



commit 2a125fbe7fb27a7293a3a60bdc8355ab76b3b5f2
Author: Jürg Billeter <j bitron ch>
Date:   Thu Oct 1 19:58:43 2009 +0200

    Report error on unexpected closing brace at end of file

 vala/valaparser.vala |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index e9add95..4c2d397 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -312,6 +312,12 @@ public class Vala.Parser : CodeVisitor {
 		try {
 			parse_using_directives (context.root);
 			parse_declarations (context.root, true);
+			if (accept (TokenType.CLOSE_BRACE)) {
+				// only report error if it's not a secondary error
+				if (context.report.get_errors () == 0) {
+					Report.error (get_last_src (), "unexpected `}'");
+				}
+			}
 		} catch (ParseError e) {
 			// already reported
 		}



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