todo_tree_core/parser.rs
1/// Default regex pattern for matching TODO-style tags in comments.
2///
3/// This pattern is inspired by the VSCode Todo Tree extension and matches tags
4/// that appear after common comment markers.
5///
6/// Pattern breakdown:
7/// - `(//|#|<!--|;|/\*|\*|--)` - Comment markers for most languages
8/// - `\s*` - Optional whitespace after comment marker
9/// - `($TAGS)` - The tag to match (placeholder, replaced at runtime)
10/// - `(?:\(([^)]+)\))?` - Optional author in parentheses
11/// - `:` - Required colon after tag
12/// - `(.*)` - The message
13///
14/// Supported comment syntaxes:
15/// ```text
16/// // - C, C++, Java, JavaScript, TypeScript, Rust, Go, Swift, Kotlin
17/// # - Python, Ruby, Shell, YAML, TOML
18/// /* - C-style block comments
19/// * - Block comment continuation lines
20/// <!-- - HTML, XML, Markdown comments
21/// -- - SQL, Lua, Haskell, Ada
22/// ; - Lisp, Clojure, Assembly, INI files
23/// % - LaTeX, Erlang, MATLAB, Prolog
24/// """ - Python docstrings
25/// ''' - Python docstrings
26/// REM - Batch files
27/// ```
28///
29/// Note: `::` was removed from default comment markers to prevent false positives
30/// in Rust, C++, and other languages where `::` is used as a scope resolution operator
31/// (e.g., `std::io::Error`).
32pub const DEFAULT_REGEX: &str =
33 r#"(//|#|<!--|;|/\*|\*|--|%|"""|'''|REM\s)\s*($TAGS)(?:\(([^)]+)\))?:(.*)"#;