summaryrefslogtreecommitdiff
path: root/src/parse/tokens.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-07-31 22:59:14 +0200
committerLaurenz <laurmaedje@gmail.com>2021-08-01 00:00:36 +0200
commit3c92bad9a7cd6b880de197806443ffcce2cac9d8 (patch)
tree1faf79c66e23bc37711af16ad690a9878e28d348 /src/parse/tokens.rs
parentfbd3d191137aac8188ab8c6503d257d65d873972 (diff)
Pretty-printed diagnostics with traceback
Diffstat (limited to 'src/parse/tokens.rs')
-rw-r--r--src/parse/tokens.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/parse/tokens.rs b/src/parse/tokens.rs
index 356a2f96..9fd13ecc 100644
--- a/src/parse/tokens.rs
+++ b/src/parse/tokens.rs
@@ -198,13 +198,16 @@ impl<'s> Tokens<'s> {
// Count the number of newlines.
let mut newlines = 0;
- while let Some(c) = self.s.eat_merging_crlf() {
+ while let Some(c) = self.s.eat() {
if !c.is_whitespace() {
self.s.uneat();
break;
}
if is_newline(c) {
+ if c == '\r' {
+ self.s.eat_if('\n');
+ }
newlines += 1;
}
}
@@ -484,8 +487,8 @@ impl Debug for Tokens<'_> {
}
}
-fn keyword(id: &str) -> Option<Token<'static>> {
- Some(match id {
+fn keyword(ident: &str) -> Option<Token<'static>> {
+ Some(match ident {
"not" => Token::Not,
"and" => Token::And,
"or" => Token::Or,