diff --git a/app/src/gambas3/.project b/app/src/gambas3/.project index 821ac55ce..b6086c183 100644 --- a/app/src/gambas3/.project +++ b/app/src/gambas3/.project @@ -31,7 +31,7 @@ Component=gb.util Description="Integrated Development Environment for Gambas" Authors="Benoît Minisini\nFabien Bodard\nCharlie Reinl\nJosé Luis Redrejo\nRobert Rowe\nTobias Boege" Arguments=[["~/AVT_Edith-Piaf_1740.jpeg"]] -CurrentArgument=1 +CurrentArgument=0 TabSize=2 Translate=1 Language=en diff --git a/app/src/gambas3/.src/Editor/Code/FTextEditor.class b/app/src/gambas3/.src/Editor/Code/FTextEditor.class index a94bb631f..eb28235d2 100644 --- a/app/src/gambas3/.src/Editor/Code/FTextEditor.class +++ b/app/src/gambas3/.src/Editor/Code/FTextEditor.class @@ -898,7 +898,7 @@ Public Sub Compress() As Boolean CompressMessage = "" & Subst(("The file has been compressed from &1 to &2 bytes (&3)."), Str(iLen), Str(Len(sText)), Format(fGain, "#.##%")) & " " & ("Original file has been saved in the Project folder.") Endif -Catch +Catch Dec Application.Busy CompressMessage = "" & ("Unable to compress file.") & "
" & Error.Text diff --git a/app/src/gambas3/.src/Editor/MCompressFile.module b/app/src/gambas3/.src/Editor/MCompressFile.module index 2be8150a8..e10147902 100644 --- a/app/src/gambas3/.src/Editor/MCompressFile.module +++ b/app/src/gambas3/.src/Editor/MCompressFile.module @@ -7,6 +7,7 @@ Private Const SUBST_CAR As String = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP Private $aExt As String[] = ["js", "css", "html"] Private $cKeyword As Collection +Private $cKeywordRegexp As Collection Private $cSubst As Collection Private $cIdent As Collection Private $iSubst As Integer @@ -44,6 +45,11 @@ Private Sub InitJavascriptKeywords() $cKeyword[sStr] = 1 Next + $cKeywordRegexp = New Collection + For Each sStr In ["break", "case", "continue", "delete", "do", "else", "finally", "in", "instanceof", "return", "throw", "try", "typeof", "void"] + $cKeywordRegexp[sStr] = True + Next + End Private Sub SubstIdent(sIdent As String) @@ -96,6 +102,7 @@ Public Sub Javascript(sText As String) As String Dim bKeyword As Boolean Dim iPosMem As Integer Dim bRegExp As Boolean + Dim sLastKeyword As String If Not $cKeyword Then InitJavascriptKeywords @@ -251,6 +258,7 @@ Public Sub Javascript(sText As String) As String sIdent &= sCar Continue Else + sLastKeyword = "" If Len(sIdent) >= 2 bKeyword = $cKeyword.Exist(sIdent) If Not IsDigit(Left(sIdent)) And If Not bKeyword Then @@ -279,6 +287,7 @@ Public Sub Javascript(sText As String) As String Else If sIdent = "var" Then bVar = True Endif + sLastKeyword = sIdent Endif Endif @@ -304,8 +313,13 @@ Public Sub Javascript(sText As String) As String Endif If Right(sRes) = "\n" Then sRes = Left(sRes, -1) Else If sCar = "/" Then - If sCar2 <> "/ " Then - bRegExp = True + If iPos > 1 Then + sCar2 = Right(RTrim(Left(sText, iPos - 1))) + If InStr("+-*/.,!%&(:;<=>?[^{|}~", sCar2) Then + bRegExp = True + Else If sLastKeyword And If $cKeywordRegexp.Exist(sLastKeyword) Then + bRegExp = True + Endif Endif Else If InStr(" \t\n", sCar) Then