Commit Graph

49 Commits

Author SHA1 Message Date
Nicola Papale afccf01216
feat(entry): Add accessors to entry type. (#43)
While the type of entries was parsed, there was no way for the library
user to access it. This commit let the user access the `ty` field of the
`KdlEntry` struct. It mirrors the accessors on the `value` field.
2022-05-11 08:20:08 -07:00
Kat Marchán 58a40fdf48
fix(compliance): pull in spec test suite and fix issues (#40)
This commit includes a whole bunch of fixes, some of which are significant changes to the parser and some related functionality. But I consider all changes to be bugfixes because they were compliance failures.
2022-04-27 23:21:28 -07:00
Kat Marchán 12d373a1e0
feat(fmt): shiny new comment-preserving formatter! (#38)
Fixes: https://github.com/kdl-org/kdl-rs/issues/34
2022-04-23 22:34:51 -07:00
Kat Marchán c2cdc5de37
docs: fix minor doc issues with error stuff 2022-04-23 02:24:23 -07:00
Kat Marchán 177c42cae7
feat(len): add APIs to calculate component lengths (#36)
Fixes: https://github.com/kdl-org/kdl-rs/issues/19
2022-04-23 02:15:31 -07:00
Kat Marchán 40b04418c9
fix(api): remove obsolete type 2022-04-23 01:38:05 -07:00
Kat Marchán 21f7dbf106
docs: readme updates 2022-04-23 01:37:48 -07:00
Kat Marchán d63f336d18 feat(errors): overhauled error reporting a ton 2022-04-23 01:21:28 -07:00
Kat Marchán 5846bea079 deps: remove phf dep 2022-04-23 01:21:28 -07:00
Kat Marchán 1a8eb35168 fix(parse): small parser tweaks + more tests 2022-04-23 01:21:28 -07:00
Kat Marchán 892bf06e69 feat(clear_fmt): add methods to clear formatting and reset it to default 2022-04-23 01:21:28 -07:00
Kat Marchán fc1d0fd24b chore: clean up and docs 2022-04-23 01:21:28 -07:00
Kat Marchán a1555949ed refactor: clean up parser/FromStr toplevel stuff and add one for KdlIdentifier 2022-04-23 01:21:28 -07:00
Kat Marchán 8ed6a5cd06
feat(errors): improve parsing errors and fix some bugs (#33) 2022-04-22 19:41:28 -07:00
Kat Marchán 16c82f1ec1
feat(types): add type annotation support (#31) 2022-04-22 12:00:32 -07:00
Kat Marchán e242613127
tests: test some example documents 2022-04-22 02:35:02 -07:00
Kat Marchán 364ea6173c
feat(api): complete rewrite into document-oriented parser (#29)
This new version of kdl-rs is a complete rewrite that introduces
a formatting-aware-and-preserving parser, much like toml_edit et al.

BREAKING CHANGE: Completely new API and bumped MSRV to 1.56.0.
2022-04-22 02:20:30 -07:00
Kat Marchán d8715c8d41
docs: fix license in readme 2021-09-22 10:39:31 -07:00
Kat Marchán f811c5c89c
feat(spec): update parser to handle KDL 1.0.0
Fixes: https://github.com/kdl-org/kdl-rs/issues/18

BREAKING CHANGE: Various things have changed in the process of moving to KDL 1.0.0. Please test your stuff
2021-09-16 01:30:58 -07:00
jam1garner c1b7c25c00
fix(numbers): Fix parsing of non-integer and non-decimal numbers (#13) 2021-05-08 14:40:37 -07:00
jam1garner 9bc5363bb5
fix(deps): Remove nom dependency on `bitvec` and `lexical` (#14) 2021-05-08 14:40:23 -07:00
jam1garner 94190697d8
feat(docs): Add documentation for the entire crate (#16) 2021-05-08 14:40:15 -07:00
hclarke 95a1ee3e57
feat(identifier): much larger character set for identifiers (not just alphanumeric), to match spec more closely (#7) 2021-05-08 14:40:02 -07:00
hclarke b8c8b52748
feat(display): implemented Display for KdlNode (#6) 2021-05-08 14:39:35 -07:00
Kat Marchán 10fb1442e8
unicode whitespace and newlines! 2020-12-19 12:52:33 -08:00
Kat Marchán 758a0bc46e
fmt 2020-12-18 22:58:31 -08:00
Kat Marchán 5809d21898
require terminator after node_children too 2020-12-18 22:53:59 -08:00
Kat Marchán 2c443aed85
cargo fmt 2020-12-18 22:35:52 -08:00
Kat Marchán ede98b9a7b
fix nodes
Credit: @lucretiel
2020-12-18 22:32:06 -08:00
Kat Marchán d0d241b65f
broken nodes parser that should really work? 2020-12-18 21:19:27 -08:00
Kat Marchán 2f282ee206
unnecessary slice 2020-12-18 21:05:01 -08:00
Kat Marchán b4d3f07d09
more stuff 2020-12-18 20:46:52 -08:00
Kat Marchán a032a9ec86
fix a bunch of stuff and write tests for slashdash 2020-12-18 20:09:59 -08:00
Lily Ballard 685a537658
Add From and TryFrom impls for converting to/from KdlNodeValue (#5)
* Add From impls for KdlNodeValue

Most clients probably don't need to create these directly, but we may as
well make it easy for them.

* Add TryFrom impls to convert from KdlNodeValue to underlying types

This includes converting from borrowed values, which will produce `&str`
instead of `String`.
2020-12-16 17:47:39 -08:00
Lily Ballard d7670e17b4
Add line, column to KdlError (#3)
* Add line and column numbers to KdlError

These numbers are calculated using our `newline` rule, as I'm not aware
of any standard for how to calculate line numbers in error messages.

The error retains the original `offset` field as well, but it's now
expressed in characters rather than bytes.

* Clean up error handling in parse_document()

We don't need to worry about `Incomplete` errors, the `complete` family
of parsers (which we're using) doesn't ever produce those. We can use
the `.finish()` function to unwrap the error instead, so we don't have
to worry about the underlying error types.
2020-12-16 17:43:13 -08:00
Lily Ballard c61ef72b03
Export KdlNodeValue (#4) 2020-12-16 17:42:54 -08:00
Lily Ballard 597b89a6cd
Fix newline handling in single-line comments (#2) 2020-12-16 00:49:13 -08:00
Lily Ballard b5f8561b79
Replace ```ignore with ```text (#21)
Using the `ignore` marker makes `cargo test` think this is rust code
that should be ignored, which means it prints an "ignored" line in the
test output. It also makes `cargo doc --document-private-items` attempt
to colorize it as rust code. Marking this as `text` instead fixes both
issues.
2020-12-14 17:40:11 -08:00
Kat Marchán 75c176ae54
switch to LF line endings 2020-12-14 00:07:14 -08:00
Kat Marchán 42564a7cf7
rename Node and NodeValue 2020-12-13 22:31:30 -08:00
Kat Marchán e715b08800
strings done! 2020-12-13 22:25:55 -08:00
Kat Marchán 7ec15b7a04
reserve # so stuff like serde can use it for, say, indexing into values 2020-12-13 20:45:28 -08:00
Kat Marchán 4b4ffb71fd
0 is an integer (thanks, tef!) 2020-12-13 17:28:24 -08:00
Kat Marchán 842d1da3b9
numbers 2020-12-13 16:47:36 -08:00
Kat Marchán 54299642da
fix raw_string 2020-12-12 18:44:05 -08:00
Kat Marchán a316f6d2ef
some progress + tests 2020-12-12 17:51:18 -08:00
Kat Marchán 100a736145
node, identifier, and comments done 2020-12-12 15:07:19 -08:00
Kat Marchán 3296cc83a0
wip parser 2020-12-12 11:50:34 -08:00
Kat Marchán a8475fd2c7
initial commit 2020-12-10 18:42:50 -08:00