Fix unexport syntax conflicts (#2158)
This commit is contained in:
parent
e6c37aacd1
commit
dd9792571b
@ -340,9 +340,13 @@ impl<'run, 'src> Parser<'run, 'src> {
|
|||||||
self.presume_keyword(Keyword::Export)?;
|
self.presume_keyword(Keyword::Export)?;
|
||||||
items.push(Item::Assignment(self.parse_assignment(true)?));
|
items.push(Item::Assignment(self.parse_assignment(true)?));
|
||||||
}
|
}
|
||||||
Some(Keyword::Unexport) => {
|
Some(Keyword::Unexport)
|
||||||
|
if self.next_are(&[Identifier, Identifier, Eof])
|
||||||
|
|| self.next_are(&[Identifier, Identifier, Eol]) =>
|
||||||
|
{
|
||||||
self.presume_keyword(Keyword::Unexport)?;
|
self.presume_keyword(Keyword::Unexport)?;
|
||||||
let name = self.parse_name()?;
|
let name = self.parse_name()?;
|
||||||
|
self.expect_eol()?;
|
||||||
items.push(Item::Unexport { name });
|
items.push(Item::Unexport { name });
|
||||||
}
|
}
|
||||||
Some(Keyword::Import)
|
Some(Keyword::Import)
|
||||||
|
@ -99,6 +99,28 @@ fn unexport_doesnt_override_local_recipe_export() {
|
|||||||
)
|
)
|
||||||
.args(["recipe", "value"])
|
.args(["recipe", "value"])
|
||||||
.stdout("variable: value\n")
|
.stdout("variable: value\n")
|
||||||
.status(0)
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn unexport_does_not_conflict_with_recipe_syntax() {
|
||||||
|
Test::new()
|
||||||
|
.justfile(
|
||||||
|
"
|
||||||
|
unexport foo:
|
||||||
|
@echo {{foo}}
|
||||||
|
",
|
||||||
|
)
|
||||||
|
.args(["unexport", "bar"])
|
||||||
|
.stdout("bar\n")
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn unexport_does_not_conflict_with_assignment_syntax() {
|
||||||
|
Test::new()
|
||||||
|
.justfile("unexport := 'foo'")
|
||||||
|
.args(["--evaluate", "unexport"])
|
||||||
|
.stdout("foo")
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user