[vala] girparser: Support specifying symbols in metadata



commit 624c7688e71b6f43a3254ba6f458c33a10a57dde
Author: Luca Bruno <lucabru src gnome org>
Date:   Wed Nov 17 21:30:04 2010 +0100

    girparser: Support specifying symbols in metadata

 vala/valagirparser.vala |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/vala/valagirparser.vala b/vala/valagirparser.vala
index 6e3fd12..0135204 100644
--- a/vala/valagirparser.vala
+++ b/vala/valagirparser.vala
@@ -400,7 +400,7 @@ public class Vala.GirParser : CodeVisitor {
 			return metadata;
 		}
 
-		Expression? parse_literal () {
+		Expression? parse_expression () {
 			var src = get_current_src ();
 			Expression expr = null;
 			switch (current) {
@@ -422,8 +422,18 @@ public class Vala.GirParser : CodeVisitor {
 			case TokenType.STRING_LITERAL:
 				expr = new StringLiteral (get_string (), src);
 				break;
+			case TokenType.IDENTIFIER:
+				expr = new MemberAccess (null, get_string (), src);
+				while (next () == TokenType.DOT) {
+					if (next () != TokenType.IDENTIFIER) {
+						Report.error (get_current_src (), "expected identifier got `%s'".printf (current.to_string ()));
+						break;
+					}
+					expr = new MemberAccess (expr, get_string (), get_current_src ());
+				}
+				return expr;
 			default:
-				Report.error (src, "expected literal");
+				Report.error (src, "expected literal or symbol got `%s'".printf (current.to_string ()));
 				break;
 			}
 			next ();
@@ -450,7 +460,7 @@ public class Vala.GirParser : CodeVisitor {
 				}
 				next ();
 
-				Expression expr = parse_literal ();
+				Expression expr = parse_expression ();
 				if (expr == null) {
 					return false;
 				}



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