diff --git a/CHANGELOG.md b/CHANGELOG.md index 211e461..1eb927b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 83913c7..f7e18b3 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/SPEC.md b/SPEC.md index dc8055e..6ae5856 100644 --- a/SPEC.md +++ b/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*) '"' diff --git a/tests/test_cases/expected_kdl/unicode_equals_signs.kdl b/tests/test_cases/expected_kdl/unicode_equals_signs.kdl new file mode 100644 index 0000000..4ab6443 --- /dev/null +++ b/tests/test_cases/expected_kdl/unicode_equals_signs.kdl @@ -0,0 +1 @@ +node p1=val1 p2=val2 p3=val3 diff --git a/tests/test_cases/input/unicode_equals_signs.kdl b/tests/test_cases/input/unicode_equals_signs.kdl new file mode 100644 index 0000000..37d8e02 --- /dev/null +++ b/tests/test_cases/input/unicode_equals_signs.kdl @@ -0,0 +1,4 @@ +node \ + p1﹦val1 \ // U+FE66 + p2=val2 \ // U+FF1D + p3🟰val3 // U+1F7F0