tree_sitter_language_pack 1.9.0.pre.rc.38 → 1.9.0.pre.rc.39

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11ff1558cce902704efbed4391e33e20a09a8e0a7941e0a8ddb2e80221edafe6
4
- data.tar.gz: eb38284932ba04b60872f89ad3ed09e5eb5a835e8f3b7f5eef5b959ccc727da3
3
+ metadata.gz: 721c6c17cfb69a2f82454711ebde611ebe5c78831639f1dcd5b13620fdaf05be
4
+ data.tar.gz: 88a7b6611d48c00ad7df7c892c9d4d74862b29b2a05dbd014a0de9763e24e130
5
5
  SHA512:
6
- metadata.gz: cbab5698da74c4b6e66fa88c4d7a788e5343649ab19f40c000ba4cf5c998645914499567fe0e1812f92601c627500400a3ea6e9abaa18d682e7818d3ddeeee00
7
- data.tar.gz: a300a87951fc8fb89828f5321b975d259eb7363916a2c81fc1740e3e9c42b41953eac896f363692cfddd38afa61c1fdd2ec513805c51b5567041a038cdc1984f
6
+ metadata.gz: ab6d81352d22a0ea17e5cf0eadd906af9ed3d63f373f56125a57b768eacadfea018233069edb30ee61fd5e9dd38ac65d5db1b04399a381450226ca78d228cc37
7
+ data.tar.gz: f31ef2f67986bef22b207fc6f6ac62542433f9d6f3cdff06ee1493eb33055b20e8bf4cea0f64269affd6dc48ba09ce8d969997e5f588e09c3c06e6c4a24480e6
@@ -1070,9 +1070,9 @@ checksum = "009994f150cc0cd50ff54917d5bc8bffe8cad10ca10d81c34da2ec421ae61782"
1070
1070
 
1071
1071
  [[package]]
1072
1072
  name = "tree-sitter-language-pack"
1073
- version = "1.9.0-rc.38"
1073
+ version = "1.9.0-rc.39"
1074
1074
  source = "registry+https://github.com/rust-lang/crates.io-index"
