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
41
42
43
44
45
46
47
48
49
50
51
52
53
//! Java AST Parser — a syn-style API for Java 25.
//!
//! This crate provides a complete Java Abstract Syntax Tree parser that closely
//! follows the Java Language Specification (JLS) SE 25. The API design is inspired
//! by Rust's [`syn`] crate.
//!
//! # Quick Start
//!
//! ```
//! use java_lang::ast::CompilationUnit;
//! use java_lang::parse_str;
//!
//! let unit: CompilationUnit = parse_str(
//! "package com.example;\n\npublic class Hello {\n public static void main(String[] args) {\n System.out.println(\"Hello, World!\");\n }\n}\n"
//! ).unwrap();
//!
//! // Access parsed elements
//! if let Some(pkg) = &unit.package {
//! println!("Package: {:?}", pkg.name);
//! }
//! for item in &unit.type_decls {
//! println!("Type: {:?}", item);
//! }
//! ```
//!
//! # Design Principles
//!
//! - **Syn-style API**: Uses `Parse` trait and `ParseStream` similar to [`syn`].
//! - **Complete coverage**: Supports Java 25 features including records, sealed classes,
//! pattern matching, switch expressions, text blocks, and unnamed variables.
//! - **Span tracking**: Every AST node carries span information for error reporting.
//! - **Zero-copy identifiers**: Uses `Ident` with interning for efficient comparison.
pub use ;
pub use Ident;
pub use ;
pub use Span;
pub use ;
// Re-export the top-level AST types for convenience
pub use CompilationUnit;
pub use ;