Lex CRLF line endings properly (#292)
This commit is contained in:
parent
26098ba609
commit
1d0aa178f7
14
src/lexer.rs
14
src/lexer.rs
@ -135,8 +135,8 @@ impl<'a> Lexer<'a> {
|
|||||||
static ref PAREN_R: Regex = token(r"[)]" );
|
static ref PAREN_R: Regex = token(r"[)]" );
|
||||||
static ref AT: Regex = token(r"@" );
|
static ref AT: Regex = token(r"@" );
|
||||||
static ref COMMA: Regex = token(r"," );
|
static ref COMMA: Regex = token(r"," );
|
||||||
static ref COMMENT: Regex = token(r"#([^!\n\r].*)?$" );
|
static ref COMMENT: Regex = token(r"#([^!\n\r]*)?\r?$" );
|
||||||
static ref EOF: Regex = token(r"(?-m)$" );
|
static ref EOF: Regex = token(r"\z" );
|
||||||
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"=" );
|
||||||
static ref INTERPOLATION_END: Regex = token(r"[}][}]" );
|
static ref INTERPOLATION_END: Regex = token(r"[}][}]" );
|
||||||
@ -526,6 +526,12 @@ c: b
|
|||||||
"((())))N(+.",
|
"((())))N(+.",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
summary_test! {
|
||||||
|
crlf_newline,
|
||||||
|
"#\r\n#asdf\r\n",
|
||||||
|
"#$#$.",
|
||||||
|
}
|
||||||
|
|
||||||
error_test! {
|
error_test! {
|
||||||
name: tokenize_space_then_tab,
|
name: tokenize_space_then_tab,
|
||||||
input: "a:
|
input: "a:
|
||||||
@ -616,8 +622,8 @@ c: b
|
|||||||
}
|
}
|
||||||
|
|
||||||
error_test! {
|
error_test! {
|
||||||
name: mixed_leading_whitespace,
|
name: mixed_leading_whitespace,
|
||||||
input: "a:\n\t echo hello",
|
input: "a:\n\t echo hello",
|
||||||
index: 3,
|
index: 3,
|
||||||
line: 1,
|
line: 1,
|
||||||
column: 0,
|
column: 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user