Skip to content

Commit 5524274

Browse files
authored
Add spans to tables (#11)
1 parent a1a2daa commit 5524274

22 files changed

+543
-346
lines changed

.github/workflows/rust-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
runs-on: ubuntu-22.04
5050
steps:
5151
- uses: actions/checkout@v4
52-
- uses: EmbarkStudios/cargo-deny-action@v1
52+
- uses: EmbarkStudios/cargo-deny-action@v2
5353

5454
publish-check:
5555
name: Publish Check

integ-tests/tests/snapshots/parser__crlf-2.snap

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,28 @@ note[string]: root_lib_0_path
2626
^^^^^^
2727

2828
note[table]: root_lib_0
29-
┌─ crlf:1:1
30-
31-
1 │ [project]
32-
^
29+
┌─ crlf:7:1
30+
31+
7 │ ╭ [[lib]]
32+
8 │ │
33+
9 │ │ path = "lib.rs"
34+
10 │ │ name = "splay"
35+
· │
36+
14 │ │ contents are never required to be entirely resident in memory all at once.
37+
15 │ │ """
38+
│ ╰───^
3339

3440
note[array]: root_lib
35-
┌─ crlf:1:1
36-
37-
1 │ [project]
38-
^
41+
┌─ crlf:7:1
42+
43+
7 │ ╭ [[lib]]
44+
8 │ │
45+
9 │ │ path = "lib.rs"
46+
10 │ │ name = "splay"
47+
· │
48+
14 │ │ contents are never required to be entirely resident in memory all at once.
49+
15 │ │ """
50+
│ ╰───^
3951

4052
note[string]: root_project_authors_0
4153
┌─ crlf:5:13
@@ -63,9 +75,13 @@ note[string]: root_project_version
6375

6476
note[table]: root_project
6577
┌─ crlf:1:1
66-
67-
1 │ [project]
68-
^
78+
79+
1 │ ╭ [project]
80+
2 │ │
81+
3 │ │ name = "splay"
82+
4 │ │ version = "0.1.0"
83+
5 │ │ authors = ["[email protected]"]
84+
│ ╰──────────────────────────────^
6985

7086
note[table]: root
7187
┌─ crlf:1:1
@@ -78,5 +94,3 @@ note[table]: root
7894
14 │ │ contents are never required to be entirely resident in memory all at once.
7995
15 │ │ """
8096
│ ╰───^
81-
82-

integ-tests/tests/snapshots/parser__empty_table-2.snap

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ source: integ-tests/tests/parser.rs
33
expression: spans
44
---
55
note[table]: root_foo
6-
┌─ empty_table:1:1
7-
8-
1
9-
^
6+
┌─ empty_table:2:1
7+
8+
2 │ ╭ [foo]
9+
3 │ │
10+
│ ╰^
1011

1112
note[table]: root
1213
┌─ empty_table:1:1
@@ -15,5 +16,3 @@ note[table]: root
1516
2 │ │ [foo]
1617
3 │ │
1718
│ ╰^
18-
19-

integ-tests/tests/snapshots/parser__fruit-2.snap

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ note[string]: root_fruit_0_physical_shape
2121
^^^^^
2222

2323
note[table]: root_fruit_0_physical
24-
┌─ fruit:1:1
25-
26-
1 │ [[fruit]]
27-
^
24+
┌─ fruit:4:1
25+
26+
4 │ ╭ [fruit.physical]
27+
5 │ │ color = "red"
28+
6 │ │ shape = "round"
29+
│ ╰───────────────^
2830

2931
note[string]: root_fruit_0_variety_0_name
3032
┌─ fruit:9:9
@@ -33,10 +35,11 @@ note[string]: root_fruit_0_variety_0_name
3335
^^^^^^^^^^^^^
3436

3537
note[table]: root_fruit_0_variety_0
36-
┌─ fruit:1:1
37-
38-
1 │ [[fruit]]
39-
^
38+
┌─ fruit:8:1
39+
40+
8 │ ╭ [[fruit.variety]]
41+
9 │ │ name = "red delicious"
42+
│ ╰──────────────────────^
4043

4144
note[string]: root_fruit_0_variety_1_name
4245
┌─ fruit:12:9
@@ -45,22 +48,25 @@ note[string]: root_fruit_0_variety_1_name
4548
^^^^^^^^^^^^
4649

4750
note[table]: root_fruit_0_variety_1
48-
┌─ fruit:1:1
49-
50-
1 │ [[fruit]]
51-
^
51+
┌─ fruit:11:1
52+
53+
11 │ ╭ [[fruit.variety]]
54+
12 │ │ name = "granny smith"
55+
│ ╰─────────────────────^
5256

5357
note[array]: root_fruit_0_variety
54-
┌─ fruit:1:1
55-
56-
1 │ [[fruit]]
57-
^
58+
┌─ fruit:8:1
59+
60+
8 │ ╭ [[fruit.variety]]
61+
9 │ │ name = "red delicious"
62+
│ ╰──────────────────────^
5863

5964
note[table]: root_fruit_0
6065
┌─ fruit:1:1
61-
62-
1 │ [[fruit]]
63-
^
66+
67+
1 │ ╭ [[fruit]]
68+
2 │ │ name = "apple"
69+
│ ╰──────────────^
6470

6571
note[string]: root_fruit_1_name
6672
┌─ fruit:15:9
@@ -75,28 +81,32 @@ note[string]: root_fruit_1_variety_0_name
7581
^^^^^^^^
7682

7783
note[table]: root_fruit_1_variety_0
78-
┌─ fruit:1:1
79-
80-
1 │ [[fruit]]
81-
^
84+
┌─ fruit:17:1
85+
86+
17 │ ╭ [[fruit.variety]]
87+
18 │ │ name = "plantain"
88+
│ ╰─────────────────^
8289

8390
note[array]: root_fruit_1_variety
84-
┌─ fruit:1:1
85-
86-
1 │ [[fruit]]
87-
^
91+
┌─ fruit:17:1
92+
93+
17 │ ╭ [[fruit.variety]]
94+
18 │ │ name = "plantain"
95+
│ ╰─────────────────^
8896

8997
note[table]: root_fruit_1
90-
┌─ fruit:1:1
91-
92-
1 │ [[fruit]]
93-
^
98+
┌─ fruit:14:1
99+
100+
14 │ ╭ [[fruit]]
101+
15 │ │ name = "banana"
102+
│ ╰───────────────^
94103

95104
note[array]: root_fruit
96105
┌─ fruit:1:1
97-
98-
1 │ [[fruit]]
99-
^
106+
107+
1 │ ╭ [[fruit]]
108+
2 │ │ name = "apple"
109+
│ ╰──────────────^
100110

101111
note[table]: root
102112
┌─ fruit:1:1
@@ -109,5 +119,3 @@ note[table]: root
109119
18 │ │ name = "plantain"
110120
19 │ │
111121
│ ╰^
112-
113-

integ-tests/tests/snapshots/parser__table_names-2.snap

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,46 +3,53 @@ source: integ-tests/tests/parser.rs
33
expression: spans
44
---
55
note[table]: root_"
6-
┌─ table_names:1:1
7-
8-
1 │ [a."b"]
9-
^
6+
┌─ table_names:4:1
7+
8+
4 │ ╭ ["\""]
9+
5 │ │ ['a.a']
10+
│ ╰^
1011

1112
note[table]: root_""
12-
┌─ table_names:1:1
13-
14-
1 │ [a."b"]
15-
^
13+
┌─ table_names:6:1
14+
15+
6 │ ╭ ['""']
16+
7 │ │
17+
│ ╰^
1618

1719
note[table]: root_a_b
1820
┌─ table_names:1:1
19-
20-
1 │ [a."b"]
21-
^
21+
22+
1 │ ╭ [a."b"]
23+
2 │ │ ["f f"]
24+
│ ╰^
2225

2326
note[table]: root_a
2427
┌─ table_names:1:1
25-
26-
1 │ [a."b"]
27-
^
28+
29+
1 │ ╭ [a."b"]
30+
2 │ │ ["f f"]
31+
│ ╰^
2832

2933
note[table]: root_a.a
30-
┌─ table_names:1:1
31-
32-
1 │ [a."b"]
33-
^
34+
┌─ table_names:5:1
35+
36+
5 │ ╭ ['a.a']
37+
6 │ │ ['""']
38+
│ ╰^
3439

3540
note[table]: root_f f
36-
┌─ table_names:1:1
37-
38-
1 │ [a."b"]
39-
^
41+
┌─ table_names:2:1
42+
43+
2 │ ╭ ["f f"]
44+
3 │ │ ["f.f"]
45+
│ ╰^
4046

4147
note[table]: root_f.f
42-
┌─ table_names:1:1
43-
44-
1 │ [a."b"]
45-
^
48+
┌─ table_names:3:1
49+
50+
3 │ ╭ ["f.f"]
51+
4 │ │ ["\""]
52+
│ ╰^
4653

4754
note[table]: root
4855
┌─ table_names:1:1
@@ -55,5 +62,3 @@ note[table]: root
5562
6 │ │ ['""']
5663
7 │ │
5764
│ ╰^
58-
59-

integ-tests/tests/snapshots/parser__tables_in_arrays-2.snap

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,39 @@ source: integ-tests/tests/parser.rs
33
expression: spans
44
---
55
note[table]: root_foo_0_bar
6-
┌─ tables_in_arrays:1:1
7-
8-
1 │ [[foo]]
9-
^
6+
┌─ tables_in_arrays:3:1
7+
8+
3 │ ╭ [foo.bar]
9+
4 │ │ #…
10+
│ ╰^
1011

1112
note[table]: root_foo_0
1213
┌─ tables_in_arrays:1:1
13-
14-
1 │ [[foo]]
15-
^
14+
15+
1 │ ╭ [[foo]]
16+
2 │ │ #…
17+
│ ╰^
1618

1719
note[table]: root_foo_1_bar
18-
┌─ tables_in_arrays:1:1
19-
20-
1 │ [[foo]]
21-
^
20+
┌─ tables_in_arrays:8:1
21+
22+
8 │ ╭ [foo.bar]
23+
9 │ │ #...
24+
│ ╰^
2225

2326
note[table]: root_foo_1
24-
┌─ tables_in_arrays:1:1
25-
26-
1 │ [[foo]]
27-
^
27+
┌─ tables_in_arrays:6:1
28+
29+
6 │ ╭ [[foo]] # ...
30+
7 │ │ #…
31+
│ ╰^
2832

2933
note[array]: root_foo
3034
┌─ tables_in_arrays:1:1
31-
32-
1 │ [[foo]]
33-
^
35+
36+
1 │ ╭ [[foo]]
37+
2 │ │ #…
38+
│ ╰^
3439

3540
note[table]: root
3641
┌─ tables_in_arrays:1:1
@@ -43,5 +48,3 @@ note[table]: root
4348
9 │ │ #...
4449
10 │ │
4550
│ ╰^
46-
47-

integ-tests/tests/snapshots/valid__arrays__one-2.snap

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,19 @@ note[string]: root_people_0_last_name
1616

1717
note[table]: root_people_0
1818
┌─ one:1:1
19-
20-
1 │ [[people]]
21-
^
19+
20+
1 │ ╭ [[people]]
21+
2 │ │ first_name = "Bruce"
22+
3 │ │ last_name = "Springsteen"
23+
│ ╰─────────────────────────^
2224

2325
note[array]: root_people
2426
┌─ one:1:1
25-
26-
1 │ [[people]]
27-
^
27+
28+
1 │ ╭ [[people]]
29+
2 │ │ first_name = "Bruce"
30+
3 │ │ last_name = "Springsteen"
31+
│ ╰─────────────────────────^
2832

2933
note[table]: root
3034
┌─ one:1:1
@@ -33,5 +37,3 @@ note[table]: root
3337
2 │ │ first_name = "Bruce"
3438
3 │ │ last_name = "Springsteen"
3539
│ ╰─────────────────────────^
36-
37-

0 commit comments

Comments
 (0)