STATIC SUB Add ( State AS Integer [ , Count AS Integer ] )Defines the state of an UTF-8 character of the highlighted line.
The first time this method is called, the state of the first character of the line is defined. Then you should call this method for each other character until all are highlighted.
If Count is defined, then Count successive characters got the same state. By default, Count is one.
' HTML highlighting from the HighlightEditor example
' Note that the String class is used for dealing with UTF-8 characters.
PUBLIC SUB Editor1_Highlight()
DIM iState AS Integer
DIM iNextState AS Integer
DIM iInd AS Integer
DIM J AS Integer
DIM sText AS String
DIM sCar AS String
DIM iPos AS Integer
DIM bMarkup AS Boolean
iState = Highlight.State
sText = Highlight.Text
'PRINT "Highlight:";; iState;; sText
FOR iInd = 1 TO String.Len(sText)
iNextState = iState
sCar = String.Mid$(sText, iInd, 1)
IF bMarkup THEN
IF sCar = ">" THEN
bMarkup = FALSE
iState = Highlight.Keyword
iNextState = Highlight.Normal
ELSE IF sCar = " " THEN
iNextState = Highlight.Operator
ELSE IF sCar = "=" THEN
iNextState = Highlight.String
ENDIF
ELSE
SELECT CASE iState
CASE Highlight.Normal
IF sCar = "<" THEN
IF String.Mid$(sText, iInd, 4) = "