Skip to content

Commit

Permalink
Lex CRLF line endings properly (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
casey authored Jan 5, 2018
1 parent 26098ba commit 1d0aa17
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ impl<'a> Lexer<'a> {
static ref PAREN_R: Regex = token(r"[)]" );
static ref AT: Regex = token(r"@" );
static ref COMMA: Regex = token(r"," );
static ref COMMENT: Regex = token(r"#([^!\n\r].*)?$" );
static ref EOF: Regex = token(r"(?-m)$" );
static ref COMMENT: Regex = token(r"#([^!\n\r]*)?\r?$" );
static ref EOF: Regex = token(r"\z" );
static ref EOL: Regex = token(r"\n|\r\n" );
static ref EQUALS: Regex = token(r"=" );
static ref INTERPOLATION_END: Regex = token(r"[}][}]" );
Expand Down Expand Up @@ -526,6 +526,12 @@ c: b
"((())))N(+.",
}

summary_test! {
crlf_newline,
"#\r\n#asdf\r\n",
"#$#$.",
}

error_test! {
name: tokenize_space_then_tab,
input: "a:
Expand Down Expand Up @@ -616,8 +622,8 @@ c: b
}

error_test! {
name: mixed_leading_whitespace,
input: "a:\n\t echo hello",
name: mixed_leading_whitespace,
input: "a:\n\t echo hello",
index: 3,
line: 1,
column: 0,
Expand Down

0 comments on commit 1d0aa17

Please sign in to comment.