Commit Graph

162 Commits

Author SHA1 Message Date
Tab Atkins-Bittner 1f28fb0e83 [editorial] Move keyword production to a better spot. Rephrase bool/keyword to include the # directly. Explicitly spell out the disallowed keywordish idents, and move where they appear. Rename numberish-ident to signed-ident (it's not numberish at all, is the point). 2024-01-03 17:19:03 -08:00
Tab Atkins-Bittner bc2b995bfe Rename/rearrange the string productions to match the spec text better. 2024-01-03 17:14:23 -08:00
Tab Atkins-Bittner 24cd2141d3 Disallow idents like '.1' to avoid footguns 2024-01-03 17:08:49 -08:00
Tab Atkins-Bittner f02ba59c0c Make multi-line ws prefix determined by the last line. 2023-12-26 14:19:45 -08:00
Tab Atkins-Bittner 6d091fd493 Use consistent codepoint spelling 2023-12-26 13:18:01 -08:00
Tab Atkins-Bittner 491cc46f89 Fix the disallowed low ASCIIs 2023-12-26 13:16:55 -08:00
Tab Atkins-Bittner b635470ab2 be more specific 2023-12-26 13:06:22 -08:00
Tab Atkins-Bittner 6d359d2e4c Remove now-irrelevant comment about idents acting like strings (they *are* strings now). 2023-12-26 13:05:10 -08:00
Tab Atkins-Bittner 419995ff19 typos 2023-12-26 13:04:44 -08:00
Tab Atkins-Bittner 057e8c894d Rewrite intro paragraph for strings to make their usage clearer. 2023-12-26 13:04:35 -08:00
Kat Marchán d4333322d9
Add LRM/RLM to the direction control char list 2023-12-17 13:24:00 -08:00
Kat Marchán 055de4e1be
better organization of how we talk about identifiers/strings and comments 2023-12-16 21:44:25 -08:00
Kat Marchán 90cd0b1bb9
make unicodey equals signs valid property assignment characters 2023-12-16 16:09:13 -08:00
Kat Marchán 56f399bf71
Add \s to the list of escapes 2023-12-14 19:25:12 -08:00
Kat Marchán 817a7dc0ab
fixes from review 2023-12-14 19:12:59 -08:00
Kat Marchán a0d5030e3b
Release 2.0 draft 1 2023-12-12 23:49:26 -08:00
Kat Marchán 8de7df6eaa
formatting 2023-12-12 23:49:04 -08:00
Kat Marchán 7790505bf9
Merge branch 'main' into kdl-v2 2023-12-12 23:44:10 -08:00
Kat Marchán fc1b59436a
add support for dedented multi-line strings and raw strings 2023-12-12 23:17:04 -08:00
Kat Marchán 49402ccb7b
allow BOM only in the first unicode scalar in a document 2023-12-12 22:51:52 -08:00
Kat Marchán 13799de32b
Allow whitespace in more places
Fixes: https://github.com/kdl-org/kdl/issues/355
2023-12-12 22:28:52 -08:00
Kat Marchán c8488db13e
Make last semicolon optional for inline nodes
Fixes: https://github.com/kdl-org/kdl/issues/341
2023-12-12 22:21:13 -08:00
Kat Marchán 5a7b339ed4
Constrain code points to unicode scalar values
Fixes: https://github.com/kdl-org/kdl/issues/207
2023-12-12 22:10:26 -08:00
Kat Marchán b42b6c80f0
Clarify that multiline comments are allowed after line continuations, per grammar
Fixes: https://github.com/kdl-org/kdl/issues/322
2023-12-12 21:57:57 -08:00
Kat Marchán 85aa3a09ab
treat bare identifiers and strings in value locations (#358)
Fixes: https://github.com/kdl-org/kdl/issues/339
2023-12-12 21:03:30 -08:00
Kat Marchán e6356d5a03
allow ,<> as identifier characters since they no longer need to be re… (#352)
* fix some confusion in grammar syntax, and actually specify the syntax itself

Fixes: https://github.com/kdl-org/kdl/issues/345

* allow ,<> as identifier characters since they no longer need to be reserved

* fix typo

* disallow more code points and outright ban certain ones from KDL documents altogether (#353)

Fixes: https://github.com/kdl-org/kdl/issues/250

* `r` prefix is no longer required for raw strings (#354)

Fixes: https://github.com/kdl-org/kdl/issues/337
2023-12-12 20:27:37 -08:00
Kat Marchán 99abeef6d3
fix some confusion in grammar syntax, and actually specify the syntax itself (#351)
Fixes: https://github.com/kdl-org/kdl/issues/345
2023-12-12 20:20:15 -08:00
Christopher Durham eb55930264
Update formal grammar for KDL 2.0 (#285)
Fixes: https://github.com/kdl-org/kdl/issues/284

* Update formal grammar

* Update SPEC.md for KDL 2.0 preview

* Update SPEC.md

Co-authored-by: Christopher Durham <cad97@cad97.com>

---------

Co-authored-by: Tab Atkins Jr <jackalmage@gmail.com>
Co-authored-by: Kat Marchán <kzm@zkat.tech>
2023-12-10 17:44:55 -08:00
Tab Atkins-Bittner 0836df1c19 Restrict idents from looking like raw strings. Closes #200, closes #204, closes #241 2023-10-06 14:32:01 -07:00
Tab Atkins-Bittner 3b39e29fee Add vertical tab to whitespace. Closes #331 2023-10-06 14:13:43 -07:00
Tab Atkins-Bittner 270c60ca9a Revert "Allow single-line comments with nothing after them. Fixes #318"
This reverts commit 652590fad3.
2023-10-06 14:07:29 -07:00
Tab Atkins-Bittner 54f5fc8025 Revert "Add vertical tab to whitespace characters. Fixes #331"
This reverts commit ef1bb689b0.
2023-10-06 14:07:28 -07:00
Tab Atkins-Bittner ef1bb689b0 Add vertical tab to whitespace characters. Fixes #331 2023-10-06 13:58:35 -07:00
Tab Atkins-Bittner 652590fad3 Allow single-line comments with nothing after them. Fixes #318 2023-10-06 13:56:03 -07:00
Tab Atkins Jr f3e5ff6027
Rearrange the number production to put decimal at the end
While the grammar makes no statements about match order, parsers pretty universally test for decimal last, after the other number productions, because `0b010` (/etc) can look like a `0` followed by garbage. Matching this order can reduce confusion.

Closes #330.
2023-05-30 14:13:46 -07:00
Evgeny a75ca13c15
Fix a typo in SPEC.md (#323) 2023-05-25 12:09:47 -07:00
Nathan West 0b99021180
Improvements to string naming consistency (#299)
This PR modifies string descriptions in SPEC.md to use more consistent language throughout, with the primary intention of removing long descriptions like "a property key is either an identifier or a string". There are no semantic changes to KDL here.
2022-09-20 17:29:59 -07:00
Nathan West 825ff2c17d
Add escaped whitespace to KDL strings (#290)
* Add escaped whitespace to KDL spec

* Add test cases for escaped whitespace

* Spelling error
2022-08-31 21:49:01 -07:00
Basile Henry 1bf4d740fa
Allow "empty" single line comments in the spec (#234)
As I read the grammar in the spec, `"//"` wouldn't parse as a single-line-comment as it requires as least one non-newline character after the slashes.
2022-08-28 13:07:17 -07:00
Danielle Smith 910f6e90a7
Do not escape / (Solidus, Forwardslash) (#197) 2022-08-28 12:59:26 -07:00
oledfish 9daa2019f7
Fix RFC typo (#276)
The ``email`` field in Reserved Type Annotations for Strings refers to [RFC 5302](https://datatracker.ietf.org/doc/html/rfc5302), it should be [RFC 5322](https://datatracker.ietf.org/doc/html/rfc5322) instead.
2022-07-22 10:34:21 -07:00
Bram Gotink b027d3a751
Remove children from node terminals (#275)
The grammar doesn't specify that children count
as node terminator, but the text does.

The following document would be valid per text,
but invalid per spec.

```kdl
node { child {} }
```

Fixes #274
2022-07-11 15:13:05 -07:00
Jelle Besseling fcd489afa6
Add more info about the hyphen character in identifiers (#271) 2022-04-25 10:04:28 -07:00
Sebastian Paarmann 81a58e64ee
Mention multi-line comments in spec prose (#263) 2022-03-29 13:00:29 -07:00
Tab Atkins Jr 3e915b5be3
Clarify the parsing of hostname and idl-hostname (#248)
Ref: #247
2022-02-19 02:06:54 -08:00
Christopher Durham 8976e2da68
Define `digit` in formal grammar (#236)
`digit` is used as a subtraction in bare-identifier, but never defined.
2022-02-19 02:06:17 -08:00
Tab Atkins Jr 5a566ea5e3
Fix #212 by clarifying left/right (#249) 2022-02-19 02:04:38 -08:00
Tab Atkins Jr a1d85e9fe1
[editorial] tweak node-props-and-args grammar (#240)
* replaces a `foo foo*` with a `foo+`
* switches the name of the production to singular, since it only represents one prop/arg at a time

No normative changes intended.
2021-10-17 08:46:34 -07:00
Christopher Durham 296fe129e1
argument/property ordering clarification (#206) 2021-09-26 22:47:08 -07:00
Ben Reinhart 5c4f83b824
Update line continuation wording (#184) 2021-09-19 16:28:25 -07:00
Ben Reinhart 16269d4325
Prevent markdown from parsing []() as link (#162)
* Use same order from grammar definition
2021-09-15 18:26:50 -07:00
Chris Morgan 785abebfc5
fix(spec): Correct bom from U+FFEF to U+FEFF (#153) 2021-09-13 20:17:20 -07:00
Kat Marchán f68137f526
slap a date on it 2021-09-11 21:08:09 -07:00
Kat Marchán 02c40c589d
bump version to 1.0.0 and add example with type annotations 2021-09-11 21:04:22 -07:00
Eric Sampson f0bc492021
Add some more reserved type annotations (#134)
I think it would be useful to get these few more common data types into 
For the decimal floating types, I referenced [this protobuf discussion](https://github.com/protocolbuffers/protobuf/pull/7039#issuecomment-679083593) and [this](https://github.com/googleapis/googleapis/blob/master/google/type/decimal.proto)

I'm not sure what to call out for the currency format, I can't find a standard for that yet. There's a [protobuf money type](https://github.com/googleapis/googleapis/blob/master/google/type/money.proto) that's basically a ISO 4217 currency code plus a decimal number, but I don't really want to invent a suggested money format if there's a real one out there somewhere.
For this PR, can we just leave it TBD in order to reserve the type keyword?
2021-09-11 20:46:32 -07:00
Lars Willighagen 0cdda0b711
Disallow ws after (type) in grammar (#138)
Fixes: https://github.com/kdl-org/kdl/issues/131
2021-09-10 17:11:41 -07:00
Tab Atkins Jr f1941b53d3
Allow node names to have type annotations. Bump JiK to take advantage of this. (#132) 2021-09-08 18:03:13 -07:00
Lars Willighagen ede621807e
Fix multi-line-comment grammar (#130)
Fix https://github.com/kdl-org/kdl/issues/128
2021-09-05 12:12:35 +02:00
Jo Liss dec2565a17
fix typos (#129) 2021-09-03 08:02:49 -07:00
Kat Marchán cbb500a4ac
allow /- to cross linespaces (#127)
Ref: https://github.com/kdl-org/kdl/issues/121
2021-09-02 15:29:25 -07:00
Kat Marchán 6b4d0ea030
allow eof termination for single line comments (#126) 2021-09-02 15:25:13 -07:00
Kat Marchán 2e42c4c0ec
Change URIs to URLs for clarity (#125) 2021-09-02 15:10:03 -07:00
Kat Marchán a44fcbb1d4
add type annotation info to spec (#123)
Fixes: https://github.com/kdl-org/kdl/issues/106
2021-09-02 09:23:51 -07:00
Kat Marchán 7c54aae64f
actually add child node spec to spec itself
Fixes: https://github.com/kdl-org/kdl/issues/59
2021-08-31 23:08:12 -07:00
Kat Marchán 129812543f
prevent the three "keywords" from being used as bare identifiers (#117)
Fixes: https://github.com/kdl-org/kdl/issues/114
2021-08-31 21:47:59 -07:00
Kat Marchán 37c0a38baa
allow _ in post-decimal-point section (#118)
Fixes: https://github.com/kdl-org/kdl/issues/69
2021-08-31 20:39:17 -07:00
Kat Marchán 3f739cad42
make / illegal in identifiers
Fixes: https://github.com/kdl-org/kdl/issues/75
2021-08-31 20:09:45 -07:00
Kat Marchán 04a84a72ec
link to other specs 2021-08-31 19:38:26 -07:00
Kat Marchán 34c6592f09
remove () from identifiers so we can use it for KQL (#108) 2021-08-31 17:09:57 -07:00
Tab Atkins Jr 9e35601c91
Partially revert #99 (#100)
6704988633 disallowed identifiers from ever starting with a sign character. This disallowed idents like `-`, or like the CSS `--foo` properties.

This change instead allows an ident to start with a sign character, so long as the *second* character isn't a digit.

I also tweaked the prose definition of identifier to talk about this restriction.
2021-08-24 14:57:03 -07:00
Kat Marchán 6704988633
identifiers should never look like numbers (#99) 2021-08-24 09:10:08 -07:00
Kat Marchán 5883435297
fix(grammar): allow whitespace before a node-terminator (#98)
kudos to @lucretiel for spotting this one.
2021-08-21 18:05:53 -07:00
Serafina Brocious e7147cf4ac
Fixed inconsistency between spec wording and BNF (#88) 2021-04-18 20:19:34 -07:00
Serafina Brocious 15aff6a309
Added optional sign to all number syntaxes (#87) 2021-04-18 20:19:21 -07:00
Daniel Smith 9ceb0ed8d4
Possible typo in "Escapes" table (#72)
The maximum unicode code point is `10FFFF` but in the escapes table it states code points can only go up to `10FFF`. I think this is an error, since most emojis are well above that number, and other languages allow escapes up to `10FFFF`
2021-01-11 12:08:03 -08:00
Daniel Smith 1f293c280b
Add forwardlash to escapes table (#73)
I noticed this was a valid escape char in the rust implementation. Not sure if this was intended.
2021-01-11 12:07:28 -08:00
Hannah Kolbeck 1cf1fd0597
Correct description of the raw string format (#71) 2021-01-08 21:09:11 -08:00
Lars Willighagen 89b52b2145
Fill in string escapes table (#60) 2020-12-29 11:27:37 -08:00
hclarke 3da011acbc
Update SPEC.md (#57)
this does a few things with identifiers and strings:

- removes `"` from the set of identifier characters, to prevent ambiguity with string
- adds `bare-identifier` and `escaped-string` non-terminals (i think less mixing of terminal/non-terminal is easier to read?)
- moves string ahead of bare-identifier in identifier, for easier implementation with ordered-choice parsers
- moves raw-string into string, so you can have raw-string identifiers
2020-12-26 18:03:32 -08:00
hclarke 81fad70856
Fixed escape table formatting (#44) 2020-12-22 14:33:39 -08:00
Kat Marchán cf341eac91
more blabber 2020-12-18 22:58:09 -08:00
Kat Marchán 60bcfdf926
require terminator after node-children too 2020-12-18 22:56:27 -08:00
Kat Marchán b30b0cf93a
messing with nodes some more 2020-12-18 21:32:40 -08:00
Kat Marchán dfc1441ec9
more node and nodes fixes 2020-12-18 20:06:11 -08:00
Kat Marchán 42672c1701
forgot eof 2020-12-18 19:31:44 -08:00
Kat Marchán b2a4610742
fix slashdash whitespace 2020-12-18 19:15:48 -08:00
Kat Marchán 3de6d3c095
version 2020-12-18 17:48:46 -08:00
Kat Marchán cc169da2c2
clean up node grammar + allow slashdash spaces 2020-12-18 17:47:36 -08:00
Kat Marchán 144f8d775f
spec out nested multiline comments 2020-12-18 17:43:14 -08:00
Kat Marchán 0f3c494235
completely reserve <>
Fixes: #35
2020-12-18 16:25:05 -08:00
Kat Marchán 1b9d878885
fix single-line-comment 2020-12-18 12:55:06 -08:00
Kat Marchán 6617e2ad47
fix code point 2020-12-18 12:55:06 -08:00
Kat Marchán 4955517118
updated grammar for identifier 2020-12-18 12:55:06 -08:00
Kat Marchán 3f5d405e58
add spec for slashdash 2020-12-18 12:55:05 -08:00
Tab Atkins Jr 980eccecfb
typo (#40) 2020-12-17 20:17:39 -08:00
Kat Marchán 92bdcb1a4d
heh 2020-12-16 22:09:11 -08:00
Kat Marchán 13e203b928
spec out Values 2020-12-16 21:34:22 -08:00
Kat Marchán 0233d5557a
work on props and args 2020-12-16 20:09:27 -08:00
Kat Marchán 1bfbe78022
nicer formatting for unicode in grammar 2020-12-16 12:07:56 -08:00
Kat Marchán 5cf6a5a276
bring back bom-as-ws (#34)
* bring back bom-as-ws

* Update SPEC.md

Co-authored-by: Lily Ballard <lily@sb.org>

Co-authored-by: Lily Ballard <lily@sb.org>
2020-12-15 23:15:50 -08:00