From 3148078e57079a3d89f1cbac4757aeabc8bb8c7d Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Sun, 25 Mar 2018 19:02:27 +0200 Subject: [PATCH 01/33] Add \a escape sequence The escape sequence that makes a beep. --- src/compiler/crystal/syntax/lexer.cr | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/crystal/syntax/lexer.cr b/src/compiler/crystal/syntax/lexer.cr index 55962aada23b..d3f7e670840a 100644 --- a/src/compiler/crystal/syntax/lexer.cr +++ b/src/compiler/crystal/syntax/lexer.cr @@ -493,6 +493,8 @@ module Crystal case char when '\\' case char = next_char + when 'a' + io << "\x07" when 'b' io << "\u{8}" when 'n' @@ -611,6 +613,8 @@ module Crystal @token.value = '\\' when '\'' @token.value = '\'' + when 'a' + @token.value = '\a' when 'b' @token.value = '\b' when 'e' @@ -1789,6 +1793,8 @@ module Crystal end else case char = next_char + when 'a' + string_token_escape_value "\x07" when 'b' string_token_escape_value "\u{8}" when 'n' From 2b20c37ee023830dd5c049ac6f24e67fd8089aa6 Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Sun, 25 Mar 2018 19:40:04 +0200 Subject: [PATCH 02/33] Update lexer_spec.cr --- spec/compiler/lexer/lexer_spec.cr | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/compiler/lexer/lexer_spec.cr b/spec/compiler/lexer/lexer_spec.cr index 7b03c8eae3a5..ce948f1c4ffc 100644 --- a/spec/compiler/lexer/lexer_spec.cr +++ b/spec/compiler/lexer/lexer_spec.cr @@ -230,6 +230,7 @@ describe "Lexer" do it_lexes_number :i8, ["0i8", "0"] it_lexes_char "'a'", 'a' + it_lexes_char "'\\a'", '\a' it_lexes_char "'\\b'", 8.chr it_lexes_char "'\\n'", '\n' it_lexes_char "'\\t'", '\t' From b22d159901c1f9b23c138e12e06429d4f820c367 Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Sun, 25 Mar 2018 20:01:05 +0200 Subject: [PATCH 03/33] 7.chr --- spec/compiler/lexer/lexer_spec.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/compiler/lexer/lexer_spec.cr b/spec/compiler/lexer/lexer_spec.cr index ce948f1c4ffc..559db973e3d0 100644 --- a/spec/compiler/lexer/lexer_spec.cr +++ b/spec/compiler/lexer/lexer_spec.cr @@ -230,7 +230,7 @@ describe "Lexer" do it_lexes_number :i8, ["0i8", "0"] it_lexes_char "'a'", 'a' - it_lexes_char "'\\a'", '\a' + it_lexes_char "'\\a'", 7.chr it_lexes_char "'\\b'", 8.chr it_lexes_char "'\\n'", '\n' it_lexes_char "'\\t'", '\t' From fdbe8913ea8d6c419962d654fc0fb85897f35225 Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Sun, 25 Mar 2018 20:07:01 +0200 Subject: [PATCH 04/33] \u{7} --- src/compiler/crystal/syntax/lexer.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/crystal/syntax/lexer.cr b/src/compiler/crystal/syntax/lexer.cr index d3f7e670840a..231bf79d241c 100644 --- a/src/compiler/crystal/syntax/lexer.cr +++ b/src/compiler/crystal/syntax/lexer.cr @@ -494,7 +494,7 @@ module Crystal when '\\' case char = next_char when 'a' - io << "\x07" + io << "\u{7}" when 'b' io << "\u{8}" when 'n' @@ -1794,7 +1794,7 @@ module Crystal else case char = next_char when 'a' - string_token_escape_value "\x07" + string_token_escape_value "\u{7}" when 'b' string_token_escape_value "\u{8}" when 'n' From e0922ea2e607dbbf9ebde95bedb2a2ed4af42f3f Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Sun, 25 Mar 2018 21:03:40 +0200 Subject: [PATCH 05/33] Update string.cr --- src/string.cr | 1 + 1 file changed, 1 insertion(+) diff --git a/src/string.cr b/src/string.cr index cc84d26345f9..11b55d24991f 100644 --- a/src/string.cr +++ b/src/string.cr @@ -3939,6 +3939,7 @@ class String case current_char when '"' then io << "\\\"" when '\\' then io << "\\\\" + when '\a' then io << "\\a" when '\b' then io << "\\b" when '\e' then io << "\\e" when '\f' then io << "\\f" From 46e8fa683346496913a6953bc11e9c48050da5fb Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Sun, 25 Mar 2018 21:22:40 +0200 Subject: [PATCH 06/33] Update char_spec.cr --- spec/std/char_spec.cr | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/std/char_spec.cr b/spec/std/char_spec.cr index 843ba043d8d1..c75ac73f83fc 100644 --- a/spec/std/char_spec.cr +++ b/spec/std/char_spec.cr @@ -133,6 +133,7 @@ describe "Char" do end it "escapes" do + '\a'.ord.should eq(7) '\b'.ord.should eq(8) '\t'.ord.should eq(9) '\n'.ord.should eq(10) From 556f4a198a303511f4eab01b0903bdf4a7495bde Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Sun, 25 Mar 2018 21:39:08 +0200 Subject: [PATCH 07/33] Update parser_spec.cr --- spec/compiler/parser/parser_spec.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/compiler/parser/parser_spec.cr b/spec/compiler/parser/parser_spec.cr index 5cbb98306058..d13762191d81 100644 --- a/spec/compiler/parser/parser_spec.cr +++ b/spec/compiler/parser/parser_spec.cr @@ -73,7 +73,7 @@ describe "Parser" do it_parses %(:"\\\\foo"), "\\foo".symbol it_parses %(:"\\\"foo"), "\"foo".symbol it_parses %(:"\\\"foo\\\""), "\"foo\"".symbol - it_parses %(:"\\b\\n\\r\\t\\v\\f\\e"), "\b\n\r\t\v\f\e".symbol + it_parses %(:"\\a\\b\\n\\r\\t\\v\\f\\e"), "\a\b\n\r\t\v\f\e".symbol it_parses %(:"\\u{61}"), "a".symbol it_parses "[1, 2]", ([1.int32, 2.int32] of ASTNode).array From 1fd04ab212168043497f05b47f76981eb9ee60e8 Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Sun, 25 Mar 2018 21:54:10 +0200 Subject: [PATCH 08/33] Update string_spec.cr --- spec/std/string_spec.cr | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/std/string_spec.cr b/spec/std/string_spec.cr index 6fbdebc7d0ce..b28e76f2f720 100644 --- a/spec/std/string_spec.cr +++ b/spec/std/string_spec.cr @@ -1444,6 +1444,7 @@ describe "String" do "a".dump.should eq %("a") "\\".dump.should eq %("\\\\") "\"".dump.should eq %("\\\"") + "\a".dump.should eq %("\\a") "\b".dump.should eq %("\\b") "\e".dump.should eq %("\\e") "\f".dump.should eq %("\\f") @@ -1471,6 +1472,7 @@ describe "String" do "a".inspect.should eq %("a") "\\".inspect.should eq %("\\\\") "\"".inspect.should eq %("\\\"") + "\a".inspect.should eq %("\\a") "\b".inspect.should eq %("\\b") "\e".inspect.should eq %("\\e") "\f".inspect.should eq %("\\f") @@ -1649,6 +1651,7 @@ describe "String" do end it "escapes chars" do + "\a"[0].should eq('\a') "\b"[0].should eq('\b') "\t"[0].should eq('\t') "\n"[0].should eq('\n') From 499f326abdda0f57ba780eed07bcac39171bc00f Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Sun, 25 Mar 2018 21:58:25 +0200 Subject: [PATCH 09/33] Update builder.cr --- src/json/builder.cr | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/json/builder.cr b/src/json/builder.cr index babb47168fcd..6e05ced8b3fb 100644 --- a/src/json/builder.cr +++ b/src/json/builder.cr @@ -107,6 +107,8 @@ class JSON::Builder escape = "\\\\" when '"' escape = "\\\"" + when '\a' + escape = "\\a" when '\b' escape = "\\b" when '\f' From 3eeba604fa728cc2d633d8afb2b7f9ccdfa4ae5f Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Sun, 25 Mar 2018 21:59:03 +0200 Subject: [PATCH 10/33] Update lexer.cr --- src/json/lexer.cr | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/json/lexer.cr b/src/json/lexer.cr index ab4d25baf5ff..a1a70b09dc16 100644 --- a/src/json/lexer.cr +++ b/src/json/lexer.cr @@ -177,6 +177,8 @@ abstract class JSON::Lexer case char = next_char when '\\', '"', '/' char + when 'a' + '\a' when 'b' '\b' when 'f' From 07933cb5b8afd0c41a7da2f60bbdd0daef25e66c Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Sun, 25 Mar 2018 22:05:47 +0200 Subject: [PATCH 11/33] Update serialization_spec.cr --- spec/std/json/serialization_spec.cr | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/std/json/serialization_spec.cr b/spec/std/json/serialization_spec.cr index 065c13b20094..eb5c1543f810 100644 --- a/spec/std/json/serialization_spec.cr +++ b/spec/std/json/serialization_spec.cr @@ -239,6 +239,7 @@ describe "JSON serialization" do end it "does for String with control codes" do + "\a".to_json.should eq("\"\\a\"") "\b".to_json.should eq("\"\\b\"") "\f".to_json.should eq("\"\\f\"") "\n".to_json.should eq("\"\\n\"") From 13d0ae309b6207b60868bcc16b918f7f9abb4520 Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Mon, 26 Mar 2018 08:03:58 +0200 Subject: [PATCH 12/33] Update lexer_spec.cr --- spec/std/json/lexer_spec.cr | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/std/json/lexer_spec.cr b/spec/std/json/lexer_spec.cr index 7a2fe61de23c..b8b247723236 100644 --- a/spec/std/json/lexer_spec.cr +++ b/spec/std/json/lexer_spec.cr @@ -83,6 +83,7 @@ describe JSON::Lexer do it_lexes_string "\"hello\\\"world\"", "hello\"world" it_lexes_string "\"hello\\\\world\"", "hello\\world" it_lexes_string "\"hello\\/world\"", "hello/world" + it_lexes_string "\"hello\\aworld\"", "hello\aworld" it_lexes_string "\"hello\\bworld\"", "hello\bworld" it_lexes_string "\"hello\\fworld\"", "hello\fworld" it_lexes_string "\"hello\\nworld\"", "hello\nworld" From 771cab168f5f231f073c18321807e7e70c671ce4 Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Mon, 26 Mar 2018 09:13:30 +0200 Subject: [PATCH 13/33] Update lexer.cr --- src/compiler/crystal/syntax/lexer.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/crystal/syntax/lexer.cr b/src/compiler/crystal/syntax/lexer.cr index 231bf79d241c..65d4a73e4e0d 100644 --- a/src/compiler/crystal/syntax/lexer.cr +++ b/src/compiler/crystal/syntax/lexer.cr @@ -614,7 +614,7 @@ module Crystal when '\'' @token.value = '\'' when 'a' - @token.value = '\a' + @token.value = 7.chr # TODO: use \a when 'b' @token.value = '\b' when 'e' From ef3ba45758a45428dc8ad9b825779c127fbbc9b2 Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Mon, 26 Mar 2018 09:18:06 +0200 Subject: [PATCH 14/33] Update string.cr --- src/string.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/string.cr b/src/string.cr index 11b55d24991f..58072644a22e 100644 --- a/src/string.cr +++ b/src/string.cr @@ -3939,7 +3939,7 @@ class String case current_char when '"' then io << "\\\"" when '\\' then io << "\\\\" - when '\a' then io << "\\a" + when (7.chr) then io << "\\a" # TODO: use \a when '\b' then io << "\\b" when '\e' then io << "\\e" when '\f' then io << "\\f" From e0f1cef8512070565ab273c89f6bcfa41a48d339 Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Mon, 26 Mar 2018 09:22:07 +0200 Subject: [PATCH 15/33] Update char_spec.cr --- spec/std/char_spec.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/std/char_spec.cr b/spec/std/char_spec.cr index c75ac73f83fc..0bdf72f8373d 100644 --- a/spec/std/char_spec.cr +++ b/spec/std/char_spec.cr @@ -133,7 +133,7 @@ describe "Char" do end it "escapes" do - '\a'.ord.should eq(7) + 7.chr.ord.should eq(7) #TODO: use \a '\b'.ord.should eq(8) '\t'.ord.should eq(9) '\n'.ord.should eq(10) From a1ab033a6b48614a228c73c02208aeead1d72cc8 Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Mon, 26 Mar 2018 09:25:42 +0200 Subject: [PATCH 16/33] Update string_spec.cr --- spec/std/string_spec.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/std/string_spec.cr b/spec/std/string_spec.cr index b28e76f2f720..efc71bf9eb07 100644 --- a/spec/std/string_spec.cr +++ b/spec/std/string_spec.cr @@ -1651,7 +1651,7 @@ describe "String" do end it "escapes chars" do - "\a"[0].should eq('\a') + "\a"[0].should eq(7.chr) #TODO: use \a "\b"[0].should eq('\b') "\t"[0].should eq('\t') "\n"[0].should eq('\n') From 3d8481532de9af4f9a4ac0dd900a602baa3c5bc7 Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Mon, 26 Mar 2018 09:28:35 +0200 Subject: [PATCH 17/33] Update builder.cr --- src/json/builder.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/json/builder.cr b/src/json/builder.cr index 6e05ced8b3fb..25d227496492 100644 --- a/src/json/builder.cr +++ b/src/json/builder.cr @@ -107,7 +107,7 @@ class JSON::Builder escape = "\\\\" when '"' escape = "\\\"" - when '\a' + when 7.chr #TODO: use \a escape = "\\a" when '\b' escape = "\\b" From 8020d779412ee7b5f2f54367040fe7ca64f81af1 Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Mon, 26 Mar 2018 09:31:03 +0200 Subject: [PATCH 18/33] Update lexer.cr --- src/json/lexer.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/json/lexer.cr b/src/json/lexer.cr index a1a70b09dc16..9e146057d955 100644 --- a/src/json/lexer.cr +++ b/src/json/lexer.cr @@ -178,7 +178,7 @@ abstract class JSON::Lexer when '\\', '"', '/' char when 'a' - '\a' + 7.chr #TODO: use \a when 'b' '\b' when 'f' From 17ad4b3a501637c29feae4162ae047590489d54f Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Mon, 26 Mar 2018 09:39:01 +0200 Subject: [PATCH 19/33] Update string_spec.cr --- spec/std/string_spec.cr | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/std/string_spec.cr b/spec/std/string_spec.cr index efc71bf9eb07..ef1d690e11c5 100644 --- a/spec/std/string_spec.cr +++ b/spec/std/string_spec.cr @@ -1444,7 +1444,7 @@ describe "String" do "a".dump.should eq %("a") "\\".dump.should eq %("\\\\") "\"".dump.should eq %("\\\"") - "\a".dump.should eq %("\\a") + #TODO: "\a".dump.should eq %("\\a") "\b".dump.should eq %("\\b") "\e".dump.should eq %("\\e") "\f".dump.should eq %("\\f") @@ -1472,7 +1472,7 @@ describe "String" do "a".inspect.should eq %("a") "\\".inspect.should eq %("\\\\") "\"".inspect.should eq %("\\\"") - "\a".inspect.should eq %("\\a") + #TODO: "\a".inspect.should eq %("\\a") "\b".inspect.should eq %("\\b") "\e".inspect.should eq %("\\e") "\f".inspect.should eq %("\\f") @@ -1651,7 +1651,7 @@ describe "String" do end it "escapes chars" do - "\a"[0].should eq(7.chr) #TODO: use \a + # TODO: "\a"[0].should eq('\a') "\b"[0].should eq('\b') "\t"[0].should eq('\t') "\n"[0].should eq('\n') From 8ee81dae3c0a17de6212f4fdde92d21ff4275853 Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Mon, 26 Mar 2018 09:42:57 +0200 Subject: [PATCH 20/33] Update lexer_spec.cr --- spec/std/json/lexer_spec.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/std/json/lexer_spec.cr b/spec/std/json/lexer_spec.cr index b8b247723236..f8a324c3849f 100644 --- a/spec/std/json/lexer_spec.cr +++ b/spec/std/json/lexer_spec.cr @@ -83,7 +83,7 @@ describe JSON::Lexer do it_lexes_string "\"hello\\\"world\"", "hello\"world" it_lexes_string "\"hello\\\\world\"", "hello\\world" it_lexes_string "\"hello\\/world\"", "hello/world" - it_lexes_string "\"hello\\aworld\"", "hello\aworld" + #TODO: it_lexes_string "\"hello\\aworld\"", "hello\aworld" it_lexes_string "\"hello\\bworld\"", "hello\bworld" it_lexes_string "\"hello\\fworld\"", "hello\fworld" it_lexes_string "\"hello\\nworld\"", "hello\nworld" From 81435b6d20cc52f112d11f7e9cb65733f231239e Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Mon, 26 Mar 2018 09:44:10 +0200 Subject: [PATCH 21/33] Update serialization_spec.cr --- spec/std/json/serialization_spec.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/std/json/serialization_spec.cr b/spec/std/json/serialization_spec.cr index eb5c1543f810..376a669365ed 100644 --- a/spec/std/json/serialization_spec.cr +++ b/spec/std/json/serialization_spec.cr @@ -239,7 +239,7 @@ describe "JSON serialization" do end it "does for String with control codes" do - "\a".to_json.should eq("\"\\a\"") + #TODO: "\a".to_json.should eq("\"\\a\"") "\b".to_json.should eq("\"\\b\"") "\f".to_json.should eq("\"\\f\"") "\n".to_json.should eq("\"\\n\"") From b709308b9d460fa90e058d02300c0f3cb95fd271 Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Mon, 26 Mar 2018 10:25:23 +0200 Subject: [PATCH 22/33] Update lexer_string_spec.cr --- spec/compiler/lexer/lexer_string_spec.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/compiler/lexer/lexer_string_spec.cr b/spec/compiler/lexer/lexer_string_spec.cr index 71c8956278ef..3aea91e8d2e1 100644 --- a/spec/compiler/lexer/lexer_string_spec.cr +++ b/spec/compiler/lexer/lexer_string_spec.cr @@ -227,7 +227,7 @@ describe "Lexer string" do tester.string_should_start_correctly tester.next_token_should_be(:NEWLINE) - tester.next_string_token_should_be("abc") + tester.next_string_token_should_be("\abc") tester.string_should_have_an_interpolation_of("foo") tester.string_should_end_correctly end From 89b5c7ed263153ae132174441bee8fe960f3b6cf Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Mon, 26 Mar 2018 12:17:24 +0200 Subject: [PATCH 23/33] Update lexer_spec.cr --- spec/std/json/lexer_spec.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/std/json/lexer_spec.cr b/spec/std/json/lexer_spec.cr index f8a324c3849f..2480f91fe6d3 100644 --- a/spec/std/json/lexer_spec.cr +++ b/spec/std/json/lexer_spec.cr @@ -83,7 +83,7 @@ describe JSON::Lexer do it_lexes_string "\"hello\\\"world\"", "hello\"world" it_lexes_string "\"hello\\\\world\"", "hello\\world" it_lexes_string "\"hello\\/world\"", "hello/world" - #TODO: it_lexes_string "\"hello\\aworld\"", "hello\aworld" + # TODO: it_lexes_string "\"hello\\aworld\"", "hello\aworld" it_lexes_string "\"hello\\bworld\"", "hello\bworld" it_lexes_string "\"hello\\fworld\"", "hello\fworld" it_lexes_string "\"hello\\nworld\"", "hello\nworld" From 8363dbb5fb62a945867f0b45cc0db4767c409cd8 Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Mon, 26 Mar 2018 12:18:23 +0200 Subject: [PATCH 24/33] Update serialization_spec.cr --- spec/std/json/serialization_spec.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/std/json/serialization_spec.cr b/spec/std/json/serialization_spec.cr index 376a669365ed..b26d6198f6ee 100644 --- a/spec/std/json/serialization_spec.cr +++ b/spec/std/json/serialization_spec.cr @@ -239,7 +239,7 @@ describe "JSON serialization" do end it "does for String with control codes" do - #TODO: "\a".to_json.should eq("\"\\a\"") + # TODO: "\a".to_json.should eq("\"\\a\"") "\b".to_json.should eq("\"\\b\"") "\f".to_json.should eq("\"\\f\"") "\n".to_json.should eq("\"\\n\"") From 29d378777be2de5642813add6565cc27875b4100 Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Mon, 26 Mar 2018 12:19:19 +0200 Subject: [PATCH 25/33] Update char_spec.cr --- spec/std/char_spec.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/std/char_spec.cr b/spec/std/char_spec.cr index 0bdf72f8373d..5851598df0f5 100644 --- a/spec/std/char_spec.cr +++ b/spec/std/char_spec.cr @@ -133,7 +133,7 @@ describe "Char" do end it "escapes" do - 7.chr.ord.should eq(7) #TODO: use \a + 7.chr.ord.should eq(7) # TODO: use \a '\b'.ord.should eq(8) '\t'.ord.should eq(9) '\n'.ord.should eq(10) From e1314db1068977bf76e81528d340138c5330fca8 Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Mon, 26 Mar 2018 12:21:19 +0200 Subject: [PATCH 26/33] Update string_spec.cr --- spec/std/string_spec.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/std/string_spec.cr b/spec/std/string_spec.cr index ef1d690e11c5..0b46c1ebc155 100644 --- a/spec/std/string_spec.cr +++ b/spec/std/string_spec.cr @@ -1444,7 +1444,7 @@ describe "String" do "a".dump.should eq %("a") "\\".dump.should eq %("\\\\") "\"".dump.should eq %("\\\"") - #TODO: "\a".dump.should eq %("\\a") + # TODO: "\a".dump.should eq %("\\a") "\b".dump.should eq %("\\b") "\e".dump.should eq %("\\e") "\f".dump.should eq %("\\f") @@ -1472,7 +1472,7 @@ describe "String" do "a".inspect.should eq %("a") "\\".inspect.should eq %("\\\\") "\"".inspect.should eq %("\\\"") - #TODO: "\a".inspect.should eq %("\\a") + # TODO: "\a".inspect.should eq %("\\a") "\b".inspect.should eq %("\\b") "\e".inspect.should eq %("\\e") "\f".inspect.should eq %("\\f") From 5249c7513537db7da8f6197b60783758f10314fa Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Mon, 26 Mar 2018 12:22:06 +0200 Subject: [PATCH 27/33] Update lexer.cr --- src/json/lexer.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/json/lexer.cr b/src/json/lexer.cr index 9e146057d955..7e257d64ac44 100644 --- a/src/json/lexer.cr +++ b/src/json/lexer.cr @@ -178,7 +178,7 @@ abstract class JSON::Lexer when '\\', '"', '/' char when 'a' - 7.chr #TODO: use \a + 7.chr # TODO: use \a when 'b' '\b' when 'f' From 04ced04378cf43b9c7d0d757f23f0ec25dbc2ef4 Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Mon, 26 Mar 2018 12:22:33 +0200 Subject: [PATCH 28/33] Update builder.cr --- src/json/builder.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/json/builder.cr b/src/json/builder.cr index 25d227496492..38897f9738a6 100644 --- a/src/json/builder.cr +++ b/src/json/builder.cr @@ -107,7 +107,7 @@ class JSON::Builder escape = "\\\\" when '"' escape = "\\\"" - when 7.chr #TODO: use \a + when 7.chr # TODO: use \a escape = "\\a" when '\b' escape = "\\b" From 208c9b89b8dcb944edac27137f24ca6704ac80d3 Mon Sep 17 00:00:00 2001 From: r00ster91 <35064754+r00ster91@users.noreply.github.com> Date: Mon, 26 Mar 2018 12:23:19 +0200 Subject: [PATCH 29/33] Update string.cr --- src/string.cr | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/string.cr b/src/string.cr index 58072644a22e..2b97aee347df 100644 --- a/src/string.cr +++ b/src/string.cr @@ -3937,16 +3937,16 @@ class String while reader.has_next? current_char = reader.current_char case current_char - when '"' then io << "\\\"" - when '\\' then io << "\\\\" + when '"' then io << "\\\"" + when '\\' then io << "\\\\" when (7.chr) then io << "\\a" # TODO: use \a - when '\b' then io << "\\b" - when '\e' then io << "\\e" - when '\f' then io << "\\f" - when '\n' then io << "\\n" - when '\r' then io << "\\r" - when '\t' then io << "\\t" - when '\v' then io << "\\v" + when '\b' then io << "\\b" + when '\e' then io << "\\e" + when '\f' then io << "\\f" + when '\n' then io << "\\n" + when '\r' then io << "\\r" + when '\t' then io << "\\t" + when '\v' then io << "\\v" when '#' current_char = reader.next_char if current_char == '{' From a37c81fb6389d011ab6b016a9406ec31fd2f9918 Mon Sep 17 00:00:00 2001 From: r00ster <35064754+r00ster91@users.noreply.github.com> Date: Sat, 28 Apr 2018 16:33:51 +0200 Subject: [PATCH 30/33] Remove \a in json lexer.cr --- src/json/lexer.cr | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/json/lexer.cr b/src/json/lexer.cr index 7e257d64ac44..ab4d25baf5ff 100644 --- a/src/json/lexer.cr +++ b/src/json/lexer.cr @@ -177,8 +177,6 @@ abstract class JSON::Lexer case char = next_char when '\\', '"', '/' char - when 'a' - 7.chr # TODO: use \a when 'b' '\b' when 'f' From 8e51d58ab72a8da359f0ea1f31e11af2085554be Mon Sep 17 00:00:00 2001 From: r00ster <35064754+r00ster91@users.noreply.github.com> Date: Sat, 28 Apr 2018 16:36:46 +0200 Subject: [PATCH 31/33] Remove \a in json lexer_spec.cr --- spec/std/json/lexer_spec.cr | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/std/json/lexer_spec.cr b/spec/std/json/lexer_spec.cr index 2480f91fe6d3..7a2fe61de23c 100644 --- a/spec/std/json/lexer_spec.cr +++ b/spec/std/json/lexer_spec.cr @@ -83,7 +83,6 @@ describe JSON::Lexer do it_lexes_string "\"hello\\\"world\"", "hello\"world" it_lexes_string "\"hello\\\\world\"", "hello\\world" it_lexes_string "\"hello\\/world\"", "hello/world" - # TODO: it_lexes_string "\"hello\\aworld\"", "hello\aworld" it_lexes_string "\"hello\\bworld\"", "hello\bworld" it_lexes_string "\"hello\\fworld\"", "hello\fworld" it_lexes_string "\"hello\\nworld\"", "hello\nworld" From 9f5073bc49cb2dc94ae593e6d247f4f2384ddce4 Mon Sep 17 00:00:00 2001 From: r00ster <35064754+r00ster91@users.noreply.github.com> Date: Sat, 28 Apr 2018 16:37:37 +0200 Subject: [PATCH 32/33] Remove \a in json serialization_spec.cr --- spec/std/json/serialization_spec.cr | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/std/json/serialization_spec.cr b/spec/std/json/serialization_spec.cr index b26d6198f6ee..065c13b20094 100644 --- a/spec/std/json/serialization_spec.cr +++ b/spec/std/json/serialization_spec.cr @@ -239,7 +239,6 @@ describe "JSON serialization" do end it "does for String with control codes" do - # TODO: "\a".to_json.should eq("\"\\a\"") "\b".to_json.should eq("\"\\b\"") "\f".to_json.should eq("\"\\f\"") "\n".to_json.should eq("\"\\n\"") From 672bea2fb0a00a007233ae635e7936f70772b0a8 Mon Sep 17 00:00:00 2001 From: r00ster <35064754+r00ster91@users.noreply.github.com> Date: Sat, 28 Apr 2018 16:39:44 +0200 Subject: [PATCH 33/33] Remove \a in json builder.cr --- src/json/builder.cr | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/json/builder.cr b/src/json/builder.cr index 38897f9738a6..babb47168fcd 100644 --- a/src/json/builder.cr +++ b/src/json/builder.cr @@ -107,8 +107,6 @@ class JSON::Builder escape = "\\\\" when '"' escape = "\\\"" - when 7.chr # TODO: use \a - escape = "\\a" when '\b' escape = "\\b" when '\f'