From 57441df4d8c88e8bfcc57fe7c6a6128f10304f72 Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz Date: Mon, 19 Sep 2016 09:41:34 +0200 Subject: 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(+) diff --git a/tests/basic-types/escape-chars.vala b/tests/basic-types/escape-chars.vala index 6784671af..0e6461488 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 19eb5c4e1..7ac0fd68c 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++; -- cgit v1.2.1