1075
- checksum = "6dbb3d7e4f965ef6d07a41e663e190cb33c9d37eea2446834d19fb8b15f1e4fe"
1075
+ checksum = "8aa8e9c9e7756e0756aa0f2790db5dac1e89b454a0c39053af3cb78ef1285573"
1076
1076
  dependencies = [
1077
1077
  "ahash",
1078
1078
  "cc",
@@ -1093,7 +1093,7 @@ dependencies = [
1093
1093
 
1094
1094
  [[package]]
1095
1095
  name = "ts-pack-core-rb"
1096
- version = "1.9.0-rc.38"
1096
+ version = "1.9.0-rc.39"
1097
1097
  dependencies = [
1098
1098
  "magnus",
1099
1099
  "rb-sys",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "ts-pack-core-rb"
3
- version = "1.9.0-rc.38"
3
+ version = "1.9.0-rc.39"
4
4
  edition = "2024"
5
5
  license = "MIT"
6
6
  description = "Pre-compiled tree-sitter grammars for 306 programming languages"
@@ -21,4 +21,4 @@ magnus = "0.8"
21
21
  rb-sys = ">=0.9, <0.9.128"
22
22
  serde = { version = "1", features = ["derive"] }
23
23
  serde_json = "1"
24
- tree-sitter-language-pack = { version = "1.9.0-rc.38", features = ["serde", "config", "download"] }
24
+ tree-sitter-language-pack = { version = "1.9.0-rc.39", features = ["serde", "config", "download"] }
@@ -1,5 +1,5 @@
1
1
  // This file is auto-generated by alef. DO NOT EDIT.
2
- // alef:hash:5c3eac2ef7892df9942263b2ef22bbce08c4729cfb235dcd7f37f968755d1b10
2
+ // alef:hash:966b101e2b4cacb4cb93c43f34e30e8bab6e2478b171704ec0a66561b9335a89
3
3
  // Re-generate with: alef generate
4
4
  #![allow(dead_code, unused_imports, unused_variables)]
5
5
  #![allow(
@@ -57,6 +57,194 @@ fn json_to_ruby(handle: &Ruby, val: serde_json::Value) -> magnus::Value {
57
57
  }
58
58
  }
59
59
 
60
+ #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
61
+ #[serde(default)]
62
+ #[magnus::wrap(class = "TreeSitterLanguagePack::DataAttribute")]
63
+ pub struct DataAttribute {
64
+ name: String,
65
+ value: String,
66
+ span: Span,
67
+ }
68
+
69
+ unsafe impl IntoValueFromNative for DataAttribute {}
70
+
71
+ impl magnus::TryConvert for DataAttribute {
72
+ fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
73
+ if let Ok(r) = <&DataAttribute as magnus::TryConvert>::try_convert(val) {
74
+ return Ok(r.clone());
75
+ }
76
+ let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
77
+ s
78
+ } else {
79
+ val.funcall::<_, _, String>("to_json", ()).map_err(|e| {
80
+ magnus::Error::new(
81
+ unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
82
+ format!("no implicit conversion into DataAttribute: {}", e),
83
+ )
84
+ })?
85
+ };
86
+ serde_json::from_str::<DataAttribute>(&json_str).map_err(|e| {
87
+ magnus::Error::new(
88
+ unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
89
+ format!("failed to deserialize DataAttribute: {}", e),
90
+ )
91
+ })
92
+ }
93
+ }
94
+
95
+ unsafe impl TryConvertOwned for DataAttribute {}
96
+
97
+ impl Default for DataAttribute {
98
+ fn default() -> Self {
99
+ tree_sitter_language_pack::DataAttribute::default().into()
100
+ }
101
+ }
102
+
103
+ impl DataAttribute {
104
+ fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
105
+ let ruby = unsafe { magnus::Ruby::get_unchecked() };
106
+ let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
107
+ let (kwargs_opt,) = args.optional;
108
+ let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
109
+ Ok(Self {
110
+ name: kwargs
111
+ .get(ruby.to_symbol("name"))
112
+ .and_then(|v| String::try_convert(v).ok())
113
+ .unwrap_or_default(),
114
+ value: kwargs
115
+ .get(ruby.to_symbol("value"))
116
+ .and_then(|v| String::try_convert(v).ok())
117
+ .unwrap_or_default(),
118
+ span: kwargs
119
+ .get(ruby.to_symbol("span"))
120
+ .and_then(|v| Span::try_convert(v).ok())
121
+ .unwrap_or_default(),
122
+ })
123
+ }
124
+
125
+ fn name(&self) -> String {
126
+ self.name.clone()
127
+ }
128
+
129
+ fn value(&self) -> String {
130
+ self.value.clone()
131
+ }
132
+
133
+ fn span(&self) -> Span {
134
+ self.span.clone()
135
+ }
136
+ }
137
+
138
+ #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
139
+ #[serde(default)]
140
+ #[magnus::wrap(class = "TreeSitterLanguagePack::DataNode")]
141
+ pub struct DataNode {
142
+ kind: DataNodeKind,
143
+ key: Option<String>,
144
+ value: Option<String>,
145
+ attributes: Vec<DataAttribute>,
146
+ children: Vec<DataNode>,
147
+ span: Span,
148
+ }
149
+
150
+ unsafe impl IntoValueFromNative for DataNode {}
151
+
152
+ impl magnus::TryConvert for DataNode {
153
+ fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
154
+ if let Ok(r) = <&DataNode as magnus::TryConvert>::try_convert(val) {
155
+ return Ok(r.clone());
156
+ }
157
+ let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
158
+ s
159
+ } else {
160
+ val.funcall::<_, _, String>("to_json", ()).map_err(|e| {
161
+ magnus::Error::new(
162
+ unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
163
+ format!("no implicit conversion into DataNode: {}", e),
164
+ )
165
+ })?
166
+ };
167
+ serde_json::from_str::<DataNode>(&json_str).map_err(|e| {
168
+ magnus::Error::new(
169
+ unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
170
+ format!("failed to deserialize DataNode: {}", e),
171
+ )
172
+ })
173
+ }
174
+ }
175
+
176
+ unsafe impl TryConvertOwned for DataNode {}
177
+
178
+ impl Default for DataNode {
179
+ fn default() -> Self {
180
+ Self {
181
+ kind: Default::default(),
182
+ key: None,
183
+ value: None,
184
+ attributes: vec![],
185
+ children: vec![],
186
+ span: Default::default(),
187
+ }
188
+ }
189
+ }
190
+
191
+ impl DataNode {
192
+ fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
193
+ let ruby = unsafe { magnus::Ruby::get_unchecked() };
194
+ let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
195
+ let (kwargs_opt,) = args.optional;
196
+ let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
197
+ Ok(Self {
198
+ kind: kwargs
199
+ .get(ruby.to_symbol("kind"))
200
+ .and_then(|v| DataNodeKind::try_convert(v).ok())
201
+ .unwrap_or_default(),
202
+ key: kwargs
203
+ .get(ruby.to_symbol("key"))
204
+ .and_then(|v| String::try_convert(v).ok()),
205
+ value: kwargs
206
+ .get(ruby.to_symbol("value"))
207
+ .and_then(|v| String::try_convert(v).ok()),
208
+ attributes: kwargs
209
+ .get(ruby.to_symbol("attributes"))
210
+ .and_then(|v| <Vec<DataAttribute>>::try_convert(v).ok())
211
+ .unwrap_or_default(),
212
+ children: kwargs
213
+ .get(ruby.to_symbol("children"))
214
+ .and_then(|v| <Vec<DataNode>>::try_convert(v).ok())
215
+ .unwrap_or_default(),
216
+ span: kwargs
217
+ .get(ruby.to_symbol("span"))
218
+ .and_then(|v| Span::try_convert(v).ok())
219
+ .unwrap_or_default(),
220
+ })
221
+ }
222
+
223
+ fn kind(&self) -> DataNodeKind {
224
+ self.kind.clone()
225
+ }
226
+
227
+ fn key(&self) -> Option<String> {
228
+ self.key.clone()
229
+ }
230
+
231
+ fn value(&self) -> Option<String> {
232
+ self.value.clone()
233
+ }
234
+
235
+ fn attributes(&self) -> Vec<DataAttribute> {
236
+ self.attributes.clone()
237
+ }
238
+
239
+ fn children(&self) -> Vec<DataNode> {
240
+ self.children.clone()
241
+ }
242
+
243
+ fn span(&self) -> Span {
244
+ self.span.clone()
245
+ }
246
+ }
247
+
60
248
  #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
