Skip to main content

osp_cli/dsl/
model.rs

1/// High-level parser classification for a stage token.
2///
3/// The parser deliberately separates "known explicit verb", "unknown
4/// verb-shaped token", and "quick-search text" so the evaluator does not have
5/// to guess later.
6#[derive(Debug, Clone, PartialEq, Eq)]
7pub enum ParsedStageKind {
8    Explicit,
9    UnknownExplicit,
10    Quick,
11}
12
13/// One stage after the parser has decided how the evaluator should treat it.
14#[derive(Debug, Clone, PartialEq, Eq)]
15pub struct ParsedStage {
16    pub kind: ParsedStageKind,
17    pub verb: String,
18    pub spec: String,
19    pub raw: String,
20}
21
22impl ParsedStage {
23    /// Creates a parsed stage with explicit kind, verb, spec, and raw text.
24    pub fn new(
25        kind: ParsedStageKind,
26        verb: impl Into<String>,
27        spec: impl Into<String>,
28        raw: impl Into<String>,
29    ) -> Self {
30        Self {
31            kind,
32            verb: verb.into(),
33            spec: spec.into(),
34            raw: raw.into(),
35        }
36    }
37}
38
39/// Full parsed pipeline used by the evaluator.
40///
41/// `raw` is preserved for trace/debug output. `stages` carries the structured
42/// stage classification that drives execution.
43#[derive(Debug, Clone, Default, PartialEq, Eq)]
44pub struct ParsedPipeline {
45    pub raw: String,
46    pub stages: Vec<ParsedStage>,
47}