]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
scanner: "\x" requires two hex digits at most
authorRico Tzschichholz <ricotz@ubuntu.com>
Sun, 24 Nov 2019 18:33:50 +0000 (19:33 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sun, 24 Nov 2019 18:36:48 +0000 (19:36 +0100)
tests/scanner/regex-escape-x.vala
tests/scanner/string-escape-x.vala
vala/valageniescanner.vala
vala/valascanner.vala

index b3ad7c991473c2b2a2ce0e5a95ea458251bf582a..ebd59b16e994ddea8d5858851e4fb5f5ba55189f 100644 (file)
@@ -1,3 +1,3 @@
 void main () {
-       Regex foo = /\x1010/s;
+       Regex foo = /\x10/s;
 }
index d2250b6eb0566d8f4d27fc316bab6653243a81d9..090c309988a5bc56e0f9e6a7ebc519d04a2c1f69 100644 (file)
@@ -1,3 +1,3 @@
 void main () {
-       string foo = "\x1010";
+       string foo = "\x10";
 }
index 8fea07804129fa57c320693df2ab8b3d671ce4a6..26d34aff7ad55aa5e31eef5aed5103cf6cb09916 100644 (file)
@@ -775,8 +775,8 @@ public class Vala.Genie.Scanner {
                                                                current++;
                                                                token_length_in_chars++;
                                                        }
-                                                       if (digit_length != 2) {
-                                                               Report.error (get_source_reference (token_length_in_chars), "\\x requires two hex digits");
+                                                       if (digit_length < 1 || digit_length > 2) {
+                                                               Report.error (get_source_reference (token_length_in_chars), "\\x requires at least one or two hex digit");
                                                        }
                                                        break;
                                                default:
index 718b654717d07b37b7a87fb37360ef0da12296b5..e824fd618c911b50a25434d8c7946011d6d03c68 100644 (file)
@@ -749,8 +749,8 @@ public class Vala.Scanner {
                                                                current++;
                                                                token_length_in_chars++;
                                                        }
-                                                       if (digit_length < 1) {
-                                                               Report.error (get_source_reference (token_length_in_chars), "\\x requires at least one hex digit");
+                                                       if (digit_length < 1 || digit_length > 2) {
+                                                               Report.error (get_source_reference (token_length_in_chars), "\\x requires at least one or two hex digit");
                                                        }
                                                        break;
                                                default: