directiva 0.1.0

A tiny, paste-friendly directive mini-language: ACTION:[<KIND>]NAME[@PATH][=NOTE]
Documentation
//! `directiva` — a tiny, paste-friendly directive mini-language.
//!
//! One directive fits on one line, in a CLI flag, in a CI config, or in a code comment:
//!
//! ```text
//! ACTION : [<KIND>] NAME [@PATH] [=NOTE]
//! ```
//!
//! Each field carries its own sigil (`:` `<>` `@` `=`), so parsing is an unambiguous,
//! context-free cascade — no grammar file, no dependencies. The crate knows nothing about any
//! specific domain: you bring a [`Target`] (the thing a directive matches against) and an
//! [`Action`] vocabulary; `directiva` brings the parser, the [`glob`](core::glob) matcher, the
//! matching rules, and the severity [`Ladder`] algebra.
//!
//! # The shape
//!
//! - **ACTION** — required. An **opaque token**; the crate ships no built-in actions. A caller
//!   resolves it to its own `A` via [`Action::from_token`]; the default `A = String` accepts any
//!   token (open set, e.g. plain markup).
//! - **`<KIND>`** — optional category filter, angle-bracketed so it never collides with the
//!   `[...]` glob char-class. `<*>` or omitted = any kind. Exact match against
//!   [`Target::qualifier`].
//! - **NAME** — required, non-empty. A glob ([`Pattern`]) matched against the target's names.
//! - **`@PATH`** — optional. A glob matched against the target's scopes.
//! - **`=NOTE`** — optional. Free text — the *why* — that travels with the rule.
//!
//! # Example
//!
//! ```
//! use directiva::{parse, Target, Pattern};
//!
//! struct Item { kind: &'static str, name: &'static str, file: &'static str }
//! impl Target for Item {
//!     fn qualifier(&self) -> Option<&str> { Some(self.kind) }
//!     fn matches_name(&self, p: &Pattern) -> bool { p.matches(self.name) }
//!     fn matches_scope(&self, p: &Pattern) -> bool { p.matches(self.file) }
//! }
//!
//! let d = parse("de-escalate:<function>get_*@*/tests/*=test fixtures").unwrap();
//! assert_eq!(d.action, "de-escalate"); // open-set String default
//!
//! let hit  = Item { kind: "function", name: "get_user", file: "src/tests/api.rs" };
//! let miss = Item { kind: "function", name: "get_user", file: "src/api.rs" };
//! assert!(d.matches(&hit));
//! assert!(!d.matches(&miss)); // @PATH glob doesn't match
//! ```

#![forbid(unsafe_code)]

pub mod core;

#[cfg(feature = "source")]
pub mod source;

#[cfg(feature = "lint")]
pub mod lint;

#[cfg(feature = "python")]
mod python;

// Flat re-exports of the most-used `core` items, so the common path is `directiva::Foo`.
pub use crate::core::{parse, parse_as, Action, Directive, Ladder, ParseError, Pattern, Target};