61
249
  #[serde(default)]
62
250
  #[magnus::wrap(class = "TreeSitterLanguagePack::Span")]
@@ -176,6 +364,7 @@ pub struct ProcessResult {
176
364
  symbols: Vec<SymbolInfo>,
177
365
  diagnostics: Vec<Diagnostic>,
178
366
  chunks: Vec<CodeChunk>,
367
+ data: Option<DataNode>,
179
368
  }
180
369
 
181
370
  unsafe impl IntoValueFromNative for ProcessResult {}
@@ -259,6 +448,9 @@ impl ProcessResult {
259
448
  .get(ruby.to_symbol("chunks"))
260
449
  .and_then(|v| <Vec<CodeChunk>>::try_convert(v).ok())
261
450
  .unwrap_or_default(),
451
+ data: kwargs
452
+ .get(ruby.to_symbol("data"))
453
+ .and_then(|v| DataNode::try_convert(v).ok()),
262
454
  })
263
455
  }
264
456
 
@@ -301,6 +493,10 @@ impl ProcessResult {
301
493
  fn chunks(&self) -> Vec<CodeChunk> {
302
494
  self.chunks.clone()
303
495
  }
496
+
497
+ fn data(&self) -> Option<DataNode> {
498
+ self.data.clone()
499
+ }
304
500
  }
305
501
 
306
502
  #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
