mirror of
https://github.com/lightbend/config.git
synced 2025-03-19 05:40:26 +08:00
prohibit /, #, and + from unquoted strings
because the spec proposes syntactic meanings for these
This commit is contained in:
parent
be560731b8
commit
796937f3ac
4
SPEC.md
4
SPEC.md
@ -102,8 +102,8 @@ Different from JSON:
|
||||
(details below)
|
||||
- String values may sometimes omit quotes.
|
||||
- Unquoted strings may not contain '$', '"', '{', '}',
|
||||
'[', ']', ':', '=', ',', or '\' (backslash) and may not
|
||||
contain whitespace (including newlines).
|
||||
'[', ']', ':', '=', ',', '+', '#', '/' or '\' (backslash)
|
||||
and may not contain whitespace (including newlines).
|
||||
- Unquoted strings do not support any form of escaping; the
|
||||
characters are all left as-is. If you need to use special
|
||||
characters or escaping, you have to quote the string.
|
||||
|
@ -182,7 +182,7 @@ final class Tokenizer {
|
||||
// chars JSON allows to be part of a number
|
||||
static final String numberChars = "0123456789eE+-.";
|
||||
// chars that stop an unquoted string
|
||||
static final String notInUnquotedText = "$\"{}[]:=,\\";
|
||||
static final String notInUnquotedText = "$\"{}[]:=,\\+#/";
|
||||
|
||||
// The rules here are intended to maximize convenience while
|
||||
// avoiding confusion with real valid JSON. Basically anything
|
||||
|
@ -133,7 +133,11 @@ abstract trait TestUtils {
|
||||
"""{ "a" : { "c" : 2 }, "b" : y${a}z }""", // trying to interpolate an object in a string
|
||||
"""{ "a" : ${a} }""", // simple cycle
|
||||
"""[ { "a" : 2, "b" : ${${a}} } ]""", // nested substitution
|
||||
"[ = ]", // = is not a valid token
|
||||
"[ = ]", // = is not a valid token in unquoted text
|
||||
"[ + ]",
|
||||
"[ / ]",
|
||||
"[ # ]",
|
||||
"[ \\ ]",
|
||||
"{ include \"bar\" : 10 }", // include with a value after it
|
||||
"{ include foo }", // include with unquoted string
|
||||
"{ include : { \"a\" : 1 } }", // include used as unquoted key
|
||||
|
Loading…
Reference in New Issue
Block a user