Skip to main content

Crate ailint_extractor

Crate ailint_extractor 

Source
Expand description

Lexical extraction of source-code comments as virtual guidance documents.

ailint-extractor uses logos to tokenize source files just enough to pull out line and block comments without building a full AST. The returned Comments can be fed to ailint-core as “virtual documents” so semantic rules (vague instructions, negative overload, bloat) can catch AI slop that leaks into inline comments and docstrings.

Supported languages: Language::Rust, Language::TypeScript, Language::JavaScript, Language::Python.

use ailint_extractor::{extract, Language, CommentKind};

let src = "fn main() {\n    // TODO: refactor this later\n}\n";
let comments = extract(src, Language::Rust);
assert_eq!(comments.len(), 1);
assert_eq!(comments[0].kind, CommentKind::Line);
assert_eq!(comments[0].line, 2);
assert_eq!(comments[0].body().trim(), "TODO: refactor this later");

Structs§

Comment
A single extracted comment.

Enums§

CommentKind
Classification of an extracted comment.
Language
Programming languages supported by the extractor.

Functions§

extract
Extract every comment from source for the given language.