diff options
author | Jesse Luehrs <doy@tozt.net> | 2022-01-11 00:10:56 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2022-01-11 00:37:09 -0500 |
commit | 4086fc1f83673554f9b9695e853c44dd895add23 (patch) | |
tree | 0ce4aa198f1cce027c726dc90e11c923cd0e4447 /src/parse | |
parent | 5bce22093b4b0778f729d8d92e37f42214f78fc5 (diff) | |
download | nbsh-4086fc1f83673554f9b9695e853c44dd895add23.tar.gz nbsh-4086fc1f83673554f9b9695e853c44dd895add23.zip |
highlight the specific pipeline that is currently running
Diffstat (limited to 'src/parse')
-rw-r--r-- | src/parse/ast.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/parse/ast.rs b/src/parse/ast.rs index a3239ce..6a3ab8e 100644 --- a/src/parse/ast.rs +++ b/src/parse/ast.rs @@ -82,6 +82,7 @@ impl Command { #[derive(Debug, Clone, PartialEq, Eq)] pub struct Pipeline { exes: Vec<Exe>, + span: (usize, usize), } impl Pipeline { @@ -95,10 +96,16 @@ impl Pipeline { }) } + pub fn span(&self) -> (usize, usize) { + self.span + } + fn build_ast(pipeline: pest::iterators::Pair<Rule>) -> Self { assert!(matches!(pipeline.as_rule(), Rule::pipeline)); + let span = (pipeline.as_span().start(), pipeline.as_span().end()); Self { exes: pipeline.into_inner().map(Exe::build_ast).collect(), + span, } } } |