tree_sitter_language_pack 1.8.0.pre.rc.43 → 1.8.0.pre.rc.44

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: fff4426415d87ba46f03ce7fdb1a86ee51b3882ee6cf81e0bc2550c83e62f381
4
- data.tar.gz: a602f644b1621faf5fd5347868d9fbe00433b217e1e8f77d67d96ed3e9e25003
3
+ metadata.gz: 2e37f5ecf12515b1edccf542a5c676a326a3898c5072cb3561a44e0262c132e6
4
+ data.tar.gz: 005ca96e301365661813588cdaa1cb951c6baf0ceee78df43c2ba2591e61c22e
5
5
  SHA512:
6
- metadata.gz: 9d9407be51e44cec710301ff35e400e080845c067a9c11256f5dcfd55dd036ceff87108241ceac8daa3544f34cd6c044c2da64eebd29ec1a821c35c1e370e0b1
7
- data.tar.gz: 942c8fc3b360689a0064d1ec41814303549707f93088940ae8b86a6f82179979ef7e81e8f3664a7d647d51caaf14fd6b17795dd0433ecb0abe3826a7d101e6a9
6
+ metadata.gz: 6b3a14f5677f663a0fae22f152ffae08af75379ebf8950fb017a9dd0874cf7a47211d765ecfee44f7fe695c915387d8b2ae780c00a4acba8f599ee6268c43900
7
+ data.tar.gz: e8c4d745a472388dbc574a553c050f099540be9db5863a98b7ed48b72cc76ac9d43cde4e495875aed85679bd4a5fe841080a96af08fa8d37c07ab78b7a38b6cc
@@ -1,5 +1,5 @@
1
1
  // This file is auto-generated by alef. DO NOT EDIT.
2
- // alef:hash:133460f2380f225fd12d91c94096bfe370669a47766afaeffc5380fdbf0c3db7
2
+ // alef:hash:eed307d857d74c9dce2d6a626941327b2f9e3442eaa781b0e2191b8f8b470855
3
3
  // Re-generate with: alef generate
4
4
  #![allow(dead_code, unused_imports, unused_variables)]
5
5
  #![allow(
@@ -96,34 +96,42 @@ unsafe impl TryConvertOwned for Span {}
96
96
 
97
97
  impl Default for Span {
98
98
  fn default() -> Self {
99
- Self {
100
- start_byte: Default::default(),
101
- end_byte: Default::default(),
102
- start_line: Default::default(),
103
- start_column: Default::default(),
104
- end_line: Default::default(),
105
- end_column: Default::default(),
106
- }
99
+ tree_sitter_language_pack::Span::default().into()
107
100
  }
108
101
  }
109
102
 
110
103
  impl Span {
111
- fn new(
112
- start_byte: usize,
113
- end_byte: usize,
114
- start_line: usize,
115
- start_column: usize,
116
- end_line: usize,
117
- end_column: usize,
118
- ) -> Self {
119
- Self {
120
- start_byte,
121
- end_byte,
122
- start_line,
123
- start_column,
124
- end_line,
125
- end_column,
126
- }
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
+ start_byte: kwargs
111
+ .get(ruby.to_symbol("start_byte"))
112
+ .and_then(|v| usize::try_convert(v).ok())
113
+ .unwrap_or_default(),
114
+ end_byte: kwargs
115
+ .get(ruby.to_symbol("end_byte"))
116
+ .and_then(|v| usize::try_convert(v).ok())
117
+ .unwrap_or_default(),
118
+ start_line: kwargs
119
+ .get(ruby.to_symbol("start_line"))
120
+ .and_then(|v| usize::try_convert(v).ok())
121
+ .unwrap_or_default(),
122
+ start_column: kwargs
123
+ .get(ruby.to_symbol("start_column"))
124
+ .and_then(|v| usize::try_convert(v).ok())
125
+ .unwrap_or_default(),
126
+ end_line: kwargs
127
+ .get(ruby.to_symbol("end_line"))
128
+ .and_then(|v| usize::try_convert(v).ok())
129
+ .unwrap_or_default(),
130
+ end_column: kwargs
131
+ .get(ruby.to_symbol("end_column"))
132
+ .and_then(|v| usize::try_convert(v).ok())
133
+ .unwrap_or_default(),
134
+ })
127
135
  }
128
136
 
