Remove shape-directed import pattern parsing (#7570)

This commit is contained in:
Jakub Žádník
2022-12-22 16:36:13 +02:00
committed by GitHub
parent 74656bf976
commit 23a5c5dc09
12 changed files with 121 additions and 81 deletions

View File

@ -18,6 +18,8 @@ pub struct Call {
pub arguments: Vec<Argument>,
pub redirect_stdout: bool,
pub redirect_stderr: bool,
/// this field is used by the parser to pass additional command-specific information
pub parser_info: Vec<Expression>,
}
impl Call {
@ -28,6 +30,7 @@ impl Call {
arguments: vec![],
redirect_stdout: true,
redirect_stderr: false,
parser_info: vec![],
}
}
@ -67,6 +70,10 @@ impl Call {
self.arguments.push(Argument::Positional(positional));
}
pub fn add_parser_info(&mut self, info: Expression) {
self.parser_info.push(info);
}
pub fn add_unknown(&mut self, unknown: Expression) {
self.arguments.push(Argument::Unknown(unknown));
}
@ -99,6 +106,10 @@ impl Call {
self.positional_iter().count()
}
pub fn parser_info_nth(&self, i: usize) -> Option<&Expression> {
self.parser_info.get(i)
}
pub fn has_flag(&self, flag_name: &str) -> bool {
for name in self.named_iter() {
if flag_name == name.0.item {