[vala] Parse `sealed' declaration modifier



commit 4cccc76af6f0f3421578e234bd643f7138b19e85
Author: Jürg Billeter <j bitron ch>
Date:   Sun Jul 18 11:24:38 2010 +0200

    Parse `sealed' declaration modifier

 vala/valaparser.vala    |   14 +++++++++++++-
 vala/valascanner.vala   |    3 +++
 vala/valatokentype.vala |    4 +++-
 3 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 391bbb4..78aecc5 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -57,7 +57,8 @@ public class Vala.Parser : CodeVisitor {
 		OVERRIDE = 1 << 5,
 		STATIC = 1 << 6,
 		VIRTUAL = 1 << 7,
-		ASYNC = 1 << 8
+		ASYNC = 1 << 8,
+		SEALED = 1 << 9
 	}
 
 	public Parser () {
@@ -221,6 +222,7 @@ public class Vala.Parser : CodeVisitor {
 		case TokenType.REF:
 		case TokenType.REQUIRES:
 		case TokenType.RETURN:
+		case TokenType.SEALED:
 		case TokenType.SET:
 		case TokenType.SIGNAL:
 		case TokenType.SIZEOF:
@@ -2210,6 +2212,7 @@ public class Vala.Parser : CodeVisitor {
 			case TokenType.PRIVATE:
 			case TokenType.PROTECTED:
 			case TokenType.PUBLIC:
+			case TokenType.SEALED:
 			case TokenType.SIGNAL:
 			case TokenType.STATIC:
 			case TokenType.STRUCT:
@@ -3157,6 +3160,10 @@ public class Vala.Parser : CodeVisitor {
 				next ();
 				flags |= ModifierFlags.EXTERN;
 				break;
+			case TokenType.SEALED:
+				next ();
+				flags |= ModifierFlags.SEALED;
+				break;
 			case TokenType.STATIC:
 				next ();
 				flags |= ModifierFlags.STATIC;
@@ -3199,6 +3206,10 @@ public class Vala.Parser : CodeVisitor {
 				next ();
 				flags |= ModifierFlags.OVERRIDE;
 				break;
+			case TokenType.SEALED:
+				next ();
+				flags |= ModifierFlags.SEALED;
+				break;
 			case TokenType.STATIC:
 				next ();
 				flags |= ModifierFlags.STATIC;
@@ -3492,6 +3503,7 @@ public class Vala.Parser : CodeVisitor {
 		case TokenType.PRIVATE:
 		case TokenType.PROTECTED:
 		case TokenType.PUBLIC:
+		case TokenType.SEALED:
 		case TokenType.SIGNAL:
 		case TokenType.STATIC:
 		case TokenType.STRUCT:
diff --git a/vala/valascanner.vala b/vala/valascanner.vala
index 3d2ebec..0f097e8 100644
--- a/vala/valascanner.vala
+++ b/vala/valascanner.vala
@@ -417,6 +417,9 @@ public class Vala.Scanner {
 				break;
 			case 's':
 				switch (begin[1]) {
+				case 'e':
+					if (matches (begin, "sealed")) return TokenType.SEALED;
+					break;
 				case 'i':
 					switch (begin[2]) {
 					case 'g':
diff --git a/vala/valatokentype.vala b/vala/valatokentype.vala
index 8a24684..91b50b9 100644
--- a/vala/valatokentype.vala
+++ b/vala/valatokentype.vala
@@ -1,6 +1,6 @@
 /* valatokentype.vala
  *
- * Copyright (C) 2008-2009  Jürg Billeter
+ * Copyright (C) 2008-2010  Jürg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -125,6 +125,7 @@ public enum Vala.TokenType {
 	REGEX_LITERAL,
 	REQUIRES,
 	RETURN,
+	SEALED,
 	SEMICOLON,
 	SET,
 	SIGNAL,
@@ -250,6 +251,7 @@ public enum Vala.TokenType {
 		case REGEX_LITERAL: return "regex literal";
 		case REQUIRES: return "`requires'";
 		case RETURN: return "`return'";
+		case SEALED: return "`sealed'";
 		case SEMICOLON: return "`;'";
 		case SET: return "`set'";
 		case SIGNAL: return "`signal'";



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