mirror of https://github.com/kdl-org/kdl.git
make unicodey equals signs valid property assignment characters
This commit is contained in:
parent
50d378f1db
commit
90cd0b1bb9
|
|
@ -58,6 +58,10 @@
|
|||
least-indented line in the body. Multiline strings and raw strings now must
|
||||
have a newline immediately following their opening `"`, and a final newline
|
||||
preceding the closing `"`.
|
||||
* SMALL EQUALS SIGN (`U+FE66`), FULLWIDTH EQUALS SIGN (`U+FF1D`), and HEAVY
|
||||
EQUALS SIGN (`U+1F7F0`) are now treated the same as `=` and can be used for
|
||||
properties (e.g. `お名前=☜(゚ヮ゚☜)`). They are also no longer valid in bare
|
||||
identifiers.
|
||||
|
||||
### KQL
|
||||
|
||||
|
|
|
|||
|
|
@ -158,10 +158,12 @@ node3 #"C:\Users\zkat\raw\string"#
|
|||
|
||||
You don't have to quote strings unless they contain whitespace, or if any the
|
||||
following apply:
|
||||
* The string contains `[]{}()\/#=";`.
|
||||
* The string contains `[]{}()\/#";`.
|
||||
* The string contains whitespace.
|
||||
* The string is one of `true`, `false`, or `null`.
|
||||
* The strings starts with a digit, or `+`/`-` and a digit.
|
||||
* The string contains an equals sign (including unicode equals signs `﹦`,
|
||||
`=`, and `🟰`).
|
||||
|
||||
In essence, if it can get confused for other KDL syntax, it needs quotes.
|
||||
|
||||
|
|
@ -294,8 +296,8 @@ smile 😁
|
|||
// Identifiers are very flexible. The following is a legal bare identifier:
|
||||
<@foo123~!$%^&*.:'|?+>
|
||||
|
||||
// And you can also use unicode!
|
||||
ノード お名前=☜(゚ヮ゚☜)
|
||||
// And you can also use unicode, even for the equals sign!
|
||||
ノード お名前=☜(゚ヮ゚☜)
|
||||
|
||||
// kdl specifically allows properties and values to be
|
||||
// interspersed with each other, much like CLI commands.
|
||||
|
|
|
|||
20
SPEC.md
20
SPEC.md
|
|
@ -137,7 +137,8 @@ negative number.
|
|||
|
||||
The following characters cannot be used anywhere in a [Bare Identifier](#identifier):
|
||||
|
||||
* Any of `(){}[]/\="#;`
|
||||
* Any of `(){}[]/\"#;`
|
||||
* Any [Equals Sign](#equals-sign)
|
||||
* Any [Whitespace](#whitespace) or [Newline](#newline).
|
||||
* Any [disallowed literal code points](#disallowed-literal-code-points) in KDL
|
||||
documents.
|
||||
|
|
@ -163,7 +164,8 @@ my-node 1 2 \ // comments are ok after \
|
|||
### Property
|
||||
|
||||
A Property is a key/value pair attached to a [Node](#node). A Property is
|
||||
composed of an [Identifier](#identifier), followed immediately by a `=`, and then a [Value](#value).
|
||||
composed of an [Identifier](#identifier), followed immediately by an [equals
|
||||
sign](#equals-sign), and then a [Value](#value).
|
||||
|
||||
Properties should be interpreted left-to-right, with rightmost properties with
|
||||
identical names overriding earlier properties. That is:
|
||||
|
|
@ -181,6 +183,17 @@ still be spec-compliant.
|
|||
Properties _MAY_ be prefixed with `/-` to "comment out" the entire token and
|
||||
make it act as plain whitespace, even if it spreads across multiple lines.
|
||||
|
||||
#### Equals Sign
|
||||
|
||||
Any of the following characters may be used as equals signs in properties:
|
||||
|
||||
| Name | Character | Code Point |
|
||||
|----|-----|----|
|
||||
| EQUALS SIGN | `=` | `U+003D` |
|
||||
| SMALL EQUALS SIGN | `﹦` | `U+FE66` |
|
||||
| FULLWIDTH EQUALS SIGN | `=` | `U+FF1D` |
|
||||
| HEAVY EQUALS SIGN | `🟰` | `U+1F7F0` |
|
||||
|
||||
### Argument
|
||||
|
||||
An Argument is a bare [Value](#value) attached to a [Node](#node), with no
|
||||
|
|
@ -600,9 +613,10 @@ numberish-ident := sign ((identifier-char - digit) identifier-char*)?
|
|||
identifier-char := unicode - line-space - [\\/(){};\[\]="#] - disallowed-literal-code-points
|
||||
|
||||
keyword := '#' (boolean | 'null')
|
||||
prop := identifier optional-node-space '=' optional-node-space value
|
||||
prop := identifier optional-node-space equals-sign optional-node-space value
|
||||
value := type? optional-node-space (identifier | string | number | keyword)
|
||||
type := '(' optional-node-space identifier optional-node-space ')'
|
||||
equals-sign := See Table (Equals Sign)
|
||||
|
||||
string := raw-string | escaped-string
|
||||
escaped-string := '"' (single-line-string-body | newline multi-line-string-body newline ws*) '"'
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
node p1=val1 p2=val2 p3=val3
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
node \
|
||||
p1﹦val1 \ // U+FE66
|
||||
p2=val2 \ // U+FF1D
|
||||
p3🟰val3 // U+1F7F0
|
||||
Loading…
Reference in New Issue