-
-
Notifications
You must be signed in to change notification settings - Fork 84
/
Copy pathyaml.scm
94 lines (84 loc) · 1.84 KB
/
yaml.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
;; https://github.com/tree-sitter-grammars/tree-sitter-yaml/blob/master/src/grammar.json
;; ;;!! foo: bar
;; ;;! ^^^ ^^^
(_
key: (_) @collectionKey @value.leading.endOf
value: (_) @value @collectionKey.trailing.startOf
) @_.domain
;;!! foo: bar
;;! ^^^^^^^^
(block_mapping
(block_mapping_pair)? @collectionItem.leading.endOf
.
(block_mapping_pair) @collectionItem
.
(block_mapping_pair)? @collectionItem.trailing.startOf
) @map
;;!! - 0
;;! ^
;;! ---
(
(block_sequence
(block_sequence_item)? @collectionItem.leading.endOf
.
(block_sequence_item
"-" @collectionItem.prefix
(_) @collectionItem
) @collectionItem.domain
.
(block_sequence_item)? @collectionItem.trailing.startOf
(#trim-end! @collectionItem)
(#insertion-delimiter! @collectionItem "\n")
) @list
(#trim-end! @list)
)
;;!! [0]
;;! ^
(flow_sequence
(flow_node)? @collectionItem.leading.endOf
.
(flow_node) @collectionItem
.
(flow_node)? @collectionItem.trailing.startOf
(#insertion-delimiter! @collectionItem ", ")
) @list
;;!! { foo: bar }
;;! ^^^^^^^^
(flow_mapping
(flow_pair)? @collectionItem.leading.endOf
.
(flow_pair) @collectionItem
.
(flow_pair)? @collectionItem.trailing.startOf
(#insertion-delimiter! @collectionItem ", ")
) @map
[
(block_mapping)
(block_sequence)
(flow_sequence)
(flow_mapping)
] @collectionItem.iteration @collectionKey.iteration @value.iteration
;;!! foo: bar
;;! ^^^
;;!! foo: | block scalar
;;! ^^^^^^^^^^^^^
value: (_
[
(plain_scalar
(string_scalar)
)
(block_scalar)
] @string @textFragment
)
;;!! foo: "bar"
;;! ^^^^^
value: (_
(double_quote_scalar) @string @textFragment
(#child-range! @textFragment 0 -1 true true)
)
;;!! # comment
;;! ^^^^^^^^^
(comment) @comment @textFragment
(block_scalar
">" @disqualifyDelimiter
)