Skip to content

Commit 28e5d50

Browse files
committed
Fixes escaped newlines not working
1 parent 9942f0f commit 28e5d50

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

dm-lezer/src/dm.grammar

+2-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
}
1212
}
1313

14-
@skip { s | escapedWs }
14+
@skip { s }
1515

1616
preprocessor[@isGroup=Preprocessor] {
1717
PpDefine |
@@ -140,11 +140,9 @@ UnaryOp[group=operator] {"!"}
140140

141141

142142
@tokens {
143-
escapedWs { "\\" ws+ }
143+
s { ("\\\n" | " " | "\t" )+ }
144144
Identifier { ("\\" ![\n] | @asciiLetter | @digit | "_" | "-")+ }
145145
PpIdentifier { (@asciiLetter | "_") (@asciiLetter | @digit | "_" | "-")+ }
146-
ws { @whitespace }
147-
s { " " }
148146
nl { "\n" | @eof }
149147
"!"
150148
"==" "!=" ">" ">=" "<" "<=" "||" "&&" "*" "/" "+" "-"

dm-lezer/tests/ppdefine

+10
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,13 @@ File(
5252
PpIdentifier
5353
),Expression)
5454
)
55+
56+
# Escaped newlines
57+
\
58+
# \
59+
define\
60+
test
61+
==>
62+
File(
63+
PpDefine(define,PpIdentifier)
64+
)

0 commit comments

Comments
 (0)