mirror of https://github.com/kdl-org/kdl.git
update SPEC to keep lines lengths short (#470)
This commit is contained in:
parent
34e4259dfc
commit
91cd421988
87
SPEC.md
87
SPEC.md
|
|
@ -266,7 +266,8 @@ IEEE 754-2008 decimal floating point numbers
|
|||
* `email`: RFC5322 email address.
|
||||
* `idn-email`: RFC6531 internationalized email address.
|
||||
* `hostname`: RFC1132 internet hostname (only ASCII segments)
|
||||
* `idn-hostname`: RFC5890 internationalized internet hostname (only `xn--`-prefixed ASCII "punycode" segments, or non-ASCII segments)
|
||||
* `idn-hostname`: RFC5890 internationalized internet hostname
|
||||
(only `xn--`-prefixed ASCII "punycode" segments, or non-ASCII segments)
|
||||
* `ipv4`: RFC2673 dotted-quad IPv4 address.
|
||||
* `ipv6`: RFC2373 IPv6 address.
|
||||
* `url`: RFC3986 URI.
|
||||
|
|
@ -653,23 +654,23 @@ The string contains the literal characters `hello\n\r\asd"#world`
|
|||
|
||||
```kdl
|
||||
raw-multi-line #"""
|
||||
You can show examples of """
|
||||
multi-line strings
|
||||
Here's a """
|
||||
multiline string
|
||||
"""
|
||||
without worrying about escapes.
|
||||
without escapes.
|
||||
"""#
|
||||
```
|
||||
|
||||
The string contains the value
|
||||
|
||||
```
|
||||
You can show examples of """
|
||||
multi-line strings
|
||||
~~~
|
||||
Here's a """
|
||||
multiline string
|
||||
"""
|
||||
without worrying about escapes.
|
||||
```
|
||||
without escapes.
|
||||
~~~
|
||||
|
||||
or equivalently, `"You can show examples of \"\"\"\n multi-line strings\n \"\"\"\nwithout worrying about escapes."` as a Quoted String.
|
||||
or equivalently, `"Here's a \"\"\"\n multiline string\n \"\"\"\nwithout escapes."` as a Quoted String.
|
||||
|
||||
### Number
|
||||
|
||||
|
|
@ -865,16 +866,31 @@ type := '(' node-space* string node-space* ')'
|
|||
string := identifier-string | quoted-string | raw-string ¶
|
||||
|
||||
identifier-string := unambiguous-ident | signed-ident | dotted-ident
|
||||
unambiguous-ident := ((identifier-char - digit - sign - '.') identifier-char*) - disallowed-keyword-strings
|
||||
signed-ident := sign ((identifier-char - digit - '.') identifier-char*)?
|
||||
dotted-ident := sign? '.' ((identifier-char - digit) identifier-char*)?
|
||||
identifier-char := unicode - unicode-space - newline - [\\/(){};\[\]"#=] - disallowed-literal-code-points
|
||||
disallowed-keyword-identifiers := 'true' | 'false' | 'null' | 'inf' | '-inf' | 'nan'
|
||||
unambiguous-ident :=
|
||||
((identifier-char - digit - sign - '.') identifier-char*)
|
||||
- disallowed-keyword-strings
|
||||
signed-ident :=
|
||||
sign ((identifier-char - digit - '.') identifier-char*)?
|
||||
dotted-ident :=
|
||||
sign? '.' ((identifier-char - digit) identifier-char*)?
|
||||
identifier-char :=
|
||||
unicode - unicode-space - newline - [\\/(){};\[\]"#=]
|
||||
- disallowed-literal-code-points
|
||||
disallowed-keyword-identifiers :=
|
||||
'true' | 'false' | 'null' | 'inf' | '-inf' | 'nan'
|
||||
|
||||
quoted-string := '"' single-line-string-body '"' | '"""' newline multi-line-string-body newline (unicode-space | ws-escape)* '"""'
|
||||
quoted-string :=
|
||||
'"' single-line-string-body '"' |
|
||||
'"""' newline
|
||||
multi-line-string-body newline
|
||||
(unicode-space | ws-escape)* '"""'
|
||||
single-line-string-body := (string-character - newline)*
|
||||
multi-line-string-body := (('"' | '""')? string-character)*
|
||||
string-character := '\\' (["\\bfnrts] | 'u{' hex-unicode '}') | ws-escape | [^\\"] - disallowed-literal-code-points
|
||||
string-character :=
|
||||
'\\' (["\\bfnrts] |
|
||||
'u{' hex-unicode '}') |
|
||||
ws-escape |
|
||||
[^\\"] - disallowed-literal-code-points
|
||||
ws-escape := '\\' (unicode-space | newline)+
|
||||
hex-digit := [0-9a-fA-F]
|
||||
hex-unicode := hex-digit{1, 6} - surrogates
|
||||
|
|
@ -883,10 +899,21 @@ surrogates := [dD][8-9a-fA-F]hex-digit{2}
|
|||
// D F FF
|
||||
|
||||
raw-string := '#' raw-string-quotes '#' | '#' raw-string '#'
|
||||
raw-string-quotes := '"' single-line-raw-string-body '"' | '"""' newline multi-line-raw-string-body newline unicode-space* '"""'
|
||||
single-line-raw-string-body := '' | (single-line-raw-string-char - '"') single-line-raw-string-char*? | '"' (single-line-raw-string-char - '"') single-line-raw-string-char*?
|
||||
single-line-raw-string-char := unicode - newline - disallowed-literal-code-points
|
||||
multi-line-raw-string-body := (unicode - disallowed-literal-code-points)*?
|
||||
raw-string-quotes :=
|
||||
'"' single-line-raw-string-body '"' |
|
||||
'"""' newline
|
||||
multi-line-raw-string-body newline
|
||||
unicode-space* '"""'
|
||||
single-line-raw-string-body :=
|
||||
'' |
|
||||
(single-line-raw-string-char - '"')
|
||||
single-line-raw-string-char*? |
|
||||
'"' (single-line-raw-string-char - '"')
|
||||
single-line-raw-string-char*?
|
||||
single-line-raw-string-char :=
|
||||
unicode - newline - disallowed-literal-code-points
|
||||
multi-line-raw-string-body :=
|
||||
(unicode - disallowed-literal-code-points)*?
|
||||
|
||||
// Numbers
|
||||
number := keyword-number | hex | octal | binary | decimal
|
||||
|
|
@ -908,14 +935,17 @@ boolean := '#true' | '#false'
|
|||
|
||||
// Specific code points
|
||||
bom := '\u{FEFF}'
|
||||
disallowed-literal-code-points := See Table (Disallowed Literal Code Points)
|
||||
disallowed-literal-code-points :=
|
||||
See Table (Disallowed Literal Code Points)
|
||||
unicode := Any Unicode Scalar Value
|
||||
unicode-space := See Table (All White_Space unicode characters which are not `newline`)
|
||||
unicode-space := See Table
|
||||
(All White_Space unicode characters which are not `newline`)
|
||||
|
||||
// Comments
|
||||
single-line-comment := '//' ^newline* (newline | eof)
|
||||
multi-line-comment := '/*' commented-block
|
||||
commented-block := '*/' | (multi-line-comment | '*' | '/' | [^*/]+) commented-block
|
||||
commented-block :=
|
||||
'*/' | (multi-line-comment | '*' | '/' | [^*/]+) commented-block
|
||||
slashdash := '/-' line-space*
|
||||
|
||||
// Whitespace
|
||||
|
|
@ -924,12 +954,15 @@ escline := '\\' ws* (single-line-comment | newline | eof)
|
|||
newline := See Table (All Newline White_Space)
|
||||
// Whitespace where newlines are allowed.
|
||||
line-space := node-space | newline | single-line-comment
|
||||
// Whitespace within nodes, where newline-ish things must be esclined.
|
||||
// Whitespace within nodes,
|
||||
// where newline-ish things must be esclined.
|
||||
node-space := ws* escline ws* | ws+
|
||||
|
||||
// Version marker
|
||||
version := '/-' unicode-space* 'kdl-version' unicode-space+ ('1' | '2') unicode-space* newline
|
||||
```
|
||||
version :=
|
||||
'/-' unicode-space* 'kdl-version' unicode-space+ ('1' | '2')
|
||||
unicode-space* newline
|
||||
~~~
|
||||
|
||||
### Grammar language
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue