Commit 676703bb authored by Jürg Billeter's avatar Jürg Billeter

Fix error handling for character literals

parent 1af651a3
......@@ -38,7 +38,7 @@ public class Vala.CharacterLiteral : Literal {
set {
_value = value;
if (!value.validate () || (value.length != 3 && value.next_char ().get_char () != '\\')) {
if (!value.validate ()) {
error = true;
}
}
......
......@@ -1156,6 +1156,10 @@ public class Vala.Scanner {
Report.error (new SourceReference (source_file, line, column + token_length_in_chars, line, column + token_length_in_chars), "invalid UTF-8 character");
}
}
if (current < end && begin[0] == '\'' && current[0] != '\'') {
// multiple characters in single character literal
Report.error (new SourceReference (source_file, line, column + token_length_in_chars, line, column + token_length_in_chars), "invalid character literal");
}
}
if (current < end) {
current++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment