Take multiline strings into account in javascript syntax highlighting and javascript editor mode.

[GB.EVAL.HIGHLIGHT]
* NEW: Take multiline strings into account in javascript syntax highlighting.

[GB.FORM.EDITOR]
* NEW: Take multiline strings into account in javascript mode.
This commit is contained in:
gambas 2018-08-10 11:52:09 +02:00
parent f5b1c1c03b
commit e76cdd33d6
4 changed files with 17 additions and 19 deletions

View file

@ -1,4 +1,4 @@
[Component]
Key=gb.eval.highlight
Version=3.10.90
Version=3.11.90
Requires=gb.eval

View file

@ -1,7 +1,7 @@
# Gambas Project File 3.0
Title=gb.eval.highlight
Startup=Init
Version=3.10.90
Version=3.11.90
VersionFile=1
Component=gb.eval
Component=gb.net

View file

@ -49,7 +49,7 @@ Public Sub Run(sText As String)
Dim iPos As Integer
Dim sCar As String
Dim bSingleLineComment As Boolean
Dim bSingleQuoteString As Boolean
Dim sQuoteChar As String
Dim sIdent As String
Dim bTestShowLimit As Boolean
Dim bLastExpr As Boolean
@ -58,7 +58,11 @@ Public Sub Run(sText As String)
iTag = TextHighlighter.Tag
iLenText = String.Len(sText)
bLastExpr = True
If iState = Highlight.Operator Then bLastExpr = False
If iState = Highlight.Operator Then
bLastExpr = False
Else If iState = Highlight.String Then
sQuoteChar = "`"
Endif
For iPos = 1 To iLenText
@ -122,12 +126,9 @@ Public Sub Run(sText As String)
Continue
Endif
Else If sCar = "\"" Then
Else If InStr("\"'`", sCar) Then
iState = Highlight.String
bSingleQuoteString = False
Else If sCar = "'" Then
iState = Highlight.String
bSingleQuoteString = True
sQuoteChar = sCar
Else If Asc(sCar) <= 32 Then
Else If IsDigit(sCar) Then
@ -251,12 +252,7 @@ Public Sub Run(sText As String)
Inc iPos
Continue
Endif
Else If sCar = "\"" And If Not bSingleQuoteString Then
TextHighlighter.Add(iState)
iState = Highlight.Normal
bLastExpr = True
Continue
Else If sCar = "'" And If bSingleQuoteString Then
Else If sCar = sQuoteChar Then
TextHighlighter.Add(iState)
iState = Highlight.Normal
bLastExpr = True
@ -274,7 +270,9 @@ Public Sub Run(sText As String)
Endif
If iState <> Highlight.Comment And If iState <> Highlight.Help Then
iState = Highlight.Normal
If iState <> Highlight.String Or If sQuoteChar <> "`" Then
iState = Highlight.Normal
Endif
Endif
TextHighlighter.Limit = False

View file

@ -2,6 +2,6 @@
Inherits TextEditorMode
Static Public Const BRACES_OPEN As String = "([{\"'"
Static Public Const BRACES_CLOSE As String = ")]}\"'"
Static Public Const STRING_DELIM As String = "\"'"
Static Public Const BRACES_OPEN As String = "([{\"'`"
Static Public Const BRACES_CLOSE As String = ")]}\"'`"
Static Public Const STRING_DELIM As String = "\"'`"