tree_sitter_language_pack 1.8.0 → 1.8.1
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 +4 -4
- data/ext/ts_pack_core_rb/native/Cargo.toml +1 -1
- data/ext/ts_pack_core_rb/src/lib.rs +766 -91
- data/lib/tree_sitter_language_pack/native.rb +1 -1
- data/lib/tree_sitter_language_pack/version.rb +2 -2
- data/lib/tree_sitter_language_pack.rb +1 -1
- data/sig/types.rbs +91 -10
- metadata +1 -2
- data/ext/ts_pack_core_rb/src/tree_sitter_language_pack/version.rb +0 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// This file is auto-generated by alef. DO NOT EDIT.
|
|
2
|
-
// alef:hash:
|
|
2
|
+
// alef:hash:2b779fd4a6411cbf6f73ed90dc178998e48f73f245c189530e77b9cad8d334d5
|
|
3
3
|
// Re-generate with: alef generate
|
|
4
4
|
#![allow(dead_code, unused_imports, unused_variables)]
|
|
5
5
|
#![allow(
|
|
@@ -13,12 +13,16 @@
|
|
|
13
13
|
clippy::unwrap_or_default,
|
|
14
14
|
clippy::derivable_impls,
|
|
15
15
|
clippy::needless_borrows_for_generic_args,
|
|
16
|
-
clippy::unnecessary_fallible_conversions
|
|
16
|
+
clippy::unnecessary_fallible_conversions,
|
|
17
|
+
clippy::type_complexity,
|
|
18
|
+
clippy::useless_conversion,
|
|
19
|
+
clippy::clone_on_copy
|
|
17
20
|
)]
|
|
18
21
|
|
|
19
22
|
use magnus::{Error, IntoValueFromNative, Ruby, function, method, prelude::*, try_convert::TryConvertOwned};
|
|
20
23
|
use std::collections::HashMap;
|
|
21
24
|
use std::sync::Arc;
|
|
25
|
+
use std::sync::Mutex;
|
|
22
26
|
|
|
23
27
|
fn json_to_ruby(handle: &Ruby, val: serde_json::Value) -> magnus::Value {
|
|
24
28
|
use magnus::IntoValue;
|
|
@@ -423,7 +427,7 @@ impl FileMetrics {
|
|
|
423
427
|
}
|
|
424
428
|
}
|
|
425
429
|
|
|
426
|
-
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize
|
|
430
|
+
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
427
431
|
#[serde(default)]
|
|
428
432
|
#[magnus::wrap(class = "TreeSitterLanguagePack::StructureItem")]
|
|
429
433
|
pub struct StructureItem {
|
|
@@ -466,6 +470,22 @@ impl magnus::TryConvert for StructureItem {
|
|
|
466
470
|
|
|
467
471
|
unsafe impl TryConvertOwned for StructureItem {}
|
|
468
472
|
|
|
473
|
+
impl Default for StructureItem {
|
|
474
|
+
fn default() -> Self {
|
|
475
|
+
Self {
|
|
476
|
+
kind: Default::default(),
|
|
477
|
+
name: None,
|
|
478
|
+
visibility: None,
|
|
479
|
+
span: Default::default(),
|
|
480
|
+
children: vec![],
|
|
481
|
+
decorators: vec![],
|
|
482
|
+
doc_comment: None,
|
|
483
|
+
signature: None,
|
|
484
|
+
body_span: None,
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
469
489
|
impl StructureItem {
|
|
470
490
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
471
491
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -544,7 +564,7 @@ impl StructureItem {
|
|
|
544
564
|
}
|
|
545
565
|
}
|
|
546
566
|
|
|
547
|
-
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize
|
|
567
|
+
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
548
568
|
#[serde(default)]
|
|
549
569
|
#[magnus::wrap(class = "TreeSitterLanguagePack::CommentInfo")]
|
|
550
570
|
pub struct CommentInfo {
|
|
@@ -582,6 +602,17 @@ impl magnus::TryConvert for CommentInfo {
|
|
|
582
602
|
|
|
583
603
|
unsafe impl TryConvertOwned for CommentInfo {}
|
|
584
604
|
|
|
605
|
+
impl Default for CommentInfo {
|
|
606
|
+
fn default() -> Self {
|
|
607
|
+
Self {
|
|
608
|
+
text: String::new(),
|
|
609
|
+
kind: Default::default(),
|
|
610
|
+
span: Default::default(),
|
|
611
|
+
associated_node: None,
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
|
|
585
616
|
impl CommentInfo {
|
|
586
617
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
587
618
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -624,7 +655,7 @@ impl CommentInfo {
|
|
|
624
655
|
}
|
|
625
656
|
}
|
|
626
657
|
|
|
627
|
-
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize
|
|
658
|
+
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
628
659
|
#[serde(default)]
|
|
629
660
|
#[magnus::wrap(class = "TreeSitterLanguagePack::DocstringInfo")]
|
|
630
661
|
pub struct DocstringInfo {
|
|
@@ -663,6 +694,18 @@ impl magnus::TryConvert for DocstringInfo {
|
|
|
663
694
|
|
|
664
695
|
unsafe impl TryConvertOwned for DocstringInfo {}
|
|
665
696
|
|
|
697
|
+
impl Default for DocstringInfo {
|
|
698
|
+
fn default() -> Self {
|
|
699
|
+
Self {
|
|
700
|
+
text: String::new(),
|
|
701
|
+
format: Default::default(),
|
|
702
|
+
span: Default::default(),
|
|
703
|
+
associated_item: None,
|
|
704
|
+
parsed_sections: vec![],
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
|
|
666
709
|
impl DocstringInfo {
|
|
667
710
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
668
711
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -885,7 +928,7 @@ impl ImportInfo {
|
|
|
885
928
|
}
|
|
886
929
|
}
|
|
887
930
|
|
|
888
|
-
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize
|
|
931
|
+
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
889
932
|
#[serde(default)]
|
|
890
933
|
#[magnus::wrap(class = "TreeSitterLanguagePack::ExportInfo")]
|
|
891
934
|
pub struct ExportInfo {
|
|
@@ -922,6 +965,16 @@ impl magnus::TryConvert for ExportInfo {
|
|
|
922
965
|
|
|
923
966
|
unsafe impl TryConvertOwned for ExportInfo {}
|
|
924
967
|
|
|
968
|
+
impl Default for ExportInfo {
|
|
969
|
+
fn default() -> Self {
|
|
970
|
+
Self {
|
|
971
|
+
name: String::new(),
|
|
972
|
+
kind: Default::default(),
|
|
973
|
+
span: Default::default(),
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
|
|
925
978
|
impl ExportInfo {
|
|
926
979
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
927
980
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -957,7 +1010,7 @@ impl ExportInfo {
|
|
|
957
1010
|
}
|
|
958
1011
|
}
|
|
959
1012
|
|
|
960
|
-
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize
|
|
1013
|
+
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
961
1014
|
#[serde(default)]
|
|
962
1015
|
#[magnus::wrap(class = "TreeSitterLanguagePack::SymbolInfo")]
|
|
963
1016
|
pub struct SymbolInfo {
|
|
@@ -996,6 +1049,18 @@ impl magnus::TryConvert for SymbolInfo {
|
|
|
996
1049
|
|
|
997
1050
|
unsafe impl TryConvertOwned for SymbolInfo {}
|
|
998
1051
|
|
|
1052
|
+
impl Default for SymbolInfo {
|
|
1053
|
+
fn default() -> Self {
|
|
1054
|
+
Self {
|
|
1055
|
+
name: String::new(),
|
|
1056
|
+
kind: Default::default(),
|
|
1057
|
+
span: Default::default(),
|
|
1058
|
+
type_annotation: None,
|
|
1059
|
+
doc: None,
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
|
|
999
1064
|
impl SymbolInfo {
|
|
1000
1065
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
1001
1066
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -1045,7 +1110,7 @@ impl SymbolInfo {
|
|
|
1045
1110
|
}
|
|
1046
1111
|
}
|
|
1047
1112
|
|
|
1048
|
-
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize
|
|
1113
|
+
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
1049
1114
|
#[serde(default)]
|
|
1050
1115
|
#[magnus::wrap(class = "TreeSitterLanguagePack::Diagnostic")]
|
|
1051
1116
|
pub struct Diagnostic {
|
|
@@ -1082,6 +1147,16 @@ impl magnus::TryConvert for Diagnostic {
|
|
|
1082
1147
|
|
|
1083
1148
|
unsafe impl TryConvertOwned for Diagnostic {}
|
|
1084
1149
|
|
|
1150
|
+
impl Default for Diagnostic {
|
|
1151
|
+
fn default() -> Self {
|
|
1152
|
+
Self {
|
|
1153
|
+
message: String::new(),
|
|
1154
|
+
severity: Default::default(),
|
|
1155
|
+
span: Default::default(),
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1085
1160
|
impl Diagnostic {
|
|
1086
1161
|
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
1087
1162
|
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
@@ -1434,6 +1509,360 @@ impl PackConfig {
|
|
|
1434
1509
|
}
|
|
1435
1510
|
}
|
|
1436
1511
|
|
|
1512
|
+
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
1513
|
+
#[magnus::wrap(class = "TreeSitterLanguagePack::Point")]
|
|
1514
|
+
pub struct Point {
|
|
1515
|
+
row: usize,
|
|
1516
|
+
column: usize,
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
unsafe impl IntoValueFromNative for Point {}
|
|
1520
|
+
|
|
1521
|
+
impl magnus::TryConvert for Point {
|
|
1522
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
1523
|
+
if let Ok(r) = <&Point as magnus::TryConvert>::try_convert(val) {
|
|
1524
|
+
return Ok(r.clone());
|
|
1525
|
+
}
|
|
1526
|
+
let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
|
|
1527
|
+
s
|
|
1528
|
+
} else {
|
|
1529
|
+
val.funcall::<_, _, String>("to_json", ()).map_err(|e| {
|
|
1530
|
+
magnus::Error::new(
|
|
1531
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
1532
|
+
format!("no implicit conversion into Point: {}", e),
|
|
1533
|
+
)
|
|
1534
|
+
})?
|
|
1535
|
+
};
|
|
1536
|
+
serde_json::from_str::<Point>(&json_str).map_err(|e| {
|
|
1537
|
+
magnus::Error::new(
|
|
1538
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
1539
|
+
format!("failed to deserialize Point: {}", e),
|
|
1540
|
+
)
|
|
1541
|
+
})
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
unsafe impl TryConvertOwned for Point {}
|
|
1546
|
+
|
|
1547
|
+
impl Point {
|
|
1548
|
+
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
1549
|
+
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
1550
|
+
let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
|
|
1551
|
+
let (kwargs_opt,) = args.optional;
|
|
1552
|
+
let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
|
|
1553
|
+
Ok(Self {
|
|
1554
|
+
row: kwargs
|
|
1555
|
+
.get(ruby.to_symbol("row"))
|
|
1556
|
+
.and_then(|v| usize::try_convert(v).ok())
|
|
1557
|
+
.unwrap_or_default(),
|
|
1558
|
+
column: kwargs
|
|
1559
|
+
.get(ruby.to_symbol("column"))
|
|
1560
|
+
.and_then(|v| usize::try_convert(v).ok())
|
|
1561
|
+
.unwrap_or_default(),
|
|
1562
|
+
})
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
fn row(&self) -> usize {
|
|
1566
|
+
self.row
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
fn column(&self) -> usize {
|
|
1570
|
+
self.column
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
1575
|
+
#[magnus::wrap(class = "TreeSitterLanguagePack::ByteRange")]
|
|
1576
|
+
pub struct ByteRange {
|
|
1577
|
+
start: usize,
|
|
1578
|
+
end: usize,
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
unsafe impl IntoValueFromNative for ByteRange {}
|
|
1582
|
+
|
|
1583
|
+
impl magnus::TryConvert for ByteRange {
|
|
1584
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
1585
|
+
if let Ok(r) = <&ByteRange as magnus::TryConvert>::try_convert(val) {
|
|
1586
|
+
return Ok(r.clone());
|
|
1587
|
+
}
|
|
1588
|
+
let json_str: String = if let Ok(s) = <String as magnus::TryConvert>::try_convert(val) {
|
|
1589
|
+
s
|
|
1590
|
+
} else {
|
|
1591
|
+
val.funcall::<_, _, String>("to_json", ()).map_err(|e| {
|
|
1592
|
+
magnus::Error::new(
|
|
1593
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
1594
|
+
format!("no implicit conversion into ByteRange: {}", e),
|
|
1595
|
+
)
|
|
1596
|
+
})?
|
|
1597
|
+
};
|
|
1598
|
+
serde_json::from_str::<ByteRange>(&json_str).map_err(|e| {
|
|
1599
|
+
magnus::Error::new(
|
|
1600
|
+
unsafe { magnus::Ruby::get_unchecked() }.exception_type_error(),
|
|
1601
|
+
format!("failed to deserialize ByteRange: {}", e),
|
|
1602
|
+
)
|
|
1603
|
+
})
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
unsafe impl TryConvertOwned for ByteRange {}
|
|
1608
|
+
|
|
1609
|
+
impl ByteRange {
|
|
1610
|
+
fn new(args: &[magnus::Value]) -> Result<Self, magnus::Error> {
|
|
1611
|
+
let ruby = unsafe { magnus::Ruby::get_unchecked() };
|
|
1612
|
+
let args = magnus::scan_args::scan_args::<(), (Option<magnus::RHash>,), (), (), (), ()>(args)?;
|
|
1613
|
+
let (kwargs_opt,) = args.optional;
|
|
1614
|
+
let kwargs = kwargs_opt.unwrap_or_else(|| ruby.hash_new());
|
|
1615
|
+
Ok(Self {
|
|
1616
|
+
start: kwargs
|
|
1617
|
+
.get(ruby.to_symbol("start"))
|
|
1618
|
+
.and_then(|v| usize::try_convert(v).ok())
|
|
1619
|
+
.unwrap_or_default(),
|
|
1620
|
+
end: kwargs
|
|
1621
|
+
.get(ruby.to_symbol("end"))
|
|
1622
|
+
.and_then(|v| usize::try_convert(v).ok())
|
|
1623
|
+
.unwrap_or_default(),
|
|
1624
|
+
})
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
fn start(&self) -> usize {
|
|
1628
|
+
self.start
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
fn end(&self) -> usize {
|
|
1632
|
+
self.end
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
#[derive(Clone)]
|
|
1637
|
+
#[magnus::wrap(class = "TreeSitterLanguagePack::Parser")]
|
|
1638
|
+
pub struct Parser {
|
|
1639
|
+
inner: Arc<std::sync::Mutex<tree_sitter_language_pack::Parser>>,
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
unsafe impl IntoValueFromNative for Parser {}
|
|
1643
|
+
|
|
1644
|
+
impl magnus::TryConvert for Parser {
|
|
1645
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
1646
|
+
let r: &Parser = magnus::TryConvert::try_convert(val)?;
|
|
1647
|
+
Ok(r.clone())
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
unsafe impl TryConvertOwned for Parser {}
|
|
1652
|
+
|
|
1653
|
+
impl Parser {
|
|
1654
|
+
fn set_language(&self, name: String) -> Result<(), Error> {
|
|
1655
|
+
self.inner.lock().unwrap().set_language(&name).map_err(|e| {
|
|
1656
|
+
magnus::Error::new(
|
|
1657
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
1658
|
+
e.to_string(),
|
|
1659
|
+
)
|
|
1660
|
+
})?;
|
|
1661
|
+
Ok(())
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
fn parse(&self, source: String) -> Option<Tree> {
|
|
1665
|
+
self.inner
|
|
1666
|
+
.lock()
|
|
1667
|
+
.unwrap()
|
|
1668
|
+
.parse(&source)
|
|
1669
|
+
.map(|v| Tree { inner: Arc::new(v) })
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
fn parse_bytes(&self, source: Vec<u8>) -> Option<Tree> {
|
|
1673
|
+
self.inner
|
|
1674
|
+
.lock()
|
|
1675
|
+
.unwrap()
|
|
1676
|
+
.parse_bytes(&source)
|
|
1677
|
+
.map(|v| Tree { inner: Arc::new(v) })
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
fn reset(&self) -> () {
|
|
1681
|
+
self.inner.lock().unwrap().reset()
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
#[derive(Clone)]
|
|
1686
|
+
#[magnus::wrap(class = "TreeSitterLanguagePack::Tree")]
|
|
1687
|
+
pub struct Tree {
|
|
1688
|
+
inner: Arc<tree_sitter_language_pack::Tree>,
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
unsafe impl IntoValueFromNative for Tree {}
|
|
1692
|
+
|
|
1693
|
+
impl magnus::TryConvert for Tree {
|
|
1694
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
1695
|
+
let r: &Tree = magnus::TryConvert::try_convert(val)?;
|
|
1696
|
+
Ok(r.clone())
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
|
|
1700
|
+
unsafe impl TryConvertOwned for Tree {}
|
|
1701
|
+
|
|
1702
|
+
impl Tree {
|
|
1703
|
+
fn root_node(&self) -> Node {
|
|
1704
|
+
Node {
|
|
1705
|
+
inner: Arc::new(self.inner.root_node()),
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
fn walk(&self) -> TreeCursor {
|
|
1710
|
+
TreeCursor {
|
|
1711
|
+
inner: Arc::new(std::sync::Mutex::new(self.inner.walk())),
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
#[derive(Clone)]
|
|
1717
|
+
#[magnus::wrap(class = "TreeSitterLanguagePack::Node")]
|
|
1718
|
+
pub struct Node {
|
|
1719
|
+
inner: Arc<tree_sitter_language_pack::Node>,
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1722
|
+
unsafe impl IntoValueFromNative for Node {}
|
|
1723
|
+
|
|
1724
|
+
impl magnus::TryConvert for Node {
|
|
1725
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
1726
|
+
let r: &Node = magnus::TryConvert::try_convert(val)?;
|
|
1727
|
+
Ok(r.clone())
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
unsafe impl TryConvertOwned for Node {}
|
|
1732
|
+
|
|
1733
|
+
impl Node {
|
|
1734
|
+
fn clone(&self) -> Node {
|
|
1735
|
+
Self {
|
|
1736
|
+
inner: self.inner.clone(),
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
fn kind(&self) -> String {
|
|
1741
|
+
self.inner.kind()
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
fn kind_id(&self) -> u16 {
|
|
1745
|
+
self.inner.kind_id()
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
fn start_byte(&self) -> usize {
|
|
1749
|
+
self.inner.start_byte()
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
fn end_byte(&self) -> usize {
|
|
1753
|
+
self.inner.end_byte()
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
fn byte_range(&self) -> ByteRange {
|
|
1757
|
+
self.inner.byte_range().into()
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
fn start_position(&self) -> Point {
|
|
1761
|
+
self.inner.start_position().into()
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
fn end_position(&self) -> Point {
|
|
1765
|
+
self.inner.end_position().into()
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
fn is_named(&self) -> bool {
|
|
1769
|
+
self.inner.is_named()
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
fn is_error(&self) -> bool {
|
|
1773
|
+
self.inner.is_error()
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
fn is_missing(&self) -> bool {
|
|
1777
|
+
self.inner.is_missing()
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
fn is_extra(&self) -> bool {
|
|
1781
|
+
self.inner.is_extra()
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
fn has_error(&self) -> bool {
|
|
1785
|
+
self.inner.has_error()
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
fn parent(&self) -> Option<Node> {
|
|
1789
|
+
self.inner.parent().map(|v| Node { inner: Arc::new(v) })
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
fn child(&self, index: u32) -> Option<Node> {
|
|
1793
|
+
self.inner.child(index).map(|v| Node { inner: Arc::new(v) })
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1796
|
+
fn child_count(&self) -> usize {
|
|
1797
|
+
self.inner.child_count()
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
fn named_child(&self, index: u32) -> Option<Node> {
|
|
1801
|
+
self.inner.named_child(index).map(|v| Node { inner: Arc::new(v) })
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1804
|
+
fn named_child_count(&self) -> usize {
|
|
1805
|
+
self.inner.named_child_count()
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
fn child_by_field_name(&self, name: String) -> Option<Node> {
|
|
1809
|
+
self.inner
|
|
1810
|
+
.child_by_field_name(&name)
|
|
1811
|
+
.map(|v| Node { inner: Arc::new(v) })
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1814
|
+
fn to_sexp(&self) -> String {
|
|
1815
|
+
self.inner.to_sexp()
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1818
|
+
fn walk(&self) -> TreeCursor {
|
|
1819
|
+
TreeCursor {
|
|
1820
|
+
inner: Arc::new(std::sync::Mutex::new(self.inner.walk())),
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
#[derive(Clone)]
|
|
1826
|
+
#[magnus::wrap(class = "TreeSitterLanguagePack::TreeCursor")]
|
|
1827
|
+
pub struct TreeCursor {
|
|
1828
|
+
inner: Arc<std::sync::Mutex<tree_sitter_language_pack::TreeCursor>>,
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
unsafe impl IntoValueFromNative for TreeCursor {}
|
|
1832
|
+
|
|
1833
|
+
impl magnus::TryConvert for TreeCursor {
|
|
1834
|
+
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
1835
|
+
let r: &TreeCursor = magnus::TryConvert::try_convert(val)?;
|
|
1836
|
+
Ok(r.clone())
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
unsafe impl TryConvertOwned for TreeCursor {}
|
|
1841
|
+
|
|
1842
|
+
impl TreeCursor {
|
|
1843
|
+
fn node(&self) -> Node {
|
|
1844
|
+
Node {
|
|
1845
|
+
inner: Arc::new(self.inner.lock().unwrap().node()),
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
|
|
1849
|
+
fn goto_first_child(&self) -> bool {
|
|
1850
|
+
self.inner.lock().unwrap().goto_first_child()
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1853
|
+
fn goto_parent(&self) -> bool {
|
|
1854
|
+
self.inner.lock().unwrap().goto_parent()
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
fn goto_next_sibling(&self) -> bool {
|
|
1858
|
+
self.inner.lock().unwrap().goto_next_sibling()
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
fn field_name(&self) -> Option<String> {
|
|
1862
|
+
self.inner.lock().unwrap().field_name()
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1437
1866
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
1438
1867
|
#[serde(default)]
|
|
1439
1868
|
#[magnus::wrap(class = "TreeSitterLanguagePack::ProcessConfig")]
|
|
@@ -1681,14 +2110,18 @@ impl LanguageRegistry {
|
|
|
1681
2110
|
}
|
|
1682
2111
|
|
|
1683
2112
|
fn process(&self, source: String, config: ProcessConfig) -> Result<ProcessResult, Error> {
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
2113
|
+
let config_core: tree_sitter_language_pack::ProcessConfig = config.into();
|
|
2114
|
+
let result = self.inner.process(&source, &config_core).map_err(|e| {
|
|
2115
|
+
magnus::Error::new(
|
|
2116
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
2117
|
+
e.to_string(),
|
|
2118
|
+
)
|
|
2119
|
+
})?;
|
|
2120
|
+
Ok(result.into())
|
|
1688
2121
|
}
|
|
1689
2122
|
}
|
|
1690
2123
|
|
|
1691
|
-
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize
|
|
2124
|
+
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
1692
2125
|
#[magnus::wrap(class = "TreeSitterLanguagePack::ParserManifest")]
|
|
1693
2126
|
pub struct ParserManifest {
|
|
1694
2127
|
version: String,
|
|
@@ -1768,7 +2201,7 @@ impl ParserManifest {
|
|
|
1768
2201
|
}
|
|
1769
2202
|
}
|
|
1770
2203
|
|
|
1771
|
-
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize
|
|
2204
|
+
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
1772
2205
|
#[magnus::wrap(class = "TreeSitterLanguagePack::PlatformBundle")]
|
|
1773
2206
|
pub struct PlatformBundle {
|
|
1774
2207
|
url: String,
|
|
@@ -1839,7 +2272,7 @@ impl PlatformBundle {
|
|
|
1839
2272
|
}
|
|
1840
2273
|
}
|
|
1841
2274
|
|
|
1842
|
-
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize
|
|
2275
|
+
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
1843
2276
|
#[magnus::wrap(class = "TreeSitterLanguagePack::LanguageInfo")]
|
|
1844
2277
|
pub struct LanguageInfo {
|
|
1845
2278
|
group: String,
|
|
@@ -1928,10 +2361,14 @@ impl DownloadManager {
|
|
|
1928
2361
|
}
|
|
1929
2362
|
|
|
1930
2363
|
fn ensure_languages(&self, names: Vec<String>) -> Result<(), Error> {
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
2364
|
+
let names_refs: Vec<&str> = names.iter().map(|s| s.as_str()).collect();
|
|
2365
|
+
self.inner.ensure_languages(&names_refs).map_err(|e| {
|
|
2366
|
+
magnus::Error::new(
|
|
2367
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
2368
|
+
e.to_string(),
|
|
2369
|
+
)
|
|
2370
|
+
})?;
|
|
2371
|
+
Ok(())
|
|
1935
2372
|
}
|
|
1936
2373
|
|
|
1937
2374
|
fn ensure_group(&self, group: String) -> Result<(), Error> {
|
|
@@ -1963,78 +2400,40 @@ impl DownloadManager {
|
|
|
1963
2400
|
magnus::Error::new(
|
|
1964
2401
|
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
1965
2402
|
e.to_string(),
|
|
1966
|
-
)
|
|
1967
|
-
})?;
|
|
1968
|
-
Ok(result)
|
|
1969
|
-
}
|
|
1970
|
-
|
|
1971
|
-
fn clean_cache(&self) -> Result<(), Error> {
|
|
1972
|
-
self.inner.clean_cache().map_err(|e| {
|
|
1973
|
-
magnus::Error::new(
|
|
1974
|
-
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
1975
|
-
e.to_string(),
|
|
1976
|
-
)
|
|
1977
|
-
})?;
|
|
1978
|
-
Ok(())
|
|
1979
|
-
}
|
|
1980
|
-
}
|
|
1981
|
-
|
|
1982
|
-
#[derive(Clone)]
|
|
1983
|
-
#[magnus::wrap(class = "TreeSitterLanguagePack::Language")]
|
|
1984
|
-
pub struct Language {
|
|
1985
|
-
inner: Arc<tree_sitter_language_pack::Language>,
|
|
1986
|
-
}
|
|
1987
|
-
|
|
1988
|
-
unsafe impl IntoValueFromNative for Language {}
|
|
1989
|
-
|
|
1990
|
-
impl magnus::TryConvert for Language {
|
|
1991
|
-
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
1992
|
-
let r: &Language = magnus::TryConvert::try_convert(val)?;
|
|
1993
|
-
Ok(r.clone())
|
|
1994
|
-
}
|
|
1995
|
-
}
|
|
1996
|
-
|
|
1997
|
-
unsafe impl TryConvertOwned for Language {}
|
|
1998
|
-
|
|
1999
|
-
impl Language {}
|
|
2000
|
-
|
|
2001
|
-
#[derive(Clone)]
|
|
2002
|
-
#[magnus::wrap(class = "TreeSitterLanguagePack::Parser")]
|
|
2003
|
-
pub struct Parser {
|
|
2004
|
-
inner: Arc<tree_sitter_language_pack::Parser>,
|
|
2005
|
-
}
|
|
2006
|
-
|
|
2007
|
-
unsafe impl IntoValueFromNative for Parser {}
|
|
2403
|
+
)
|
|
2404
|
+
})?;
|
|
2405
|
+
Ok(result)
|
|
2406
|
+
}
|
|
2008
2407
|
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2408
|
+
fn clean_cache(&self) -> Result<(), Error> {
|
|
2409
|
+
self.inner.clean_cache().map_err(|e| {
|
|
2410
|
+
magnus::Error::new(
|
|
2411
|
+
unsafe { Ruby::get_unchecked() }.exception_runtime_error(),
|
|
2412
|
+
e.to_string(),
|
|
2413
|
+
)
|
|
2414
|
+
})?;
|
|
2415
|
+
Ok(())
|
|
2013
2416
|
}
|
|
2014
2417
|
}
|
|
2015
2418
|
|
|
2016
|
-
unsafe impl TryConvertOwned for Parser {}
|
|
2017
|
-
|
|
2018
|
-
impl Parser {}
|
|
2019
|
-
|
|
2020
2419
|
#[derive(Clone)]
|
|
2021
|
-
#[magnus::wrap(class = "TreeSitterLanguagePack::
|
|
2022
|
-
pub struct
|
|
2023
|
-
inner: Arc<tree_sitter_language_pack::
|
|
2420
|
+
#[magnus::wrap(class = "TreeSitterLanguagePack::Language")]
|
|
2421
|
+
pub struct Language {
|
|
2422
|
+
inner: Arc<tree_sitter_language_pack::Language>,
|
|
2024
2423
|
}
|
|
2025
2424
|
|
|
2026
|
-
unsafe impl IntoValueFromNative for
|
|
2425
|
+
unsafe impl IntoValueFromNative for Language {}
|
|
2027
2426
|
|
|
2028
|
-
impl magnus::TryConvert for
|
|
2427
|
+
impl magnus::TryConvert for Language {
|
|
2029
2428
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
2030
|
-
let r: &
|
|
2429
|
+
let r: &Language = magnus::TryConvert::try_convert(val)?;
|
|
2031
2430
|
Ok(r.clone())
|
|
2032
2431
|
}
|
|
2033
2432
|
}
|
|
2034
2433
|
|
|
2035
|
-
unsafe impl TryConvertOwned for
|
|
2434
|
+
unsafe impl TryConvertOwned for Language {}
|
|
2036
2435
|
|
|
2037
|
-
impl
|
|
2436
|
+
impl Language {}
|
|
2038
2437
|
|
|
2039
2438
|
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
|
|
2040
2439
|
pub enum StructureKind {
|
|
@@ -2115,10 +2514,12 @@ impl magnus::IntoValue for CommentKind {
|
|
|
2115
2514
|
impl magnus::TryConvert for CommentKind {
|
|
2116
2515
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
2117
2516
|
let s: String = magnus::TryConvert::try_convert(val)?;
|
|
2517
|
+
// Accept the serde wire name (snake_case), the PascalCase Rust variant name,
|
|
2518
|
+
// and a lowercase fallback so fixtures written in any of those styles work.
|
|
2118
2519
|
match s.as_str() {
|
|
2119
|
-
"line" => Ok(CommentKind::Line),
|
|
2120
|
-
"block" => Ok(CommentKind::Block),
|
|
2121
|
-
"doc" => Ok(CommentKind::Doc),
|
|
2520
|
+
"line" | "Line" => Ok(CommentKind::Line),
|
|
2521
|
+
"block" | "Block" => Ok(CommentKind::Block),
|
|
2522
|
+
"doc" | "Doc" => Ok(CommentKind::Doc),
|
|
2122
2523
|
other => Err(magnus::Error::new(
|
|
2123
2524
|
unsafe { Ruby::get_unchecked() }.exception_arg_error(),
|
|
2124
2525
|
format!("invalid CommentKind value: {other}"),
|
|
@@ -2204,10 +2605,12 @@ impl magnus::IntoValue for ExportKind {
|
|
|
2204
2605
|
impl magnus::TryConvert for ExportKind {
|
|
2205
2606
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
2206
2607
|
let s: String = magnus::TryConvert::try_convert(val)?;
|
|
2608
|
+
// Accept the serde wire name (snake_case), the PascalCase Rust variant name,
|
|
2609
|
+
// and a lowercase fallback so fixtures written in any of those styles work.
|
|
2207
2610
|
match s.as_str() {
|
|
2208
|
-
"named" => Ok(ExportKind::Named),
|
|
2209
|
-
"default" => Ok(ExportKind::Default),
|
|
2210
|
-
"re_export" => Ok(ExportKind::ReExport),
|
|
2611
|
+
"named" | "Named" => Ok(ExportKind::Named),
|
|
2612
|
+
"default" | "Default" => Ok(ExportKind::Default),
|
|
2613
|
+
"re_export" | "ReExport" => Ok(ExportKind::ReExport),
|
|
2211
2614
|
other => Err(magnus::Error::new(
|
|
2212
2615
|
unsafe { Ruby::get_unchecked() }.exception_arg_error(),
|
|
2213
2616
|
format!("invalid ExportKind value: {other}"),
|
|
@@ -2296,10 +2699,12 @@ impl magnus::IntoValue for DiagnosticSeverity {
|
|
|
2296
2699
|
impl magnus::TryConvert for DiagnosticSeverity {
|
|
2297
2700
|
fn try_convert(val: magnus::Value) -> Result<Self, magnus::Error> {
|
|
2298
2701
|
let s: String = magnus::TryConvert::try_convert(val)?;
|
|
2702
|
+
// Accept the serde wire name (snake_case), the PascalCase Rust variant name,
|
|
2703
|
+
// and a lowercase fallback so fixtures written in any of those styles work.
|
|
2299
2704
|
match s.as_str() {
|
|
2300
|
-
"error" => Ok(DiagnosticSeverity::Error),
|
|
2301
|
-
"warning" => Ok(DiagnosticSeverity::Warning),
|
|
2302
|
-
"info" => Ok(DiagnosticSeverity::Info),
|
|
2705
|
+
"error" | "Error" => Ok(DiagnosticSeverity::Error),
|
|
2706
|
+
"warning" | "Warning" => Ok(DiagnosticSeverity::Warning),
|
|
2707
|
+
"info" | "Info" => Ok(DiagnosticSeverity::Info),
|
|
2303
2708
|
other => Err(magnus::Error::new(
|
|
2304
2709
|
unsafe { Ruby::get_unchecked() }.exception_arg_error(),
|
|
2305
2710
|
format!("invalid DiagnosticSeverity value: {other}"),
|
|
@@ -2355,7 +2760,7 @@ fn get_parser(name: String) -> Result<Parser, Error> {
|
|
|
2355
2760
|
)
|
|
2356
2761
|
})?;
|
|
2357
2762
|
Ok(Parser {
|
|
2358
|
-
inner: Arc::new(result),
|
|
2763
|
+
inner: Arc::new(std::sync::Mutex::new(result)),
|
|
2359
2764
|
})
|
|
2360
2765
|
}
|
|
2361
2766
|
|
|
@@ -2378,7 +2783,9 @@ fn language_count() -> usize {
|
|
|
2378
2783
|
fn process(args: &[magnus::Value]) -> Result<ProcessResult, Error> {
|
|
2379
2784
|
let args = magnus::scan_args::scan_args::<(String,), (Option<magnus::Value>,), (), (), (), ()>(args)?;
|
|
2380
2785
|
let (source,) = args.required;
|
|
2786
|
+
|
|
2381
2787
|
let (config,) = args.optional;
|
|
2788
|
+
|
|
2382
2789
|
let config_core: tree_sitter_language_pack::ProcessConfig = match config {
|
|
2383
2790
|
Some(_v) if !_v.is_nil() => {
|
|
2384
2791
|
let binding_val: ProcessConfig = ProcessConfig::try_convert(_v).map_err(|e| {
|
|
@@ -2403,6 +2810,7 @@ fn process(args: &[magnus::Value]) -> Result<ProcessResult, Error> {
|
|
|
2403
2810
|
fn init(args: &[magnus::Value]) -> Result<(), Error> {
|
|
2404
2811
|
let args = magnus::scan_args::scan_args::<(), (Option<magnus::Value>,), (), (), (), ()>(args)?;
|
|
2405
2812
|
let (config,) = args.optional;
|
|
2813
|
+
|
|
2406
2814
|
let config_core: tree_sitter_language_pack::PackConfig = match config {
|
|
2407
2815
|
Some(_v) if !_v.is_nil() => {
|
|
2408
2816
|
let binding_val: PackConfig = PackConfig::try_convert(_v).map_err(|e| {
|
|
@@ -2427,6 +2835,7 @@ fn init(args: &[magnus::Value]) -> Result<(), Error> {
|
|
|
2427
2835
|
fn configure(args: &[magnus::Value]) -> Result<(), Error> {
|
|
2428
2836
|
let args = magnus::scan_args::scan_args::<(), (Option<magnus::Value>,), (), (), (), ()>(args)?;
|
|
2429
2837
|
let (config,) = args.optional;
|
|
2838
|
+
|
|
2430
2839
|
let config_core: tree_sitter_language_pack::PackConfig = match config {
|
|
2431
2840
|
Some(_v) if !_v.is_nil() => {
|
|
2432
2841
|
let binding_val: PackConfig = PackConfig::try_convert(_v).map_err(|e| {
|
|
@@ -2885,6 +3294,46 @@ impl From<tree_sitter_language_pack::PackConfig> for PackConfig {
|
|
|
2885
3294
|
}
|
|
2886
3295
|
}
|
|
2887
3296
|
|
|
3297
|
+
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
3298
|
+
impl From<Point> for tree_sitter_language_pack::Point {
|
|
3299
|
+
fn from(val: Point) -> Self {
|
|
3300
|
+
Self {
|
|
3301
|
+
row: val.row,
|
|
3302
|
+
column: val.column,
|
|
3303
|
+
}
|
|
3304
|
+
}
|
|
3305
|
+
}
|
|
3306
|
+
|
|
3307
|
+
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
3308
|
+
impl From<tree_sitter_language_pack::Point> for Point {
|
|
3309
|
+
fn from(val: tree_sitter_language_pack::Point) -> Self {
|
|
3310
|
+
Self {
|
|
3311
|
+
row: val.row,
|
|
3312
|
+
column: val.column,
|
|
3313
|
+
}
|
|
3314
|
+
}
|
|
3315
|
+
}
|
|
3316
|
+
|
|
3317
|
+
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
3318
|
+
impl From<ByteRange> for tree_sitter_language_pack::ByteRange {
|
|
3319
|
+
fn from(val: ByteRange) -> Self {
|
|
3320
|
+
Self {
|
|
3321
|
+
start: val.start,
|
|
3322
|
+
end: val.end,
|
|
3323
|
+
}
|
|
3324
|
+
}
|
|
3325
|
+
}
|
|
3326
|
+
|
|
3327
|
+
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
3328
|
+
impl From<tree_sitter_language_pack::ByteRange> for ByteRange {
|
|
3329
|
+
fn from(val: tree_sitter_language_pack::ByteRange) -> Self {
|
|
3330
|
+
Self {
|
|
3331
|
+
start: val.start,
|
|
3332
|
+
end: val.end,
|
|
3333
|
+
}
|
|
3334
|
+
}
|
|
3335
|
+
}
|
|
3336
|
+
|
|
2888
3337
|
#[allow(clippy::redundant_closure, clippy::useless_conversion)]
|
|
2889
3338
|
impl From<ProcessConfig> for tree_sitter_language_pack::ProcessConfig {
|
|
2890
3339
|
fn from(val: ProcessConfig) -> Self {
|
|
@@ -3150,214 +3599,440 @@ fn error_to_magnus_err(e: tree_sitter_language_pack::error::Error) -> magnus::Er
|
|
|
3150
3599
|
fn ruby_init(ruby: &Ruby) -> Result<(), Error> {
|
|
3151
3600
|
let module = ruby.define_module("TreeSitterLanguagePack")?;
|
|
3152
3601
|
|
|
3602
|
+
// Ensure JSON library is loaded for Hash#to_json
|
|
3603
|
+
let _ = ruby.eval::<magnus::Value>("require \"json\"");
|
|
3604
|
+
|
|
3153
3605
|
let class = module.define_class("Span", ruby.class_object())?;
|
|
3606
|
+
|
|
3154
3607
|
class.define_singleton_method("new", function!(Span::new, -1))?;
|
|
3608
|
+
|
|
3155
3609
|
class.define_method("start_byte", method!(Span::start_byte, 0))?;
|
|
3610
|
+
|
|
3156
3611
|
class.define_method("end_byte", method!(Span::end_byte, 0))?;
|
|
3612
|
+
|
|
3157
3613
|
class.define_method("start_line", method!(Span::start_line, 0))?;
|
|
3614
|
+
|
|
3158
3615
|
class.define_method("start_column", method!(Span::start_column, 0))?;
|
|
3616
|
+
|
|
3159
3617
|
class.define_method("end_line", method!(Span::end_line, 0))?;
|
|
3618
|
+
|
|
3160
3619
|
class.define_method("end_column", method!(Span::end_column, 0))?;
|
|
3161
3620
|
|
|
3162
3621
|
let class = module.define_class("ProcessResult", ruby.class_object())?;
|
|
3622
|
+
|
|
3163
3623
|
class.define_singleton_method("new", function!(ProcessResult::new, -1))?;
|
|
3624
|
+
|
|
3164
3625
|
class.define_method("language", method!(ProcessResult::language, 0))?;
|
|
3626
|
+
|
|
3165
3627
|
class.define_method("metrics", method!(ProcessResult::metrics, 0))?;
|
|
3628
|
+
|
|
3166
3629
|
class.define_method("structure", method!(ProcessResult::structure, 0))?;
|
|
3630
|
+
|
|
3167
3631
|
class.define_method("imports", method!(ProcessResult::imports, 0))?;
|
|
3632
|
+
|
|
3168
3633
|
class.define_method("exports", method!(ProcessResult::exports, 0))?;
|
|
3634
|
+
|
|
3169
3635
|
class.define_method("comments", method!(ProcessResult::comments, 0))?;
|
|
3636
|
+
|
|
3170
3637
|
class.define_method("docstrings", method!(ProcessResult::docstrings, 0))?;
|
|
3638
|
+
|
|
3171
3639
|
class.define_method("symbols", method!(ProcessResult::symbols, 0))?;
|
|
3640
|
+
|
|
3172
3641
|
class.define_method("diagnostics", method!(ProcessResult::diagnostics, 0))?;
|
|
3642
|
+
|
|
3173
3643
|
class.define_method("chunks", method!(ProcessResult::chunks, 0))?;
|
|
3174
3644
|
|
|
3175
3645
|
let class = module.define_class("FileMetrics", ruby.class_object())?;
|
|
3646
|
+
|
|
3176
3647
|
class.define_singleton_method("new", function!(FileMetrics::new, -1))?;
|
|
3648
|
+
|
|
3177
3649
|
class.define_method("total_lines", method!(FileMetrics::total_lines, 0))?;
|
|
3650
|
+
|
|
3178
3651
|
class.define_method("code_lines", method!(FileMetrics::code_lines, 0))?;
|
|
3652
|
+
|
|
3179
3653
|
class.define_method("comment_lines", method!(FileMetrics::comment_lines, 0))?;
|
|
3654
|
+
|
|
3180
3655
|
class.define_method("blank_lines", method!(FileMetrics::blank_lines, 0))?;
|
|
3656
|
+
|
|
3181
3657
|
class.define_method("total_bytes", method!(FileMetrics::total_bytes, 0))?;
|
|
3658
|
+
|
|
3182
3659
|
class.define_method("node_count", method!(FileMetrics::node_count, 0))?;
|
|
3660
|
+
|
|
3183
3661
|
class.define_method("error_count", method!(FileMetrics::error_count, 0))?;
|
|
3662
|
+
|
|
3184
3663
|
class.define_method("max_depth", method!(FileMetrics::max_depth, 0))?;
|
|
3185
3664
|
|
|
3186
3665
|
let class = module.define_class("StructureItem", ruby.class_object())?;
|
|
3666
|
+
|
|
3187
3667
|
class.define_singleton_method("new", function!(StructureItem::new, -1))?;
|
|
3668
|
+
|
|
3188
3669
|
class.define_method("kind", method!(StructureItem::kind, 0))?;
|
|
3670
|
+
|
|
3189
3671
|
class.define_method("name", method!(StructureItem::name, 0))?;
|
|
3672
|
+
|
|
3190
3673
|
class.define_method("visibility", method!(StructureItem::visibility, 0))?;
|
|
3674
|
+
|
|
3191
3675
|
class.define_method("span", method!(StructureItem::span, 0))?;
|
|
3676
|
+
|
|
3192
3677
|
class.define_method("children", method!(StructureItem::children, 0))?;
|
|
3678
|
+
|
|
3193
3679
|
class.define_method("decorators", method!(StructureItem::decorators, 0))?;
|
|
3680
|
+
|
|
3194
3681
|
class.define_method("doc_comment", method!(StructureItem::doc_comment, 0))?;
|
|
3682
|
+
|
|
3195
3683
|
class.define_method("signature", method!(StructureItem::signature, 0))?;
|
|
3684
|
+
|
|
3196
3685
|
class.define_method("body_span", method!(StructureItem::body_span, 0))?;
|
|
3197
3686
|
|
|
3198
3687
|
let class = module.define_class("CommentInfo", ruby.class_object())?;
|
|
3688
|
+
|
|
3199
3689
|
class.define_singleton_method("new", function!(CommentInfo::new, -1))?;
|
|
3690
|
+
|
|
3200
3691
|
class.define_method("text", method!(CommentInfo::text, 0))?;
|
|
3692
|
+
|
|
3201
3693
|
class.define_method("kind", method!(CommentInfo::kind, 0))?;
|
|
3694
|
+
|
|
3202
3695
|
class.define_method("span", method!(CommentInfo::span, 0))?;
|
|
3696
|
+
|
|
3203
3697
|
class.define_method("associated_node", method!(CommentInfo::associated_node, 0))?;
|
|
3204
3698
|
|
|
3205
3699
|
let class = module.define_class("DocstringInfo", ruby.class_object())?;
|
|
3700
|
+
|
|
3206
3701
|
class.define_singleton_method("new", function!(DocstringInfo::new, -1))?;
|
|
3702
|
+
|
|
3207
3703
|
class.define_method("text", method!(DocstringInfo::text, 0))?;
|
|
3704
|
+
|
|
3208
3705
|
class.define_method("format", method!(DocstringInfo::format, 0))?;
|
|
3706
|
+
|
|
3209
3707
|
class.define_method("span", method!(DocstringInfo::span, 0))?;
|
|
3708
|
+
|
|
3210
3709
|
class.define_method("associated_item", method!(DocstringInfo::associated_item, 0))?;
|
|
3710
|
+
|
|
3211
3711
|
class.define_method("parsed_sections", method!(DocstringInfo::parsed_sections, 0))?;
|
|
3212
3712
|
|
|
3213
3713
|
let class = module.define_class("DocSection", ruby.class_object())?;
|
|
3714
|
+
|
|
3214
3715
|
class.define_singleton_method("new", function!(DocSection::new, -1))?;
|
|
3716
|
+
|
|
3215
3717
|
class.define_method("kind", method!(DocSection::kind, 0))?;
|
|
3718
|
+
|
|
3216
3719
|
class.define_method("name", method!(DocSection::name, 0))?;
|
|
3720
|
+
|
|
3217
3721
|
class.define_method("description", method!(DocSection::description, 0))?;
|
|
3218
3722
|
|
|
3219
3723
|
let class = module.define_class("ImportInfo", ruby.class_object())?;
|
|
3724
|
+
|
|
3220
3725
|
class.define_singleton_method("new", function!(ImportInfo::new, -1))?;
|
|
3726
|
+
|
|
3221
3727
|
class.define_method("source", method!(ImportInfo::source, 0))?;
|
|
3728
|
+
|
|
3222
3729
|
class.define_method("items", method!(ImportInfo::items, 0))?;
|
|
3730
|
+
|
|
3223
3731
|
class.define_method("alias", method!(ImportInfo::alias, 0))?;
|
|
3732
|
+
|
|
3224
3733
|
class.define_method("is_wildcard", method!(ImportInfo::is_wildcard, 0))?;
|
|
3734
|
+
|
|
3225
3735
|
class.define_method("span", method!(ImportInfo::span, 0))?;
|
|
3226
3736
|
|
|
3227
3737
|
let class = module.define_class("ExportInfo", ruby.class_object())?;
|
|
3738
|
+
|
|
3228
3739
|
class.define_singleton_method("new", function!(ExportInfo::new, -1))?;
|
|
3740
|
+
|
|
3229
3741
|
class.define_method("name", method!(ExportInfo::name, 0))?;
|
|
3742
|
+
|
|
3230
3743
|
class.define_method("kind", method!(ExportInfo::kind, 0))?;
|
|
3744
|
+
|
|
3231
3745
|
class.define_method("span", method!(ExportInfo::span, 0))?;
|
|
3232
3746
|
|
|
3233
3747
|
let class = module.define_class("SymbolInfo", ruby.class_object())?;
|
|
3748
|
+
|
|
3234
3749
|
class.define_singleton_method("new", function!(SymbolInfo::new, -1))?;
|
|
3750
|
+
|
|
3235
3751
|
class.define_method("name", method!(SymbolInfo::name, 0))?;
|
|
3752
|
+
|
|
3236
3753
|
class.define_method("kind", method!(SymbolInfo::kind, 0))?;
|
|
3754
|
+
|
|
3237
3755
|
class.define_method("span", method!(SymbolInfo::span, 0))?;
|
|
3756
|
+
|
|
3238
3757
|
class.define_method("type_annotation", method!(SymbolInfo::type_annotation, 0))?;
|
|
3758
|
+
|
|
3239
3759
|
class.define_method("doc", method!(SymbolInfo::doc, 0))?;
|
|
3240
3760
|
|
|
3241
3761
|
let class = module.define_class("Diagnostic", ruby.class_object())?;
|
|
3762
|
+
|
|
3242
3763
|
class.define_singleton_method("new", function!(Diagnostic::new, -1))?;
|
|
3764
|
+
|
|
3243
3765
|
class.define_method("message", method!(Diagnostic::message, 0))?;
|
|
3766
|
+
|
|
3244
3767
|
class.define_method("severity", method!(Diagnostic::severity, 0))?;
|
|
3768
|
+
|
|
3245
3769
|
class.define_method("span", method!(Diagnostic::span, 0))?;
|
|
3246
3770
|
|
|
3247
3771
|
let class = module.define_class("CodeChunk", ruby.class_object())?;
|
|
3772
|
+
|
|
3248
3773
|
class.define_singleton_method("new", function!(CodeChunk::new, -1))?;
|
|
3774
|
+
|
|
3249
3775
|
class.define_method("content", method!(CodeChunk::content, 0))?;
|
|
3776
|
+
|
|
3250
3777
|
class.define_method("start_byte", method!(CodeChunk::start_byte, 0))?;
|
|
3778
|
+
|
|
3251
3779
|
class.define_method("end_byte", method!(CodeChunk::end_byte, 0))?;
|
|
3780
|
+
|
|
3252
3781
|
class.define_method("start_line", method!(CodeChunk::start_line, 0))?;
|
|
3782
|
+
|
|
3253
3783
|
class.define_method("end_line", method!(CodeChunk::end_line, 0))?;
|
|
3784
|
+
|
|
3254
3785
|
class.define_method("metadata", method!(CodeChunk::metadata, 0))?;
|
|
3786
|
+
|
|
3255
3787
|
class.define_method("to_s", method!(CodeChunk::to_s, 0))?;
|
|
3256
3788
|
|
|
3257
3789
|
let class = module.define_class("ChunkContext", ruby.class_object())?;
|
|
3790
|
+
|
|
3258
3791
|
class.define_singleton_method("new", function!(ChunkContext::new, -1))?;
|
|
3792
|
+
|
|
3259
3793
|
class.define_method("language", method!(ChunkContext::language, 0))?;
|
|
3794
|
+
|
|
3260
3795
|
class.define_method("chunk_index", method!(ChunkContext::chunk_index, 0))?;
|
|
3796
|
+
|
|
3261
3797
|
class.define_method("total_chunks", method!(ChunkContext::total_chunks, 0))?;
|
|
3798
|
+
|
|
3262
3799
|
class.define_method("node_types", method!(ChunkContext::node_types, 0))?;
|
|
3800
|
+
|
|
3263
3801
|
class.define_method("context_path", method!(ChunkContext::context_path, 0))?;
|
|
3802
|
+
|
|
3264
3803
|
class.define_method("symbols_defined", method!(ChunkContext::symbols_defined, 0))?;
|
|
3804
|
+
|
|
3265
3805
|
class.define_method("comments", method!(ChunkContext::comments, 0))?;
|
|
3806
|
+
|
|
3266
3807
|
class.define_method("docstrings", method!(ChunkContext::docstrings, 0))?;
|
|
3808
|
+
|
|
3267
3809
|
class.define_method("has_error_nodes", method!(ChunkContext::has_error_nodes, 0))?;
|
|
3268
3810
|
|
|
3269
3811
|
let class = module.define_class("PackConfig", ruby.class_object())?;
|
|
3812
|
+
|
|
3270
3813
|
class.define_singleton_method("new", function!(PackConfig::new, -1))?;
|
|
3814
|
+
|
|
3271
3815
|
class.define_method("cache_dir", method!(PackConfig::cache_dir, 0))?;
|
|
3816
|
+
|
|
3272
3817
|
class.define_method("languages", method!(PackConfig::languages, 0))?;
|
|
3818
|
+
|
|
3273
3819
|
class.define_method("groups", method!(PackConfig::groups, 0))?;
|
|
3274
3820
|
|
|
3821
|
+
let class = module.define_class("Point", ruby.class_object())?;
|
|
3822
|
+
|
|
3823
|
+
class.define_singleton_method("new", function!(Point::new, -1))?;
|
|
3824
|
+
|
|
3825
|
+
class.define_method("row", method!(Point::row, 0))?;
|
|
3826
|
+
|
|
3827
|
+
class.define_method("column", method!(Point::column, 0))?;
|
|
3828
|
+
|
|
3829
|
+
let class = module.define_class("ByteRange", ruby.class_object())?;
|
|
3830
|
+
|
|
3831
|
+
class.define_singleton_method("new", function!(ByteRange::new, -1))?;
|
|
3832
|
+
|
|
3833
|
+
class.define_method("start", method!(ByteRange::start, 0))?;
|
|
3834
|
+
|
|
3835
|
+
class.define_method("end", method!(ByteRange::end, 0))?;
|
|
3836
|
+
|
|
3837
|
+
let class = module.define_class("Parser", ruby.class_object())?;
|
|
3838
|
+
|
|
3839
|
+
let class = module.define_class("Tree", ruby.class_object())?;
|
|
3840
|
+
|
|
3841
|
+
class.define_method("root_node", method!(Tree::root_node, 0))?;
|
|
3842
|
+
|
|
3843
|
+
class.define_method("walk", method!(Tree::walk, 0))?;
|
|
3844
|
+
|
|
3845
|
+
let class = module.define_class("Node", ruby.class_object())?;
|
|
3846
|
+
|
|
3847
|
+
class.define_method("clone", method!(Node::clone, 0))?;
|
|
3848
|
+
|
|
3849
|
+
class.define_method("kind", method!(Node::kind, 0))?;
|
|
3850
|
+
|
|
3851
|
+
class.define_method("kind_id", method!(Node::kind_id, 0))?;
|
|
3852
|
+
|
|
3853
|
+
class.define_method("start_byte", method!(Node::start_byte, 0))?;
|
|
3854
|
+
|
|
3855
|
+
class.define_method("end_byte", method!(Node::end_byte, 0))?;
|
|
3856
|
+
|
|
3857
|
+
class.define_method("byte_range", method!(Node::byte_range, 0))?;
|
|
3858
|
+
|
|
3859
|
+
class.define_method("start_position", method!(Node::start_position, 0))?;
|
|
3860
|
+
|
|
3861
|
+
class.define_method("end_position", method!(Node::end_position, 0))?;
|
|
3862
|
+
|
|
3863
|
+
class.define_method("is_named", method!(Node::is_named, 0))?;
|
|
3864
|
+
|
|
3865
|
+
class.define_method("is_error", method!(Node::is_error, 0))?;
|
|
3866
|
+
|
|
3867
|
+
class.define_method("is_missing", method!(Node::is_missing, 0))?;
|
|
3868
|
+
|
|
3869
|
+
class.define_method("is_extra", method!(Node::is_extra, 0))?;
|
|
3870
|
+
|
|
3871
|
+
class.define_method("has_error", method!(Node::has_error, 0))?;
|
|
3872
|
+
|
|
3873
|
+
class.define_method("parent", method!(Node::parent, 0))?;
|
|
3874
|
+
|
|
3875
|
+
class.define_method("child", method!(Node::child, 1))?;
|
|
3876
|
+
|
|
3877
|
+
class.define_method("child_count", method!(Node::child_count, 0))?;
|
|
3878
|
+
|
|
3879
|
+
class.define_method("named_child", method!(Node::named_child, 1))?;
|
|
3880
|
+
|
|
3881
|
+
class.define_method("named_child_count", method!(Node::named_child_count, 0))?;
|
|
3882
|
+
|
|
3883
|
+
class.define_method("child_by_field_name", method!(Node::child_by_field_name, 1))?;
|
|
3884
|
+
|
|
3885
|
+
class.define_method("to_sexp", method!(Node::to_sexp, 0))?;
|
|
3886
|
+
|
|
3887
|
+
class.define_method("walk", method!(Node::walk, 0))?;
|
|
3888
|
+
|
|
3889
|
+
let class = module.define_class("TreeCursor", ruby.class_object())?;
|
|
3890
|
+
|
|
3891
|
+
class.define_method("node", method!(TreeCursor::node, 0))?;
|
|
3892
|
+
|
|
3893
|
+
class.define_method("field_name", method!(TreeCursor::field_name, 0))?;
|
|
3894
|
+
|
|
3275
3895
|
let class = module.define_class("ProcessConfig", ruby.class_object())?;
|
|
3896
|
+
|
|
3276
3897
|
class.define_singleton_method("new", function!(ProcessConfig::new, -1))?;
|
|
3898
|
+
|
|
3277
3899
|
class.define_method("language", method!(ProcessConfig::language, 0))?;
|
|
3900
|
+
|
|
3278
3901
|
class.define_method("structure", method!(ProcessConfig::structure, 0))?;
|
|
3902
|
+
|
|
3279
3903
|
class.define_method("imports", method!(ProcessConfig::imports, 0))?;
|
|
3904
|
+
|
|
3280
3905
|
class.define_method("exports", method!(ProcessConfig::exports, 0))?;
|
|
3906
|
+
|
|
3281
3907
|
class.define_method("comments", method!(ProcessConfig::comments, 0))?;
|
|
3908
|
+
|
|
3282
3909
|
class.define_method("docstrings", method!(ProcessConfig::docstrings, 0))?;
|
|
3910
|
+
|
|
3283
3911
|
class.define_method("symbols", method!(ProcessConfig::symbols, 0))?;
|
|
3912
|
+
|
|
3284
3913
|
class.define_method("diagnostics", method!(ProcessConfig::diagnostics, 0))?;
|
|
3914
|
+
|
|
3285
3915
|
class.define_method("chunk_max_size", method!(ProcessConfig::chunk_max_size, 0))?;
|
|
3916
|
+
|
|
3286
3917
|
class.define_method("with_chunking", method!(ProcessConfig::with_chunking, 1))?;
|
|
3918
|
+
|
|
3287
3919
|
class.define_method("all", method!(ProcessConfig::all, 0))?;
|
|
3920
|
+
|
|
3288
3921
|
class.define_method("minimal", method!(ProcessConfig::minimal, 0))?;
|
|
3289
3922
|
|
|
3290
3923
|
let class = module.define_class("LanguageRegistry", ruby.class_object())?;
|
|
3924
|
+
|
|
3291
3925
|
class.define_method("add_extra_libs_dir", method!(LanguageRegistry::add_extra_libs_dir, 1))?;
|
|
3926
|
+
|
|
3292
3927
|
class.define_method("get_language", method!(LanguageRegistry::get_language, 1))?;
|
|
3928
|
+
|
|
3293
3929
|
class.define_method("available_languages", method!(LanguageRegistry::available_languages, 0))?;
|
|
3930
|
+
|
|
3294
3931
|
class.define_method("has_language", method!(LanguageRegistry::has_language, 1))?;
|
|
3932
|
+
|
|
3295
3933
|
class.define_method("language_count", method!(LanguageRegistry::language_count, 0))?;
|
|
3934
|
+
|
|
3296
3935
|
class.define_method("process", method!(LanguageRegistry::process, 2))?;
|
|
3297
3936
|
|
|
3298
3937
|
let class = module.define_class("ParserManifest", ruby.class_object())?;
|
|
3938
|
+
|
|
3299
3939
|
class.define_singleton_method("new", function!(ParserManifest::new, -1))?;
|
|
3940
|
+
|
|
3300
3941
|
class.define_method("version", method!(ParserManifest::version, 0))?;
|
|
3942
|
+
|
|
3301
3943
|
class.define_method("platforms", method!(ParserManifest::platforms, 0))?;
|
|
3944
|
+
|
|
3302
3945
|
class.define_method("languages", method!(ParserManifest::languages, 0))?;
|
|
3946
|
+
|
|
3303
3947
|
class.define_method("groups", method!(ParserManifest::groups, 0))?;
|
|
3304
3948
|
|
|
3305
3949
|
let class = module.define_class("PlatformBundle", ruby.class_object())?;
|
|
3950
|
+
|
|
3306
3951
|
class.define_singleton_method("new", function!(PlatformBundle::new, -1))?;
|
|
3952
|
+
|
|
3307
3953
|
class.define_method("url", method!(PlatformBundle::url, 0))?;
|
|
3954
|
+
|
|
3308
3955
|
class.define_method("sha256", method!(PlatformBundle::sha256, 0))?;
|
|
3956
|
+
|
|
3309
3957
|
class.define_method("size", method!(PlatformBundle::size, 0))?;
|
|
3310
3958
|
|
|
3311
3959
|
let class = module.define_class("LanguageInfo", ruby.class_object())?;
|
|
3960
|
+
|
|
3312
3961
|
class.define_singleton_method("new", function!(LanguageInfo::new, -1))?;
|
|
3962
|
+
|
|
3313
3963
|
class.define_method("group", method!(LanguageInfo::group, 0))?;
|
|
3964
|
+
|
|
3314
3965
|
class.define_method("size", method!(LanguageInfo::size, 0))?;
|
|
3315
3966
|
|
|
3316
3967
|
let class = module.define_class("DownloadManager", ruby.class_object())?;
|
|
3968
|
+
|
|
3317
3969
|
class.define_method("cache_dir", method!(DownloadManager::cache_dir, 0))?;
|
|
3970
|
+
|
|
3318
3971
|
class.define_method("installed_languages", method!(DownloadManager::installed_languages, 0))?;
|
|
3972
|
+
|
|
3319
3973
|
class.define_method("ensure_languages", method!(DownloadManager::ensure_languages, 1))?;
|
|
3974
|
+
|
|
3320
3975
|
class.define_method("ensure_group", method!(DownloadManager::ensure_group, 1))?;
|
|
3976
|
+
|
|
3321
3977
|
class.define_method("lib_path", method!(DownloadManager::lib_path, 1))?;
|
|
3978
|
+
|
|
3322
3979
|
class.define_method("fetch_manifest", method!(DownloadManager::fetch_manifest, 0))?;
|
|
3980
|
+
|
|
3323
3981
|
class.define_method(
|
|
3324
3982
|
"download_all_best_effort",
|
|
3325
3983
|
method!(DownloadManager::download_all_best_effort, 0),
|
|
3326
3984
|
)?;
|
|
3985
|
+
|
|
3327
3986
|
class.define_method("clean_cache", method!(DownloadManager::clean_cache, 0))?;
|
|
3328
3987
|
|
|
3329
3988
|
let _class = module.define_class("Language", ruby.class_object())?;
|
|
3330
3989
|
|
|
3331
|
-
let _class = module.define_class("Parser", ruby.class_object())?;
|
|
3332
|
-
|
|
3333
|
-
let _class = module.define_class("Tree", ruby.class_object())?;
|
|
3334
|
-
|
|
3335
3990
|
module.define_module_function(
|
|
3336
3991
|
"detect_language_from_extension",
|
|
3337
3992
|
function!(detect_language_from_extension, 1),
|
|
3338
3993
|
)?;
|
|
3994
|
+
|
|
3339
3995
|
module.define_module_function("detect_language_from_path", function!(detect_language_from_path, 1))?;
|
|
3996
|
+
|
|
3340
3997
|
module.define_module_function(
|
|
3341
3998
|
"detect_language_from_content",
|
|
3342
3999
|
function!(detect_language_from_content, 1),
|
|
3343
4000
|
)?;
|
|
4001
|
+
|
|
3344
4002
|
module.define_module_function("get_highlights_query", function!(get_highlights_query, 1))?;
|
|
4003
|
+
|
|
3345
4004
|
module.define_module_function("get_injections_query", function!(get_injections_query, 1))?;
|
|
4005
|
+
|
|
3346
4006
|
module.define_module_function("get_locals_query", function!(get_locals_query, 1))?;
|
|
4007
|
+
|
|
3347
4008
|
module.define_module_function("get_language", function!(get_language, 1))?;
|
|
4009
|
+
|
|
3348
4010
|
module.define_module_function("get_parser", function!(get_parser, 1))?;
|
|
4011
|
+
|
|
3349
4012
|
module.define_module_function("detect_language", function!(detect_language, 1))?;
|
|
4013
|
+
|
|
3350
4014
|
module.define_module_function("available_languages", function!(available_languages, 0))?;
|
|
4015
|
+
|
|
3351
4016
|
module.define_module_function("has_language", function!(has_language, 1))?;
|
|
4017
|
+
|
|
3352
4018
|
module.define_module_function("language_count", function!(language_count, 0))?;
|
|
4019
|
+
|
|
3353
4020
|
module.define_module_function("process", function!(process, -1))?;
|
|
4021
|
+
|
|
3354
4022
|
module.define_module_function("init", function!(init, -1))?;
|
|
4023
|
+
|
|
3355
4024
|
module.define_module_function("configure", function!(configure, -1))?;
|
|
4025
|
+
|
|
3356
4026
|
module.define_module_function("download", function!(download, 1))?;
|
|
4027
|
+
|
|
3357
4028
|
module.define_module_function("download_all", function!(download_all, 0))?;
|
|
4029
|
+
|
|
3358
4030
|
module.define_module_function("manifest_languages", function!(manifest_languages, 0))?;
|
|
4031
|
+
|
|
3359
4032
|
module.define_module_function("downloaded_languages", function!(downloaded_languages, 0))?;
|
|
4033
|
+
|
|
3360
4034
|
module.define_module_function("clean_cache", function!(clean_cache, 0))?;
|
|
4035
|
+
|
|
3361
4036
|
module.define_module_function("cache_dir", function!(cache_dir, 0))?;
|
|
3362
4037
|
|
|
3363
4038
|
Ok(())
|