-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6c60867
commit b676f93
Showing
3 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,6 @@ pub mod pipeline; | |
pub mod command; | ||
pub mod io; | ||
pub mod word; | ||
pub mod subword; | ||
|
||
use self::io::pipe::Pipe; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//SPDX-FileCopyrightText: 2022 Ryuichi Ueda [email protected] | ||
//SPDX-License-Identifier: BSD-3-Clause | ||
|
||
pub mod unquoted; | ||
pub mod brace; | ||
|
||
use crate::{Feeder, ShellCore}; | ||
use super::subword::unquoted::UnquotedSubword; | ||
use std::fmt; | ||
use std::fmt::Debug; | ||
|
||
impl Debug for dyn Subword { | ||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | ||
fmt.debug_struct(&self.get_text()).finish() | ||
} | ||
} | ||
|
||
pub trait Subword { | ||
fn get_text(&self) -> String; | ||
fn eval(&mut self) -> Vec<Vec<String>>; | ||
} | ||
|
||
pub fn parse(feeder: &mut Feeder, core: &mut ShellCore) -> Option<Box<dyn Subword>> { | ||
if let Some(a) = UnquotedSubword::parse(feeder, core){ Some(Box::new(a)) } | ||
else{ None } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters