tree-sitter-sed 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/grammar.js +3 -0
- package/package.json +12 -10
- package/queries/highlights.scm +122 -0
- package/{sed-ere → sed_ere}/grammar.js +0 -5
- package/sed_ere/queries/highlights.scm +122 -0
- package/{sed-ere → sed_ere}/src/parser.c +1 -1
- package/{sed/src → src}/parser.c +1 -1
- package/{sed/src → src}/scanner.c +1 -1
- package/tree-sitter.json +6 -4
- package/sed/grammar.js +0 -8
- /package/{sed-ere → sed_ere}/src/grammar.json +0 -0
- /package/{sed-ere → sed_ere}/src/node-types.json +0 -0
- /package/{sed-ere → sed_ere}/src/scanner.c +0 -0
- /package/{sed-ere → sed_ere}/src/tree_sitter/alloc.h +0 -0
- /package/{sed-ere → sed_ere}/src/tree_sitter/array.h +0 -0
- /package/{sed-ere → sed_ere}/src/tree_sitter/parser.h +0 -0
- /package/{sed/src → src}/grammar.json +0 -0
- /package/{sed/src → src}/node-types.json +0 -0
- /package/{sed/src → src}/tree_sitter/alloc.h +0 -0
- /package/{sed/src → src}/tree_sitter/array.h +0 -0
- /package/{sed/src → src}/tree_sitter/parser.h +0 -0
package/README.md
CHANGED
|
@@ -14,8 +14,7 @@ npm install tree-sitter-sed
|
|
|
14
14
|
|
|
15
15
|
## Grammars
|
|
16
16
|
|
|
17
|
-
This repository contains two grammars. You can find [`
|
|
18
|
-
[`sed_ere`](sed-ere) here.
|
|
17
|
+
This repository contains two grammars. You can find [`sed_ere`](sed_ere) here.
|
|
19
18
|
|
|
20
19
|
## Specifications
|
|
21
20
|
|
package/grammar.js
ADDED
package/package.json
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tree-sitter-sed",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Tree-sitter grammars for POSIX sed.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "git+https://github.com/konomanoasa/tree-sitter-sed.git",
|
|
7
7
|
"files": [
|
|
8
8
|
"common/*.js",
|
|
9
9
|
"common/scanner.h",
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
10
|
+
"grammar.js",
|
|
11
|
+
"queries/*.scm",
|
|
12
|
+
"src/*.c",
|
|
13
|
+
"src/*.json",
|
|
14
|
+
"src/tree_sitter/*.h",
|
|
15
|
+
"sed_ere/grammar.js",
|
|
16
|
+
"sed_ere/queries/*.scm",
|
|
17
|
+
"sed_ere/src/*.c",
|
|
18
|
+
"sed_ere/src/*.json",
|
|
19
|
+
"sed_ere/src/tree_sitter/*.h",
|
|
18
20
|
"tree-sitter.json"
|
|
19
21
|
],
|
|
20
22
|
"scripts": {
|
|
21
23
|
"check": "biome check . && node scripts/check-scanner.js && node scripts/check-generated.js && npm test",
|
|
22
24
|
"format": "biome check --write . && node scripts/check-scanner.js --write",
|
|
23
25
|
"generate": "npm run tree-sitter -- generate-all",
|
|
24
|
-
"test": "npm run tree-sitter -- test --rebuild && node --test
|
|
26
|
+
"test": "npm run tree-sitter -- test-corpus --rebuild && node --test",
|
|
25
27
|
"test:fuzz": "npm run tree-sitter -- fuzz-all --iterations 100 --edits 5",
|
|
26
28
|
"tree-sitter": "node scripts/tree-sitter.js"
|
|
27
29
|
},
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
[
|
|
2
|
+
(address_escape)
|
|
3
|
+
(escaped_delimiter_token)
|
|
4
|
+
(quoted_character_token)
|
|
5
|
+
(replacement_escape_token)
|
|
6
|
+
(sed_newline_escape_token)
|
|
7
|
+
(text_backslash_escape_token)
|
|
8
|
+
(translation_escape_token)
|
|
9
|
+
] @string.escape
|
|
10
|
+
|
|
11
|
+
[
|
|
12
|
+
(back_bar)
|
|
13
|
+
(back_plus)
|
|
14
|
+
(back_qm)
|
|
15
|
+
(left_anchor_token)
|
|
16
|
+
(negation_operator)
|
|
17
|
+
(right_anchor_token)
|
|
18
|
+
(zero_or_more_operator)
|
|
19
|
+
] @operator
|
|
20
|
+
|
|
21
|
+
[
|
|
22
|
+
(case_insensitive_flag)
|
|
23
|
+
(global_flag)
|
|
24
|
+
(print_flag)
|
|
25
|
+
(substitution_flag)
|
|
26
|
+
] @keyword.modifier
|
|
27
|
+
|
|
28
|
+
(function_verb) @keyword
|
|
29
|
+
|
|
30
|
+
(comment_text) @comment
|
|
31
|
+
|
|
32
|
+
(default_output_suppression) @keyword.directive
|
|
33
|
+
|
|
34
|
+
[
|
|
35
|
+
(escaped_newline_token)
|
|
36
|
+
(text_introducer_token)
|
|
37
|
+
(text_escaped_newline_token)
|
|
38
|
+
] @punctuation.special
|
|
39
|
+
|
|
40
|
+
(label_token) @label
|
|
41
|
+
|
|
42
|
+
(last_line_address) @constant.builtin
|
|
43
|
+
|
|
44
|
+
[
|
|
45
|
+
(dup_count_token)
|
|
46
|
+
(line_number_address)
|
|
47
|
+
(occurrence_flag)
|
|
48
|
+
] @number
|
|
49
|
+
|
|
50
|
+
[
|
|
51
|
+
(backreference_token)
|
|
52
|
+
(matched_text_reference_token)
|
|
53
|
+
(replacement_backreference_token)
|
|
54
|
+
] @string.special.symbol
|
|
55
|
+
|
|
56
|
+
[
|
|
57
|
+
(rfile_token)
|
|
58
|
+
(wfile_token)
|
|
59
|
+
] @string.special.path
|
|
60
|
+
|
|
61
|
+
[
|
|
62
|
+
(back_close_brace)
|
|
63
|
+
(back_close_parenthesis_token)
|
|
64
|
+
(back_open_brace)
|
|
65
|
+
(back_open_parenthesis)
|
|
66
|
+
(close_bracket_token)
|
|
67
|
+
(closing_brace_token)
|
|
68
|
+
(colon_close)
|
|
69
|
+
(open_bracket)
|
|
70
|
+
(open_colon)
|
|
71
|
+
] @punctuation.bracket
|
|
72
|
+
|
|
73
|
+
[
|
|
74
|
+
(nonmatching_list_operator)
|
|
75
|
+
(range_operator)
|
|
76
|
+
] @punctuation.special
|
|
77
|
+
|
|
78
|
+
[
|
|
79
|
+
(range_end_hyphen)
|
|
80
|
+
(trailing_hyphen)
|
|
81
|
+
] @string.regexp
|
|
82
|
+
|
|
83
|
+
[
|
|
84
|
+
(class_name)
|
|
85
|
+
(coll_elem_multi)
|
|
86
|
+
(coll_elem_single)
|
|
87
|
+
(collating_element_token)
|
|
88
|
+
(dot_close)
|
|
89
|
+
(equal_close)
|
|
90
|
+
(meta_char)
|
|
91
|
+
(open_dot)
|
|
92
|
+
(open_equal)
|
|
93
|
+
(period_token)
|
|
94
|
+
] @character.special
|
|
95
|
+
|
|
96
|
+
[
|
|
97
|
+
(address_separator_token)
|
|
98
|
+
(delimiter_token)
|
|
99
|
+
(interval_separator)
|
|
100
|
+
] @punctuation.delimiter
|
|
101
|
+
|
|
102
|
+
((command_separator) @punctuation.delimiter
|
|
103
|
+
(#eq? @punctuation.delimiter ";"))
|
|
104
|
+
|
|
105
|
+
(ordinary_character_token) @string.regexp
|
|
106
|
+
|
|
107
|
+
[
|
|
108
|
+
(replacement_literal_token)
|
|
109
|
+
(text_literal_token)
|
|
110
|
+
(translation_literal_token)
|
|
111
|
+
] @string
|
|
112
|
+
|
|
113
|
+
(block_function
|
|
114
|
+
verb: (function_verb) @punctuation.bracket)
|
|
115
|
+
|
|
116
|
+
(comment_function
|
|
117
|
+
verb: (function_verb) @comment)
|
|
118
|
+
|
|
119
|
+
(comment_function
|
|
120
|
+
verb: (function_verb) @keyword.directive
|
|
121
|
+
comment: (comment
|
|
122
|
+
suppression: (default_output_suppression)))
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
[
|
|
2
|
+
(address_escape)
|
|
3
|
+
(escaped_delimiter_token)
|
|
4
|
+
(quoted_character_token)
|
|
5
|
+
(replacement_escape_token)
|
|
6
|
+
(sed_newline_escape_token)
|
|
7
|
+
(text_backslash_escape_token)
|
|
8
|
+
(translation_escape_token)
|
|
9
|
+
] @string.escape
|
|
10
|
+
|
|
11
|
+
[
|
|
12
|
+
(ere_alternation_operator_token)
|
|
13
|
+
(left_anchor_token)
|
|
14
|
+
(negation_operator)
|
|
15
|
+
(one_or_more_operator)
|
|
16
|
+
(repetition_modifier)
|
|
17
|
+
(right_anchor_token)
|
|
18
|
+
(zero_or_more_operator)
|
|
19
|
+
(zero_or_one_operator)
|
|
20
|
+
] @operator
|
|
21
|
+
|
|
22
|
+
[
|
|
23
|
+
(case_insensitive_flag)
|
|
24
|
+
(global_flag)
|
|
25
|
+
(print_flag)
|
|
26
|
+
(substitution_flag)
|
|
27
|
+
] @keyword.modifier
|
|
28
|
+
|
|
29
|
+
(function_verb) @keyword
|
|
30
|
+
|
|
31
|
+
(comment_text) @comment
|
|
32
|
+
|
|
33
|
+
(default_output_suppression) @keyword.directive
|
|
34
|
+
|
|
35
|
+
[
|
|
36
|
+
(escaped_newline_token)
|
|
37
|
+
(text_introducer_token)
|
|
38
|
+
(text_escaped_newline_token)
|
|
39
|
+
] @punctuation.special
|
|
40
|
+
|
|
41
|
+
(label_token) @label
|
|
42
|
+
|
|
43
|
+
(last_line_address) @constant.builtin
|
|
44
|
+
|
|
45
|
+
[
|
|
46
|
+
(dup_count_token)
|
|
47
|
+
(line_number_address)
|
|
48
|
+
(occurrence_flag)
|
|
49
|
+
] @number
|
|
50
|
+
|
|
51
|
+
[
|
|
52
|
+
(matched_text_reference_token)
|
|
53
|
+
(replacement_backreference_token)
|
|
54
|
+
] @string.special.symbol
|
|
55
|
+
|
|
56
|
+
[
|
|
57
|
+
(rfile_token)
|
|
58
|
+
(wfile_token)
|
|
59
|
+
] @string.special.path
|
|
60
|
+
|
|
61
|
+
[
|
|
62
|
+
(close_brace)
|
|
63
|
+
(close_bracket_token)
|
|
64
|
+
(close_parenthesis_token)
|
|
65
|
+
(closing_brace_token)
|
|
66
|
+
(colon_close)
|
|
67
|
+
(open_brace)
|
|
68
|
+
(open_bracket)
|
|
69
|
+
(open_colon)
|
|
70
|
+
(open_parenthesis)
|
|
71
|
+
] @punctuation.bracket
|
|
72
|
+
|
|
73
|
+
[
|
|
74
|
+
(nonmatching_list_operator)
|
|
75
|
+
(range_operator)
|
|
76
|
+
] @punctuation.special
|
|
77
|
+
|
|
78
|
+
[
|
|
79
|
+
(range_end_hyphen)
|
|
80
|
+
(trailing_hyphen)
|
|
81
|
+
] @string.regexp
|
|
82
|
+
|
|
83
|
+
[
|
|
84
|
+
(class_name)
|
|
85
|
+
(coll_elem_multi)
|
|
86
|
+
(coll_elem_single)
|
|
87
|
+
(collating_element_token)
|
|
88
|
+
(dot_close)
|
|
89
|
+
(equal_close)
|
|
90
|
+
(meta_char)
|
|
91
|
+
(open_dot)
|
|
92
|
+
(open_equal)
|
|
93
|
+
(period_token)
|
|
94
|
+
] @character.special
|
|
95
|
+
|
|
96
|
+
[
|
|
97
|
+
(address_separator_token)
|
|
98
|
+
(delimiter_token)
|
|
99
|
+
(interval_separator)
|
|
100
|
+
] @punctuation.delimiter
|
|
101
|
+
|
|
102
|
+
((command_separator) @punctuation.delimiter
|
|
103
|
+
(#eq? @punctuation.delimiter ";"))
|
|
104
|
+
|
|
105
|
+
(ordinary_character_token) @string.regexp
|
|
106
|
+
|
|
107
|
+
[
|
|
108
|
+
(replacement_literal_token)
|
|
109
|
+
(text_literal_token)
|
|
110
|
+
(translation_literal_token)
|
|
111
|
+
] @string
|
|
112
|
+
|
|
113
|
+
(block_function
|
|
114
|
+
verb: (function_verb) @punctuation.bracket)
|
|
115
|
+
|
|
116
|
+
(comment_function
|
|
117
|
+
verb: (function_verb) @comment)
|
|
118
|
+
|
|
119
|
+
(comment_function
|
|
120
|
+
verb: (function_verb) @keyword.directive
|
|
121
|
+
comment: (comment
|
|
122
|
+
suppression: (default_output_suppression)))
|
|
@@ -55863,7 +55863,7 @@ TS_PUBLIC const TSLanguage *tree_sitter_sed_ere(void) {
|
|
|
55863
55863
|
.max_reserved_word_set_size = 0,
|
|
55864
55864
|
.metadata = {
|
|
55865
55865
|
.major_version = 0,
|
|
55866
|
-
.minor_version =
|
|
55866
|
+
.minor_version = 2,
|
|
55867
55867
|
.patch_version = 0,
|
|
55868
55868
|
},
|
|
55869
55869
|
};
|
package/{sed/src → src}/parser.c
RENAMED
|
@@ -57899,7 +57899,7 @@ TS_PUBLIC const TSLanguage *tree_sitter_sed(void) {
|
|
|
57899
57899
|
.max_reserved_word_set_size = 0,
|
|
57900
57900
|
.metadata = {
|
|
57901
57901
|
.major_version = 0,
|
|
57902
|
-
.minor_version =
|
|
57902
|
+
.minor_version = 2,
|
|
57903
57903
|
.patch_version = 0,
|
|
57904
57904
|
},
|
|
57905
57905
|
};
|
package/tree-sitter.json
CHANGED
|
@@ -3,23 +3,25 @@
|
|
|
3
3
|
"grammars": [
|
|
4
4
|
{
|
|
5
5
|
"name": "sed",
|
|
6
|
-
"title": "POSIX sed
|
|
6
|
+
"title": "POSIX sed",
|
|
7
7
|
"scope": "source.sed",
|
|
8
|
-
"path": "
|
|
8
|
+
"path": ".",
|
|
9
9
|
"file-types": ["sed"],
|
|
10
10
|
"injection-regex": "^sed$",
|
|
11
|
+
"highlights": "queries/highlights.scm",
|
|
11
12
|
"external-files": ["common/scanner.h"]
|
|
12
13
|
},
|
|
13
14
|
{
|
|
14
15
|
"name": "sed_ere",
|
|
15
16
|
"title": "POSIX sed (ERE)",
|
|
16
17
|
"scope": "source.sed.ere",
|
|
17
|
-
"path": "
|
|
18
|
+
"path": "sed_ere",
|
|
19
|
+
"highlights": "sed_ere/queries/highlights.scm",
|
|
18
20
|
"external-files": ["common/scanner.h"]
|
|
19
21
|
}
|
|
20
22
|
],
|
|
21
23
|
"metadata": {
|
|
22
|
-
"version": "0.
|
|
24
|
+
"version": "0.2.0",
|
|
23
25
|
"license": "MIT",
|
|
24
26
|
"description": "Tree-sitter grammars for POSIX sed.",
|
|
25
27
|
"authors": [
|
package/sed/grammar.js
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|