diff --git a/comp/src/gb.eval.highlight/.src/OldHighlighter/Helper.module b/comp/src/gb.eval.highlight/.hidden/OldHighlighter/Helper.module similarity index 100% rename from comp/src/gb.eval.highlight/.src/OldHighlighter/Helper.module rename to comp/src/gb.eval.highlight/.hidden/OldHighlighter/Helper.module diff --git a/comp/src/gb.eval.highlight/.src/OldHighlighter/HighlightC.module b/comp/src/gb.eval.highlight/.hidden/OldHighlighter/HighlightC.module similarity index 100% rename from comp/src/gb.eval.highlight/.src/OldHighlighter/HighlightC.module rename to comp/src/gb.eval.highlight/.hidden/OldHighlighter/HighlightC.module diff --git a/comp/src/gb.eval.highlight/.src/OldHighlighter/HighlightCPlusPlus.module b/comp/src/gb.eval.highlight/.hidden/OldHighlighter/HighlightCPlusPlus.module similarity index 100% rename from comp/src/gb.eval.highlight/.src/OldHighlighter/HighlightCPlusPlus.module rename to comp/src/gb.eval.highlight/.hidden/OldHighlighter/HighlightCPlusPlus.module diff --git a/comp/src/gb.eval.highlight/.src/OldHighlighter/HighlightCSS.module b/comp/src/gb.eval.highlight/.hidden/OldHighlighter/HighlightCSS.module similarity index 100% rename from comp/src/gb.eval.highlight/.src/OldHighlighter/HighlightCSS.module rename to comp/src/gb.eval.highlight/.hidden/OldHighlighter/HighlightCSS.module diff --git a/comp/src/gb.eval.highlight/.src/OldHighlighter/HighlightDiff.module b/comp/src/gb.eval.highlight/.hidden/OldHighlighter/HighlightDiff.module similarity index 100% rename from comp/src/gb.eval.highlight/.src/OldHighlighter/HighlightDiff.module rename to comp/src/gb.eval.highlight/.hidden/OldHighlighter/HighlightDiff.module diff --git a/comp/src/gb.eval.highlight/.src/OldHighlighter/HighlightHTML.module b/comp/src/gb.eval.highlight/.hidden/OldHighlighter/HighlightHTML.module similarity index 100% rename from comp/src/gb.eval.highlight/.src/OldHighlighter/HighlightHTML.module rename to comp/src/gb.eval.highlight/.hidden/OldHighlighter/HighlightHTML.module diff --git a/comp/src/gb.eval.highlight/.src/OldHighlighter/HighlightJavascript.module b/comp/src/gb.eval.highlight/.hidden/OldHighlighter/HighlightJavascript.module similarity index 100% rename from comp/src/gb.eval.highlight/.src/OldHighlighter/HighlightJavascript.module rename to comp/src/gb.eval.highlight/.hidden/OldHighlighter/HighlightJavascript.module diff --git a/comp/src/gb.eval.highlight/.src/OldHighlighter/HighlightSQL.module b/comp/src/gb.eval.highlight/.hidden/OldHighlighter/HighlightSQL.module similarity index 100% rename from comp/src/gb.eval.highlight/.src/OldHighlighter/HighlightSQL.module rename to comp/src/gb.eval.highlight/.hidden/OldHighlighter/HighlightSQL.module diff --git a/comp/src/gb.eval.highlight/.src/Helper.module b/comp/src/gb.eval.highlight/.src/Helper.module new file mode 100644 index 000000000..476075675 --- /dev/null +++ b/comp/src/gb.eval.highlight/.src/Helper.module @@ -0,0 +1,71 @@ +' Gambas module file + +Public Sub ReadNumber(sText As String, iPos As Integer) As Integer + + sText = String.Mid$(sText, iPos) + iPos = 1 + + If IsDigit(Left(sText)) Then + Inc iPos + Else If InStr("+-", Left(sText)) And If IsDigit(Mid$(sText, 2, 1)) Then + iPos += 2 + Else + Return 0 + Endif + + While IsDigit(Mid$(sText, iPos, 1)) + Inc iPos + Wend + + If Mid$(sText, iPos, 1) = "." Then + Inc iPos + Else + Return iPos - 1 + Endif + + While IsDigit(Mid$(sText, iPos, 1)) + Inc iPos + Wend + + If InStr("eE", Mid$(sText, iPos, 1)) Then + Inc iPos + Else + Return iPos - 1 + Endif + + If InStr("+-", Mid$(sText, iPos, 1)) And If IsDigit(Mid$(sText, iPos + 1, 1)) Then + iPos += 2 + Else If IsDigit(Mid$(sText, iPos, 1)) Then + Inc iPos + Else + Return iPos - 1 + Endif + + While IsDigit(Mid$(sText, iPos, 1)) + Inc iPos + Wend + + Return iPos - 1 + +End + +Public Sub ReadIdentifier(sText As String, iPos As Integer, sIdentCar As String) As Integer + + sText = String.Mid$(sText, iPos) + iPos = 1 + + If InStr(sIdentCar, Left(sText)) Then + While InStr(sIdentCar, Mid$(sText, iPos, 1)) > 0 And Asc(Mid$(sText, iPos, 1)) > 32 + Inc iPos + Wend + Else + While InStr(sIdentCar, Mid$(sText, iPos, 1)) = 0 And Asc(Mid$(sText, iPos, 1)) > 32 + Inc iPos + Wend + Endif + + Return iPos - 1 + +End + + diff --git a/comp/src/gb.eval.highlight/.src/Main.module b/comp/src/gb.eval.highlight/.src/Main.module index 9d484affe..590158b64 100644 --- a/comp/src/gb.eval.highlight/.src/Main.module +++ b/comp/src/gb.eval.highlight/.src/Main.module @@ -7,43 +7,43 @@ Public Const STYLE_CSS As Integer = 3 Private Const TAG_HTML As Integer = 0 Private Const TAG_CODE As Integer = 1 -Public Sub Main2() - - Dim sLine As String - Dim fTime As Float - Dim aScan As String[] - Dim I As Integer - - For I = 1 To 1 - - fTime = Timer - - For Each sLine In Split(File.Load("~/gambas/3.0/trunk/comp/src/gb.form.editor/test.html"), "\n") - - 'Inc iLine - 'Debug iLine;; Len(sLine) - - Highlight.Text = sLine - Highlight.State = Highlight.Normal - - HighlightHTML.Run(STYLE_HTML) - - Next - - Print Timer - fTime - - For Each sLine In Split(File.Load("/proc/self/maps"), "\n") - If InStr(sLine, "[heap]") Then - aScan = Scan(sLine, "*-* *") - Print "Heap size is " & Format(Val("&H" & aScan[1] & "&") - Val("&H" & aScan[0] & "&"), "#,##0") & " bytes." - Break - Endif - Next - - Next - -End - +' Public Sub Main2() +' +' Dim sLine As String +' Dim fTime As Float +' Dim aScan As String[] +' Dim I As Integer +' +' For I = 1 To 1 +' +' fTime = Timer +' +' For Each sLine In Split(File.Load("~/gambas/3.0/trunk/comp/src/gb.form.editor/test.html"), "\n") +' +' 'Inc iLine +' 'Debug iLine;; Len(sLine) +' +' Highlight.Text = sLine +' Highlight.State = Highlight.Normal +' +' HighlightHTML.Run(STYLE_HTML) +' +' Next +' +' Print Timer - fTime +' +' For Each sLine In Split(File.Load("/proc/self/maps"), "\n") +' If InStr(sLine, "[heap]") Then +' aScan = Scan(sLine, "*-* *") +' Print "Heap size is " & Format(Val("&H" & aScan[1] & "&") - Val("&H" & aScan[0] & "&"), "#,##0") & " bytes." +' Break +' Endif +' Next +' +' Next +' +' End +' Public Sub Main() Dim hHighlighter As TextHighlighter diff --git a/comp/src/gb.eval.highlight/.src/TextHighlighter.class b/comp/src/gb.eval.highlight/.src/TextHighlighter.class index a6ab7b14d..ccef345a5 100644 --- a/comp/src/gb.eval.highlight/.src/TextHighlighter.class +++ b/comp/src/gb.eval.highlight/.src/TextHighlighter.class @@ -22,7 +22,7 @@ Property Read Styles As String[] Static Public _Highlight As Byte[] Static Public (Line) As Integer -Static Public State As Integer +Static Public State As Short Static Public Tag As Short Static Public TextAfter As String Static Public Alternate As Boolean @@ -44,7 +44,7 @@ Private Sub GetAlternate() As Integer End -Fast Static Public Sub Add((State) As Integer, Optional Count As Integer = 1) +Fast Static Public Sub Add((State) As Short, Optional Count As Integer = 1) Dim iState As Integer Dim I As Integer @@ -112,7 +112,7 @@ Public Sub ToHTML(Text As String, Optional Theme As Variant) As String Dim I As Integer Dim sHTML As String Dim aText As String[] - Dim iState As Integer + Dim iState As Short Dim hStyle As TextHighlighterStyle Dim bAlt As Boolean Dim iLen As Integer diff --git a/comp/src/gb.eval.highlight/.src/TextHighlighter_C.class b/comp/src/gb.eval.highlight/.src/TextHighlighter_C.class index 2ba7f2b19..d8d28627d 100644 --- a/comp/src/gb.eval.highlight/.src/TextHighlighter_C.class +++ b/comp/src/gb.eval.highlight/.src/TextHighlighter_C.class @@ -51,8 +51,8 @@ End Public Sub RunWith(sText As String, cKeyword As Collection, cOperator As Collection, cType As Collection) - Dim iState As Integer - Dim iTag As Integer + Dim iState As Short + Dim iTag As Short Dim iLenText As Integer Dim iPos, iSavePos As Integer Dim sCar As String diff --git a/comp/src/gb.eval.highlight/.src/TextHighlighter_CSS.class b/comp/src/gb.eval.highlight/.src/TextHighlighter_CSS.class index a93c31488..016b89ee2 100644 --- a/comp/src/gb.eval.highlight/.src/TextHighlighter_CSS.class +++ b/comp/src/gb.eval.highlight/.src/TextHighlighter_CSS.class @@ -72,16 +72,16 @@ End Public Sub Run(sText As String) - Dim iState As Integer - Dim iNextState As Integer + Dim iState As Short + Dim iNextState As Short Dim iInd As Integer Dim sOrgText As String Dim sCar As String Dim bLimit As Boolean - Dim iTag As Integer + Dim iTag As Short Dim sProperty As String Dim sWait As String - Dim iSaveState As Integer + Dim iSaveState As Short Dim iPos, iPos2 As Integer Dim bEscape As Boolean Dim N As Integer diff --git a/comp/src/gb.eval.highlight/.src/TextHighlighter_Diff.class b/comp/src/gb.eval.highlight/.src/TextHighlighter_Diff.class index 7278b7696..2932b80dd 100644 --- a/comp/src/gb.eval.highlight/.src/TextHighlighter_Diff.class +++ b/comp/src/gb.eval.highlight/.src/TextHighlighter_Diff.class @@ -8,7 +8,7 @@ Public Const _Styles As String = "File,Header,Position,Added,Removed" Public Sub Run(sText As String) - Dim iState As Integer + Dim iState As Short Dim nSpace As Integer TextHighlighter.Limit = False diff --git a/comp/src/gb.eval.highlight/.src/TextHighlighter_Gambas.class b/comp/src/gb.eval.highlight/.src/TextHighlighter_Gambas.class index d5978d134..23c2db6b4 100644 --- a/comp/src/gb.eval.highlight/.src/TextHighlighter_Gambas.class +++ b/comp/src/gb.eval.highlight/.src/TextHighlighter_Gambas.class @@ -49,8 +49,8 @@ End Public Sub Run(Text As String) - Dim iState As Integer - Dim iTag As Integer + Dim iState As Short + Dim iTag As Short Dim iPos As Integer Dim I As Integer Dim iLen As Integer diff --git a/comp/src/gb.eval.highlight/.src/TextHighlighter_Html.class b/comp/src/gb.eval.highlight/.src/TextHighlighter_Html.class index 152ef2a21..8c32945ec 100644 --- a/comp/src/gb.eval.highlight/.src/TextHighlighter_Html.class +++ b/comp/src/gb.eval.highlight/.src/TextHighlighter_Html.class @@ -32,7 +32,7 @@ Private Enum TAG_VARIABLE, TAG_CODE_MARKUP Static Private $sTextAfter As String Static Private $sBufferAfter As String -Static Private $aStateStack As Integer[] +Static Private $aStateStack As Short[] ' TODO: call TextHighlighter_Gambas ! @@ -41,8 +41,8 @@ Private Sub AnalyzeCode(sText As String) As String Dim iInd As Integer Dim iPos As Integer Dim iLen As Integer - Dim iState As Integer - Dim iTag As Integer + Dim iState As Short + Dim iTag As Short 'Print "AnalyzeCode: "; sText @@ -99,13 +99,13 @@ End Private Sub RunWith(Text As String, iStyle As Integer) - Dim iState As Integer - Dim iTag, iTagCode, iTagMode As Integer + Dim iState As Short + Dim iTag, iTagCode, iTagMode As Short Dim sText As String Dim I, iLenText As Integer Dim sCar As String Dim iPos As Integer - Dim iNextState As Integer + Dim iNextState As Short Dim bLimit, bNextLimit As Boolean Dim sQuote As String Dim sMarkup As String @@ -597,7 +597,7 @@ NEXT_CHAR: PUSH_STATE: - If Not $aStateStack Then $aStateStack = New Integer[] + If Not $aStateStack Then $aStateStack = New Short[] $aStateStack.Push(TextHighlighter.State) $aStateStack.Push(TextHighlighter.Tag) diff --git a/comp/src/gb.eval.highlight/.src/TextHighlighter_Javascript.class b/comp/src/gb.eval.highlight/.src/TextHighlighter_Javascript.class index fe884e8c0..8dd08ce62 100644 --- a/comp/src/gb.eval.highlight/.src/TextHighlighter_Javascript.class +++ b/comp/src/gb.eval.highlight/.src/TextHighlighter_Javascript.class @@ -20,7 +20,7 @@ Static Public Sub _init() $aKeywords = New String[] For Each sStr In ["break", "case", "catch", "class", "const", "continue", "debugger", "default", "delete", "do", "else", "enum", "export", - "extends", "finally", "for", "function", "get", "if", "import", "in", "instanceof", "new", "return", "set", "super", "switch", "throw", + "extends", "finally", "for", "function", "get", "if", "import", "in", "instanceof", "let", "new", "return", "set", "super", "switch", "throw", "try", "typeof", "var", "void", "while", "with", "yield"] $cKeyword[sStr] = 0 $aKeywords.Add(sStr) @@ -47,7 +47,7 @@ End Public Sub Run(sText As String) Dim iState As Integer - Dim iTag As Integer + Dim iTag As Short Dim iLenText As Integer Dim iPos As Integer Dim sCar As String diff --git a/comp/src/gb.eval.highlight/.src/TextHighlighter_SQL.class b/comp/src/gb.eval.highlight/.src/TextHighlighter_SQL.class index e2f61b904..c467faf33 100644 --- a/comp/src/gb.eval.highlight/.src/TextHighlighter_SQL.class +++ b/comp/src/gb.eval.highlight/.src/TextHighlighter_SQL.class @@ -51,7 +51,7 @@ End Public Sub Run(sText As String) Dim iState As Integer - Dim iTag As Integer + Dim iTag As Short Dim iLenText As Integer Dim iPos As Integer Dim sCar As String diff --git a/comp/src/gb.eval.highlight/.src/TextHighlighter_Sh.class b/comp/src/gb.eval.highlight/.src/TextHighlighter_Sh.class index 33fa6a857..f86a8c58c 100644 --- a/comp/src/gb.eval.highlight/.src/TextHighlighter_Sh.class +++ b/comp/src/gb.eval.highlight/.src/TextHighlighter_Sh.class @@ -63,7 +63,7 @@ End Public Sub RunWith(sText As String, cKeyword As Collection, cOperator As Collection, cType As Collection) Dim iState As Integer - Dim iTag As Integer + Dim iTag As Short Dim iLenText As Integer Dim iPos, iSavePos As Integer Dim sCar As String