treesitter-types-cpp 1.0.0

Pre-generated strongly-typed AST types for C++ (tree-sitter-cpp)
Documentation
//! Strongly-typed AST types for C++, auto-generated from
//! [`tree-sitter-cpp`](https://docs.rs/tree-sitter-cpp)'s `node-types.json`.
//!
//! This crate is generated by [`treesitter-types`](https://docs.rs/treesitter-types) and is
//! automatically kept up to date when a new version of the grammar crate is released.
//!
//! These types have been tested by parsing the
//! [nlohmann/json](https://github.com/nlohmann/json) source code.
//!
//! See the [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) project for more
//! information about the underlying parser framework.
//!
//! # Example
//!
//! ```
//! use treesitter_types_cpp::*;
//!
//! // A minimal C++ hello-world program.
//! let src = b"\
//! #include <iostream>
//!
//! int main() {
//!     std::cout << \"Hello, World!\" << std::endl;
//!     return 0;
//! }
//! ";
//!
//! // Parse the source with tree-sitter and convert into typed AST.
//! let mut parser = tree_sitter::Parser::new();
//! parser.set_language(&tree_sitter_cpp::LANGUAGE.into()).unwrap();
//! let tree = parser.parse(src, None).unwrap();
//! let tu = TranslationUnit::from_node(tree.root_node(), src).unwrap();
//!
//! // The translation unit has two top-level children.
//! assert_eq!(tu.children.len(), 2);
//!
//! // 1) The #include directive.
//! let TranslationUnitChildren::PreprocInclude(include) = &tu.children[0] else {
//!     panic!("expected a preproc include");
//! };
//! assert_eq!(include.span.start.row, 0);
//!
//! // 2) The `main` function definition.
//! let TranslationUnitChildren::FunctionDefinition(func) = &tu.children[1] else {
//!     panic!("expected a function definition");
//! };
//! assert!(func.body.is_some()); // has a function body
//! ```

pub use tree_sitter_cpp;
pub use treesitter_types::tree_sitter;
pub use treesitter_types::{FromNode, LeafNode, ParseError, Span, Spanned};

mod generated;
pub use generated::*;