[vala] Fix error message when encountering invalid character literals in Genie parser



commit f25a20370715c88d164a230342b27ce70b6a1836
Author: Jamie McCracken <jamiemcc gnome org>
Date:   Mon Apr 13 12:16:15 2009 -0400

    Fix error message when encountering invalid character literals in Genie parser
---
 vala/valagenieparser.vala |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala
index 7c5925f..53e79ae 100644
--- a/vala/valagenieparser.vala
+++ b/vala/valagenieparser.vala
@@ -319,7 +319,12 @@ public class Vala.Genie.Parser : CodeVisitor {
 			return new RealLiteral (get_last_string (), get_src (begin));
 		case TokenType.CHARACTER_LITERAL:
 			next ();
-			return new CharacterLiteral (get_last_string (), get_src (begin));
+			// FIXME validate and unescape here and just pass unichar to CharacterLiteral
+			var lit = new CharacterLiteral (get_last_string (), get_src (begin));
+			if (lit.error) {
+				Report.error (lit.source_reference, "invalid character literal");
+			}
+			return lit;
 		case TokenType.STRING_LITERAL:
 			next ();
 			return new StringLiteral (get_last_string (), get_src (begin));



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