Skip to content

Commit

Permalink
Fixes escaped newlines not working
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkar598 committed Jul 7, 2024
1 parent 9942f0f commit 28e5d50
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 2 additions & 4 deletions dm-lezer/src/dm.grammar
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
}

@skip { s | escapedWs }
@skip { s }

preprocessor[@isGroup=Preprocessor] {
PpDefine |
Expand Down Expand Up @@ -140,11 +140,9 @@ UnaryOp[group=operator] {"!"}


@tokens {
escapedWs { "\\" ws+ }
s { ("\\\n" | " " | "\t" )+ }
Identifier { ("\\" ![\n] | @asciiLetter | @digit | "_" | "-")+ }
PpIdentifier { (@asciiLetter | "_") (@asciiLetter | @digit | "_" | "-")+ }
ws { @whitespace }
s { " " }
nl { "\n" | @eof }
"!"
"==" "!=" ">" ">=" "<" "<=" "||" "&&" "*" "/" "+" "-"
Expand Down
10 changes: 10 additions & 0 deletions dm-lezer/tests/ppdefine
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,13 @@ File(
PpIdentifier
),Expression)
)

# Escaped newlines
\
# \
define\
test
==>
File(
PpDefine(define,PpIdentifier)
)

0 comments on commit 28e5d50

Please sign in to comment.