treesitter-types-java 0.2.0

Pre-generated strongly-typed AST types for Java (tree-sitter-java)
Documentation
//! Strongly-typed AST types for Java, auto-generated from
//! [`tree-sitter-java`](https://docs.rs/tree-sitter-java)'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
//! [Spring Framework](https://github.com/spring-projects/spring-framework) 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_java::*;
//!
//! // A minimal Java hello-world program.
//! let src = b"\
//! class Hello {
//!     public static void main(String[] args) {
//!         System.out.println(\"Hello, World!\");
//!     }
//! }
//! ";
//!
//! // Parse the source with tree-sitter and convert into typed AST.
//! let mut parser = tree_sitter::Parser::new();
//! parser.set_language(&tree_sitter_java::LANGUAGE.into()).unwrap();
//! let tree = parser.parse(src, None).unwrap();
//! let program = Program::from_node(tree.root_node(), src).unwrap();
//!
//! // The program has one top-level child: the `Hello` class.
//! assert_eq!(program.children.len(), 1);
//!
//! // Unwrap the class declaration.
//! let ProgramChildren::Statement(stmt) = &program.children[0] else {
//!     panic!("expected a statement");
//! };
//! let Statement::Declaration(decl) = stmt.as_ref() else {
//!     panic!("expected a declaration");
//! };
//! let Declaration::ClassDeclaration(class) = decl.as_ref() else {
//!     panic!("expected a class declaration");
//! };
//! assert_eq!(class.name.text(), "Hello");
//! assert!(class.superclass.is_none());   // no `extends`
//! assert!(class.interfaces.is_none());   // no `implements`
//!
//! // The class body contains one method.
//! assert_eq!(class.body.children.len(), 1);
//! ```

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

mod generated;
pub use generated::*;