From d6266102c3c128398e9ef0aee9e39e93cf7c215e Mon Sep 17 00:00:00 2001 From: gluax Date: Wed, 9 Jun 2021 15:54:05 -0700 Subject: [PATCH 1/3] more tests, hex fix --- .../string_transformation.json | 77 ++-- .../string_transformation.leo | 2 +- input/src/values/char_types.rs | 2 +- tests/compiler/char/circuit.leo | 16 +- .../compiler/char/inputs/escaped_unicode1.in | 5 + .../compiler/char/inputs/escaped_unicode2.in | 5 + .../compiler/char/inputs/escaped_unicode3.in | 5 + ...escaped_unicode.in => escaped_unicode4.in} | 0 .../compiler/char/inputs/escaped_unicode5.in | 5 + .../compiler/char/inputs/escaped_unicode6.in | 5 + .../compiler/char/inputs/{hex.in => hex1.in} | 0 tests/compiler/char/inputs/hex2.in | 5 + tests/compiler/char/inputs/nonprinting.in | 72 ++++ tests/compiler/char/inputs/unicode1.in | 5 + tests/compiler/char/inputs/unicode2.in | 5 + tests/compiler/char/inputs/unicode3.in | 5 + .../char/inputs/{unicode.in => unicode4.in} | 0 tests/compiler/char/inputs/unicode5.in | 5 + tests/compiler/char/neq.leo | 16 +- tests/compiler/char/nonprinting.leo | 79 ++++ tests/compiler/char/out.leo | 25 ++ .../compiler/compiler/char/circuit.leo.out | 66 ++- .../compiler/compiler/char/neq.leo.out | 66 ++- .../compiler/char/nonprinting.leo.out | 21 + .../compiler/compiler/char/out.leo.out | 102 +++++ .../parser/expression/literal/char.leo.out | 44 +- .../expression/literal/char_fail.leo.out | 23 +- .../expression/literal/char_parse.leo.out | 384 +++++++++++++++++- tests/parser/expression/literal/char.leo | 47 ++- tests/parser/expression/literal/char_fail.leo | 27 +- .../parser/expression/literal/char_parse.leo | 47 ++- 31 files changed, 1077 insertions(+), 89 deletions(-) create mode 100644 tests/compiler/char/inputs/escaped_unicode1.in create mode 100644 tests/compiler/char/inputs/escaped_unicode2.in create mode 100644 tests/compiler/char/inputs/escaped_unicode3.in rename tests/compiler/char/inputs/{escaped_unicode.in => escaped_unicode4.in} (100%) create mode 100644 tests/compiler/char/inputs/escaped_unicode5.in create mode 100644 tests/compiler/char/inputs/escaped_unicode6.in rename tests/compiler/char/inputs/{hex.in => hex1.in} (100%) create mode 100644 tests/compiler/char/inputs/hex2.in create mode 100644 tests/compiler/char/inputs/nonprinting.in create mode 100644 tests/compiler/char/inputs/unicode1.in create mode 100644 tests/compiler/char/inputs/unicode2.in create mode 100644 tests/compiler/char/inputs/unicode3.in rename tests/compiler/char/inputs/{unicode.in => unicode4.in} (100%) create mode 100644 tests/compiler/char/inputs/unicode5.in create mode 100644 tests/compiler/char/nonprinting.leo create mode 100644 tests/compiler/char/out.leo create mode 100644 tests/expectations/compiler/compiler/char/nonprinting.leo.out create mode 100644 tests/expectations/compiler/compiler/char/out.leo.out diff --git a/compiler/tests/canonicalization/string_transformation.json b/compiler/tests/canonicalization/string_transformation.json index 9abfbb842f..579ff55d4a 100644 --- a/compiler/tests/canonicalization/string_transformation.json +++ b/compiler/tests/canonicalization/string_transformation.json @@ -20,27 +20,18 @@ "variable_names": [ { "mutable": true, - "identifier": "{\"name\":\"s\",\"span\":\"{\\\"line_start\\\":2,\\\"line_stop\\\":2,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let s = \\\\\\\"Hello, World!\\\\\\\";\\\"}\"}", + "identifier": "{\"name\":\"s\",\"span\":\"{\\\"line_start\\\":2,\\\"line_stop\\\":2,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\" let s = \\\\\\\"\\\\\\\\u{2764}ello, World!\\\\\\\";\\\"}\"}", "span": { "line_start": 2, "line_stop": 2, "col_start": 9, "col_stop": 10, "path": "", - "content": " let s = \"Hello, World!\";" + "content": " let s = \"\\u{2764}ello, World!\";" } } ], - "type_": { - "Array": [ - "Char", - [ - { - "value": "13" - } - ] - ] - }, + "type_": null, "value": { "ArrayInline": { "elements": [ @@ -48,14 +39,14 @@ "Expression": { "Value": { "Char": [ - "H", + "❤", { "line_start": 2, "line_stop": 2, "col_start": 13, - "col_stop": 28, + "col_stop": 35, "path": "", - "content": " let s = \"Hello, World!\";" + "content": " let s = \"\\u{2764}ello, World!\";" } ] } @@ -70,9 +61,9 @@ "line_start": 2, "line_stop": 2, "col_start": 13, - "col_stop": 28, + "col_stop": 35, "path": "", - "content": " let s = \"Hello, World!\";" + "content": " let s = \"\\u{2764}ello, World!\";" } ] } @@ -87,9 +78,9 @@ "line_start": 2, "line_stop": 2, "col_start": 13, - "col_stop": 28, + "col_stop": 35, "path": "", - "content": " let s = \"Hello, World!\";" + "content": " let s = \"\\u{2764}ello, World!\";" } ] } @@ -104,9 +95,9 @@ "line_start": 2, "line_stop": 2, "col_start": 13, - "col_stop": 28, + "col_stop": 35, "path": "", - "content": " let s = \"Hello, World!\";" + "content": " let s = \"\\u{2764}ello, World!\";" } ] } @@ -121,9 +112,9 @@ "line_start": 2, "line_stop": 2, "col_start": 13, - "col_stop": 28, + "col_stop": 35, "path": "", - "content": " let s = \"Hello, World!\";" + "content": " let s = \"\\u{2764}ello, World!\";" } ] } @@ -138,9 +129,9 @@ "line_start": 2, "line_stop": 2, "col_start": 13, - "col_stop": 28, + "col_stop": 35, "path": "", - "content": " let s = \"Hello, World!\";" + "content": " let s = \"\\u{2764}ello, World!\";" } ] } @@ -155,9 +146,9 @@ "line_start": 2, "line_stop": 2, "col_start": 13, - "col_stop": 28, + "col_stop": 35, "path": "", - "content": " let s = \"Hello, World!\";" + "content": " let s = \"\\u{2764}ello, World!\";" } ] } @@ -172,9 +163,9 @@ "line_start": 2, "line_stop": 2, "col_start": 13, - "col_stop": 28, + "col_stop": 35, "path": "", - "content": " let s = \"Hello, World!\";" + "content": " let s = \"\\u{2764}ello, World!\";" } ] } @@ -189,9 +180,9 @@ "line_start": 2, "line_stop": 2, "col_start": 13, - "col_stop": 28, + "col_stop": 35, "path": "", - "content": " let s = \"Hello, World!\";" + "content": " let s = \"\\u{2764}ello, World!\";" } ] } @@ -206,9 +197,9 @@ "line_start": 2, "line_stop": 2, "col_start": 13, - "col_stop": 28, + "col_stop": 35, "path": "", - "content": " let s = \"Hello, World!\";" + "content": " let s = \"\\u{2764}ello, World!\";" } ] } @@ -223,9 +214,9 @@ "line_start": 2, "line_stop": 2, "col_start": 13, - "col_stop": 28, + "col_stop": 35, "path": "", - "content": " let s = \"Hello, World!\";" + "content": " let s = \"\\u{2764}ello, World!\";" } ] } @@ -240,9 +231,9 @@ "line_start": 2, "line_stop": 2, "col_start": 13, - "col_stop": 28, + "col_stop": 35, "path": "", - "content": " let s = \"Hello, World!\";" + "content": " let s = \"\\u{2764}ello, World!\";" } ] } @@ -257,9 +248,9 @@ "line_start": 2, "line_stop": 2, "col_start": 13, - "col_stop": 28, + "col_stop": 35, "path": "", - "content": " let s = \"Hello, World!\";" + "content": " let s = \"\\u{2764}ello, World!\";" } ] } @@ -270,9 +261,9 @@ "line_start": 2, "line_stop": 2, "col_start": 13, - "col_stop": 28, + "col_stop": 35, "path": "", - "content": " let s = \"Hello, World!\";" + "content": " let s = \"\\u{2764}ello, World!\";" } } }, @@ -280,9 +271,9 @@ "line_start": 2, "line_stop": 2, "col_start": 5, - "col_stop": 28, + "col_stop": 35, "path": "", - "content": " let s = \"Hello, World!\";" + "content": " let s = \"\\u{2764}ello, World!\";" } } } diff --git a/compiler/tests/canonicalization/string_transformation.leo b/compiler/tests/canonicalization/string_transformation.leo index e3830d38ee..fe6fb91610 100644 --- a/compiler/tests/canonicalization/string_transformation.leo +++ b/compiler/tests/canonicalization/string_transformation.leo @@ -1,3 +1,3 @@ function main() { - let s = "Hello, World!"; + let s = "\u{2764}ello, World!"; } \ No newline at end of file diff --git a/input/src/values/char_types.rs b/input/src/values/char_types.rs index a83c315324..b947e2f0dd 100644 --- a/input/src/values/char_types.rs +++ b/input/src/values/char_types.rs @@ -107,7 +107,7 @@ impl<'ast> CharTypes<'ast> { Self::Hex(character) => { let hex_string_number = character.value[2..character.value.len()].to_string(); if let Ok(number) = u8::from_str_radix(&hex_string_number, 16) { - if number < 127 { + if number <= 127 { return Ok(number as char); } } diff --git a/tests/compiler/char/circuit.leo b/tests/compiler/char/circuit.leo index 7bdcd1119f..b3f7f3c7cd 100644 --- a/tests/compiler/char/circuit.leo +++ b/tests/compiler/char/circuit.leo @@ -3,10 +3,20 @@ namespace: Compile expectation: Pass input_file: - inputs/ascii.in - - inputs/escaped_unicode.in + - inputs/escaped_unicode1.in + - inputs/escaped_unicode2.in + - inputs/escaped_unicode3.in + - inputs/escaped_unicode4.in + - inputs/escaped_unicode5.in + - inputs/escaped_unicode6.in - inputs/escaped.in - - inputs/hex.in - - inputs/unicode.in + - inputs/hex1.in + - inputs/hex2.in + - inputs/unicode1.in + - inputs/unicode2.in + - inputs/unicode3.in + - inputs/unicode4.in + - inputs/unicode5.in */ circuit Foo { diff --git a/tests/compiler/char/inputs/escaped_unicode1.in b/tests/compiler/char/inputs/escaped_unicode1.in new file mode 100644 index 0000000000..955b1276ad --- /dev/null +++ b/tests/compiler/char/inputs/escaped_unicode1.in @@ -0,0 +1,5 @@ +[main] +character: char = '\u{F}'; + +[registers] +r: char = 'a'; \ No newline at end of file diff --git a/tests/compiler/char/inputs/escaped_unicode2.in b/tests/compiler/char/inputs/escaped_unicode2.in new file mode 100644 index 0000000000..875360c75b --- /dev/null +++ b/tests/compiler/char/inputs/escaped_unicode2.in @@ -0,0 +1,5 @@ +[main] +character: char = '\u{E5}'; + +[registers] +r: char = 'a'; \ No newline at end of file diff --git a/tests/compiler/char/inputs/escaped_unicode3.in b/tests/compiler/char/inputs/escaped_unicode3.in new file mode 100644 index 0000000000..22d522b0f9 --- /dev/null +++ b/tests/compiler/char/inputs/escaped_unicode3.in @@ -0,0 +1,5 @@ +[main] +character: char = '\u{4e0}'; + +[registers] +r: char = 'a'; \ No newline at end of file diff --git a/tests/compiler/char/inputs/escaped_unicode.in b/tests/compiler/char/inputs/escaped_unicode4.in similarity index 100% rename from tests/compiler/char/inputs/escaped_unicode.in rename to tests/compiler/char/inputs/escaped_unicode4.in diff --git a/tests/compiler/char/inputs/escaped_unicode5.in b/tests/compiler/char/inputs/escaped_unicode5.in new file mode 100644 index 0000000000..b8fb9166ad --- /dev/null +++ b/tests/compiler/char/inputs/escaped_unicode5.in @@ -0,0 +1,5 @@ +[main] +character: char = '\u{1F622}'; + +[registers] +r: char = 'a'; \ No newline at end of file diff --git a/tests/compiler/char/inputs/escaped_unicode6.in b/tests/compiler/char/inputs/escaped_unicode6.in new file mode 100644 index 0000000000..3182ea61c4 --- /dev/null +++ b/tests/compiler/char/inputs/escaped_unicode6.in @@ -0,0 +1,5 @@ +[main] +character: char = '\u{10001F}'; + +[registers] +r: char = 'a'; \ No newline at end of file diff --git a/tests/compiler/char/inputs/hex.in b/tests/compiler/char/inputs/hex1.in similarity index 100% rename from tests/compiler/char/inputs/hex.in rename to tests/compiler/char/inputs/hex1.in diff --git a/tests/compiler/char/inputs/hex2.in b/tests/compiler/char/inputs/hex2.in new file mode 100644 index 0000000000..151d77eb7b --- /dev/null +++ b/tests/compiler/char/inputs/hex2.in @@ -0,0 +1,5 @@ +[main] +character: char = '\x7f'; + +[registers] +r: char = 'a'; \ No newline at end of file diff --git a/tests/compiler/char/inputs/nonprinting.in b/tests/compiler/char/inputs/nonprinting.in new file mode 100644 index 0000000000..1d5028b600 --- /dev/null +++ b/tests/compiler/char/inputs/nonprinting.in @@ -0,0 +1,72 @@ +[main] +in1: char = '\x00'; +in2: char = '\x01'; +in3: char = '\x02'; +in4: char = '\x03'; +in5: char = '\x04'; +in6: char = '\x05'; +in7: char = '\x06'; +in8: char = '\x07'; +in9: char = '\x08'; +in10: char = '\x09'; +in11: char = '\x0A'; +in12: char = '\x0B'; +in13: char = '\x0C'; +in14: char = '\x0D'; +in15: char = '\x0E'; +in16: char = '\x0F'; +in17: char = '\x10'; +in18: char = '\x11'; +in19: char = '\x12'; +in20: char = '\x13'; +in21: char = '\x14'; +in22: char = '\x15'; +in23: char = '\x16'; +in24: char = '\x17'; +in25: char = '\x18'; +in26: char = '\x19'; +in27: char = '\x1A'; +in28: char = '\x1B'; +in29: char = '\x1C'; +in30: char = '\x1D'; +in31: char = '\x1E'; +in32: char = '\x1F'; +in33: char = '\x20'; + +[registers] +r0: [char; 33] = [ + '\x00', + '\x01', + '\x02', + '\x03', + '\x04', + '\x05', + '\x06', + '\x07', + '\x08', + '\x09', + '\x0A', + '\x0B', + '\x0C', + '\x0D', + '\x0E', + '\x0F', + '\x10', + '\x11', + '\x12', + '\x13', + '\x14', + '\x15', + '\x16', + '\x17', + '\x18', + '\x19', + '\x1A', + '\x1B', + '\x1C', + '\x1D', + '\x1E', + '\x1F', + '\x20' +]; +r1: bool = false; \ No newline at end of file diff --git a/tests/compiler/char/inputs/unicode1.in b/tests/compiler/char/inputs/unicode1.in new file mode 100644 index 0000000000..834b3083c3 --- /dev/null +++ b/tests/compiler/char/inputs/unicode1.in @@ -0,0 +1,5 @@ +[main] +character: char = ''; + +[registers] +r: char = 'a'; \ No newline at end of file diff --git a/tests/compiler/char/inputs/unicode2.in b/tests/compiler/char/inputs/unicode2.in new file mode 100644 index 0000000000..7e58c11d68 --- /dev/null +++ b/tests/compiler/char/inputs/unicode2.in @@ -0,0 +1,5 @@ +[main] +character: char = 'å'; + +[registers] +r: char = 'a'; \ No newline at end of file diff --git a/tests/compiler/char/inputs/unicode3.in b/tests/compiler/char/inputs/unicode3.in new file mode 100644 index 0000000000..400887314c --- /dev/null +++ b/tests/compiler/char/inputs/unicode3.in @@ -0,0 +1,5 @@ +[main] +character: char = 'Ӡ'; + +[registers] +r: char = 'a'; \ No newline at end of file diff --git a/tests/compiler/char/inputs/unicode.in b/tests/compiler/char/inputs/unicode4.in similarity index 100% rename from tests/compiler/char/inputs/unicode.in rename to tests/compiler/char/inputs/unicode4.in diff --git a/tests/compiler/char/inputs/unicode5.in b/tests/compiler/char/inputs/unicode5.in new file mode 100644 index 0000000000..9486e85d43 --- /dev/null +++ b/tests/compiler/char/inputs/unicode5.in @@ -0,0 +1,5 @@ +[main] +character: char = '😭'; + +[registers] +r: char = 'a'; \ No newline at end of file diff --git a/tests/compiler/char/neq.leo b/tests/compiler/char/neq.leo index 5605ce31b4..26d9131f4d 100644 --- a/tests/compiler/char/neq.leo +++ b/tests/compiler/char/neq.leo @@ -3,10 +3,20 @@ namespace: Compile expectation: Pass input_file: - inputs/ascii.in - - inputs/escaped_unicode.in + - inputs/escaped_unicode1.in + - inputs/escaped_unicode2.in + - inputs/escaped_unicode3.in + - inputs/escaped_unicode4.in + - inputs/escaped_unicode5.in + - inputs/escaped_unicode6.in - inputs/escaped.in - - inputs/hex.in - - inputs/unicode.in + - inputs/hex1.in + - inputs/hex2.in + - inputs/unicode1.in + - inputs/unicode2.in + - inputs/unicode3.in + - inputs/unicode4.in + - inputs/unicode5.in */ function main(character: char) -> char { diff --git a/tests/compiler/char/nonprinting.leo b/tests/compiler/char/nonprinting.leo new file mode 100644 index 0000000000..381d3e6cb4 --- /dev/null +++ b/tests/compiler/char/nonprinting.leo @@ -0,0 +1,79 @@ +/* +namespace: Compile +expectation: Pass +input_file: + - inputs/nonprinting.in +*/ +function main( + in1: char, + in2: char, + in3: char, + in4: char, + in5: char, + in6: char, + in7: char, + in8: char, + in9: char, + in10: char, + in11: char, + in12: char, + in13: char, + in14: char, + in15: char, + in16: char, + in17: char, + in18: char, + in19: char, + in20: char, + in21: char, + in22: char, + in23: char, + in24: char, + in25: char, + in26: char, + in27: char, + in28: char, + in29: char, + in30: char, + in31: char, + in32: char, + in32: char, +) -> ([char; 33], bool) { + let str = [ + in1, + in2, + in3, + in4, + in5, + in6, + in7, + in8, + in9, + in10, + in11, + in12, + in13, + in14, + in15, + in16, + in17, + in18, + in19, + in20, + in21, + in22, + in23, + in24, + in25, + in26, + in27, + in28, + in29, + in30, + in31, + in32, + in32, + ]; + console.log("{}", str); + return (str, in1 == '\x00'); +} \ No newline at end of file diff --git a/tests/compiler/char/out.leo b/tests/compiler/char/out.leo new file mode 100644 index 0000000000..e8369bd265 --- /dev/null +++ b/tests/compiler/char/out.leo @@ -0,0 +1,25 @@ +/* +namespace: Compile +expectation: Pass +input_file: + - inputs/ascii.in + - inputs/escaped_unicode1.in + - inputs/escaped_unicode2.in + - inputs/escaped_unicode3.in + - inputs/escaped_unicode4.in + - inputs/escaped_unicode5.in + - inputs/escaped_unicode6.in + - inputs/escaped.in + - inputs/hex1.in + - inputs/hex2.in + - inputs/unicode1.in + - inputs/unicode2.in + - inputs/unicode3.in + - inputs/unicode4.in + - inputs/unicode5.in +*/ +function main(character: char) -> char { + console.log("{}", character); + + return character == 'z' ? 'x' : character; +} \ No newline at end of file diff --git a/tests/expectations/compiler/compiler/char/circuit.leo.out b/tests/expectations/compiler/compiler/char/circuit.leo.out index a8b5bd9764..c10e66b153 100644 --- a/tests/expectations/compiler/compiler/char/circuit.leo.out +++ b/tests/expectations/compiler/compiler/char/circuit.leo.out @@ -16,27 +16,87 @@ outputs: r: type: char value: a - - input_file: inputs/escaped_unicode.in + - input_file: inputs/escaped_unicode1.in + output: + registers: + r: + type: char + value: "\\u{f}" + - input_file: inputs/escaped_unicode2.in + output: + registers: + r: + type: char + value: "\\u{e5}" + - input_file: inputs/escaped_unicode3.in + output: + registers: + r: + type: char + value: "\\u{4e0}" + - input_file: inputs/escaped_unicode4.in output: registers: r: type: char value: "\\u{2764}" + - input_file: inputs/escaped_unicode5.in + output: + registers: + r: + type: char + value: "\\u{1f622}" + - input_file: inputs/escaped_unicode6.in + output: + registers: + r: + type: char + value: "\\u{10001f}" - input_file: inputs/escaped.in output: registers: r: type: char value: "\\'" - - input_file: inputs/hex.in + - input_file: inputs/hex1.in output: registers: r: type: char value: "*" - - input_file: inputs/unicode.in + - input_file: inputs/hex2.in + output: + registers: + r: + type: char + value: "\\u{7f}" + - input_file: inputs/unicode1.in + output: + registers: + r: + type: char + value: "\\u{e00f}" + - input_file: inputs/unicode2.in + output: + registers: + r: + type: char + value: "\\u{e5}" + - input_file: inputs/unicode3.in + output: + registers: + r: + type: char + value: "\\u{4e0}" + - input_file: inputs/unicode4.in output: registers: r: type: char value: "\\u{2764}" + - input_file: inputs/unicode5.in + output: + registers: + r: + type: char + value: "\\u{1f62d}" diff --git a/tests/expectations/compiler/compiler/char/neq.leo.out b/tests/expectations/compiler/compiler/char/neq.leo.out index 48f1729114..d6f2b8ef84 100644 --- a/tests/expectations/compiler/compiler/char/neq.leo.out +++ b/tests/expectations/compiler/compiler/char/neq.leo.out @@ -16,7 +16,37 @@ outputs: r: type: char value: Z - - input_file: inputs/escaped_unicode.in + - input_file: inputs/escaped_unicode1.in + output: + registers: + r: + type: char + value: a + - input_file: inputs/escaped_unicode2.in + output: + registers: + r: + type: char + value: a + - input_file: inputs/escaped_unicode3.in + output: + registers: + r: + type: char + value: a + - input_file: inputs/escaped_unicode4.in + output: + registers: + r: + type: char + value: a + - input_file: inputs/escaped_unicode5.in + output: + registers: + r: + type: char + value: a + - input_file: inputs/escaped_unicode6.in output: registers: r: @@ -28,13 +58,43 @@ outputs: r: type: char value: a - - input_file: inputs/hex.in + - input_file: inputs/hex1.in output: registers: r: type: char value: a - - input_file: inputs/unicode.in + - input_file: inputs/hex2.in + output: + registers: + r: + type: char + value: a + - input_file: inputs/unicode1.in + output: + registers: + r: + type: char + value: a + - input_file: inputs/unicode2.in + output: + registers: + r: + type: char + value: a + - input_file: inputs/unicode3.in + output: + registers: + r: + type: char + value: a + - input_file: inputs/unicode4.in + output: + registers: + r: + type: char + value: a + - input_file: inputs/unicode5.in output: registers: r: diff --git a/tests/expectations/compiler/compiler/char/nonprinting.leo.out b/tests/expectations/compiler/compiler/char/nonprinting.leo.out new file mode 100644 index 0000000000..b7f0879951 --- /dev/null +++ b/tests/expectations/compiler/compiler/char/nonprinting.leo.out @@ -0,0 +1,21 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - circuit: + num_public_variables: 0 + num_private_variables: 35 + num_constraints: 3 + at: 27242eeb2faf33996c0329ac2ec3b337434f78d392ff29465d3508084de6c721 + bt: 4727127f178bb02895a615bf38a4aa3c5cb9d2b076eca15ebe6fea741b48ce98 + ct: cae904ba23a045f4438177f10211a50ae29eee49d08211c731aee88353dc0cfb + output: + - input_file: inputs/nonprinting.in + output: + registers: + r0: + type: "[char; 33]" + value: "\\u{0}\\u{1}\\u{2}\\u{3}\\u{4}\\u{5}\\u{6}\\u{7}\\u{8}\\t\\n\\u{b}\\u{c}\\r\\u{e}\\u{f}\\u{10}\\u{11}\\u{12}\\u{13}\\u{14}\\u{15}\\u{16}\\u{17}\\u{18}\\u{19}\\u{1a}\\u{1b}\\u{1c}\\u{1d}\\u{1e}\\u{1f}\\u{1f}" + r1: + type: bool + value: "true" diff --git a/tests/expectations/compiler/compiler/char/out.leo.out b/tests/expectations/compiler/compiler/char/out.leo.out new file mode 100644 index 0000000000..c10e66b153 --- /dev/null +++ b/tests/expectations/compiler/compiler/char/out.leo.out @@ -0,0 +1,102 @@ +--- +namespace: Compile +expectation: Pass +outputs: + - circuit: + num_public_variables: 0 + num_private_variables: 6 + num_constraints: 4 + at: 2859fe6f24016b5634df2791da7de932e68ec32c73b5b573e0c39e968c7a4e12 + bt: 8143508f19c8eee208a7fbbcfb833aeeace6ba0a761e41d028599d2237cc60fa + ct: d0c6feeed1e6b8d5c0e03dc9e25641b7fdc34ad912e2b1488296d4a99ed6cbf5 + output: + - input_file: inputs/ascii.in + output: + registers: + r: + type: char + value: a + - input_file: inputs/escaped_unicode1.in + output: + registers: + r: + type: char + value: "\\u{f}" + - input_file: inputs/escaped_unicode2.in + output: + registers: + r: + type: char + value: "\\u{e5}" + - input_file: inputs/escaped_unicode3.in + output: + registers: + r: + type: char + value: "\\u{4e0}" + - input_file: inputs/escaped_unicode4.in + output: + registers: + r: + type: char + value: "\\u{2764}" + - input_file: inputs/escaped_unicode5.in + output: + registers: + r: + type: char + value: "\\u{1f622}" + - input_file: inputs/escaped_unicode6.in + output: + registers: + r: + type: char + value: "\\u{10001f}" + - input_file: inputs/escaped.in + output: + registers: + r: + type: char + value: "\\'" + - input_file: inputs/hex1.in + output: + registers: + r: + type: char + value: "*" + - input_file: inputs/hex2.in + output: + registers: + r: + type: char + value: "\\u{7f}" + - input_file: inputs/unicode1.in + output: + registers: + r: + type: char + value: "\\u{e00f}" + - input_file: inputs/unicode2.in + output: + registers: + r: + type: char + value: "\\u{e5}" + - input_file: inputs/unicode3.in + output: + registers: + r: + type: char + value: "\\u{4e0}" + - input_file: inputs/unicode4.in + output: + registers: + r: + type: char + value: "\\u{2764}" + - input_file: inputs/unicode5.in + output: + registers: + r: + type: char + value: "\\u{1f62d}" diff --git a/tests/expectations/parser/parser/expression/literal/char.leo.out b/tests/expectations/parser/parser/expression/literal/char.leo.out index d6e0fd1fc1..fa87952664 100644 --- a/tests/expectations/parser/parser/expression/literal/char.leo.out +++ b/tests/expectations/parser/parser/expression/literal/char.leo.out @@ -8,8 +8,48 @@ outputs: - "'' @ 1:1-5" - "'' @ 1:1-5" - "'\u0000' @ 1:1-5" + - "'\u000f' @ 1:1-8" + - "'' @ 1:1-6" + - "'å' @ 1:1-9" + - "'å' @ 1:1-5" + - "'Ӡ' @ 1:1-10" + - "'Ӡ' @ 1:1-5" - "'❤' @ 1:1-11" - - "'の' @ 1:1-11" - "'❤' @ 1:1-6" - - "'の' @ 1:1-6" + - "'😢' @ 1:1-12" + - "'😭' @ 1:1-7" + - "'􀀟' @ 1:1-13" - "'*' @ 1:1-7" + - "'\u007f' @ 1:1-7" + - "'\u0000' @ 1:1-7" + - "'\u0001' @ 1:1-7" + - "'\u0002' @ 1:1-7" + - "'\u0003' @ 1:1-7" + - "'\u0004' @ 1:1-7" + - "'\u0005' @ 1:1-7" + - "'\u0006' @ 1:1-7" + - "'\u0007' @ 1:1-7" + - "'\u0010' @ 1:1-7" + - "'\u0011' @ 1:1-7" + - "'\u0012' @ 1:1-7" + - "'\u0013' @ 1:1-7" + - "'\u0014' @ 1:1-7" + - "'\u0015' @ 1:1-7" + - "'\u0016' @ 1:1-7" + - "'\u0017' @ 1:1-7" + - "'' @ 1:1-7" + - "'!' @ 1:1-7" + - "'\"' @ 1:1-7" + - "'#' @ 1:1-7" + - "'$' @ 1:1-7" + - "'%' @ 1:1-7" + - "'&' @ 1:1-7" + - "''' @ 1:1-7" + - "'0' @ 1:1-7" + - "'1' @ 1:1-7" + - "'2' @ 1:1-7" + - "'3' @ 1:1-7" + - "'4' @ 1:1-7" + - "'5' @ 1:1-7" + - "'6' @ 1:1-7" + - "'7' @ 1:1-7" diff --git a/tests/expectations/parser/parser/expression/literal/char_fail.leo.out b/tests/expectations/parser/parser/expression/literal/char_fail.leo.out index 463bc50708..7cb900bc21 100644 --- a/tests/expectations/parser/parser/expression/literal/char_fail.leo.out +++ b/tests/expectations/parser/parser/expression/literal/char_fail.leo.out @@ -5,13 +5,26 @@ outputs: - " --> test:1:1\n |\n 1 | '\\'\n | ^\n |\n = unexpected token: '''" - " --> test:1:1\n |\n 1 | 'a\n | ^\n |\n = unexpected token: '''" - " --> test:1:1\n |\n 1 | ''\n | ^\n |\n = unexpected token: '''" - - " --> test:1:1\n |\n 1 | '\\x9'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\x9A'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\x7'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\x7g'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\xz'\n | ^\n |\n = unexpected token: '''" - " --> test:1:1\n |\n 1 | 'abcdefg'\n | ^\n |\n = unexpected token: '''" - " --> test:1:1\n |\n 1 | '\\t\\t'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\a'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\z'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\A'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\Z'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\1'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\9'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\*'\n | ^\n |\n = unexpected token: '''" - " --> test:1:1\n |\n 1 | '\\u{bbbbb}\\u{aaaa}'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\uz'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\u1'\n | ^\n |\n = unexpected token: '''" - " --> test:1:1\n |\n 1 | '\\u123'\n | ^\n |\n = unexpected token: '''" - - " --> test:1:1\n |\n 1 | '\\u1' // should error\n | ^\n |\n = unexpected token: '''" - - " --> test:1:1\n |\n 1 | '\\u00000000' // should error\n | ^\n |\n = unexpected token: '''" - - " --> test:1:1\n |\n 1 | '\\u01000000' // should error\n | ^\n |\n = unexpected token: '''" - - " --> test:1:1\n |\n 1 | '\\u9999999' // should error\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | \\u{2764z'\n | ^\n |\n = unexpected token: '\\'" + - " --> test:1:1\n |\n 1 | \\u{276g}'\n | ^\n |\n = unexpected token: '\\'" + - " --> test:1:1\n |\n 1 | '\\u00000000'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\u01000000'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\u9999999'\n | ^\n |\n = unexpected token: '''" - " --> test:1:1\n |\n 1 | '😭😂😘'\n | ^\n |\n = unexpected token: '''" diff --git a/tests/expectations/parser/parser/expression/literal/char_parse.leo.out b/tests/expectations/parser/parser/expression/literal/char_parse.leo.out index 3b080cd0a6..56a21b3028 100644 --- a/tests/expectations/parser/parser/expression/literal/char_parse.leo.out +++ b/tests/expectations/parser/parser/expression/literal/char_parse.leo.out @@ -56,6 +56,60 @@ outputs: col_stop: 5 path: test content: "'\\0'" + - Value: + Char: + - "\u000f" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 8 + path: test + content: "'\\u{F}'" + - Value: + Char: + -  + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 6 + path: test + content: "''" + - Value: + Char: + - å + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 9 + path: test + content: "'\\u{E5}'" + - Value: + Char: + - å + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "'å'" + - Value: + Char: + - Ӡ + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 10 + path: test + content: "'\\u{4e0}'" + - Value: + Char: + - Ӡ + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 5 + path: test + content: "'Ӡ'" - Value: Char: - ❤ @@ -65,15 +119,6 @@ outputs: col_stop: 11 path: test content: "'\\u{2764}'" - - Value: - Char: - - の - - line_start: 1 - line_stop: 1 - col_start: 1 - col_stop: 11 - path: test - content: "'\\u{306E}'" - Value: Char: - ❤ @@ -85,13 +130,31 @@ outputs: content: "'❤'" - Value: Char: - - の + - 😢 - line_start: 1 line_stop: 1 col_start: 1 - col_stop: 6 + col_stop: 12 path: test - content: "'の'" + content: "'\\u{1F622}'" + - Value: + Char: + - 😭 + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'😭'" + - Value: + Char: + - 􀀟 + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 13 + path: test + content: "'\\u{10001F}'" - Value: Char: - "*" @@ -101,3 +164,300 @@ outputs: col_stop: 7 path: test content: "'\\x2A'" + - Value: + Char: + -  + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x7f'" + - Value: + Char: + - "\u0000" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x00'" + - Value: + Char: + - "\u0001" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x01'" + - Value: + Char: + - "\u0002" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x02'" + - Value: + Char: + - "\u0003" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x03'" + - Value: + Char: + - "\u0004" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x04'" + - Value: + Char: + - "\u0005" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x05'" + - Value: + Char: + - "\u0006" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x06'" + - Value: + Char: + -  + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x07'" + - Value: + Char: + - "\u0010" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x10'" + - Value: + Char: + - "\u0011" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x11'" + - Value: + Char: + - "\u0012" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x12'" + - Value: + Char: + - "\u0013" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x13'" + - Value: + Char: + - "\u0014" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x14'" + - Value: + Char: + - "\u0015" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x15'" + - Value: + Char: + - "\u0016" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x16'" + - Value: + Char: + - "\u0017" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x17'" + - Value: + Char: + - " " + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x20'" + - Value: + Char: + - "!" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x21'" + - Value: + Char: + - "\"" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x22'" + - Value: + Char: + - "#" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x23'" + - Value: + Char: + - $ + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x24'" + - Value: + Char: + - "%" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x25'" + - Value: + Char: + - "&" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x26'" + - Value: + Char: + - "'" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x27'" + - Value: + Char: + - "0" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x30'" + - Value: + Char: + - "1" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x31'" + - Value: + Char: + - "2" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x32'" + - Value: + Char: + - "3" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x33'" + - Value: + Char: + - "4" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x34'" + - Value: + Char: + - "5" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x35'" + - Value: + Char: + - "6" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x36'" + - Value: + Char: + - "7" + - line_start: 1 + line_stop: 1 + col_start: 1 + col_stop: 7 + path: test + content: "'\\x37'" diff --git a/tests/parser/expression/literal/char.leo b/tests/parser/expression/literal/char.leo index 5ea47f7dbf..68f7edc37b 100644 --- a/tests/parser/expression/literal/char.leo +++ b/tests/parser/expression/literal/char.leo @@ -9,8 +9,49 @@ expectation: Pass '\t' '\r' '\0' +'\u{F}' +'' +'\u{E5}' +'å' +'\u{4e0}' +'Ӡ' '\u{2764}' -'\u{306E}' '❤' -'の' -'\x2A' \ No newline at end of file +'\u{1F622}' +'😭' +'\u{10001F}' +'\x2A' +'\x7f' + +'\x00' +'\x01' +'\x02' +'\x03' +'\x04' +'\x05' +'\x06' +'\x07' +'\x10' +'\x11' +'\x12' +'\x13' +'\x14' +'\x15' +'\x16' +'\x17' +'\x20' +'\x21' +'\x22' +'\x23' +'\x24' +'\x25' +'\x26' +'\x27' +'\x30' +'\x31' +'\x32' +'\x33' +'\x34' +'\x35' +'\x36' +'\x37' \ No newline at end of file diff --git a/tests/parser/expression/literal/char_fail.leo b/tests/parser/expression/literal/char_fail.leo index aa5bb198f2..c692f20913 100644 --- a/tests/parser/expression/literal/char_fail.leo +++ b/tests/parser/expression/literal/char_fail.leo @@ -9,19 +9,32 @@ expectation: Fail '' -'\x9' +'\x9A' +'\x7' +'\x7g' +'\xz' 'abcdefg' '\t\t' +'\a' +'\z' +'\A' +'\Z' +'\1' +'\9' +'\*' +'\x' +'\u' '\u{bbbbb}\u{aaaa}' - +'\uz' +'\u1' '\u123' - -'\u1' // should error -'\u00000000' // should error -'\u01000000' // should error -'\u9999999' // should error +\u{2764z' +\u{276g}' +'\u00000000' +'\u01000000' +'\u9999999' '😭😂😘' diff --git a/tests/parser/expression/literal/char_parse.leo b/tests/parser/expression/literal/char_parse.leo index 515f6b10f3..60a6a6e80c 100644 --- a/tests/parser/expression/literal/char_parse.leo +++ b/tests/parser/expression/literal/char_parse.leo @@ -9,8 +9,49 @@ expectation: Pass '\t' '\r' '\0' +'\u{F}' +'' +'\u{E5}' +'å' +'\u{4e0}' +'Ӡ' '\u{2764}' -'\u{306E}' '❤' -'の' -'\x2A' \ No newline at end of file +'\u{1F622}' +'😭' +'\u{10001F}' +'\x2A' +'\x7f' + +'\x00' +'\x01' +'\x02' +'\x03' +'\x04' +'\x05' +'\x06' +'\x07' +'\x10' +'\x11' +'\x12' +'\x13' +'\x14' +'\x15' +'\x16' +'\x17' +'\x20' +'\x21' +'\x22' +'\x23' +'\x24' +'\x25' +'\x26' +'\x27' +'\x30' +'\x31' +'\x32' +'\x33' +'\x34' +'\x35' +'\x36' +'\x37' \ No newline at end of file From 5b4cc494c10801bd81c40fc37ca6eacdcc35364a Mon Sep 17 00:00:00 2001 From: gluax Date: Thu, 10 Jun 2021 10:59:35 -0700 Subject: [PATCH 2/3] fix parser bug allowing illegal unicode escape --- parser/src/tokenizer/lexer.rs | 4 ++++ .../parser/parser/expression/literal/char_fail.leo.out | 6 ++++-- tests/parser/expression/literal/char_fail.leo | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/parser/src/tokenizer/lexer.rs b/parser/src/tokenizer/lexer.rs index b21cc77755..1ab67a3a87 100644 --- a/parser/src/tokenizer/lexer.rs +++ b/parser/src/tokenizer/lexer.rs @@ -113,6 +113,10 @@ impl Token { if unicode { let string = input_tendril.to_string(); + if &string[string.len() - 1..] != "}" { + return None; + } + let unicode_number = &string[3..string.len() - 1]; let len = unicode_number.len(); if !(1..=6).contains(&len) { diff --git a/tests/expectations/parser/parser/expression/literal/char_fail.leo.out b/tests/expectations/parser/parser/expression/literal/char_fail.leo.out index 7cb900bc21..d32df523c8 100644 --- a/tests/expectations/parser/parser/expression/literal/char_fail.leo.out +++ b/tests/expectations/parser/parser/expression/literal/char_fail.leo.out @@ -18,12 +18,14 @@ outputs: - " --> test:1:1\n |\n 1 | '\\1'\n | ^\n |\n = unexpected token: '''" - " --> test:1:1\n |\n 1 | '\\9'\n | ^\n |\n = unexpected token: '''" - " --> test:1:1\n |\n 1 | '\\*'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\x'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\u'\n | ^\n |\n = unexpected token: '''" - " --> test:1:1\n |\n 1 | '\\u{bbbbb}\\u{aaaa}'\n | ^\n |\n = unexpected token: '''" - " --> test:1:1\n |\n 1 | '\\uz'\n | ^\n |\n = unexpected token: '''" - " --> test:1:1\n |\n 1 | '\\u1'\n | ^\n |\n = unexpected token: '''" - " --> test:1:1\n |\n 1 | '\\u123'\n | ^\n |\n = unexpected token: '''" - - " --> test:1:1\n |\n 1 | \\u{2764z'\n | ^\n |\n = unexpected token: '\\'" - - " --> test:1:1\n |\n 1 | \\u{276g}'\n | ^\n |\n = unexpected token: '\\'" + - " --> test:1:1\n |\n 1 | '\\u{2764z'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\u{276g}'\n | ^\n |\n = unexpected token: '''" - " --> test:1:1\n |\n 1 | '\\u00000000'\n | ^\n |\n = unexpected token: '''" - " --> test:1:1\n |\n 1 | '\\u01000000'\n | ^\n |\n = unexpected token: '''" - " --> test:1:1\n |\n 1 | '\\u9999999'\n | ^\n |\n = unexpected token: '''" diff --git a/tests/parser/expression/literal/char_fail.leo b/tests/parser/expression/literal/char_fail.leo index c692f20913..fc12b5ca9a 100644 --- a/tests/parser/expression/literal/char_fail.leo +++ b/tests/parser/expression/literal/char_fail.leo @@ -31,8 +31,8 @@ expectation: Fail '\uz' '\u1' '\u123' -\u{2764z' -\u{276g}' +'\u{2764z' +'\u{276g}' '\u00000000' '\u01000000' '\u9999999' From debaf9cd617d073dddfbc971c84f850551614219 Mon Sep 17 00:00:00 2001 From: gluax Date: Fri, 11 Jun 2021 10:05:08 -0700 Subject: [PATCH 3/3] more byte failing tests --- .../parser/parser/expression/literal/char_fail.leo.out | 7 +++++++ tests/parser/expression/literal/char_fail.leo | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/tests/expectations/parser/parser/expression/literal/char_fail.leo.out b/tests/expectations/parser/parser/expression/literal/char_fail.leo.out index d32df523c8..30bb2b78e6 100644 --- a/tests/expectations/parser/parser/expression/literal/char_fail.leo.out +++ b/tests/expectations/parser/parser/expression/literal/char_fail.leo.out @@ -9,6 +9,13 @@ outputs: - " --> test:1:1\n |\n 1 | '\\x7'\n | ^\n |\n = unexpected token: '''" - " --> test:1:1\n |\n 1 | '\\x7g'\n | ^\n |\n = unexpected token: '''" - " --> test:1:1\n |\n 1 | '\\xz'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\x80'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\xc1'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\xc2'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\xDF'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\xC0'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\xe0'\n | ^\n |\n = unexpected token: '''" + - " --> test:1:1\n |\n 1 | '\\x9f'\n | ^\n |\n = unexpected token: '''" - " --> test:1:1\n |\n 1 | 'abcdefg'\n | ^\n |\n = unexpected token: '''" - " --> test:1:1\n |\n 1 | '\\t\\t'\n | ^\n |\n = unexpected token: '''" - " --> test:1:1\n |\n 1 | '\\a'\n | ^\n |\n = unexpected token: '''" diff --git a/tests/parser/expression/literal/char_fail.leo b/tests/parser/expression/literal/char_fail.leo index fc12b5ca9a..982cc3f801 100644 --- a/tests/parser/expression/literal/char_fail.leo +++ b/tests/parser/expression/literal/char_fail.leo @@ -13,6 +13,13 @@ expectation: Fail '\x7' '\x7g' '\xz' +'\x80' +'\xc1' +'\xc2' +'\xDF' +'\xC0' +'\xe0' +'\x9f' 'abcdefg'