From 28e5d504274b6f3bd7478cfbf9f9ef783db725aa Mon Sep 17 00:00:00 2001 From: alexkar598 <25136265+alexkar598@users.noreply.github.com> Date: Sun, 7 Jul 2024 16:43:18 -0400 Subject: [PATCH] Fixes escaped newlines not working --- dm-lezer/src/dm.grammar | 6 ++---- dm-lezer/tests/ppdefine | 10 ++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/dm-lezer/src/dm.grammar b/dm-lezer/src/dm.grammar index a46a434..aeebf66 100644 --- a/dm-lezer/src/dm.grammar +++ b/dm-lezer/src/dm.grammar @@ -11,7 +11,7 @@ } } -@skip { s | escapedWs } +@skip { s } preprocessor[@isGroup=Preprocessor] { PpDefine | @@ -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 } "!" "==" "!=" ">" ">=" "<" "<=" "||" "&&" "*" "/" "+" "-" diff --git a/dm-lezer/tests/ppdefine b/dm-lezer/tests/ppdefine index 428895a..a11f5d6 100644 --- a/dm-lezer/tests/ppdefine +++ b/dm-lezer/tests/ppdefine @@ -52,3 +52,13 @@ File( PpIdentifier ),Expression) ) + +# Escaped newlines +\ +# \ + define\ + test +==> +File( + PpDefine(define,PpIdentifier) +)