[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Help how to use Highlight component in Gambas


Hello,

Does someone could help me on how to use the Highlight component of Gambas.

I have tried many things but not able to use it.
I have an Editor1 object in a Form and I would like to have my personal Highlight for this Editor.

This is what I have implemented for now that not works:

Public Sub Form_Open()

  Dim hTextHighlighterTheme As New TextHighlighterTheme
  Dim hTextHighlighterStyle As New TextHighlighterStyle


  If Not TextHighlighter.List.Exist("personal") Then 
    TextHighlighter.Register("personal", "Personal", "manifest.highlight")
  End If

  If Exist(Application.Path &/ "manifest.theme") Then
    hTextHighlighterTheme.Load(Application.Path &/ "manifest.theme")
  End If

  If TextHighlighter.List.Exist("personal") Then 
    Editor1.Highlight = "personal"
  End If

End

=========================================================
File: manifest.highlight

escape{Normal}:
  match /\\./
shebang{Shebang=Preprocessor}:
  from /^#!/
comment:
  from /^#/
  from /#\s/
number:
  match /$(NUMBER)/
  match /$(NUMBER_HEXA)/
string.simple{String}:
  from ` to `
  escape:
    match /\\./
string.double{String}:
  from " to "
  escape:
    match /\\[$`'"\\]/
  expansion{Expansion=Datatype}:
    match /\$[A-Za-z0-9_]+/
  expansion.brace{Expansion}:
    from ${ to } with sh
  command{Expansion}:
    from ` to ` with sh
string.ansi{String}:
  from $' to '
  escape:
    match /\\[abeEfnrtv\\'"?]/
    match /\\[0-7]{3}/
    match /\\x[0-9a-fA-F]{2}/
    match /\\u[0-9a-fA-F]{4}/
    match /\\u[0-9a-fA-F]{8}/
    match /\\c[a-zA-Z]/
expansion{Expansion}:
  match /\$[A-Za-z0-9_]+/
expansion.brace{Expansion}:
  from ${ to } with sh
  from $[[ to ]] with sh
  from [[ to ]] with sh
command{Expansion}:
  from ` to ` with sh
keyword:
  keyword function do else test for to in fi if elif then return exit while until done break continue select case esac expect
operator:
  symbol -gt -lt -ge -ne -le -eq
  symbol { } $ # [ ] <<< . + << = >> == - ~ += ( , != * -= &= ;; ) < % & ]; @ ! ; > | ? ^ : <= /
function{Command=Function}:
 keyword echo read cd which rm cp mv rmdir cat grep awk tr sed sleep clear sudo su source eval export time date pwd set unset chown chmod exec alias unalias bg bind builtin caller command compgen complete compopt declare dirs disown enable fc fg getopts hash help history jobs kill let local logout mapfile popd printf pushd readarray readonly shift shopt suspend test times trap type typeset ulimit umask wait
symbol:
  match /[A-Za-z_][A-Za-z_0-9]*/


================================================
File: manifest.theme

[Gambas Highlighting Theme 1.0]
Background="#FFFFFF"
Normal="#000000"
Keyword="#C08C00,Bold"
Datatype="#E67E22,Bold"
Function="#3398C3,Bold"
Operator="#000000,Bold"
Symbol="#000000"
Number="#E62222"
String="#7F0000"
Comment="#888786"
Documentation="#808080,Bold"
Preprocessor="#C02FC0,Bold"
Breakpoint="#FF5F5F"
Current="#42C9FF"
Selection="#A4D9F0"
Highlight="#FFEB7F"
CurrentLine="#E7F7FF"
Error="#BF0303,Underline"
Escape="#A01717,Bold"
Label="#000000,Dotted"
Constant="#E62222,Bold"
Alternate="#FFFF7F"
Added="#009000,Bold"
Removed="#A00000,Bold"
Class="#DF6B00,Bold"
Id="#3398C3,Bold"
Element="#000000,Bold"
Property="#000000"
Pseudo="#404040,Bold"
Rule="#008040,Bold"
Important="#E00000,Bold,Underline"
File="#808080,Bold"
Header="#808080"
Position="#000000,Bold"
Markup="#000000,Bold"
Attribute="#3398C3,Bold"
Value="#7F0000"
Entity="#E67E22,Bold"
WebMarkup="#138013,Bold"
WebComment="#808080,Bold"
WebArgument="#138013"
Shebang="#1CC01C,Bold"
Expansion="#E67E22,Bold"
Command="#3398C3,Bold"
AtRule="#1CC01C,Bold"
PseudoClass="#000000,Bold"
Tag="#000000,Bold"
TagAttribute="#000000,Bold"
Color="#E62222,Bold"
Unit="#3398C3,Bold"
Diff="#3398C3,Bold"
Index="#000000,Bold"
Doctype="#1CC01C,Bold"
RegExp="#E67E22,Bold"

Thank you

Olivier Cruilles



Follow-Ups:
Re: Help how to use Highlight component in GambasBenoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx>
Re: Help how to use Highlight component in GambasLinus <olivier.cruilles@xxxxxxxx>