1
0
dust/src/lib.rs

43 lines
1.1 KiB
Rust
Raw Normal View History

2024-01-30 19:48:38 +00:00
#![warn(missing_docs)]
2024-01-25 12:10:45 +00:00
//! The Dust library is used to parse, format and run dust source code.
2023-08-28 13:51:04 +00:00
//!
2024-01-25 12:10:45 +00:00
//! See the [interpret] module for more information.
2024-01-30 23:13:30 +00:00
//!
//! You can use this library externally by calling either of the "interpret"
//! functions or by constructing your own Interpreter.
2023-08-22 15:40:50 +00:00
pub use crate::{
2024-01-23 22:35:12 +00:00
abstract_tree::*, built_in_functions::BuiltInFunction, error::*, interpret::*, value::*,
2023-08-22 15:40:50 +00:00
};
pub use tree_sitter::Node as SyntaxNode;
2024-01-30 23:13:30 +00:00
pub mod abstract_tree;
2023-11-28 22:54:17 +00:00
pub mod built_in_functions;
2024-01-30 23:13:30 +00:00
pub mod error;
pub mod interpret;
pub mod value;
2023-09-28 19:58:01 +00:00
use tree_sitter::Language;
extern "C" {
fn tree_sitter_dust() -> Language;
}
/// Get the tree-sitter [Language][] for this grammar.
///
/// [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html
pub fn language() -> Language {
unsafe { tree_sitter_dust() }
}
#[cfg(test)]
mod tests {
#[test]
fn test_can_load_grammar() {
let mut parser = tree_sitter::Parser::new();
parser
.set_language(super::language())
.expect("Error loading dust language");
}
}