@@ -1875,6 +2071,7 @@ pub struct ProcessConfig {
1875
2071
  symbols: bool,
1876
2072
  diagnostics: bool,
1877
2073
  chunk_max_size: Option<usize>,
2074
+ data_extraction: bool,
1878
2075
  }
1879
2076
 
1880
2077
  unsafe impl IntoValueFromNative for ProcessConfig {}
@@ -1953,6 +2150,10 @@ impl ProcessConfig {
1953
2150
  chunk_max_size: kwargs
1954
2151
  .get(ruby.to_symbol("chunk_max_size"))
1955
2152
  .and_then(|v| usize::try_convert(v).ok()),
2153
+ data_extraction: kwargs
2154
+ .get(ruby.to_symbol("data_extraction"))
2155
+ .and_then(|v| bool::try_convert(v).ok())
2156
+ .unwrap_or(false),
1956
2157
  })
1957
2158
  }
1958
2159
 
@@ -1992,6 +2193,10 @@ impl ProcessConfig {
1992
2193
  self.chunk_max_size
1993
2194
  }
1994
2195
 
2196
+ fn data_extraction(&self) -> bool {
2197
+ self.data_extraction
2198
+ }
2199
+
1995
2200
  fn with_chunking(&self, max_size: usize) -> ProcessConfig {
1996
2201
  let core_self = tree_sitter_language_pack::ProcessConfig {
1997
2202
  language: self.language.clone().into(),
@@ -2011,6 +2216,8 @@ impl ProcessConfig {
2011
2216
  diagnostics: self.diagnostics,
2012
2217
 
2013
2218
  chunk_max_size: self.chunk_max_size,
2219
+
2220
+ data_extraction: self.data_extraction,
2014
2221
  };
2015
2222
  core_self.with_chunking(max_size).into()
2016
2223
  }
@@ -2034,6 +2241,8 @@ impl ProcessConfig {
2034
2241
  diagnostics: self.diagnostics,
2035
2242
 
2036
2243
  chunk_max_size: self.chunk_max_size,
2244
+
2245
+ data_extraction: self.data_extraction,
2037
2246
  };
2038
2247
  core_self.all().into()
2039
2248
  }
@@ -2057,9 +2266,36 @@ impl ProcessConfig {
2057
2266
  diagnostics: self.diagnostics,
2058
2267
 
2059
2268
  chunk_max_size: self.chunk_max_size,
2269
+
2270
+ data_extraction: self.data_extraction,
2060
2271
  };
2061
2272
  core_self.minimal().into()
2062
2273
  }
2274
+
2275
+ fn with_data_extraction(&self, enabled: bool) -> ProcessConfig {
2276
+ let core_self = tree_sitter_language_pack::ProcessConfig {
2277
+ language: self.language.clone().into(),
2278
+
2279
+ structure: self.structure,
2280
+
2281
+ imports: self.imports,
2282
+
2283
+ exports: self.exports,
2284
+
2285
+ comments: self.comments,
2286
+
2287
+ docstrings: self.docstrings,
2288
+
2289
+ symbols: self.symbols,
2290
+
2291
+ diagnostics: self.diagnostics,
2292
+
2293
+ chunk_max_size: self.chunk_max_size,
2294
+
2295
+ data_extraction: self.data_extraction,
2296
+ };
2297
+ core_self.with_data_extraction(enabled).into()
2298
+ }
2063
2299
  }
2064
2300
 
2065
2301
  #[derive(Clone)]
@@ -2182,6 +2418,50 @@ unsafe impl TryConvertOwned for Language {}
2182
2418
 
2183
2419
  impl Language {}
2184
2420
 
