Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ colored = "2"

[dev-dependencies]
insta = "1.40"
cargo-insta = "1.43.2"

[build-dependencies]
cc = "1.0"
Expand Down
1 change: 1 addition & 0 deletions rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ fn main() {
build.compile("herb");

let bindings = bindgen::Builder::default()
.header(src_dir.join("include/analyze.h").to_str().unwrap())
.header(src_dir.join("include/herb.h").to_str().unwrap())
.header(src_dir.join("include/ast_nodes.h").to_str().unwrap())
.header(src_dir.join("include/errors.h").to_str().unwrap())
Expand Down
5 changes: 3 additions & 2 deletions rust/src/ffi.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub use crate::bindings::{
ast_node_free, element_source_to_string, hb_array_get, hb_array_size, hb_string_T, herb_extract,
herb_free_tokens, herb_lex, herb_parse, herb_prism_version, herb_version, token_type_to_string,
ast_node_free, element_source_to_string, hb_array_get, hb_array_size, hb_string_T,
herb_analyze_parse_tree, herb_extract, herb_free_tokens, herb_lex, herb_parse,
herb_prism_version, herb_version, token_type_to_string,
};
2 changes: 2 additions & 0 deletions rust/src/herb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ pub fn parse(source: &str) -> Result<ParseResult, String> {
return Err("Failed to parse source".to_string());
}

crate::ffi::herb_analyze_parse_tree(ast, c_source.as_ptr());

let document_node = crate::ast::convert_document_node(ast as *const std::ffi::c_void)
.ok_or_else(|| "Failed to convert AST".to_string())?;

Expand Down
225 changes: 110 additions & 115 deletions rust/tests/snapshots/snapshot_test__parse_output.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading