]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Add support for the \v escape charactor
authorRico Tzschichholz <ricotz@ubuntu.com>
Mon, 19 Sep 2016 07:41:34 +0000 (09:41 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Tue, 20 Sep 2016 10:09:47 +0000 (12:09 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=664689

tests/basic-types/escape-chars.vala
vala/valascanner.vala

index 6784671af9e5715c7c231d9fab0d79376b02825f..0e646148863eefc6bc944cbfc21f44a70f7c5963 100644 (file)
@@ -15,8 +15,18 @@ void test_u_escape_chars () {
        assert (s == "Copyright ©");
 }
 
+void test_simple_escape_chars () {
+       string s = "\b\f\n\r\t\v";
+       s = s.escape ();
+       assert (s == "\\b\\f\\n\\r\\t\\v");
+       assert (s.compress () == "\b\f\n\r\t\v");
+}
+
 void main () {
        // Test case for the bug report 704709
        test_x_escape_chars ();
        test_u_escape_chars ();
+
+       // Test case for the bug report 664689
+       test_simple_escape_chars ();
 }
index 19eb5c4e1d462446b7ea252a09411578dcd28afa..7ac0fd68c47a1a5e177432208a9cd3b0182cf61c 100644 (file)
@@ -195,6 +195,7 @@ public class Vala.Scanner {
                                                case 'n':
                                                case 'r':
                                                case 't':
+                                               case 'v':
                                                case 'a':
                                                case 'A':
                                                case 'p':
@@ -707,6 +708,7 @@ public class Vala.Scanner {
                                                case 'n':
                                                case 'r':
                                                case 't':
+                                               case 'v':
                                                        current++;
                                                        token_length_in_chars++;
                                                        break;
@@ -1140,6 +1142,7 @@ public class Vala.Scanner {
                                                case 'n':
                                                case 'r':
                                                case 't':
+                                               case 'v':
                                                case '$':
                                                        current++;
                                                        token_length_in_chars++;