icsharpcode / AvalonEdit

The WPF-based text editor component used in SharpDevelop
http://avalonedit.net/
MIT License
1.85k stars 471 forks source link

TSQL backslash single quote in a string breaks highlighting #324

Closed timgblack closed 2 years ago

timgblack commented 2 years ago

'\''' breaks syntax highlighting. The following is valid TSQL code to escape single quotes in a string:

SELECT REPLACE('hello '' world', '''', '\''')

Expected output: hello \' world

I believe the problem is that the highlighter treats \ as an escape character, while TSQL does not. The highlighter sees the first 4 characters as a string containing a single escaped quote '\'', and the last single quote as the start of a new string, where TSQL sees it as a string with a backslash and a single quote.