Rather than create a whole new folding highlighter, I thought I would modify a copy of TSynPasSyn, called TSynPasSyn2. It's in its own unit and also renamed other types e.g. TPascalCodeFoldBlockType2 etc so nothing should be referring back to old TSynPasSyn.
I'd like to change the pascal keyword from '
function' to '
defn'
so I created a
const kw_function = 'defn' ;
and replaced in 2 places where the text 'function' is hard coded:
RESERVED_WORDS_TP: array [1..54] of String = (
'absolute', 'and', 'array', 'asm',
'begin',
'case', 'const', 'constructor',
'destructor', 'div', 'do', 'downto',
'else', 'end',
'file', 'for',
//'function',
kw_function ,
'goto',
and
function TSynPasSyn2.Func102: TtkTokenKind2;
var
InClass: Boolean;
begin
if KeyComp({'Function'}kw_function) then begin
It didn't highlight the word 'defn' and from tracing the code I think the highlighter is still expecting an
8 letter word (the count of letters in 'function'). I also tried changing my keyword to 8 letters ('functio_') but that didn't work either.
I'm not sure about hash tables, maybe that is where I need to look closer, but can anyone tell me where I should be looking to make this change please? If I can make a few simple changes to the pascal highlighter it would be great for me because it already does so much of what I want to do, it just has different keyword names for my purposes.
Thanks.