Allow for comments in simplexpr
This commit is contained in:
parent
fcd54abf91
commit
8fea52bda9
2 changed files with 18 additions and 0 deletions
|
@ -49,6 +49,7 @@ pub enum Token {
|
|||
|
||||
#[error]
|
||||
#[regex(r"[ \t\n\f]+", logos::skip)]
|
||||
#[regex(r";.*", logos::skip)]
|
||||
Error,
|
||||
}
|
||||
|
||||
|
@ -101,4 +102,5 @@ fn test_simplexpr_lexer() {
|
|||
use itertools::Itertools;
|
||||
insta::assert_debug_snapshot!(Lexer::new(0, 0, r#"(foo + - "()" "a\"b" true false [] 12.2)"#).collect_vec());
|
||||
insta::assert_debug_snapshot!(Lexer::new(0, 0, r#"" " + music"#).collect_vec());
|
||||
insta::assert_debug_snapshot!(Lexer::new(0, 0, r#"foo ; bar"#).collect_vec());
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
source: crates/simplexpr/src/parser/lexer.rs
|
||||
expression: "Lexer::new(0, 0, r#\"foo ; bar\"#).collect_vec()"
|
||||
|
||||
---
|
||||
[
|
||||
Ok(
|
||||
(
|
||||
0,
|
||||
Ident(
|
||||
"foo",
|
||||
),
|
||||
3,
|
||||
),
|
||||
),
|
||||
]
|
Loading…
Add table
Reference in a new issue