Allow comments on same line as settings (#1339)

This commit is contained in:
Casey Rodarmor 2022-09-10 15:19:49 -07:00 committed by GitHub
parent 3135db5e51
commit baaa8cb194
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 2 deletions

View File

@ -333,8 +333,10 @@ impl<'tokens, 'src> Parser<'tokens, 'src> {
} }
Some(Keyword::Set) Some(Keyword::Set)
if self.next_are(&[Identifier, Identifier, ColonEquals]) if self.next_are(&[Identifier, Identifier, ColonEquals])
|| self.next_are(&[Identifier, Identifier, Eol]) || self.next_are(&[Identifier, Identifier, Comment, Eof])
|| self.next_are(&[Identifier, Identifier, Eof]) => || self.next_are(&[Identifier, Identifier, Comment, Eol])
|| self.next_are(&[Identifier, Identifier, Eof])
|| self.next_are(&[Identifier, Identifier, Eol]) =>
{ {
items.push(Item::Set(self.parse_set()?)); items.push(Item::Set(self.parse_set()?));
} }

View File

@ -58,6 +58,7 @@ mod json;
mod line_prefixes; mod line_prefixes;
mod misc; mod misc;
mod multibyte_char; mod multibyte_char;
mod parser;
mod positional_arguments; mod positional_arguments;
mod quiet; mod quiet;
mod quote; mod quote;

13
tests/parser.rs Normal file
View File

@ -0,0 +1,13 @@
use super::*;
#[test]
fn dont_run_duplicate_recipes() {
Test::new()
.justfile(
"
set dotenv-load # foo
bar:
",
)
.run();
}