1 unstable release

new 0.0.2 Mar 19, 2025

#2842 in Parser implementations

Download history 104/week @ 2025-03-16

104 downloads per month

MIT license

385KB
11K SLoC

C 11K SLoC // 0.0% comments JavaScript 337 SLoC // 0.1% comments Scheme 94 SLoC // 0.1% comments Rust 32 SLoC // 0.1% comments

tree-sitter-javadoc

Javadoc grammar for tree-sitter

About

Features:

  • Complete old-school HTML (/**)
  • Basic new-school Markdown (///) support
  • Highlight queries, especially for those important/pesky @see and @link references
  • @nospell set for javadocs syntax regions, so you don't have to turn spellcheck off anymore
  • Injection queries for @snippet, @value
  • Tested on heaps of java code, popular open source codebases
  • Not perfect, but javadocs parsing is a dirty business

Screenshot of highlighting: Syntax highlighting screenshot


lib.rs:

This crate provides Javadoc language support for the tree-sitter parsing library.

Typically, you will use the [LANGUAGE][] constant to add this language to a tree-sitter Parser, and then use the parser to parse some code:

let code = r#"
"#;
let mut parser = tree_sitter::Parser::new();
let language = tree_sitter_javadoc::LANGUAGE;
parser
    .set_language(&language.into())
    .expect("Error loading Javadoc parser");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());

Dependencies

~4–280KB