| Crates.io | oak-javadoc |
| lib.rs | oak-javadoc |
| version | 0.0.1 |
| created_at | 2025-10-20 16:46:11.684163+00 |
| updated_at | 2026-01-23 04:30:04.808993+00 |
| description | Javadoc documentation language parser with support for API documentation generation and code analysis. |
| homepage | https://github.com/ygg-lang/oaks |
| repository | https://github.com/ygg-lang/oaks |
| max_upload_size | |
| id | 1892315 |
| size | 71,029 |
High-performance incremental Javadoc parser for the oak ecosystem with flexible configuration, optimized for API documentation generation and code analysis.
Oak Javadoc is a robust parser for Java documentation comments (Javadoc), designed to handle complete Javadoc syntax including standard tags and custom extensions. Built on the solid foundation of oak-core, it provides both high-level convenience and detailed AST generation for documentation analysis and generation.
Basic example:
use oak_javadoc::{Parser, JavadocLanguage, SourceText};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let parser = Parser::new();
let source = SourceText::new(r#"
/**
* Calculates the sum of two integers.
*
* @param a The first integer
* @param b The second integer
* @return The sum of a and b
* @throws IllegalArgumentException If either parameter is null
* @since 1.0
* @author John Doe
*/
public int add(int a, int b) {
return a + b;
}
"#);
let result = parser.parse(&source);
println!("Parsed Javadoc comment successfully.");
Ok(())
}
use oak_javadoc::{Parser, JavadocLanguage, SourceText};
let parser = Parser::new();
let source = SourceText::new(r#"
/**
* Represents a person with a name and age.
* <p>
* This class provides basic functionality for storing and retrieving
* person information. It includes validation for age constraints.
*
* @author Jane Smith
* @version 1.2
* @since 1.0
*/
public class Person {
private String name;
private int age;
/**
* Constructs a new Person with the specified name and age.
*
* @param name The person's name, cannot be null
* @param age The person's age, must be between 0 and 150
* @throws IllegalArgumentException If name is null or age is out of range
*/
public Person(String name, int age) {
// Implementation...
}
}
"#);
let result = parser.parse(&source);
println!("Parsed class documentation successfully.");
use oak_javadoc::{Parser, JavadocLanguage, SourceText};
let parser = Parser::new();
let source = SourceText::new(r#"
/**
* Formats a string using the specified template and arguments.
* <p>
* This method replaces placeholders in the template with the provided arguments.
* Placeholders are specified in the format {0}, {1}, etc.
*
* <pre>
* String result = StringFormatter.format("Hello {0}, today is {1}", "Alice", "Monday");
* // Returns: "Hello Alice, today is Monday"
* </pre>
*
* @param template The template string with placeholders
* @param args The arguments to replace the placeholders
* @return The formatted string
* @throws IllegalArgumentException If template is null or number of arguments doesn't match placeholders
* @see java.text.MessageFormat
* @since 1.5
*/
public String format(String template, Object... args) {
// Implementation...
}
"#);
let result = parser.parse(&source);
println!("Parsed method documentation with examples successfully.");
use oak_javadoc::{Parser, JavadocLanguage, SourceText};
let parser = Parser::new();
let source = SourceText::new("/** Simple comment */");
let result = parser.parse(&source);
// Token information is available in the parse result
use oak_javadoc::{Parser, JavadocLanguage, SourceText};
let parser = Parser::new();
let source = SourceText::new(r#"
/**
* This comment has an unclosed tag
* @param x This parameter is described
* @return This return is not properly closed
public int broken() {
return 0;
}
"#);
let result = parser.parse(&source);
if let Err(e) = result.result {
println!("Parse error: {:?}", e);
}
The parser generates a comprehensive AST with the following main structures:
Oak-javadoc integrates seamlessly with:
Check out the examples directory for comprehensive examples:
Contributions are welcome!
Please feel free to submit pull requests at the project repository or open issues.