Skip to content

Commit

Permalink
Merge pull request #175 from itchyny/support-multiline-comments
Browse files Browse the repository at this point in the history
Support multi-line comment with backslash
  • Loading branch information
MiSawa authored Feb 25, 2024
2 parents e3251cc + bc5c51c commit 82fc61b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crates/lang/src/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ lexer! {
type Error = LexicalError;

let ws = [' ' '\t' '\n'] | "\r\n";
let comment = '#' (_ # ['\r' '\n'])*;
let comment = '#' (_ # ['\\' '\r' '\n'] | '\\' (_ # '\r' | "\r\n"))*;
let ident_start = ['a'-'z' 'A'-'Z' '_'];
let digit = ['0'-'9'];
let hex_digit = $digit | ['a'-'f' 'A'-'F'];
Expand Down Expand Up @@ -671,7 +671,8 @@ mod test {
assert_lex(
r#""\(
1# This
+ # is
+ # is \
test
2 #
)" # comment"#,
&[
Expand Down

0 comments on commit 82fc61b

Please # to comment.