diff --git a/justfile b/justfile index 948d8db..0443c64 100644 --- a/justfile +++ b/justfile @@ -24,6 +24,8 @@ create: clean: rm -r tmp +polyglot: python js perl sh ruby + python: #!/usr/bin/env python3 print('Hello from python!') diff --git a/src/lib.rs b/src/lib.rs index 356fe74..2249fb4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -50,7 +50,7 @@ pub struct Recipe<'a> { name: &'a str, leading_whitespace: &'a str, lines: Vec<&'a str>, - dependencies: BTreeSet<&'a str>, + dependencies: Vec<&'a str>, shebang: bool, } @@ -502,15 +502,15 @@ pub fn parse<'a>(text: &'a str) -> Result { } let rest = captures.at(2).unwrap().trim(); - let mut dependencies = BTreeSet::new(); + let mut dependencies = vec![]; for part in whitespace_re.split(rest) { if name_re.is_match(part) { - if dependencies.contains(part) { + if dependencies.contains(&part) { return Err(error(text, i, ErrorKind::DuplicateDependency{ name: part, })); } - dependencies.insert(part); + dependencies.push(part); } else { return Err(error(text, i, ErrorKind::UnparsableDependencies)); }