Skip to content

Commit

Permalink
feat(compliance): update to latest 2.0 spec (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat authored Dec 19, 2024
1 parent d0366db commit 4734b06
Show file tree
Hide file tree
Showing 27 changed files with 62 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! `kdl` is a "document-oriented" parser and API for the [KDL Document
//! Language](https://kdl.dev), a node-based, human-friendly configuration and
//! serialization format.
//!
//!
//! Unlike serde-based implementations, this crate preserves formatting when
//! editing, as well as when inserting or changing values with custom
//! formatting. This is most useful when working with human-maintained KDL
Expand Down
2 changes: 1 addition & 1 deletion src/v2_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ fn badval_ty_char(input: &mut Input<'_>) -> PResult<()> {

/// `line-space := newline | ws | single-line-comment`
fn line_space(input: &mut Input<'_>) -> PResult<()> {
alt((newline, ws, single_line_comment)).parse_next(input)
alt((node_space, newline, single_line_comment)).parse_next(input)
}

/// `node-space := ws* escline ws* | ws+`
Expand Down
1 change: 1 addition & 0 deletions tests/test_cases/expected_kdl/esc_multiple_newlines.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node "12"
2 changes: 2 additions & 0 deletions tests/test_cases/expected_kdl/escline_after_semicolon.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node
node
1 change: 1 addition & 0 deletions tests/test_cases/expected_kdl/escline_alone.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions tests/test_cases/expected_kdl/escline_empty_line.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node
2 changes: 2 additions & 0 deletions tests/test_cases/expected_kdl/escline_end_of_node.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
a
b
4 changes: 4 additions & 0 deletions tests/test_cases/expected_kdl/escline_in_child_block.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
parent {
child
child
}
1 change: 1 addition & 0 deletions tests/test_cases/expected_kdl/escline_node_type.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(type)node
1 change: 1 addition & 0 deletions tests/test_cases/expected_kdl/escline_slashdash.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node "a\\ b\na\\b"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node "\"\"\""
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node " a"
4 changes: 4 additions & 0 deletions tests/test_cases/input/esc_multiple_newlines.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node "1\


2"
2 changes: 2 additions & 0 deletions tests/test_cases/input/escline_after_semicolon.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node; \
node
1 change: 1 addition & 0 deletions tests/test_cases/input/escline_alone.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
\
3 changes: 3 additions & 0 deletions tests/test_cases/input/escline_empty_line.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
\

node
3 changes: 3 additions & 0 deletions tests/test_cases/input/escline_end_of_node.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
a \

b
5 changes: 5 additions & 0 deletions tests/test_cases/input/escline_in_child_block.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
parent {
child
\ // comment
child
}
1 change: 1 addition & 0 deletions tests/test_cases/input/escline_node.kdl
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node1
\
node2
2 changes: 2 additions & 0 deletions tests/test_cases/input/escline_node_type.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
\
(type)node
4 changes: 4 additions & 0 deletions tests/test_cases/input/escline_slashdash.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node
\
/-
node
4 changes: 4 additions & 0 deletions tests/test_cases/input/multiline_string_double_backslash.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node """
a\\ b
a\\\ b
"""
3 changes: 3 additions & 0 deletions tests/test_cases/input/multiline_string_escape_delimiter.kdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node """
\"""
"""
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node """
a
\
"""
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node """
a
\
"""
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node """
\s escaped prefix
literal prefix
"""

0 comments on commit 4734b06

Please sign in to comment.