2421
+ #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
2422
+ pub enum DataNodeKind {
2423
+ KeyValue,
2424
+ Element,
2425
+ Sequence,
2426
+ }
2427
+
2428
+ impl Default for DataNodeKind {
2429
+ fn default() -> Self {
2430
+ Self::KeyValue
2431
+ }
2432
+ }
2433
+
2434
+ impl magnus::IntoValue for DataNodeKind {
2435
+ fn into_value_with(self, handle: &Ruby) -> magnus::Value {
2436
+ let sym = match self {
2437
+ DataNodeKind::KeyValue => "key_value",
2438
+ DataNodeKind::Element => "element",
2439
+ DataNodeKind::Sequence => "sequence",
2440
+ };
2441
+ handle.to_symbol(sym).into_value_with(handle)
2442
+ }
2443
+ }
2444
+
2445
+ impl magnus::TryConvert for DataNodeKind {
2446
+ fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
2447
+ let s: String = magnus::TryConvert::try_convert(val)?;
2448
+ // Accept the serde wire name (snake_case), the PascalCase Rust variant name,
2449
+ // and a lowercase fallback so fixtures written in any of those styles work.
2450
+ match s.as_str() {
2451
+ "key_value" | "KeyValue" => Ok(DataNodeKind::KeyValue),
2452
+ "element" | "Element" => Ok(DataNodeKind::Element),
2453
+ "sequence" | "Sequence" => Ok(DataNodeKind::Sequence),
2454
+ other => Err(magnus::Error::new(
2455
+ unsafe { Ruby::get_unchecked() }.exception_arg_error(),
2456
+ format!("invalid DataNodeKind value: {other}"),
2457
+ )),
2458
+ }
2459
+ }
2460
+ }
2461
+
2462
+ unsafe impl IntoValueFromNative for DataNodeKind {}
2463
+ unsafe impl TryConvertOwned for DataNodeKind {}
2464
+
2185
2465
  #[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
2186
2466
  pub enum StructureKind {
2187
2467
  Function,
@@ -2706,6 +2986,56 @@ fn cache_dir() -> Result<String, Error> {
2706
2986
  Ok(result)
2707
2987
  }
2708
2988
 
2989
+ #[allow(clippy::redundant_closure, clippy::useless_conversion)]
2990
+ impl From<DataAttribute> for tree_sitter_language_pack::DataAttribute {
2991
+ fn from(val: DataAttribute) -> Self {
2992
+ Self {
2993
+ name: val.name,
2994
+ value: val.value,
2995
+ span: val.span.into(),
2996
+ }
2997
+ }
2998
+ }
2999
+
3000
+ #[allow(clippy::redundant_closure, clippy::useless_conversion)]
3001
+ impl From<tree_sitter_language_pack::DataAttribute> for DataAttribute {
3002
+ fn from(val: tree_sitter_language_pack::DataAttribute) -> Self {
3003
+ Self {
3004
+ name: val.name.to_string(),
3005
+ value: val.value.to_string(),
3006
+ span: val.span.into(),
3007
+ }
3008
+ }
3009
+ }
3010
+
3011
+ #[allow(clippy::redundant_closure, clippy::useless_conversion)]
3012
+ impl From<DataNode> for tree_sitter_language_pack::DataNode {
3013
+ fn from(val: DataNode) -> Self {
3014
+ Self {
3015
+ kind: val.kind.into(),
3016
+ key: val.key,
3017
+ value: val.value,
3018
+ attributes: val.attributes.into_iter().map(Into::into).collect(),
3019
+ children: val.children.into_iter().map(Into::into).collect(),
3020
+ span: val.span.into(),
3021
+ }
3022
+ }
3023
+ }
3024
+
3025
+ #[allow(clippy::redundant_closure, clippy::useless_conversion)]
3026
+ impl From<tree_sitter_language_pack::DataNode> for DataNode {
3027
+ fn from(val: tree_sitter_language_pack::DataNode) -> Self {
3028
+ Self {
3029
+ kind: val.kind.into(),
3030
+ key: val.key.map(|v| v.to_string()),
3031
+ value: val.value.map(|v| v.to_string()),
3032
+ attributes: val.attributes.into_iter().map(Into::into).collect(),
3033
+ children: val.children.into_iter().map(Into::into).collect(),
3034
+ span: val.span.into(),
3035
+ }
3036
+ }
3037
+ }
3038
+
2709
3039
  #[allow(clippy::redundant_closure, clippy::useless_conversion)]
2710
3040
  impl From<Span> for tree_sitter_language_pack::Span {
2711
3041
  fn from(val: Span) -> Self {
@@ -2748,6 +3078,7 @@ impl From<ProcessResult> for tree_sitter_language_pack::ProcessResult {
2748
3078
  symbols: val.symbols.into_iter().map(Into::into).collect(),
2749
3079
  diagnostics: val.diagnostics.into_iter().map(Into::into).collect(),
2750
3080
  chunks: val.chunks.into_iter().map(Into::into).collect(),
3081
+ data: val.data.map(Into::into),
2751
3082
  }
2752
3083
  }
2753
3084
  }
@@ -2766,6 +3097,7 @@ impl From<tree_sitter_language_pack::ProcessResult> for ProcessResult {
2766
3097
  symbols: val.symbols.into_iter().map(Into::into).collect(),
2767
3098
  diagnostics: val.diagnostics.into_iter().map(Into::into).collect(),
2768
3099
  chunks: val.chunks.into_iter().map(Into::into).collect(),
3100
+ data: val.data.map(Into::into),
2769
3101
  }
2770
3102
  }
