Skip to content

Commit 6fe6895

Browse files
committed
Fix lexing on Windows.
Accidentally forgot to skip `\r` as whitespace, so lexing for files saved on Windows didn't work. Added a file with `\r\n` endings to ensure both the lexing and the reporting spans are correct.
1 parent d949eeb commit 6fe6895

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

crates/wac-parser/src/lexer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ fn detect_invalid_input(source: &str) -> Result<(), (Error, Span)> {
145145
/// Represents a WAC token.
146146
#[derive(Logos, Debug, Clone, Copy, PartialEq, Eq)]
147147
#[logos(error = Error)]
148-
#[logos(skip r"[ \t\n\f]+")]
148+
#[logos(skip r"[ \t\r\n\f]+")]
149149
#[logos(subpattern id = r"%?[a-z][a-z0-9]*(-[a-z][a-z0-9]*)*")]
150150
#[logos(subpattern package_name = r"(?&id)(:(?&id))+")]
151151
#[logos(subpattern semver = r"[0-9a-zA-Z-\.\+]+")]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package foo:bar;
2+
3+
import x: func();
4+
import x: func();
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
duplicate import `x`
2+
--> tests/resolution/fail/windows-file.wac:4:8
3+
|
4+
4 | import x: func();
5+
| ^

0 commit comments

Comments
 (0)