ATSynEdit: Assign a lexer
Posted: 24.08.2019 14:51
I am trying to add a lexer defined in a cpp.lcf file to ATsynedit.
On a wiki page it says that TATAdapterEControl can be added to a ATsynedit.:
Adapter:= TATAdapterEControl.Create(Self);
ed.AdapterForHilite:= Adapter;
However, I assume that I have to load the definition of the highlighter. However, the method "Adapter.Lexer.LoadFromFile" cannot load *.lcf files.
I tried to follow the CudaText code:
an:=TecSyntAnalyzer.Create(self);
an.LoadFromFile('../lex/cpp.lcf');
This works but I have trouble finding a simple way to assign this "an" object to a ATsynedit. The CudaText code is more complex and works for multiple lexers, but I am looking for something simple and currently I only need one lexer.
btw. lex.lib.demo on Linux Mint 19.2 did not work for me. It fails to compile "F.edSample.Gutter[F.edSample.GutterBandBm].Visible:= false; " on line 229 in unit formlexerprop. Another issue I have is that most of the packages does not appear on the component palette. Nevertheless, CudaText compiles and works fine.
Thanks,
Rune
On a wiki page it says that TATAdapterEControl can be added to a ATsynedit.:
Adapter:= TATAdapterEControl.Create(Self);
ed.AdapterForHilite:= Adapter;
However, I assume that I have to load the definition of the highlighter. However, the method "Adapter.Lexer.LoadFromFile" cannot load *.lcf files.
I tried to follow the CudaText code:
an:=TecSyntAnalyzer.Create(self);
an.LoadFromFile('../lex/cpp.lcf');
This works but I have trouble finding a simple way to assign this "an" object to a ATsynedit. The CudaText code is more complex and works for multiple lexers, but I am looking for something simple and currently I only need one lexer.
btw. lex.lib.demo on Linux Mint 19.2 did not work for me. It fails to compile "F.edSample.Gutter[F.edSample.GutterBandBm].Visible:= false; " on line 229 in unit formlexerprop. Another issue I have is that most of the packages does not appear on the component palette. Nevertheless, CudaText compiles and works fine.
Thanks,
Rune