2771
3103
  }
@@ -3141,6 +3473,7 @@ impl From<ProcessConfig> for tree_sitter_language_pack::ProcessConfig {
3141
3473
  symbols: val.symbols,
3142
3474
  diagnostics: val.diagnostics,
3143
3475
  chunk_max_size: val.chunk_max_size,
3476
+ data_extraction: val.data_extraction,
3144
3477
  }
3145
3478
  }
3146
3479
  }
@@ -3158,6 +3491,27 @@ impl From<tree_sitter_language_pack::ProcessConfig> for ProcessConfig {
3158
3491
  symbols: val.symbols,
3159
3492
  diagnostics: val.diagnostics,
3160
3493
  chunk_max_size: val.chunk_max_size,
3494
+ data_extraction: val.data_extraction,
3495
+ }
3496
+ }
3497
+ }
3498
+
3499
+ impl From<DataNodeKind> for tree_sitter_language_pack::DataNodeKind {
3500
+ fn from(val: DataNodeKind) -> Self {
3501
+ match val {
3502
+ DataNodeKind::KeyValue => Self::KeyValue,
3503
+ DataNodeKind::Element => Self::Element,
3504
+ DataNodeKind::Sequence => Self::Sequence,
3505
+ }
3506
+ }
3507
+ }
3508
+
3509
+ impl From<tree_sitter_language_pack::DataNodeKind> for DataNodeKind {
3510
+ fn from(val: tree_sitter_language_pack::DataNodeKind) -> Self {
3511
+ match val {
3512
+ tree_sitter_language_pack::DataNodeKind::KeyValue => Self::KeyValue,
3513
+ tree_sitter_language_pack::DataNodeKind::Element => Self::Element,
3514
+ tree_sitter_language_pack::DataNodeKind::Sequence => Self::Sequence,
3161
3515
  }
3162
3516
  }
3163
3517
  }
@@ -3330,6 +3684,32 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
3330
3684
  // Ensure JSON library is loaded for Hash#to_json
3331
3685
  let _ = ruby.eval::<magnus::Value>("require \"json\"");
3332
3686
 
3687
+ let class = module.define_class("DataAttribute", ruby.class_object())?;
3688
+
3689
+ class.define_singleton_method("new", function!(DataAttribute::new, -1))?;
3690
+
3691
+ class.define_method("name", method!(DataAttribute::name, 0))?;
3692
+
3693
+ class.define_method("value", method!(DataAttribute::value, 0))?;
3694
+
3695
+ class.define_method("span", method!(DataAttribute::span, 0))?;
3696
+
3697
+ let class = module.define_class("DataNode", ruby.class_object())?;
3698
+
3699
+ class.define_singleton_method("new", function!(DataNode::new, -1))?;
3700
+
3701
+ class.define_method("kind", method!(DataNode::kind, 0))?;
3702
+
3703
+ class.define_method("key", method!(DataNode::key, 0))?;
3704
+
3705
+ class.define_method("value", method!(DataNode::value, 0))?;
3706
+
3707
+ class.define_method("attributes", method!(DataNode::attributes, 0))?;
3708
+
3709
+ class.define_method("children", method!(DataNode::children, 0))?;
3710
+
3711
+ class.define_method("span", method!(DataNode::span, 0))?;
3712
+
3333
3713
  let class = module.define_class("Span", ruby.class_object())?;
