[vala] Add support for the \v escape charactor



commit 57441df4d8c88e8bfcc57fe7c6a6128f10304f72
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon Sep 19 09:41:34 2016 +0200

    Add support for the \v escape charactor
    
    https://bugzilla.gnome.org/show_bug.cgi?id=664689

 tests/basic-types/escape-chars.vala |   10 ++++++++++
 vala/valascanner.vala               |    3 +++
 2 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/tests/basic-types/escape-chars.vala b/tests/basic-types/escape-chars.vala
index 6784671..0e64614 100644
--- a/tests/basic-types/escape-chars.vala
+++ b/tests/basic-types/escape-chars.vala
@@ -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 ();
 }
diff --git a/vala/valascanner.vala b/vala/valascanner.vala
index 19eb5c4..7ac0fd6 100644
--- a/vala/valascanner.vala
+++ b/vala/valascanner.vala
@@ -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++;


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