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    pub fn new(
24        kind: ParsedStageKind,
25        verb: impl Into<String>,
26        spec: impl Into<String>,
27        raw: impl Into<String>,
28    ) -> Self {
29        Self {
30            kind,
31            verb: verb.into(),
32            spec: spec.into(),
33            raw: raw.into(),
34        }
35    }
36}
37
38/// Full parsed pipeline used by the evaluator.
39///
40/// `raw` is preserved for trace/debug output. `stages` carries the structured
41/// stage classification that drives execution.
42#[derive(Debug, Clone, Default, PartialEq, Eq)]
43pub struct ParsedPipeline {
44    pub raw: String,
45    pub stages: Vec<ParsedStage>,
46}