3334
3714
 
3335
3715
  class.define_singleton_method("new", function!(Span::new, -1))?;
@@ -3370,6 +3750,8 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
3370
3750
 
3371
3751
  class.define_method("chunks", method!(ProcessResult::chunks, 0))?;
3372
3752
 
3753
+ class.define_method("data", method!(ProcessResult::data, 0))?;
3754
+
3373
3755
  let class = module.define_class("FileMetrics", ruby.class_object())?;
3374
3756
 
3375
3757
  class.define_singleton_method("new", function!(FileMetrics::new, -1))?;
@@ -3642,12 +4024,16 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
3642
4024
 
3643
4025
  class.define_method("chunk_max_size", method!(ProcessConfig::chunk_max_size, 0))?;
3644
4026
 
4027
+ class.define_method("data_extraction", method!(ProcessConfig::data_extraction, 0))?;
4028
+
3645
4029
  class.define_method("with_chunking", method!(ProcessConfig::with_chunking, 1))?;
3646
4030
 
3647
4031
  class.define_method("all", method!(ProcessConfig::all, 0))?;
3648
4032
 
3649
4033
  class.define_method("minimal", method!(ProcessConfig::minimal, 0))?;
3650
4034
 
4035
+ class.define_method("with_data_extraction", method!(ProcessConfig::with_data_extraction, 1))?;
4036
+
3651
4037
  let class = module.define_class("LanguageRegistry", ruby.class_object())?;
3652
4038
 
3653
4039
  class.define_method("get_language", method!(LanguageRegistry::get_language, 1))?;
@@ -1,5 +1,5 @@
1
1
  # This file is auto-generated by alef — DO NOT EDIT.
2
- # alef:hash:5c3eac2ef7892df9942263b2ef22bbce08c4729cfb235dcd7f37f968755d1b10
2
+ # alef:hash:966b101e2b4cacb4cb93c43f34e30e8bab6e2478b171704ec0a66561b9335a89
3
3
  # To regenerate: alef generate
4
4
  # To verify freshness: alef verify --exit-code
5
5
  # frozen_string_literal: true
@@ -1,10 +1,10 @@
1
1
  # This file is auto-generated by alef — DO NOT EDIT.
2
- # alef:hash:af8fbb2b58d7d13bf4f1cf1965e5b0296b4767fb76d55cad9ec48420f80f2ff8
2
+ # alef:hash:966b101e2b4cacb4cb93c43f34e30e8bab6e2478b171704ec0a66561b9335a89
3
3
  # To regenerate: alef generate
4
4
  # To verify freshness: alef verify --exit-code
5
5
  # frozen_string_literal: true
6
6
 
7
7
  module TreeSitterLanguagePack
8
8
  ## The version string for this package.
9
- VERSION = "1.9.0.pre.rc.38"
9
+ VERSION = "1.9.0.pre.rc.39"
10
10
  end
@@ -1,5 +1,5 @@
1
1
  # This file is auto-generated by alef — DO NOT EDIT.
2
- # alef:hash:5c3eac2ef7892df9942263b2ef22bbce08c4729cfb235dcd7f37f968755d1b10
2
+ # alef:hash:966b101e2b4cacb4cb93c43f34e30e8bab6e2478b171704ec0a66561b9335a89
3
3
  # To regenerate: alef generate
4
4
  # To verify freshness: alef verify --exit-code
5
5
  # frozen_string_literal: true
data/sig/types.rbs CHANGED
@@ -1,5 +1,5 @@
1
1
  # This file is auto-generated by alef — DO NOT EDIT.
2
- # alef:hash:5c3eac2ef7892df9942263b2ef22bbce08c4729cfb235dcd7f37f968755d1b10
2
+ # alef:hash:966b101e2b4cacb4cb93c43f34e30e8bab6e2478b171704ec0a66561b9335a89
3
3
  # To regenerate: alef generate
