#TextHighlighter

CA
'This class is the parent class of all syntax highlighters.
'
'It allows to create a custom highlighter based on a definition file.
Paint
m

(Text)s(X)f(Y)f[(Theme)TextHighlighterTheme;(Pos)i]
'Paint highlighted text on the current painter.
'
'- ~Text~: The text to highlight.
'- ~X~, ~Y~: The coordinates of the drawing start point.
'- ~Theme~: The theme to use. If not specified, a default theme is used.
'- ~Pos~: The position of the first character to draw. By default all text is drawn.
'
'### See also
'- [/doc/richtext]
List
R
String[]

'Return the list of all registered syntax highlighters.
'
'### See also
'- [../register]
CanRewrite
v
b

'Return or set if the highlighter is allowed to rewrite the text to highlight.
TextAfter
v
s

'Return or set the highlighted text after it has been rewritten.
LengthAdded
v
i

'Return or set the number of characters added (or removed) after the text has been rewritten.
Limit
v
b

'Return or set if the highlighted text is a function limit.
Comment
v
b

'Return or set if the highlighted text is a comment.
_IncludeHighlight
v
i

Key
r
s

'Return the highlighter internal name.
Name
r
s

'Return the highlighter display name.
Keywords
r
String[]

'Return the list of keywords associated with the highlighter.
States
r
String[]

'Return the list of state names used by the highlighter.
HasLimit
r
b

'Return if the highlighter use limits
_init
M


Register
M

(Key)s[(Name)s(Path)s]
'Register a custom highlighter based on a definition file.
'
'- ~Key~: The highlighter internal name.
'- ~Name~: The highlighter display name.
'- ~Path~: The path of the definition file.
_get
M
TextHighlighter
(Key)s
'Create and return the highlighter from its internal name.
'
'- ~Key~: The highlighter internal name.
_Create
M
TextHighlighter
(Key)s
RegisterState
m
i
(Name)s
'Register a state for that highlighter.
'
'- ~Name~: The name of the state.
'
'The function returns the state index that must be used to fill the highlight array.
_Analyze
m
Byte[]
(Text)s(CompileState)Short[];[(MatchLimit)b(Limit)s(&Pos)i]
_Add
m

(aHighlight)Byte[];(iState)c(iCount)i
Run
m
Byte[]
(Text)s(State)Short[];
'Highlight some piece of text.
'
'- ~Text~: The text to highlight. It usually must be a full line of text ended with a newline character.
'- ~State~: The internal highlighter state.
'
'Return the result of the highlighthing as an array of bytes.
'
'The internal state must be initialized with a void array of bytes.
'
'When the 'Run()' method returns, it will be updated to reflect the state of the highlighter after the highlighting, so
'that you can call the 'Run()' method again to highlight the next line of text.
ToHTML
m
s
(Text)s[(Theme)TextHighlighterTheme;]
'Return the result of text highlighting as HTML.
'
'- ~Text~: The text to highlight.
'- ~Theme~: The theme to use. If not specified, a default theme is used.
ToRichText
m
s
(Text)s[(Theme)TextHighlighterTheme;]
'Return the result of text highlighting as rich text.
'
'- ~Text~: The text to highlight.
'- ~Theme~: The theme to use. If not specified, a default theme is used.
'
'### See also
'- [/doc/richtext]
ToANSI
m
s
(Text)s[(Theme)TextHighlighterTheme;]
'Return the result of text highlighting as VT100 ANSI characters that can be printed on a terminal.
'
'- ~Text~: The text to highlight.
'- ~Theme~: The theme to use. If not specified, a default theme is used.
GetName
M
s
(Key)s
'Return the display name of an highlighter from its internal name.
'
'- ~Key~: The highlighter internal name.
#TextHighlighterStyle

C
'This class represents the style used for drawing a specific highlighter state.
Color
p
i

'Return or set the RGB color used for drawing some text using that style.
Key
p
s

'Return or set the name of the state the style is associated with.
Name
r
s

'Return the display name of the style.
'
'This is the display name of its associated state.
Bold
p
b

'Return or set if the text drawn with that style must be bold.
Underline
p
b

'Return or set if the text drawn with that style must have a solid underline.
Dotted
p
b

'Return or set if the text drawn with that style must have a dotted underline.
Strikeout
p
b

'Return or set if the text drawn with that style must be stroke out.
Oblique
p
b

'Return or set if the text drawn with that style must be oblique.
Background
r
b

