Allow comments after mod
statements (#2201)
This commit is contained in:
parent
570d3058cf
commit
23f1c1ca9f
@ -365,10 +365,11 @@ impl<'run, 'src> Parser<'run, 'src> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
Some(Keyword::Mod)
|
Some(Keyword::Mod)
|
||||||
if self.next_are(&[Identifier, Identifier, StringToken])
|
if self.next_are(&[Identifier, Identifier, Comment])
|
||||||
|| self.next_are(&[Identifier, Identifier, Identifier, StringToken])
|
|
||||||
|| self.next_are(&[Identifier, Identifier, Eof])
|
|| self.next_are(&[Identifier, Identifier, Eof])
|
||||||
|| self.next_are(&[Identifier, Identifier, Eol])
|
|| self.next_are(&[Identifier, Identifier, Eol])
|
||||||
|
|| self.next_are(&[Identifier, Identifier, Identifier, StringToken])
|
||||||
|
|| self.next_are(&[Identifier, Identifier, StringToken])
|
||||||
|| self.next_are(&[Identifier, QuestionMark]) =>
|
|| self.next_are(&[Identifier, QuestionMark]) =>
|
||||||
{
|
{
|
||||||
self.presume_keyword(Keyword::Mod)?;
|
self.presume_keyword(Keyword::Mod)?;
|
||||||
|
@ -8,8 +8,6 @@ fn modules_are_unstable() {
|
|||||||
mod foo
|
mod foo
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
.arg("foo")
|
|
||||||
.arg("foo")
|
|
||||||
.stderr(
|
.stderr(
|
||||||
"error: Modules are currently unstable. \
|
"error: Modules are currently unstable. \
|
||||||
Invoke `just` with the `--unstable` flag to enable unstable features.\n",
|
Invoke `just` with the `--unstable` flag to enable unstable features.\n",
|
||||||
@ -781,3 +779,18 @@ fn colon_separated_path_components_are_not_used_as_arguments() {
|
|||||||
.status(1)
|
.status(1)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn comments_can_follow_modules() {
|
||||||
|
Test::new()
|
||||||
|
.write("foo.just", "foo:\n @echo FOO")
|
||||||
|
.justfile(
|
||||||
|
"
|
||||||
|
mod foo # this is foo
|
||||||
|
",
|
||||||
|
)
|
||||||
|
.test_round_trip(false)
|
||||||
|
.args(["--unstable", "foo", "foo"])
|
||||||
|
.stdout("FOO\n")
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user