@konomanoasa/tree-sitter-diagnostic-sh 0.2.0 → 0.4.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/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "konomanoasa-tree-sitter-diagnostic-sh"
3
- version = "0.2.0"
3
+ version = "0.4.0"
4
4
  edition = "2024"
5
5
  description = "Tree-sitter grammar for diagnostics of POSIX sh."
6
6
  readme = "README.md"
@@ -27,11 +27,11 @@ name = "bindings"
27
27
  path = "test/bindings.test.rs"
28
28
 
29
29
  [dependencies]
30
- tree-sitter-language = "0.1.8"
30
+ tree-sitter-language = "=0.1.9"
31
31
 
32
32
  [dev-dependencies]
33
- serde_json = "1"
34
- tree-sitter = "0.27.1"
33
+ serde_json = "=1.0.154"
34
+ tree-sitter = "=0.27.1"
35
35
 
36
36
  [build-dependencies]
37
- cc = "1.4"
37
+ cc = "=1.10.0"
package/README.md CHANGED
@@ -17,8 +17,6 @@ npm install @konomanoasa/tree-sitter-diagnostic-sh
17
17
 
18
18
  ## Development
19
19
 
20
- Development uses Node.js 24.21.0 or later.
21
-
22
20
  ```sh
23
21
  npm install
24
22
  npm run build
@@ -1,10 +1,11 @@
1
1
  fn main() {
2
- println!("cargo::rerun-if-changed=src");
3
2
  let mut build = cc::Build::new();
4
3
  build.std("c17");
5
4
  if build.get_compiler().is_like_msvc() {
6
5
  build.flag("-utf-8");
7
6
  }
7
+
8
+ println!("cargo::rerun-if-changed=src");
8
9
  build
9
10
  .include("src")
10
11
  .files(["src/parser.c", "src/scanner.c"])
package/grammar.js CHANGED
@@ -81,6 +81,7 @@ const faults = [
81
81
  "case_pattern_separator_error",
82
82
  "parenthesis_gap",
83
83
  "brace_gap",
84
+ "special_builtin_function_name",
84
85
  "function_body_gap",
85
86
  "invalid_function_body",
86
87
  "function_parameter_error",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konomanoasa/tree-sitter-diagnostic-sh",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "description": "Tree-sitter grammar for diagnostics of POSIX sh.",
6
6
  "license": "MIT",
@@ -21,16 +21,17 @@
21
21
  },
22
22
  "scripts": {
23
23
  "build": "npm run tree-sitter -- build-all",
24
- "check": "biome check . && tsc --noEmit",
24
+ "check": "biome check . && tsc",
25
25
  "format": "biome format --write .",
26
26
  "generate": "npm run tree-sitter -- generate-all",
27
- "test": "node --test --test-concurrency=1 \"test/*.test.js\"",
27
+ "test": "node --test --test-concurrency=1 test/cst.test.js test/parser.test.js",
28
+ "test:performance": "node --test test/performance.test.js",
28
29
  "test:sanitize": "node scripts/check-c.js --sanitize",
29
30
  "test:scanner": "node scripts/check-c.js",
30
31
  "tree-sitter": "node scripts/tree-sitter.js"
31
32
  },
32
33
  "devDependencies": {
33
- "@biomejs/biome": "2.5.15",
34
+ "@biomejs/biome": "2.6.2",
34
35
  "@types/node": "26.6.5",
35
36
  "tree-sitter-cli": "0.27.1",
36
37
  "typescript": "7.0.2"
package/src/grammar.json CHANGED
@@ -1781,6 +1781,10 @@
1781
1781
  "type": "SYMBOL",
1782
1782
  "name": "brace_gap"
1783
1783
  },
1784
+ {
1785
+ "type": "SYMBOL",
1786
+ "name": "special_builtin_function_name"
1787
+ },
1784
1788
  {
1785
1789
  "type": "SYMBOL",
1786
1790
  "name": "function_body_gap"
@@ -2153,6 +2157,10 @@
2153
2157
  "type": "SYMBOL",
2154
2158
  "name": "brace_gap"
2155
2159
  },
2160
+ {
2161
+ "type": "SYMBOL",
2162
+ "name": "special_builtin_function_name"
2163
+ },
2156
2164
  {
2157
2165
  "type": "SYMBOL",
2158
2166
  "name": "function_body_gap"
@@ -2671,6 +2679,10 @@
2671
2679
  "type": "SYMBOL",
2672
2680
  "name": "brace_gap"
2673
2681
  },
2682
+ {
2683
+ "type": "SYMBOL",
2684
+ "name": "special_builtin_function_name"
2685
+ },
2674
2686
  {
2675
2687
  "type": "SYMBOL",
2676
2688
  "name": "function_body_gap"
@@ -4040,6 +4040,10 @@
4040
4040
  "type": "single_quote_gap",
4041
4041
  "named": true
4042
4042
  },
4043
+ {
4044
+ "type": "special_builtin_function_name",
4045
+ "named": true
4046
+ },
4043
4047
  {
4044
4048
  "type": "substitution_ending_gap",
4045
4049
  "named": true
@@ -4830,6 +4834,10 @@
4830
4834
  "type": "source",
4831
4835
  "named": true
4832
4836
  },
4837
+ {
4838
+ "type": "special_builtin_function_name",
4839
+ "named": true
4840
+ },
4833
4841
  {
4834
4842
  "type": "substitution_ending_gap",
4835
4843
  "named": true
package/src/parser.c CHANGED
@@ -9,10 +9,10 @@
9
9
  #define LANGUAGE_VERSION 15
10
10
  #define STATE_COUNT 251
11
11
  #define LARGE_STATE_COUNT 118
12
- #define SYMBOL_COUNT 152
12
+ #define SYMBOL_COUNT 153
13
13
  #define ALIAS_COUNT 0
14
- #define TOKEN_COUNT 118
15
- #define EXTERNAL_TOKEN_COUNT 116
14
+ #define TOKEN_COUNT 119
15
+ #define EXTERNAL_TOKEN_COUNT 117
16
16
  #define FIELD_COUNT 5
17
17
  #define MAX_ALIAS_SEQUENCE_LENGTH 4
18
18
  #define MAX_RESERVED_WORD_SET_SIZE 0
@@ -106,71 +106,72 @@ enum ts_symbol_identifiers {
106
106
  sym_case_pattern_separator_error = 84,
107
107
  sym_parenthesis_gap = 85,
108
108
  sym_brace_gap = 86,
109
- sym_function_body_gap = 87,
110
- sym_invalid_function_body = 88,
111
- sym_function_parameter_error = 89,
112
- sym_single_quote_gap = 90,
113
- sym_double_quote_gap = 91,
114
- sym_dollar_quote_gap = 92,
115
- sym_incomplete_escape = 93,
116
- sym_unspecified_dollar_quote_escape = 94,
117
- sym_unspecified_empty_hex_escape = 95,
118
- sym_unspecified_control_escape = 96,
119
- sym_unspecified_hex_escape = 97,
120
- sym_unspecified_octal_escape = 98,
121
- sym_parameter_name_gap = 99,
122
- sym_invalid_parameter_name = 100,
123
- sym_parameter_operator_gap = 101,
124
- sym_parameter_operator_error = 102,
125
- sym_parameter_length_suffix_error = 103,
126
- sym_parameter_word_gap = 104,
127
- sym_parameter_ending_gap = 105,
128
- sym_unspecified_parameter_quote = 106,
129
- sym_unspecified_expansion_start = 107,
130
- sym_arithmetic_ending_gap = 108,
131
- sym_substitution_ending_gap = 109,
132
- sym_backquote_gap = 110,
133
- sym_undefined_backquote_quote = 111,
134
- sym_undefined_backquote_comment = 112,
135
- sym_undefined_backquote_here_document = 113,
136
- sym_undefined_backquote_substitution = 114,
137
- sym_recovery_fragment = 115,
138
- sym_recovery_resume = 116,
139
- sym_recovery_eof = 117,
140
- sym_program = 118,
141
- sym__owner = 119,
142
- sym_list = 120,
143
- sym_compound_list = 121,
144
- sym_and_or = 122,
145
- sym_pipeline = 123,
146
- sym_simple_command = 124,
147
- sym_word = 125,
148
- sym_subshell = 126,
149
- sym_brace_group = 127,
150
- sym_if_clause = 128,
151
- sym_else_part = 129,
152
- sym_for_clause = 130,
153
- sym_while_clause = 131,
154
- sym_until_clause = 132,
155
- sym_do_group = 133,
156
- sym_case_clause = 134,
157
- sym_case_item = 135,
158
- sym_function_definition = 136,
159
- sym_io_redirect = 137,
160
- sym_here_document_body = 138,
161
- sym_single_quoted = 139,
162
- sym_double_quoted = 140,
163
- sym_dollar_single_quoted = 141,
164
- sym_escaped_character = 142,
165
- sym_dollar_single_quote_escape = 143,
166
- sym_parameter_expansion = 144,
167
- sym_arithmetic_expansion = 145,
168
- sym_command_substitution = 146,
169
- sym_backquote_substitution = 147,
170
- sym_syntax_issue = 148,
171
- sym__unowned_issue = 149,
172
- aux_sym_program_repeat1 = 150,
173
- aux_sym_list_repeat1 = 151,
109
+ sym_special_builtin_function_name = 87,
110
+ sym_function_body_gap = 88,
111
+ sym_invalid_function_body = 89,
112
+ sym_function_parameter_error = 90,
113
+ sym_single_quote_gap = 91,
114
+ sym_double_quote_gap = 92,
115
+ sym_dollar_quote_gap = 93,
116
+ sym_incomplete_escape = 94,
117
+ sym_unspecified_dollar_quote_escape = 95,
118
+ sym_unspecified_empty_hex_escape = 96,
119
+ sym_unspecified_control_escape = 97,
120
+ sym_unspecified_hex_escape = 98,
121
+ sym_unspecified_octal_escape = 99,
122
+ sym_parameter_name_gap = 100,
123
+ sym_invalid_parameter_name = 101,
124
+ sym_parameter_operator_gap = 102,
125
+ sym_parameter_operator_error = 103,
126
+ sym_parameter_length_suffix_error = 104,
127
+ sym_parameter_word_gap = 105,
128
+ sym_parameter_ending_gap = 106,
129
+ sym_unspecified_parameter_quote = 107,
130
+ sym_unspecified_expansion_start = 108,
131
+ sym_arithmetic_ending_gap = 109,
132
+ sym_substitution_ending_gap = 110,
133
+ sym_backquote_gap = 111,
134
+ sym_undefined_backquote_quote = 112,
135
+ sym_undefined_backquote_comment = 113,
136
+ sym_undefined_backquote_here_document = 114,
137
+ sym_undefined_backquote_substitution = 115,
138
+ sym_recovery_fragment = 116,
139
+ sym_recovery_resume = 117,
140
+ sym_recovery_eof = 118,
141
+ sym_program = 119,
142
+ sym__owner = 120,
143
+ sym_list = 121,
144
+ sym_compound_list = 122,
145
+ sym_and_or = 123,
146
+ sym_pipeline = 124,
147
+ sym_simple_command = 125,
148
+ sym_word = 126,
149
+ sym_subshell = 127,
150
+ sym_brace_group = 128,
151
+ sym_if_clause = 129,
152
+ sym_else_part = 130,
153
+ sym_for_clause = 131,
154
+ sym_while_clause = 132,
155
+ sym_until_clause = 133,
156
+ sym_do_group = 134,
157
+ sym_case_clause = 135,
158
+ sym_case_item = 136,
159
+ sym_function_definition = 137,
160
+ sym_io_redirect = 138,
161
+ sym_here_document_body = 139,
162
+ sym_single_quoted = 140,
163
+ sym_double_quoted = 141,
164
+ sym_dollar_single_quoted = 142,
165
+ sym_escaped_character = 143,
166
+ sym_dollar_single_quote_escape = 144,
167
+ sym_parameter_expansion = 145,
168
+ sym_arithmetic_expansion = 146,
169
+ sym_command_substitution = 147,
170
+ sym_backquote_substitution = 148,
171
+ sym_syntax_issue = 149,
172
+ sym__unowned_issue = 150,
173
+ aux_sym_program_repeat1 = 151,
174
+ aux_sym_list_repeat1 = 152,
174
175
  };
175
176
 
176
177
  static const char * const ts_symbol_names[] = {
@@ -261,6 +262,7 @@ static const char * const ts_symbol_names[] = {
261
262
  [sym_case_pattern_separator_error] = "case_pattern_separator_error",
262
263
  [sym_parenthesis_gap] = "parenthesis_gap",
263
264
  [sym_brace_gap] = "brace_gap",
265
+ [sym_special_builtin_function_name] = "special_builtin_function_name",
264
266
  [sym_function_body_gap] = "function_body_gap",
265
267
  [sym_invalid_function_body] = "invalid_function_body",
266
268
  [sym_function_parameter_error] = "function_parameter_error",
@@ -416,6 +418,7 @@ static const TSSymbol ts_symbol_map[] = {
416
418
  [sym_case_pattern_separator_error] = sym_case_pattern_separator_error,
417
419
  [sym_parenthesis_gap] = sym_parenthesis_gap,
418
420
  [sym_brace_gap] = sym_brace_gap,
421
+ [sym_special_builtin_function_name] = sym_special_builtin_function_name,
419
422
  [sym_function_body_gap] = sym_function_body_gap,
420
423
  [sym_invalid_function_body] = sym_invalid_function_body,
421
424
  [sym_function_parameter_error] = sym_function_parameter_error,
@@ -832,6 +835,10 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
832
835
  .visible = true,
833
836
  .named = true,
834
837
  },
838
+ [sym_special_builtin_function_name] = {
839
+ .visible = true,
840
+ .named = true,
841
+ },
835
842
  [sym_function_body_gap] = {
836
843
  .visible = true,
837
844
  .named = true,
@@ -1775,6 +1782,7 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = {
1775
1782
  [sym_case_pattern_separator_error] = ACTIONS(1),
1776
1783
  [sym_parenthesis_gap] = ACTIONS(1),
1777
1784
  [sym_brace_gap] = ACTIONS(1),
1785
+ [sym_special_builtin_function_name] = ACTIONS(1),
1778
1786
  [sym_function_body_gap] = ACTIONS(1),
1779
1787
  [sym_invalid_function_body] = ACTIONS(1),
1780
1788
  [sym_function_parameter_error] = ACTIONS(1),
@@ -1865,6 +1873,7 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = {
1865
1873
  [sym_case_pattern_separator_error] = ACTIONS(7),
1866
1874
  [sym_parenthesis_gap] = ACTIONS(7),
1867
1875
  [sym_brace_gap] = ACTIONS(7),
1876
+ [sym_special_builtin_function_name] = ACTIONS(7),
1868
1877
  [sym_function_body_gap] = ACTIONS(7),
1869
1878
  [sym_invalid_function_body] = ACTIONS(7),
1870
1879
  [sym_function_parameter_error] = ACTIONS(7),
@@ -1947,6 +1956,7 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = {
1947
1956
  [sym_case_pattern_separator_error] = ACTIONS(9),
1948
1957
  [sym_parenthesis_gap] = ACTIONS(9),
1949
1958
  [sym_brace_gap] = ACTIONS(9),
1959
+ [sym_special_builtin_function_name] = ACTIONS(9),
1950
1960
  [sym_function_body_gap] = ACTIONS(9),
1951
1961
  [sym_invalid_function_body] = ACTIONS(9),
1952
1962
  [sym_function_parameter_error] = ACTIONS(9),
@@ -2029,6 +2039,7 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = {
2029
2039
  [sym_case_pattern_separator_error] = ACTIONS(11),
2030
2040
  [sym_parenthesis_gap] = ACTIONS(11),
2031
2041
  [sym_brace_gap] = ACTIONS(11),
2042
+ [sym_special_builtin_function_name] = ACTIONS(11),
2032
2043
  [sym_function_body_gap] = ACTIONS(11),
2033
2044
  [sym_invalid_function_body] = ACTIONS(11),
2034
2045
  [sym_function_parameter_error] = ACTIONS(11),
@@ -14884,37 +14895,38 @@ enum ts_external_scanner_symbol_identifiers {
14884
14895
  ts_external_token_case_pattern_separator_error = 82,
14885
14896
  ts_external_token_parenthesis_gap = 83,
14886
14897
  ts_external_token_brace_gap = 84,
14887
- ts_external_token_function_body_gap = 85,
14888
- ts_external_token_invalid_function_body = 86,
14889
- ts_external_token_function_parameter_error = 87,
14890
- ts_external_token_single_quote_gap = 88,
14891
- ts_external_token_double_quote_gap = 89,
14892
- ts_external_token_dollar_quote_gap = 90,
14893
- ts_external_token_incomplete_escape = 91,
14894
- ts_external_token_unspecified_dollar_quote_escape = 92,
14895
- ts_external_token_unspecified_empty_hex_escape = 93,
14896
- ts_external_token_unspecified_control_escape = 94,
14897
- ts_external_token_unspecified_hex_escape = 95,
14898
- ts_external_token_unspecified_octal_escape = 96,
14899
- ts_external_token_parameter_name_gap = 97,
14900
- ts_external_token_invalid_parameter_name = 98,
14901
- ts_external_token_parameter_operator_gap = 99,
14902
- ts_external_token_parameter_operator_error = 100,
14903
- ts_external_token_parameter_length_suffix_error = 101,
14904
- ts_external_token_parameter_word_gap = 102,
14905
- ts_external_token_parameter_ending_gap = 103,
14906
- ts_external_token_unspecified_parameter_quote = 104,
14907
- ts_external_token_unspecified_expansion_start = 105,
14908
- ts_external_token_arithmetic_ending_gap = 106,
14909
- ts_external_token_substitution_ending_gap = 107,
14910
- ts_external_token_backquote_gap = 108,
14911
- ts_external_token_undefined_backquote_quote = 109,
14912
- ts_external_token_undefined_backquote_comment = 110,
14913
- ts_external_token_undefined_backquote_here_document = 111,
14914
- ts_external_token_undefined_backquote_substitution = 112,
14915
- ts_external_token_recovery_fragment = 113,
14916
- ts_external_token_recovery_resume = 114,
14917
- ts_external_token_recovery_eof = 115,
14898
+ ts_external_token_special_builtin_function_name = 85,
14899
+ ts_external_token_function_body_gap = 86,
14900
+ ts_external_token_invalid_function_body = 87,
14901
+ ts_external_token_function_parameter_error = 88,
14902
+ ts_external_token_single_quote_gap = 89,
14903
+ ts_external_token_double_quote_gap = 90,
14904
+ ts_external_token_dollar_quote_gap = 91,
14905
+ ts_external_token_incomplete_escape = 92,
14906
+ ts_external_token_unspecified_dollar_quote_escape = 93,
14907
+ ts_external_token_unspecified_empty_hex_escape = 94,
14908
+ ts_external_token_unspecified_control_escape = 95,
14909
+ ts_external_token_unspecified_hex_escape = 96,
14910
+ ts_external_token_unspecified_octal_escape = 97,
14911
+ ts_external_token_parameter_name_gap = 98,
14912
+ ts_external_token_invalid_parameter_name = 99,
14913
+ ts_external_token_parameter_operator_gap = 100,
14914
+ ts_external_token_parameter_operator_error = 101,
14915
+ ts_external_token_parameter_length_suffix_error = 102,
14916
+ ts_external_token_parameter_word_gap = 103,
14917
+ ts_external_token_parameter_ending_gap = 104,
14918
+ ts_external_token_unspecified_parameter_quote = 105,
14919
+ ts_external_token_unspecified_expansion_start = 106,
14920
+ ts_external_token_arithmetic_ending_gap = 107,
14921
+ ts_external_token_substitution_ending_gap = 108,
14922
+ ts_external_token_backquote_gap = 109,
14923
+ ts_external_token_undefined_backquote_quote = 110,
14924
+ ts_external_token_undefined_backquote_comment = 111,
14925
+ ts_external_token_undefined_backquote_here_document = 112,
14926
+ ts_external_token_undefined_backquote_substitution = 113,
14927
+ ts_external_token_recovery_fragment = 114,
14928
+ ts_external_token_recovery_resume = 115,
14929
+ ts_external_token_recovery_eof = 116,
14918
14930
  };
14919
14931
 
14920
14932
  static const TSSymbol ts_external_scanner_symbol_map[EXTERNAL_TOKEN_COUNT] = {
@@ -15003,6 +15015,7 @@ static const TSSymbol ts_external_scanner_symbol_map[EXTERNAL_TOKEN_COUNT] = {
15003
15015
  [ts_external_token_case_pattern_separator_error] = sym_case_pattern_separator_error,
15004
15016
  [ts_external_token_parenthesis_gap] = sym_parenthesis_gap,
15005
15017
  [ts_external_token_brace_gap] = sym_brace_gap,
15018
+ [ts_external_token_special_builtin_function_name] = sym_special_builtin_function_name,
15006
15019
  [ts_external_token_function_body_gap] = sym_function_body_gap,
15007
15020
  [ts_external_token_invalid_function_body] = sym_invalid_function_body,
15008
15021
  [ts_external_token_function_parameter_error] = sym_function_parameter_error,
@@ -15123,6 +15136,7 @@ static const bool ts_external_scanner_states[8][EXTERNAL_TOKEN_COUNT] = {
15123
15136
  [ts_external_token_case_pattern_separator_error] = true,
15124
15137
  [ts_external_token_parenthesis_gap] = true,
15125
15138
  [ts_external_token_brace_gap] = true,
15139
+ [ts_external_token_special_builtin_function_name] = true,
15126
15140
  [ts_external_token_function_body_gap] = true,
15127
15141
  [ts_external_token_invalid_function_body] = true,
15128
15142
  [ts_external_token_function_parameter_error] = true,
@@ -15210,6 +15224,7 @@ static const bool ts_external_scanner_states[8][EXTERNAL_TOKEN_COUNT] = {
15210
15224
  [ts_external_token_case_pattern_separator_error] = true,
15211
15225
  [ts_external_token_parenthesis_gap] = true,
15212
15226
  [ts_external_token_brace_gap] = true,
15227
+ [ts_external_token_special_builtin_function_name] = true,
15213
15228
  [ts_external_token_function_body_gap] = true,
15214
15229
  [ts_external_token_invalid_function_body] = true,
15215
15230
  [ts_external_token_function_parameter_error] = true,
@@ -15375,7 +15390,7 @@ TS_PUBLIC const TSLanguage *tree_sitter_diagnostic_sh(void) {
15375
15390
  .max_reserved_word_set_size = 0,
15376
15391
  .metadata = {
15377
15392
  .major_version = 0,
15378
- .minor_version = 2,
15393
+ .minor_version = 4,
15379
15394
  .patch_version = 0,
15380
15395
  },
15381
15396
  };