'Return if that style is for drawing a background and not drawing text.
InvertedColor
r
i

'Return the inverted color of the [../color] property.
_call
M
TextHighlighterStyle
(Color)i[(Bold)b(Underline)b(Dotted)b(Oblique)b]
'Create a new highlighter style from some of its properties.
'
'- ~Color~: The RGB color used for drawing some text using that style.
'- ~Bold~: If the text drawn with that style must be bold.
'- ~Underline~: If the text drawn with that style must have a dotted underline.
'- ~Dotted~: If the text drawn with that style must be stroke out.
Copy
m
TextHighlighterStyle

'Return a copy of the current style.
Apply
m

(Style)TextHighlighterStyle;
'@{since 3.21}
'
'Copy the contents of another style inside the current style
ToString
m
s

'Convert the style contents to a string.
FromString
M
TextHighlighterStyle
(Style)s
'Create a style from a string description.
'
'- ~Style~: The style description. It should be a string returned by the [../tostring] method.
'
'Return the newly created style.
:Change
:


'This event is raised when the style contents has changed.
#TextHighlighterTheme

C
'This class implements an highlighter theme.
States
R
String[]

'Return the list of the default states implemented in each registered highlighters.
AllStates
R
String[]

'Return the list of all registered states.
List
R
String[]

'Return the list of all default themes
Names
R
String[]

'Return the display names of all default themes.
Settings
p
s

'Return or set the theme contents as a settings string.
Dark
r
b

'Return if the theme has been adapted to a dark background.
Styles
r
TextHighlighterStyle[]

'Return the styles associated with this theme
Background
p
i

'@{since 3.21}
'
'Return or set the background color the theme is adapted to.
'
'The [Color.Default](/comp/gb.image/color/default) value means that the theme is not adapted, and that the style colors are the original ones.
Adaptative
p
b

'@{since 3.22}
'
'Return or set if the theme colors will automatically adapt to the background color.
'
'The property is TRUE by default.
_init
M


_RegisterState
M
i
(Key)s[(Highlighter)s(sDefault)s]
_new
m


'Create a new highlighter theme initialized with the default "gambas" theme.
_Load
m

(Path)s
Copy
m
TextHighlighterTheme

'Copy a theme and returns it.
_put
m

(Style)TextHighlighterStyle;(Key)s
'Define the highlighter style associated with a color name.
'
'- ~Key~ is the color name.
'- ~Style~ is the associated style.
Add
m
TextHighlighterStyle
(Key)s(Color)i[(Bold)b(Underline)b(Dotted)b]
'Shortcut method for creating a style and associating it with a color name.
'
'- ~Key~: The color name.
'- ~Color~: The RGB color of the style.
'- ~Bold~: If the text must be drawn bold.
'- ~Underline~: If the text must be drawn with a solid underline.
'- ~Dotted~: If the text must be drawn with a dotted underline.
'
'The newly created style is returned.
_get
m
TextHighlighterStyle
(Key)s
'Return the style associated with a color name.
'
'- ~Key~: The color name.
Style_Change
m


BackgroundStyle_Change
m


Save
m

(Path)s
'Save the theme contents to a file
'
'- ~Path~: The file path.
ToString
m
s

'Convert the contents of the theme to a string.
Load
M
TextHighlighterTheme
(Path)s
'Create a theme from a file.
'
'- ~Path~: The path of the file to load.
FromString
m

(Theme)s
'Initialize a theme from a string description.
'
'- ~Theme~: The description of the theme.
'
'The description should have been created by the [../tostring] method.
Invert
m


'Invert the color of all theme styles.
_CheckDefault
M

[(sHighlighter)s]
_GetHighlighterStates
M
String[]
(sHighlighter)s
GetStateIndex
M
i
(Key)s
'Return the index of a specific state.
'
'- ~Key~ is the state key.
'
'If the state key is either '"Normal"' or '"*"', then '0' is returned.
'
'If no state has been registered with that key, '-1' is returned.
_GetStateName
M
s
(sKey)s
_GetIncludeColor
m
i
(Include)i
:Change
:


'This event is raised when one of the theme style has been modified.
#_TextHighlighter_Gambas
TextHighlighter
C
Keywords
r
String[]

HasLimit
r
b

_init
M


_Analyze
m
Byte[]
(Text)s(CompileState)Short[];[(MatchLimit)b(Limit)s(&Pos)i]
