Stop empty comments from swallowing the next line (#247)
This commit is contained in:
parent
b9e1f73919
commit
3acd56646f
@ -1614,3 +1614,17 @@ echo A B C:
|
|||||||
stderr: "echo --some --awesome --flags\n",
|
stderr: "echo --some --awesome --flags\n",
|
||||||
status: EXIT_SUCCESS,
|
status: EXIT_SUCCESS,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
integration_test! {
|
||||||
|
name: comment_before_variable,
|
||||||
|
justfile: "
|
||||||
|
#
|
||||||
|
A='1'
|
||||||
|
echo:
|
||||||
|
echo {{A}}
|
||||||
|
",
|
||||||
|
args: ("echo"),
|
||||||
|
stdout: "1\n",
|
||||||
|
stderr: "echo 1\n",
|
||||||
|
status: EXIT_SUCCESS,
|
||||||
|
}
|
||||||
|
@ -1528,7 +1528,7 @@ fn tokenize(text: &str) -> Result<Vec<Token>, CompileError> {
|
|||||||
static ref BACKTICK: Regex = token(r"`[^`\n\r]*`" );
|
static ref BACKTICK: Regex = token(r"`[^`\n\r]*`" );
|
||||||
static ref COLON: Regex = token(r":" );
|
static ref COLON: Regex = token(r":" );
|
||||||
static ref AT: Regex = token(r"@" );
|
static ref AT: Regex = token(r"@" );
|
||||||
static ref COMMENT: Regex = token(r"#([^!].*)?$" );
|
static ref COMMENT: Regex = token(r"#([^!\n\r].*)?$" );
|
||||||
static ref EOF: Regex = token(r"(?-m)$" );
|
static ref EOF: Regex = token(r"(?-m)$" );
|
||||||
static ref EOL: Regex = token(r"\n|\r\n" );
|
static ref EOL: Regex = token(r"\n|\r\n" );
|
||||||
static ref EQUALS: Regex = token(r"=" );
|
static ref EQUALS: Regex = token(r"=" );
|
||||||
|
11
src/unit.rs
11
src/unit.rs
@ -156,6 +156,17 @@ hello:
|
|||||||
tokenize_success(text, "$#$N:$>^_$^_$$^_$$^_$$<#$.");
|
tokenize_success(text, "$#$N:$>^_$^_$$^_$$^_$$<#$.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn tokenize_comment_before_variable() {
|
||||||
|
let text = "
|
||||||
|
#
|
||||||
|
A='1'
|
||||||
|
echo:
|
||||||
|
echo {{A}}
|
||||||
|
";
|
||||||
|
tokenize_success(text, "$#$N='$N:$>^_{N}$<.");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn tokenize_interpolation_backticks() {
|
fn tokenize_interpolation_backticks() {
|
||||||
tokenize_success(
|
tokenize_success(
|
||||||
|
Loading…
Reference in New Issue
Block a user