129
137
  fn start_byte(&self) -> usize {
@@ -197,46 +205,58 @@ unsafe impl TryConvertOwned for ProcessResult {}
197
205
 
198
206
  impl Default for ProcessResult {
199
207
  fn default() -> Self {
200
- Self {
201
- language: Default::default(),
202
- metrics: Default::default(),
203
- structure: Default::default(),
204
- imports: Default::default(),
205
- exports: Default::default(),
206
- comments: Default::default(),
207
- docstrings: Default::default(),
208
- symbols: Default::default(),
209
- diagnostics: Default::default(),
210
- chunks: Default::default(),
211
- }
208
+ tree_sitter_language_pack::ProcessResult::default().into()
212
209
  }
213
210
  }
214
211
 
215
212
  impl ProcessResult {
216
- fn new(
217
- language: String,
218
- metrics: FileMetrics,
219
- structure: Vec<StructureItem>,
220
- imports: Vec<ImportInfo>,
221
- exports: Vec<ExportInfo>,
222
- comments: Vec<CommentInfo>,
223
- docstrings: Vec<DocstringInfo>,
224
- symbols: Vec<SymbolInfo>,
225
- diagnostics: Vec<Diagnostic>,
226
- chunks: Vec<CodeChunk>,
227
- ) -> Self {
228
- Self {
229
- language,
230
- metrics,
231
- structure,
232
- imports,
233
- exports,
234
- comments,
235
- docstrings,
236
- symbols,
237
- diagnostics,
238
- chunks,
239
- }
213
+ fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
214
+ let ruby = unsafe { magnus::Ruby::get_unchecked() };
215
+ let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
216
+ let (kwargs_opt,) = args.optional;
217
+ let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
218
+ Ok(Self {
219
+ language: kwargs
220
+ .get(ruby.to_symbol("language"))
221
+ .and_then(|v| String::try_convert(v).ok())
222
+ .unwrap_or_default(),
223
+ metrics: kwargs
224
+ .get(ruby.to_symbol("metrics"))
225
+ .and_then(|v| FileMetrics::try_convert(v).ok())
226
+ .unwrap_or_default(),
227
+ structure: kwargs
228
+ .get(ruby.to_symbol("structure"))
229
+ .and_then(|v| <Vec<StructureItem>>::try_convert(v).ok())
230
+ .unwrap_or_default(),
231
+ imports: kwargs
232
+ .get(ruby.to_symbol("imports"))
233
+ .and_then(|v| <Vec<ImportInfo>>::try_convert(v).ok())
234
+ .unwrap_or_default(),
235
+ exports: kwargs
236
+ .get(ruby.to_symbol("exports"))
237
+ .and_then(|v| <Vec<ExportInfo>>::try_convert(v).ok())
238
+ .unwrap_or_default(),
239
+ comments: kwargs
240
+ .get(ruby.to_symbol("comments"))
241
+ .and_then(|v| <Vec<CommentInfo>>::try_convert(v).ok())
242
+ .unwrap_or_default(),
243
+ docstrings: kwargs
244
+ .get(ruby.to_symbol("docstrings"))
245
+ .and_then(|v| <Vec<DocstringInfo>>::try_convert(v).ok())
246
+ .unwrap_or_default(),
247
+ symbols: kwargs
248
+ .get(ruby.to_symbol("symbols"))
249
+ .and_then(|v| <Vec<SymbolInfo>>::try_convert(v).ok())
250
+ .unwrap_or_default(),
251
+ diagnostics: kwargs
252
+ .get(ruby.to_symbol("diagnostics"))
253
+ .and_then(|v| <Vec<Diagnostic>>::try_convert(v).ok())
254
+ .unwrap_or_default(),
255
+ chunks: kwargs
256
+ .get(ruby.to_symbol("chunks"))
257
+ .and_then(|v| <Vec<CodeChunk>>::try_convert(v).ok())
258
+ .unwrap_or_default(),
259
+ })
240
260
  }
241
261
 
242
262
  fn language(&self) -> String {
@@ -324,40 +344,50 @@ unsafe impl TryConvertOwned for FileMetrics {}
324
344
 
325
345
  impl Default for FileMetrics {
326
346
  fn default() -> Self {
327
- Self {
328
- total_lines: Default::default(),
329
- code_lines: Default::default(),
330
- comment_lines: Default::default(),
331
- blank_lines: Default::default(),
332
- total_bytes: Default::default(),
333
- node_count: Default::default(),
334
- error_count: Default::default(),
335
- max_depth: Default::default(),
336
- }
347
+ tree_sitter_language_pack::FileMetrics::default().into()
337
348
  }
338
349
  }
339
350
 
340
351
  impl FileMetrics {
341
- fn new(
342
- total_lines: usize,
343
- code_lines: usize,
344
- comment_lines: usize,
345
- blank_lines: usize,
346
- total_bytes: usize,
347
- node_count: usize,
348
- error_count: usize,
349
- max_depth: usize,
350
- ) -> Self {
351
- Self {
352
- total_lines,
353
- code_lines,
354
- comment_lines,
355
- blank_lines,
356
- total_bytes,
357
- node_count,
358
- error_count,
359
- max_depth,
360
- }
352
+ fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
353
+ let ruby = unsafe { magnus::Ruby::get_unchecked() };
354
+ let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
355
+ let (kwargs_opt,) = args.optional;
356
+ let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
357
+ Ok(Self {
358
+ total_lines: kwargs
359
+ .get(ruby.to_symbol("total_lines"))
360
+ .and_then(|v| usize::try_convert(v).ok())
361
+ .unwrap_or_default(),
362
+ code_lines: kwargs
363
+ .get(ruby.to_symbol("code_lines"))
364
+ .and_then(|v| usize::try_convert(v).ok())
365
+ .unwrap_or_default(),
366
+ comment_lines: kwargs
367
+ .get(ruby.to_symbol("comment_lines"))
368
+ .and_then(|v| usize::try_convert(v).ok())
369
+ .unwrap_or_default(),
370
+ blank_lines: kwargs
371
+ .get(ruby.to_symbol("blank_lines"))
372
+ .and_then(|v| usize::try_convert(v).ok())
373
+ .unwrap_or_default(),
374
+ total_bytes: kwargs
375
+ .get(ruby.to_symbol("total_bytes"))
376
+ .and_then(|v| usize::try_convert(v).ok())
377
+ .unwrap_or_default(),
378
+ node_count: kwargs
379
+ .get(ruby.to_symbol("node_count"))
380
+ .and_then(|v| usize::try_convert(v).ok())
381
+ .unwrap_or_default(),
382
+ error_count: kwargs
383
+ .get(ruby.to_symbol("error_count"))
384
+ .and_then(|v| usize::try_convert(v).ok())
385
+ .unwrap_or_default(),
386
+ max_depth: kwargs
387
+ .get(ruby.to_symbol("max_depth"))
388
+ .and_then(|v| usize::try_convert(v).ok())
389
+ .unwrap_or_default(),
390
+ })
361
391
  }
362
392
 
363
393
  fn total_lines(&self) -> usize {
@@ -437,28 +467,44 @@ impl magnus::TryConvert for StructureItem {
437
467
  unsafe impl TryConvertOwned for StructureItem {}
438
468
 
439
469
  impl StructureItem {
440
- fn new(
441
- kind: StructureKind,
442
- span: Span,
443
- children: Vec<StructureItem>,
444
- decorators: Vec<String>,
445
- name: Option<String>,
446
- visibility: Option<String>,
447
- doc_comment: Option<String>,
448
- signature: Option<String>,
449
- body_span: Option<Span>,
450
- ) -> Self {
451
- Self {
452
- kind,
453
- name,
454
- visibility,
455
- span,
456
- children,
457
- decorators,
458
- doc_comment,
459
- signature,
460
- body_span,
461
- }
470
+ fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
471
+ let ruby = unsafe { magnus::Ruby::get_unchecked() };
472
+ let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
473
+ let (kwargs_opt,) = args.optional;
474
+ let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
475
+ Ok(Self {
476
+ kind: kwargs
477
+ .get(ruby.to_symbol("kind"))
478
+ .and_then(|v| StructureKind::try_convert(v).ok())
479
+ .unwrap_or_default(),
480
+ name: kwargs
481
+ .get(ruby.to_symbol("name"))
482
+ .and_then(|v| String::try_convert(v).ok()),
483
+ visibility: kwargs
484
+ .get(ruby.to_symbol("visibility"))
485
+ .and_then(|v| String::try_convert(v).ok()),
486
+ span: kwargs
487
+ .get(ruby.to_symbol("span"))
488
+ .and_then(|v| Span::try_convert(v).ok())
489
+ .unwrap_or_default(),
490
+ children: kwargs
491
+ .get(ruby.to_symbol("children"))
492
+ .and_then(|v| <Vec<StructureItem>>::try_convert(v).ok())
493
+ .unwrap_or_default(),
494
+ decorators: kwargs
495
+ .get(ruby.to_symbol("decorators"))
496
+ .and_then(|v| <Vec<String>>::try_convert(v).ok())
497
+ .unwrap_or_default(),
498
+ doc_comment: kwargs
499
+ .get(ruby.to_symbol("doc_comment"))
500
+ .and_then(|v| String::try_convert(v).ok()),
501
+ signature: kwargs
502
+ .get(ruby.to_symbol("signature"))
503
+ .and_then(|v| String::try_convert(v).ok()),
504
+ body_span: kwargs
505
+ .get(ruby.to_symbol("body_span"))
506
+ .and_then(|v| Span::try_convert(v).ok()),
507
+ })
462
508
  }
463
509
 
464
510
  fn kind(&self) -> StructureKind {
@@ -537,13 +583,28 @@ impl magnus::TryConvert for CommentInfo {
537
583
  unsafe impl TryConvertOwned for CommentInfo {}
538
584
 
539
585
  impl CommentInfo {
540
- fn new(text: String, kind: CommentKind, span: Span, associated_node: Option<String>) -> Self {
541
- Self {
542
- text,
543
- kind,
544
- span,
545
- associated_node,
546
- }
586
+ fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
587
+ let ruby = unsafe { magnus::Ruby::get_unchecked() };
588
+ let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
589
+ let (kwargs_opt,) = args.optional;
590
+ let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
591
+ Ok(Self {
592
+ text: kwargs
593
+ .get(ruby.to_symbol("text"))
594
+ .and_then(|v| String::try_convert(v).ok())
595
+ .unwrap_or_default(),
596
+ kind: kwargs
597
+ .get(ruby.to_symbol("kind"))
598
+ .and_then(|v| CommentKind::try_convert(v).ok())
599
+ .unwrap_or_default(),
600
+ span: kwargs
601
+ .get(ruby.to_symbol("span"))
602
+ .and_then(|v| Span::try_convert(v).ok())
603
+ .unwrap_or_default(),
604
+ associated_node: kwargs
605
+ .get(ruby.to_symbol("associated_node"))
606
+ .and_then(|v| String::try_convert(v).ok()),
607
+ })
547
608
  }
548
609
 
549
610
  fn text(&self) -> String {
@@ -603,20 +664,32 @@ impl magnus::TryConvert for DocstringInfo {
603
664
  unsafe impl TryConvertOwned for DocstringInfo {}
604
665
 
605
666
  impl DocstringInfo {
606
- fn new(
607
- text: String,
608
- format: DocstringFormat,
609
- span: Span,
610
- parsed_sections: Vec<DocSection>,
611
- associated_item: Option<String>,
612
- ) -> Self {
613
- Self {
614
- text,
615
- format,
616
- span,
617
- associated_item,
618
- parsed_sections,
619
- }
667
+ fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
668
+ let ruby = unsafe { magnus::Ruby::get_unchecked() };
669
+ let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
670
+ let (kwargs_opt,) = args.optional;
671
+ let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
672
+ Ok(Self {
673
+ text: kwargs
674
+ .get(ruby.to_symbol("text"))
675
+ .and_then(|v| String::try_convert(v).ok())
676
+ .unwrap_or_default(),
677
+ format: kwargs
678
+ .get(ruby.to_symbol("format"))
679
+ .and_then(|v| DocstringFormat::try_convert(v).ok())
680
+ .unwrap_or_default(),
681
+ span: kwargs
682
+ .get(ruby.to_symbol("span"))
683
+ .and_then(|v| Span::try_convert(v).ok())
684
+ .unwrap_or_default(),
685
+ associated_item: kwargs
686
+ .get(ruby.to_symbol("associated_item"))
687
+ .and_then(|v| String::try_convert(v).ok()),
688
+ parsed_sections: kwargs
689
+ .get(ruby.to_symbol("parsed_sections"))
690
+ .and_then(|v| <Vec<DocSection>>::try_convert(v).ok())
691
+ .unwrap_or_default(),
692
+ })
620
693
  }
621
694
 
622
695
  fn text(&self) -> String {
@@ -679,21 +752,29 @@ unsafe impl TryConvertOwned for DocSection {}
679
752
 
680
753
  impl Default for DocSection {
681
754
  fn default() -> Self {
682
- Self {
683
- kind: Default::default(),
684
- name: Default::default(),
685
- description: Default::default(),
686
- }
755
+ tree_sitter_language_pack::DocSection::default().into()
687
756
  }
688
757
  }
689
758
 
690
759
  impl DocSection {
691
- fn new(kind: String, description: String, name: Option<String>) -> Self {
692
- Self {
693
- kind,
694
- name,
695
- description,
696
- }
760
+ fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
761
+ let ruby = unsafe { magnus::Ruby::get_unchecked() };
762
+ let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
763
+ let (kwargs_opt,) = args.optional;
764
+ let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
765
+ Ok(Self {
766
+ kind: kwargs
767
+ .get(ruby.to_symbol("kind"))
768
+ .and_then(|v| String::try_convert(v).ok())
769
+ .unwrap_or_default(),
770
+ name: kwargs
771
+ .get(ruby.to_symbol("name"))
772
+ .and_then(|v| String::try_convert(v).ok()),
773
+ description: kwargs
774
+ .get(ruby.to_symbol("description"))
775
+ .and_then(|v| String::try_convert(v).ok())
776
+ .unwrap_or_default(),
777
+ })
697
778
  }
698
779
 
699
780
  fn kind(&self) -> String {
@@ -750,25 +831,37 @@ unsafe impl TryConvertOwned for ImportInfo {}
750
831
 
751
832
  impl Default for ImportInfo {
752
833
  fn default() -> Self {
753
- Self {
754
- source: Default::default(),
755
- items: Default::default(),
756
- alias: Default::default(),
757
- is_wildcard: Default::default(),
758
- span: Default::default(),
759
- }
834
+ tree_sitter_language_pack::ImportInfo::default().into()
760
835
  }
761
836
  }
762
837
 
763
838
  impl ImportInfo {
764
- fn new(source: String, items: Vec<String>, is_wildcard: bool, span: Span, alias: Option<String>) -> Self {
765
- Self {
766
- source,
767
- items,
768
- alias,
769
- is_wildcard,
770
- span,
771
- }
839
+ fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
840
+ let ruby = unsafe { magnus::Ruby::get_unchecked() };
841
+ let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
842
+ let (kwargs_opt,) = args.optional;
843
+ let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
844
+ Ok(Self {
845
+ source: kwargs
846
+ .get(ruby.to_symbol("source"))
847
+ .and_then(|v| String::try_convert(v).ok())
848
+ .unwrap_or_default(),
849
+ items: kwargs
850
+ .get(ruby.to_symbol("items"))
851
+ .and_then(|v| <Vec<String>>::try_convert(v).ok())
852
+ .unwrap_or_default(),
853
+ alias: kwargs
854
+ .get(ruby.to_symbol("alias"))
855
+ .and_then(|v| String::try_convert(v).ok()),
856
+ is_wildcard: kwargs
857
+ .get(ruby.to_symbol("is_wildcard"))
858
+ .and_then(|v| bool::try_convert(v).ok())
859
+ .unwrap_or_default(),
860
+ span: kwargs
861
+ .get(ruby.to_symbol("span"))
862
+ .and_then(|v| Span::try_convert(v).ok())
863
+ .unwrap_or_default(),
864
+ })
772
865
  }
773
866
 
774
867
  fn source(&self) -> String {
@@ -830,8 +923,25 @@ impl magnus::TryConvert for ExportInfo {
830
923
  unsafe impl TryConvertOwned for ExportInfo {}
831
924
 
832
925
  impl ExportInfo {
833
- fn new(name: String, kind: ExportKind, span: Span) -> Self {
834
- Self { name, kind, span }
926
+ fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
927
+ let ruby = unsafe { magnus::Ruby::get_unchecked() };
928
+ let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
929
+ let (kwargs_opt,) = args.optional;
930
+ let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
931
+ Ok(Self {
932
+ name: kwargs
933
+ .get(ruby.to_symbol("name"))
934
+ .and_then(|v| String::try_convert(v).ok())
935
+ .unwrap_or_default(),
936
+ kind: kwargs
937
+ .get(ruby.to_symbol("kind"))
938
+ .and_then(|v| ExportKind::try_convert(v).ok())
939
+ .unwrap_or_default(),
940
+ span: kwargs
941
+ .get(ruby.to_symbol("span"))
942
+ .and_then(|v| Span::try_convert(v).ok())
943
+ .unwrap_or_default(),
944
+ })
835
945
  }
836
946
 
837
947
  fn name(&self) -> String {
@@ -887,14 +997,31 @@ impl magnus::TryConvert for SymbolInfo {
887
997
  unsafe impl TryConvertOwned for SymbolInfo {}
888
998
 
889
999
  impl SymbolInfo {
890
- fn new(name: String, kind: SymbolKind, span: Span, type_annotation: Option<String>, doc: Option<String>) -> Self {
891
- Self {
892
- name,
893
- kind,
894
- span,
895
- type_annotation,
896
- doc,
897
- }
1000
+ fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
1001
+ let ruby = unsafe { magnus::Ruby::get_unchecked() };
1002
+ let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
1003
+ let (kwargs_opt,) = args.optional;
1004
+ let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
1005
+ Ok(Self {
1006
+ name: kwargs
1007
+ .get(ruby.to_symbol("name"))
1008
+ .and_then(|v| String::try_convert(v).ok())
1009
+ .unwrap_or_default(),
1010
+ kind: kwargs
1011
+ .get(ruby.to_symbol("kind"))
1012
+ .and_then(|v| SymbolKind::try_convert(v).ok())
1013
+ .unwrap_or_default(),
1014
+ span: kwargs
1015
+ .get(ruby.to_symbol("span"))
1016
+ .and_then(|v| Span::try_convert(v).ok())
1017
+ .unwrap_or_default(),
1018
+ type_annotation: kwargs
1019
+ .get(ruby.to_symbol("type_annotation"))
1020
+ .and_then(|v| String::try_convert(v).ok()),
1021
+ doc: kwargs
1022
+ .get(ruby.to_symbol("doc"))
1023
+ .and_then(|v| String::try_convert(v).ok()),
1024
+ })
898
1025
  }
899
1026
 
900
1027
  fn name(&self) -> String {
@@ -956,12 +1083,25 @@ impl magnus::TryConvert for Diagnostic {
956
1083
  unsafe impl TryConvertOwned for Diagnostic {}
957
1084
 
958
1085
  impl Diagnostic {
959
- fn new(message: String, severity: DiagnosticSeverity, span: Span) -> Self {
960
- Self {
961
- message,
962
- severity,
963
- span,
964
- }
1086
+ fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
1087
+ let ruby = unsafe { magnus::Ruby::get_unchecked() };
1088
+ let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
1089
+ let (kwargs_opt,) = args.optional;
1090
+ let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
1091
+ Ok(Self {
1092
+ message: kwargs
1093
+ .get(ruby.to_symbol("message"))
1094
+ .and_then(|v| String::try_convert(v).ok())
1095
+ .unwrap_or_default(),
1096
+ severity: kwargs
1097
+ .get(ruby.to_symbol("severity"))
1098
+ .and_then(|v| DiagnosticSeverity::try_convert(v).ok())
1099
+ .unwrap_or_default(),
1100
+ span: kwargs
1101
+ .get(ruby.to_symbol("span"))
1102
+ .and_then(|v| Span::try_convert(v).ok())
1103
+ .unwrap_or_default(),
1104
+ })
965
1105
  }
966
1106
 
967
1107
  fn message(&self) -> String {
@@ -1019,34 +1159,42 @@ unsafe impl TryConvertOwned for CodeChunk {}
1019
1159
 
1020
1160
  impl Default for CodeChunk {
1021
1161
  fn default() -> Self {
1022
- Self {
1023
- content: Default::default(),
1024
- start_byte: Default::default(),
1025
- end_byte: Default::default(),
1026
- start_line: Default::default(),
1027
- end_line: Default::default(),
1028
- metadata: Default::default(),
1029
- }
1162
+ tree_sitter_language_pack::CodeChunk::default().into()
1030
1163
  }
1031
1164
  }
1032
1165
 
1033
1166
  impl CodeChunk {
1034
- fn new(
1035
- content: String,
1036
- start_byte: usize,
1037
- end_byte: usize,
1038
- start_line: usize,
1039
- end_line: usize,
1040
- metadata: ChunkContext,
1041
- ) -> Self {
1042
- Self {
1043
- content,
1044
- start_byte,
1045
- end_byte,
1046
- start_line,
1047
- end_line,
1048
- metadata,
1049
- }
1167
+ fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
1168
+ let ruby = unsafe { magnus::Ruby::get_unchecked() };
1169
+ let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
1170
+ let (kwargs_opt,) = args.optional;
1171
+ let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
1172
+ Ok(Self {
1173
+ content: kwargs
1174
+ .get(ruby.to_symbol("content"))
1175
+ .and_then(|v| String::try_convert(v).ok())
1176
+ .unwrap_or_default(),
1177
+ start_byte: kwargs
1178
+ .get(ruby.to_symbol("start_byte"))
1179
+ .and_then(|v| usize::try_convert(v).ok())
1180
+ .unwrap_or_default(),
1181
+ end_byte: kwargs
1182
+ .get(ruby.to_symbol("end_byte"))
1183
+ .and_then(|v| usize::try_convert(v).ok())
1184
+ .unwrap_or_default(),
1185
+ start_line: kwargs
1186
+ .get(ruby.to_symbol("start_line"))
1187
+ .and_then(|v| usize::try_convert(v).ok())
1188
+ .unwrap_or_default(),
1189
+ end_line: kwargs
1190
+ .get(ruby.to_symbol("end_line"))
1191
+ .and_then(|v| usize::try_convert(v).ok())
1192
+ .unwrap_or_default(),
1193
+ metadata: kwargs
1194
+ .get(ruby.to_symbol("metadata"))
1195
+ .and_then(|v| ChunkContext::try_convert(v).ok())
1196
+ .unwrap_or_default(),
1197
+ })
1050
1198
  }
1051
1199
 
1052
1200
  fn content(&self) -> String {
@@ -1124,43 +1272,54 @@ unsafe impl TryConvertOwned for ChunkContext {}
1124
1272
 
1125
1273
  impl Default for ChunkContext {
1126
1274
  fn default() -> Self {
1127
- Self {
1128
- language: Default::default(),
1129
- chunk_index: Default::default(),
1130
- total_chunks: Default::default(),
1131
- node_types: Default::default(),
1132
- context_path: Default::default(),
1133
- symbols_defined: Default::default(),
1134
- comments: Default::default(),
1135
- docstrings: Default::default(),
1136
- has_error_nodes: Default::default(),
1137
- }
1275
+ tree_sitter_language_pack::ChunkContext::default().into()
1138
1276
  }
1139
1277
  }
1140
1278
 
1141
1279
  impl ChunkContext {
1142
- fn new(
1143
- language: String,
1144
- chunk_index: usize,
1145
- total_chunks: usize,
1146
- node_types: Vec<String>,
1147
- context_path: Vec<String>,
1148
- symbols_defined: Vec<String>,
1149
- comments: Vec<CommentInfo>,
1150
- docstrings: Vec<DocstringInfo>,
1151
- has_error_nodes: bool,
1152
- ) -> Self {
1153
- Self {
1154
- language,
1155
- chunk_index,
1156
- total_chunks,
1157
- node_types,
1158
- context_path,
1159
- symbols_defined,
1160
- comments,
1161
- docstrings,
1162
- has_error_nodes,
1163
- }
1280
+ fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
1281
+ let ruby = unsafe { magnus::Ruby::get_unchecked() };
1282
+ let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
1283
+ let (kwargs_opt,) = args.optional;
1284
+ let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
1285
+ Ok(Self {
1286
+ language: kwargs
1287
+ .get(ruby.to_symbol("language"))
1288
+ .and_then(|v| String::try_convert(v).ok())
1289
+ .unwrap_or_default(),
1290
+ chunk_index: kwargs
1291
+ .get(ruby.to_symbol("chunk_index"))
1292
+ .and_then(|v| usize::try_convert(v).ok())
1293
+ .unwrap_or_default(),
1294
+ total_chunks: kwargs
1295
+ .get(ruby.to_symbol("total_chunks"))
1296
+ .and_then(|v| usize::try_convert(v).ok())
1297
+ .unwrap_or_default(),
1298
+ node_types: kwargs
1299
+ .get(ruby.to_symbol("node_types"))
1300
+ .and_then(|v| <Vec<String>>::try_convert(v).ok())
1301
+ .unwrap_or_default(),
1302
+ context_path: kwargs
1303
+ .get(ruby.to_symbol("context_path"))
1304
+ .and_then(|v| <Vec<String>>::try_convert(v).ok())
1305
+ .unwrap_or_default(),
1306
+ symbols_defined: kwargs
1307
+ .get(ruby.to_symbol("symbols_defined"))
1308
+ .and_then(|v| <Vec<String>>::try_convert(v).ok())
1309
+ .unwrap_or_default(),
1310
+ comments: kwargs
1311
+ .get(ruby.to_symbol("comments"))
1312
+ .and_then(|v| <Vec<CommentInfo>>::try_convert(v).ok())
1313
+ .unwrap_or_default(),
1314
+ docstrings: kwargs
1315
+ .get(ruby.to_symbol("docstrings"))
1316
+ .and_then(|v| <Vec<DocstringInfo>>::try_convert(v).ok())
1317
+ .unwrap_or_default(),
1318
+ has_error_nodes: kwargs
1319
+ .get(ruby.to_symbol("has_error_nodes"))
1320
+ .and_then(|v| bool::try_convert(v).ok())
1321
+ .unwrap_or_default(),
1322
+ })
1164
1323
  }
1165
1324
 
1166
1325
  fn language(&self) -> String {
@@ -1239,21 +1398,27 @@ unsafe impl TryConvertOwned for PackConfig {}
1239
1398
 
1240
1399
  impl Default for PackConfig {
1241
1400
  fn default() -> Self {
1242
- Self {
1243
- cache_dir: Default::default(),
1244
- languages: Default::default(),
1245
- groups: Default::default(),
1246
- }
1401
+ tree_sitter_language_pack::PackConfig::default().into()
1247
1402
  }
1248
1403
  }
1249
1404
 
1250
1405
  impl PackConfig {
1251
- fn new(cache_dir: Option<String>, languages: Option<Vec<String>>, groups: Option<Vec<String>>) -> Self {
1252
- Self {
1253
- cache_dir,
1254
- languages,
1255
- groups,
1256
- }
1406
+ fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
1407
+ let ruby = unsafe { magnus::Ruby::get_unchecked() };
1408
+ let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
1409
+ let (kwargs_opt,) = args.optional;
1410
+ let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
1411
+ Ok(Self {
1412
+ cache_dir: kwargs
1413
+ .get(ruby.to_symbol("cache_dir"))
1414
+ .and_then(|v| String::try_convert(v).ok()),
1415
+ languages: kwargs
1416
+ .get(ruby.to_symbol("languages"))
1417
+ .and_then(|v| <Vec<String>>::try_convert(v).ok()),
1418
+ groups: kwargs
1419
+ .get(ruby.to_symbol("groups"))
1420
+ .and_then(|v| <Vec<String>>::try_convert(v).ok()),
1421
+ })
1257
1422
  }
1258
1423
 
1259
1424
  fn cache_dir(&self) -> Option<String> {
@@ -1314,43 +1479,53 @@ unsafe impl TryConvertOwned for ProcessConfig {}
1314
1479
 
1315
1480
  impl Default for ProcessConfig {
1316
1481
  fn default() -> Self {
1317
- Self {
1318
- language: Default::default(),
1319
- structure: Default::default(),
1320
- imports: Default::default(),
1321
- exports: Default::default(),
1322
- comments: Default::default(),
1323
- docstrings: Default::default(),
1324
- symbols: Default::default(),
1325
- diagnostics: Default::default(),
1326
- chunk_max_size: Default::default(),
1327
- }
1482
+ tree_sitter_language_pack::ProcessConfig::default().into()
1328
1483
  }
1329
1484
  }
1330
1485
 
1331
1486
  impl ProcessConfig {
1332
- fn new(
1333
- language: String,
1334
- structure: bool,
1335
- imports: bool,
1336
- exports: bool,
1337
- comments: bool,
1338
- docstrings: bool,
1339
- symbols: bool,
1340
- diagnostics: bool,
1341
- chunk_max_size: Option<usize>,
1342
- ) -> Self {
1343
- Self {
1344
- language,
1345
- structure,
1346
- imports,
1347
- exports,
1348
- comments,
1349
- docstrings,
1350
- symbols,
1351
- diagnostics,
1352
- chunk_max_size,
1353
- }
1487
+ fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
1488
+ let ruby = unsafe { magnus::Ruby::get_unchecked() };
1489
+ let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
1490
+ let (kwargs_opt,) = args.optional;
1491
+ let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
1492
+ Ok(Self {
1493
+ language: kwargs
1494
+ .get(ruby.to_symbol("language"))
1495
+ .and_then(|v| String::try_convert(v).ok())
1496
+ .unwrap_or_default(),
1497
+ structure: kwargs
1498
+ .get(ruby.to_symbol("structure"))
1499
+ .and_then(|v| bool::try_convert(v).ok())
1500
+ .unwrap_or(true),
1501
+ imports: kwargs
1502
+ .get(ruby.to_symbol("imports"))
1503
+ .and_then(|v| bool::try_convert(v).ok())
1504
+ .unwrap_or(true),
1505
+ exports: kwargs
1506
+ .get(ruby.to_symbol("exports"))
1507
+ .and_then(|v| bool::try_convert(v).ok())
1508
+ .unwrap_or(true),
1509
+ comments: kwargs
1510
+ .get(ruby.to_symbol("comments"))
1511
+ .and_then(|v| bool::try_convert(v).ok())
1512
+ .unwrap_or(false),
1513
+ docstrings: kwargs
1514
+ .get(ruby.to_symbol("docstrings"))
1515
+ .and_then(|v| bool::try_convert(v).ok())
1516
+ .unwrap_or(false),
1517
+ symbols: kwargs
1518
+ .get(ruby.to_symbol("symbols"))
1519
+ .and_then(|v| bool::try_convert(v).ok())
1520
+ .unwrap_or(false),
1521
+ diagnostics: kwargs
1522
+ .get(ruby.to_symbol("diagnostics"))
1523
+ .and_then(|v| bool::try_convert(v).ok())
1524
+ .unwrap_or(false),
1525
+ chunk_max_size: kwargs
1526
+ .get(ruby.to_symbol("chunk_max_size"))
1527
+ .and_then(|v| usize::try_convert(v).ok()),
1528
+ })
1354
1529
  }
1355
1530
 
1356
1531
  fn language(&self) -> String {
@@ -1551,18 +1726,29 @@ impl magnus::TryConvert for ParserManifest {
1551
1726
  unsafe impl TryConvertOwned for ParserManifest {}
1552
1727
 
1553
1728
  impl ParserManifest {
1554
- fn new(
1555
- version: String,
1556
- platforms: HashMap<String, PlatformBundle>,
1557
- languages: HashMap<String, LanguageInfo>,
1558
- groups: HashMap<String, Vec<String>>,
1559
- ) -> Self {
1560
- Self {
1561
- version,
1562
- platforms,
1563
- languages,
1564
- groups,
1565
- }
1729
+ fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
1730
+ let ruby = unsafe { magnus::Ruby::get_unchecked() };
1731
+ let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
1732
+ let (kwargs_opt,) = args.optional;
1733
+ let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
1734
+ Ok(Self {
1735
+ version: kwargs
1736
+ .get(ruby.to_symbol("version"))
1737
+ .and_then(|v| String::try_convert(v).ok())
1738
+ .unwrap_or_default(),
1739
+ platforms: kwargs
1740
+ .get(ruby.to_symbol("platforms"))
1741
+ .and_then(|v| <HashMap<String, PlatformBundle>>::try_convert(v).ok())
1742
+ .unwrap_or_default(),
1743
+ languages: kwargs
1744
+ .get(ruby.to_symbol("languages"))
1745
+ .and_then(|v| <HashMap<String, LanguageInfo>>::try_convert(v).ok())
1746
+ .unwrap_or_default(),
1747
+ groups: kwargs
1748
+ .get(ruby.to_symbol("groups"))
1749
+ .and_then(|v| <HashMap<String, Vec<String>>>::try_convert(v).ok())
1750
+ .unwrap_or_default(),
1751
+ })
1566
1752
  }
1567
1753
 
1568
1754
  fn version(&self) -> String {
@@ -1619,8 +1805,25 @@ impl magnus::TryConvert for PlatformBundle {
1619
1805
  unsafe impl TryConvertOwned for PlatformBundle {}
1620
1806
 
1621
1807
  impl PlatformBundle {
1622
- fn new(url: String, sha256: String, size: u64) -> Self {
1623
- Self { url, sha256, size }
1808
+ fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
1809
+ let ruby = unsafe { magnus::Ruby::get_unchecked() };
1810
+ let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
1811
+ let (kwargs_opt,) = args.optional;
1812
+ let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
1813
+ Ok(Self {
1814
+ url: kwargs
1815
+ .get(ruby.to_symbol("url"))
1816
+ .and_then(|v| String::try_convert(v).ok())
1817
+ .unwrap_or_default(),
1818
+ sha256: kwargs
1819
+ .get(ruby.to_symbol("sha256"))
1820
+ .and_then(|v| String::try_convert(v).ok())
1821
+ .unwrap_or_default(),
1822
+ size: kwargs
1823
+ .get(ruby.to_symbol("size"))
1824
+ .and_then(|v| u64::try_convert(v).ok())
1825
+ .unwrap_or_default(),
1826
+ })
1624
1827
  }
1625
1828
 
1626
1829
  fn url(&self) -> String {
@@ -1672,8 +1875,21 @@ impl magnus::TryConvert for LanguageInfo {
1672
1875
  unsafe impl TryConvertOwned for LanguageInfo {}
1673
1876
 
1674
1877
  impl LanguageInfo {
1675
- fn new(group: String, size: u64) -> Self {
1676
- Self { group, size }
1878
+ fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
1879
+ let ruby = unsafe { magnus::Ruby::get_unchecked() };
1880
+ let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
1881
+ let (kwargs_opt,) = args.optional;
1882
+ let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
1883
+ Ok(Self {
1884
+ group: kwargs
1885
+ .get(ruby.to_symbol("group"))
1886
+ .and_then(|v| String::try_convert(v).ok())
1887
+ .unwrap_or_default(),
1888
+ size: kwargs
1889
+ .get(ruby.to_symbol("size"))
1890
+ .and_then(|v| u64::try_convert(v).ok())
1891
+ .unwrap_or_default(),
1892
+ })
1677
1893
  }
1678
1894
 
1679
1895
  fn group(&self) -> String {
@@ -1853,21 +2069,24 @@ impl magnus::IntoValue for StructureKind {
1853
2069
  impl magnus::TryConvert for StructureKind {
1854
2070
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
1855
2071
  let s: String = magnus::TryConvert::try_convert(val)?;
2072
+ // Try deserializing as JSON first (handles JSON strings like "\"markdown\"")
2073
+ // If that fails, try treating it as a plain string value and wrap in quotes
2074
+ // If both fail, try as Custom variant (for untagged enum support)
1856
2075
  serde_json::from_str(&s)
2076
+ .or_else(|_| serde_json::from_str(&format!("\"{s}\"")))
2077
+ .or_else(|_| {
2078
+ // Try as a JSON string for Custom variant (untagged enums accept any remaining value)
2079
+ match serde_json::to_value(&s) {
2080
+ Ok(val) => serde_json::from_value(val),
2081
+ Err(e) => Err(e),
2082
+ }
2083
+ })
1857
2084
  .map_err(|e| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_type_error(), e.to_string()))
1858
2085
  }
1859
2086
  }
1860
2087
 
1861
2088
  unsafe impl IntoValueFromNative for StructureKind {}
1862
2089
  unsafe impl TryConvertOwned for StructureKind {}
1863
- impl StructureKind {
1864
- fn other(&self) -> Option<String> {
1865
- match self {
1866
- Self::Other { _0 } => Some(_0.clone()),
1867
- _ => None,
1868
- }
1869
- }
1870
- }
1871
2090
 
1872
2091
  #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
1873
2092
  pub enum CommentKind {
@@ -1939,21 +2158,24 @@ impl magnus::IntoValue for DocstringFormat {
1939
2158
  impl magnus::TryConvert for DocstringFormat {
1940
2159
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
1941
2160
  let s: String = magnus::TryConvert::try_convert(val)?;
2161
+ // Try deserializing as JSON first (handles JSON strings like "\"markdown\"")
2162
+ // If that fails, try treating it as a plain string value and wrap in quotes
2163
+ // If both fail, try as Custom variant (for untagged enum support)
1942
2164
  serde_json::from_str(&s)
2165
+ .or_else(|_| serde_json::from_str(&format!("\"{s}\"")))
2166
+ .or_else(|_| {
2167
+ // Try as a JSON string for Custom variant (untagged enums accept any remaining value)
2168
+ match serde_json::to_value(&s) {
2169
+ Ok(val) => serde_json::from_value(val),
2170
+ Err(e) => Err(e),
2171
+ }
2172
+ })
1943
2173
  .map_err(|e| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_type_error(), e.to_string()))
1944
2174
  }
1945
2175
  }
1946
2176
 
1947
2177
  unsafe impl IntoValueFromNative for DocstringFormat {}
1948
2178
  unsafe impl TryConvertOwned for DocstringFormat {}
1949
- impl DocstringFormat {
1950
- fn other(&self) -> Option<String> {
1951
- match self {
1952
- Self::Other { _0 } => Some(_0.clone()),
1953
- _ => None,
1954
- }
1955
- }
1956
- }
1957
2179
 
1958
2180
  #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
1959
2181
  pub enum ExportKind {
@@ -2028,21 +2250,24 @@ impl magnus::IntoValue for SymbolKind {
2028
2250
  impl magnus::TryConvert for SymbolKind {
2029
2251
  fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
2030
2252
  let s: String = magnus::TryConvert::try_convert(val)?;
2253
+ // Try deserializing as JSON first (handles JSON strings like "\"markdown\"")
2254
+ // If that fails, try treating it as a plain string value and wrap in quotes
2255
+ // If both fail, try as Custom variant (for untagged enum support)
2031
2256
  serde_json::from_str(&s)
2257
+ .or_else(|_| serde_json::from_str(&format!("\"{s}\"")))
2258
+ .or_else(|_| {
2259
+ // Try as a JSON string for Custom variant (untagged enums accept any remaining value)
2260
+ match serde_json::to_value(&s) {
2261
+ Ok(val) => serde_json::from_value(val),
2262
+ Err(e) => Err(e),
2263
+ }
2264
+ })
2032
2265
  .map_err(|e| magnus::Error::new(unsafe { Ruby::get_unchecked() }.exception_type_error(), e.to_string()))
2033
2266
  }
2034
2267
  }
2035
2268
 
2036
2269
  unsafe impl IntoValueFromNative for SymbolKind {}
2037
2270
  unsafe impl TryConvertOwned for SymbolKind {}
2038
- impl SymbolKind {
2039
- fn other(&self) -> Option<String> {
2040
- match self {
2041
- Self::Other { _0 } => Some(_0.clone()),
2042
- _ => None,
2043
- }
2044
- }
2045
- }
2046
2271
 
2047
2272
  #[derive(Clone, Copy, PartialEq, Eq, Debug, serde::Serialize, serde::Deserialize)]
2048
2273
  pub enum DiagnosticSeverity {
@@ -2926,7 +3151,7 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
2926
3151
  let module = ruby.define_module("TreeSitterLanguagePack")?;
2927
3152
 
2928
3153
  let class = module.define_class("Span", ruby.class_object())?;
2929
- class.define_singleton_method("new", function!(Span::new, 6))?;
3154
+ class.define_singleton_method("new", function!(Span::new, -1))?;
2930
3155
  class.define_method("start_byte", method!(Span::start_byte, 0))?;
2931
3156
  class.define_method("end_byte", method!(Span::end_byte, 0))?;
2932
3157
  class.define_method("start_line", method!(Span::start_line, 0))?;
@@ -2935,7 +3160,7 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
2935
3160
  class.define_method("end_column", method!(Span::end_column, 0))?;
2936
3161
 
2937
3162
  let class = module.define_class("ProcessResult", ruby.class_object())?;
2938
- class.define_singleton_method("new", function!(ProcessResult::new, 10))?;
3163
+ class.define_singleton_method("new", function!(ProcessResult::new, -1))?;
2939
3164
  class.define_method("language", method!(ProcessResult::language, 0))?;
2940
3165
  class.define_method("metrics", method!(ProcessResult::metrics, 0))?;
2941
3166
  class.define_method("structure", method!(ProcessResult::structure, 0))?;
@@ -2948,7 +3173,7 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
2948
3173
  class.define_method("chunks", method!(ProcessResult::chunks, 0))?;
2949
3174
 
2950
3175
  let class = module.define_class("FileMetrics", ruby.class_object())?;
2951
- class.define_singleton_method("new", function!(FileMetrics::new, 8))?;
3176
+ class.define_singleton_method("new", function!(FileMetrics::new, -1))?;
2952
3177
  class.define_method("total_lines", method!(FileMetrics::total_lines, 0))?;
2953
3178
  class.define_method("code_lines", method!(FileMetrics::code_lines, 0))?;
2954
3179
  class.define_method("comment_lines", method!(FileMetrics::comment_lines, 0))?;
@@ -2959,7 +3184,7 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
2959
3184
  class.define_method("max_depth", method!(FileMetrics::max_depth, 0))?;
2960
3185
 
2961
3186
  let class = module.define_class("StructureItem", ruby.class_object())?;
2962
- class.define_singleton_method("new", function!(StructureItem::new, 9))?;
3187
+ class.define_singleton_method("new", function!(StructureItem::new, -1))?;
2963
3188
  class.define_method("kind", method!(StructureItem::kind, 0))?;
2964
3189
  class.define_method("name", method!(StructureItem::name, 0))?;
2965
3190
  class.define_method("visibility", method!(StructureItem::visibility, 0))?;
@@ -2971,14 +3196,14 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
2971
3196
  class.define_method("body_span", method!(StructureItem::body_span, 0))?;
2972
3197
 
2973
3198
  let class = module.define_class("CommentInfo", ruby.class_object())?;
2974
- class.define_singleton_method("new", function!(CommentInfo::new, 4))?;
3199
+ class.define_singleton_method("new", function!(CommentInfo::new, -1))?;
2975
3200
  class.define_method("text", method!(CommentInfo::text, 0))?;
2976
3201
  class.define_method("kind", method!(CommentInfo::kind, 0))?;
2977
3202
  class.define_method("span", method!(CommentInfo::span, 0))?;
2978
3203
  class.define_method("associated_node", method!(CommentInfo::associated_node, 0))?;
2979
3204
 
2980
3205
  let class = module.define_class("DocstringInfo", ruby.class_object())?;
2981
- class.define_singleton_method("new", function!(DocstringInfo::new, 5))?;
3206
+ class.define_singleton_method("new", function!(DocstringInfo::new, -1))?;
2982
3207
  class.define_method("text", method!(DocstringInfo::text, 0))?;
2983
3208
  class.define_method("format", method!(DocstringInfo::format, 0))?;
2984
3209
  class.define_method("span", method!(DocstringInfo::span, 0))?;
@@ -2986,13 +3211,13 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
2986
3211
  class.define_method("parsed_sections", method!(DocstringInfo::parsed_sections, 0))?;
2987
3212
 
2988
3213
  let class = module.define_class("DocSection", ruby.class_object())?;
2989
- class.define_singleton_method("new", function!(DocSection::new, 3))?;
3214
+ class.define_singleton_method("new", function!(DocSection::new, -1))?;
2990
3215
  class.define_method("kind", method!(DocSection::kind, 0))?;
2991
3216
  class.define_method("name", method!(DocSection::name, 0))?;
2992
3217
  class.define_method("description", method!(DocSection::description, 0))?;
2993
3218
 
2994
3219
  let class = module.define_class("ImportInfo", ruby.class_object())?;
2995
- class.define_singleton_method("new", function!(ImportInfo::new, 5))?;
3220
+ class.define_singleton_method("new", function!(ImportInfo::new, -1))?;
2996
3221
  class.define_method("source", method!(ImportInfo::source, 0))?;
2997
3222
  class.define_method("items", method!(ImportInfo::items, 0))?;
2998
3223
  class.define_method("alias", method!(ImportInfo::alias, 0))?;
@@ -3000,13 +3225,13 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
3000
3225
  class.define_method("span", method!(ImportInfo::span, 0))?;
3001
3226
 
3002
3227
  let class = module.define_class("ExportInfo", ruby.class_object())?;
3003
- class.define_singleton_method("new", function!(ExportInfo::new, 3))?;
3228
+ class.define_singleton_method("new", function!(ExportInfo::new, -1))?;
3004
3229
  class.define_method("name", method!(ExportInfo::name, 0))?;
3005
3230
  class.define_method("kind", method!(ExportInfo::kind, 0))?;
3006
3231
  class.define_method("span", method!(ExportInfo::span, 0))?;
3007
3232
 
3008
3233
  let class = module.define_class("SymbolInfo", ruby.class_object())?;
3009
- class.define_singleton_method("new", function!(SymbolInfo::new, 5))?;
3234
+ class.define_singleton_method("new", function!(SymbolInfo::new, -1))?;
3010
3235
  class.define_method("name", method!(SymbolInfo::name, 0))?;
3011
3236
  class.define_method("kind", method!(SymbolInfo::kind, 0))?;
3012
3237
  class.define_method("span", method!(SymbolInfo::span, 0))?;
@@ -3014,13 +3239,13 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
3014
3239
  class.define_method("doc", method!(SymbolInfo::doc, 0))?;
3015
3240
 
3016
3241
  let class = module.define_class("Diagnostic", ruby.class_object())?;
3017
- class.define_singleton_method("new", function!(Diagnostic::new, 3))?;
3242
+ class.define_singleton_method("new", function!(Diagnostic::new, -1))?;
3018
3243
  class.define_method("message", method!(Diagnostic::message, 0))?;
3019
3244
  class.define_method("severity", method!(Diagnostic::severity, 0))?;
3020
3245
  class.define_method("span", method!(Diagnostic::span, 0))?;
3021
3246
 
3022
3247
  let class = module.define_class("CodeChunk", ruby.class_object())?;
3023
- class.define_singleton_method("new", function!(CodeChunk::new, 6))?;
3248
+ class.define_singleton_method("new", function!(CodeChunk::new, -1))?;
3024
3249
  class.define_method("content", method!(CodeChunk::content, 0))?;
3025
3250
  class.define_method("start_byte", method!(CodeChunk::start_byte, 0))?;
3026
3251
  class.define_method("end_byte", method!(CodeChunk::end_byte, 0))?;
@@ -3030,7 +3255,7 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
3030
3255
  class.define_method("to_s", method!(CodeChunk::to_s, 0))?;
3031
3256
 
3032
3257
  let class = module.define_class("ChunkContext", ruby.class_object())?;
3033
- class.define_singleton_method("new", function!(ChunkContext::new, 9))?;
3258
+ class.define_singleton_method("new", function!(ChunkContext::new, -1))?;
3034
3259
  class.define_method("language", method!(ChunkContext::language, 0))?;
3035
3260
  class.define_method("chunk_index", method!(ChunkContext::chunk_index, 0))?;
3036
3261
  class.define_method("total_chunks", method!(ChunkContext::total_chunks, 0))?;
@@ -3042,13 +3267,13 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
3042
3267
  class.define_method("has_error_nodes", method!(ChunkContext::has_error_nodes, 0))?;
3043
3268
 
3044
3269
  let class = module.define_class("PackConfig", ruby.class_object())?;
3045
- class.define_singleton_method("new", function!(PackConfig::new, 3))?;
3270
+ class.define_singleton_method("new", function!(PackConfig::new, -1))?;
3046
3271
  class.define_method("cache_dir", method!(PackConfig::cache_dir, 0))?;
3047
3272
  class.define_method("languages", method!(PackConfig::languages, 0))?;
3048
3273
  class.define_method("groups", method!(PackConfig::groups, 0))?;
3049
3274
 
3050
3275
  let class = module.define_class("ProcessConfig", ruby.class_object())?;
3051
- class.define_singleton_method("new", function!(ProcessConfig::new, 9))?;
3276
+ class.define_singleton_method("new", function!(ProcessConfig::new, -1))?;
3052
3277
  class.define_method("language", method!(ProcessConfig::language, 0))?;
3053
3278
  class.define_method("structure", method!(ProcessConfig::structure, 0))?;
3054
3279
  class.define_method("imports", method!(ProcessConfig::imports, 0))?;
@@ -3071,20 +3296,20 @@ fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
3071
3296
  class.define_method("process", method!(LanguageRegistry::process, 2))?;
3072
3297
 
3073
3298
  let class = module.define_class("ParserManifest", ruby.class_object())?;
3074
- class.define_singleton_method("new", function!(ParserManifest::new, 4))?;
3299
+ class.define_singleton_method("new", function!(ParserManifest::new, -1))?;
3075
3300
  class.define_method("version", method!(ParserManifest::version, 0))?;
3076
3301
  class.define_method("platforms", method!(ParserManifest::platforms, 0))?;
3077
3302
  class.define_method("languages", method!(ParserManifest::languages, 0))?;
3078
3303
  class.define_method("groups", method!(ParserManifest::groups, 0))?;
3079
3304
 
3080
3305
  let class = module.define_class("PlatformBundle", ruby.class_object())?;
3081
- class.define_singleton_method("new", function!(PlatformBundle::new, 3))?;
3306
+ class.define_singleton_method("new", function!(PlatformBundle::new, -1))?;
3082
3307
  class.define_method("url", method!(PlatformBundle::url, 0))?;
3083
3308
  class.define_method("sha256", method!(PlatformBundle::sha256, 0))?;
3084
3309
  class.define_method("size", method!(PlatformBundle::size, 0))?;
3085
3310
 
3086
3311
  let class = module.define_class("LanguageInfo", ruby.class_object())?;
3087
- class.define_singleton_method("new", function!(LanguageInfo::new, 2))?;
3312
+ class.define_singleton_method("new", function!(LanguageInfo::new, -1))?;
3088
3313
  class.define_method("group", method!(LanguageInfo::group, 0))?;
3089
3314
  class.define_method("size", method!(LanguageInfo::size, 0))?;
3090
3315
 
@@ -1,10 +1,10 @@
1
1
  # This file is auto-generated by alef — DO NOT EDIT.
2
- # alef:hash:67114fe2834308bdefd0e1ac878d8023d287cc5dba61baa6088e16c3c89e9cee
2
+ # alef:hash:022d1f4e1fec514d50495a6cee0804bab2448e02fba38e81f5165a4c57b742bd
3
3
  # To regenerate: alef generate
4
4
  # To verify freshness: alef verify --exit-code
5
5
  # Issues & docs: https://github.com/kreuzberg-dev/alef
6
6
  # frozen_string_literal: true
7
7
 
8
8
  module Tree_sitter_language_pack
9
- VERSION = '1.8.0.pre.rc.43'
9
+ VERSION = '1.8.0.pre.rc.44'
10
10
  end
@@ -1,5 +1,5 @@
1
1
  # This file is auto-generated by alef — DO NOT EDIT.
2
- # alef:hash:b638543f033e039229fe860d8d3f9d16bb04a353217126d0401a975e2ecc3838
2
+ # alef:hash:f1cee06ff8900ef2d958db4c1c0a5cb8d233243dfa3834f678c826f070dc817d
3
3
  # To regenerate: alef generate
4
4
  # To verify freshness: alef verify --exit-code
5
5
  # Issues & docs: https://github.com/kreuzberg-dev/alef
@@ -7,3 +7,40 @@
7
7
 
8
8
  require 'json'
9
9
  require 'ts_pack_core_rb'
10
+
11
+ # Add accessor methods to Hash-based internally-tagged enum instances
12
+ class Hash
13
+ # Support internally-tagged enum accessors like format.excel, format.email, etc.
14
+ # Also support direct field access like format.sheet_count
15
+ # rubocop:disable Metrics/CyclomaticComplexity
16
+ def method_missing(method_name, *args, &)
17
+ # Try symbol key first (how Magnus converts JSON keys)
18
+ return self[method_name] if key?(method_name)
19
+
20
+ # Try string key
21
+ return self[method_name.to_s] if key?(method_name.to_s)
22
+
23
+ # Check if this hash has a 'format_type' field (indicating an internally-tagged enum)
24
+ format_type = self[:format_type] || self['format_type']
25
+ return super unless format_type
26
+
27
+ # If the method name matches the format_type (snake_case), extract and return the variant's wrapped data
28
+ # Internally-tagged enums store variant data in the '_0' field (from alef's struct variant conversion)
29
+ # This allows format.excel to return the ExcelMetadata hash with sheet_count, sheet_names, etc.
30
+ snake_case_method = method_name.to_s.downcase
31
+ return self[:_0] || self['_0'] || self if snake_case_method == format_type.to_s.downcase
32
+
33
+ super
34
+ end
35
+ # rubocop:enable Metrics/CyclomaticComplexity
36
+
37
+ def respond_to_missing?(method_name, include_private = false)
38
+ return true if key?(method_name) || key?(method_name.to_s)
39
+
40
+ format_type = self[:format_type] || self['format_type']
41
+ return false unless format_type
42
+
43
+ snake_case_method = method_name.to_s.downcase
44
+ snake_case_method == format_type.to_s.downcase || super
45
+ end
46
+ end
@@ -1,10 +1,10 @@
1
1
  # This file is auto-generated by alef — DO NOT EDIT.
2
- # alef:hash:f72879f8162d8b8377bac9df171b35030472b294e5b4a9bf8d83a60edd7b6d45
2
+ # alef:hash:e0342931f53b51d8116ea5c8a064e3acc1783cc8acd0d0fe337866407e99f370
3
3
  # To regenerate: alef generate
4
4
  # To verify freshness: alef verify --exit-code
5
5
  # Issues & docs: https://github.com/kreuzberg-dev/alef
6
6
  # frozen_string_literal: true
7
7
 
8
8
  module TreeSitterLanguagePack
9
- VERSION = '1.8.0.pre.rc.43'
9
+ VERSION = '1.8.0.pre.rc.44'
10
10
  end
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.8.0.pre.rc.43
4
+ version: 1.8.0.pre.rc.44
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kreuzberg Team