1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use tree_sitter::Language;
extern "C" {
fn tree_sitter_ruby() -> Language;
}
pub fn language() -> Language {
unsafe { tree_sitter_ruby() }
}
pub const GRAMMAR: &'static str = include_str!("../languages/tree-sitter-ruby/grammar.js");
pub const HIGHLIGHT_QUERY: &'static str = include_str!("../languages/tree-sitter-ruby/queries/highlights.scm");
pub const LOCALS_QUERY: &'static str = include_str!("../languages/tree-sitter-ruby/queries/locals.scm");
pub const NODE_TYPES: &'static str = include_str!("../languages/tree-sitter-ruby/src/node-types.json");
pub const TAGGING_QUERY: &'static str = include_str!("../languages/tree-sitter-ruby/queries/tags.scm");
#[cfg(test)]
mod tests {
#[test]
fn can_load_grammar() {
let mut parser = tree_sitter::Parser::new();
parser
.set_language(super::language())
.expect("Error loading Ruby grammar");
}
}