From 2f372b9f1079b866d633d6b5cecfaf573f3480f0 Mon Sep 17 00:00:00 2001 From: rhysd Date: Tue, 25 Sep 2018 16:33:52 +0900 Subject: Fix multi-line strings are not allowed for key In spec https://github.com/toml-lang/toml#keys Quoted keys are clarified as > he exact same rules as either basic strings or literal strings TOML clearly distinguishes basic string and multi-line basic string (literal string is also). https://github.com/toml-lang/toml#string So table key and quoted key should not allow multi-line basic string and multi-line literal string. ABNF definition also describes that. https://github.com/toml-lang/toml/blob/master/toml.abnf ``` string = ml-basic-string / basic-string / ml-literal-string / literal-string quoted-key = basic-string / literal-string ``` `string` contains `ml-*` but `quoted-key` doesn't. --- test-suite/tests/parser.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test-suite') diff --git a/test-suite/tests/parser.rs b/test-suite/tests/parser.rs index 2282416..2534ce6 100644 --- a/test-suite/tests/parser.rs +++ b/test-suite/tests/parser.rs @@ -275,6 +275,10 @@ fn bad_keys() { "\"\"|=3".parse::().unwrap_err(); "\"\n\"|=3".parse::().unwrap_err(); "\"\r\"|=3".parse::().unwrap_err(); + "''''''=3".parse::().unwrap_err(); + "\"\"\"\"\"\"=3".parse::().unwrap_err(); + "'''key'''=3".parse::().unwrap_err(); + "\"\"\"key\"\"\"=3".parse::().unwrap_err(); } #[test] @@ -290,6 +294,8 @@ fn bad_table_names() { "[']".parse::().unwrap_err(); "[''']".parse::().unwrap_err(); "['''''']".parse::().unwrap_err(); + "['''foo''']".parse::().unwrap_err(); + "[\"\"\"bar\"\"\"]".parse::().unwrap_err(); "['\n']".parse::().unwrap_err(); "['\r\n']".parse::().unwrap_err(); } -- cgit v1.2.3