diff --git a/pygments/lexers/lean.py b/pygments/lexers/lean.py index 968043c9ca..0805584baf 100644 --- a/pygments/lexers/lean.py +++ b/pygments/lexers/lean.py @@ -223,7 +223,7 @@ class Lean4Lexer(RegexLexer): ], 'string': [ (r'[^\\"]+', String.Double), - (r'\\[n"\\]', String.Escape), + (r'\\[n"\\\n]', String.Escape), ('"', String.Double, '#pop'), ], } diff --git a/tests/examplefiles/lean4/Test.lean b/tests/examplefiles/lean4/Test.lean index cb0b8330d9..697b2934c6 100644 --- a/tests/examplefiles/lean4/Test.lean +++ b/tests/examplefiles/lean4/Test.lean @@ -238,3 +238,7 @@ variable {ι A B : Type*} (𝒜 : ι → A) (ℬ : ι → B) #check `𝒜.a #check ``𝒜 + +#check "\ + This is\na \ + wrapped string. diff --git a/tests/examplefiles/lean4/Test.lean.output b/tests/examplefiles/lean4/Test.lean.output index c2abb1bfb7..2b134d7c3e 100644 --- a/tests/examplefiles/lean4/Test.lean.output +++ b/tests/examplefiles/lean4/Test.lean.output @@ -3608,4 +3608,17 @@ 'check' Name ' ' Text.Whitespace '``𝒜' Literal.String.Symbol -'\n' Text.Whitespace +'\n\n' Text.Whitespace + +'#' Name.Builtin.Pseudo +'check' Name +' ' Text.Whitespace +'"' Literal.String.Double +'\\\n' Literal.String.Escape + +' This is' Literal.String.Double +'\\n' Literal.String.Escape +'a ' Literal.String.Double +'\\\n' Literal.String.Escape + +' wrapped string.\n' Literal.String.Double