[Gambas-user] Question about highlight.styles[] list from original eval.highlight class

Benoît Minisini benoit.minisini at gambas-basic.org
Mon Dec 11 02:08:53 CET 2023


Le 11/12/2023 à 01:41, Brian G a écrit :
> 
> On 12/10/23 12:00, Benoît Minisini wrote:
>> Le 10/12/2023 à 18:55, Brian G a écrit :
>>> I have a number of programs that analyze the source code, and produce 
>>> output, they use this to identify the types of elements found
>>>
>>> and print in human readable names.   They no longer work!
>>>
>>
>> If you use 'Highlight.Analyze()', the values of the 'Highlight.Types' 
>> array are the constants of the 'Highlight' class.
>>
>> It should be enough for what you need, isn't it? Or did I miss something?
>>
> It is not enough, the styles array contained the text value for each of 
> the types[] entry values. the types entry values were an index into the 
> array
> 
> styles looked like this
> 
> Styles As String[] = ["Background", "Normal", "Selection", "Alternate", 
> "Highlight", "CurrentLine", "Added", "Removed", "Error", "Comment", 
> "Documentation", "Keyword",
>    "Function", "Operator", "Symbol", "Number", "String", "Breakpoint", 
> "Current", "Datatype", "Preprocessor", "Escape", "Label", "Constant", 
> "Class", "Id", "Element",
>    "Property", "Pseudo", "Rule", "Important", "File", "Header", 
> "Position", "Markup", "Attribute", "Value", "Entity", "WebMarkup", 
> "WebComment", "WebArgument"]
> 
> There is nothing equivalent now.
> 
> I have code that does this print highlight.styles[types[9]]
> 
> which prints 'comment'
> 
> My  programs analyze other programs and produce reports using this 
> information.
> 
> And rely on the text from the styles array that was part of the original 
> eval.highlight class
> 

The style names are now managed by 'gb.highlight'.

Either you use 'gb.eval.highlight', and then you can use the 
Highlight.Styles property (I -did not- remove it).

Either you use 'gb.highlight', which replaces 'gb.eval.highlight', and 
then the array of style names is now dynamically managed by the 
TextHighlighterTheme class (any highlighter register its style names 
dynamically). It's that class that will return that array. At the 
moment, it's an hidden public method, but I can make a public property.

Regards,

-- 
Benoît Minisini.



More information about the User mailing list