4
4
  # To verify freshness: alef verify --exit-code
5
5
 
@@ -9,6 +9,25 @@ module TreeSitterLanguagePack
9
9
 
10
10
  type json_value = Hash[String, untyped] | Array[untyped] | String | Integer | Float | bool | nil
11
11
 
12
+ class DataAttribute
13
+ attr_accessor name: String?
14
+ attr_accessor value: String?
15
+ attr_accessor span: Span?
16
+
17
+ def initialize: (?name: String, ?value: String, ?span: Span) -> void
18
+ end
19
+
20
+ class DataNode
21
+ attr_accessor kind: DataNodeKind?
22
+ attr_accessor key: String?
23
+ attr_accessor value: String?
24
+ attr_accessor attributes: Array[DataAttribute]?
25
+ attr_accessor children: Array[DataNode]?
26
+ attr_accessor span: Span?
27
+
28
+ def initialize: (?kind: DataNodeKind, ?key: String, ?value: String, ?attributes: Array[DataAttribute], ?children: Array[DataNode], ?span: Span) -> void
29
+ end
30
+
12
31
  class Span
13
32
  attr_accessor start_byte: Integer?
14
33
  attr_accessor end_byte: Integer?
@@ -31,8 +50,9 @@ module TreeSitterLanguagePack
31
50
  attr_accessor symbols: Array[SymbolInfo]?
32
51
  attr_accessor diagnostics: Array[Diagnostic]?
33
52
  attr_accessor chunks: Array[CodeChunk]?
53
+ attr_accessor data: DataNode?
34
54
 
35
- def initialize: (?language: String, ?metrics: FileMetrics, ?structure: Array[StructureItem], ?imports: Array[ImportInfo], ?exports: Array[ExportInfo], ?comments: Array[CommentInfo], ?docstrings: Array[DocstringInfo], ?symbols: Array[SymbolInfo], ?diagnostics: Array[Diagnostic], ?chunks: Array[CodeChunk]) -> void
55
+ def initialize: (?language: String, ?metrics: FileMetrics, ?structure: Array[StructureItem], ?imports: Array[ImportInfo], ?exports: Array[ExportInfo], ?comments: Array[CommentInfo], ?docstrings: Array[DocstringInfo], ?symbols: Array[SymbolInfo], ?diagnostics: Array[Diagnostic], ?chunks: Array[CodeChunk], ?data: DataNode) -> void
36
56
  end
37
57
 
38
58
  class FileMetrics
@@ -228,11 +248,13 @@ module TreeSitterLanguagePack
228
248
  attr_accessor symbols: bool?
229
249
  attr_accessor diagnostics: bool?
230
250
  attr_accessor chunk_max_size: Integer?
251
+ attr_accessor data_extraction: bool?
231
252
 
232
- def initialize: (?language: String, ?structure: bool, ?imports: bool, ?exports: bool, ?comments: bool, ?docstrings: bool, ?symbols: bool, ?diagnostics: bool, ?chunk_max_size: Integer) -> void
253
+ def initialize: (?language: String, ?structure: bool, ?imports: bool, ?exports: bool, ?comments: bool, ?docstrings: bool, ?symbols: bool, ?diagnostics: bool, ?chunk_max_size: Integer, ?data_extraction: bool) -> void
233
254
  def with_chunking: (Integer max_size) -> ProcessConfig
234
255
  def all: () -> ProcessConfig
235
256
  def minimal: () -> ProcessConfig
257
+ def with_data_extraction: (bool enabled) -> ProcessConfig
236
258
  def self.default: () -> ProcessConfig
237
259
  end
238
260
 
@@ -257,6 +279,10 @@ module TreeSitterLanguagePack
257
279
  class Language
258
280
  end
259
281
 
282
+ class DataNodeKind
283
+ type value = :key_value | :element | :sequence
284
+ end
285
+
260
286
  class StructureKind
261
287
  end
262
288
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tree_sitter_language_pack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0.pre.rc.38
4
+ version: 1.9.0.pre.rc.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kreuzberg Team