SQLEditor: lots of stuff

This commit is contained in:
Jonathan Jenne
2022-05-05 16:34:56 +02:00
parent 6a2bd3eabe
commit 02f61b1e3f
14 changed files with 506 additions and 118 deletions

View File

@@ -15,8 +15,9 @@ Public Class SQLSyntaxHighlightService
Private _keywords As Regex
Private _quotedString As New Regex("'([^']|'')*'")
Private _commentedString As New Regex("(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/)")
Private _placeholderString As New Regex("{#(\w+)#([\:\.\w\s_/-]+)}")
Private keywords As New List(Of String) From {
Private ReadOnly keywords As New List(Of String) From {
"INSERT",
"SELECT",
"CREATE",
@@ -72,6 +73,14 @@ Public Class SQLSyntaxHighlightService
End If
Next j
'Find all placeholders
ranges = TryCast(document.FindAll(_placeholderString).GetAsFrozen(), DocumentRange())
For j As Integer = 0 To ranges.Length - 1
If Not IsRangeInTokens(ranges(j), tokens) Then
tokens.Add(CreateToken(ranges(j).Start.ToInt(), ranges(j).End.ToInt(), Color.DarkTurquoise))
End If
Next j
'Find all comments
ranges = TryCast(document.FindAll(_commentedString).GetAsFrozen(), DocumentRange())
For j As Integer = 0 To ranges.Length - 1