Recent

Author Topic: AtSynEdit and HL's  (Read 899 times)

Borneq

  • Full Member
  • ***
  • Posts: 238
AtSynEdit and HL's
« on: February 02, 2020, 11:07:00 am »
How to add syntaxt highlighter to AtSynEdit ?
How get information about text file structure from highlighter like SynWrite editor?

Alextp

  • Hero Member
  • *****
  • Posts: 1119
    • UVviewsoft
Re: AtSynEdit and HL's
« Reply #1 on: February 03, 2020, 09:37:14 pm »
How to create new highlighter?
If you mean EControl lexer (lexer can be another), see
https://wiki.freepascal.org/CudaText#Lexers_editing

Or how to plug-in ready highlighter?
See demo in the folder app/demo_adapter_econtrol.

Alextp

  • Hero Member
  • *****
  • Posts: 1119
    • UVviewsoft
Re: AtSynEdit and HL's
« Reply #2 on: February 03, 2020, 09:39:41 pm »
>How get information about text file structure from highlighter like SynWrite editor?

Get Editor's AdapterHilite property, cast it to TATAdapterEControl, then use properties of that class to read all data about parsed contents-- tokens etc.

file atsynedit_adapter_econtrol.pas -
Code: Pascal  [Select][+][-]
  1.     //tokens
  2.     procedure GetTokenWithIndex(AIndex: integer; out APntFrom, APntTo: TPoint; out
  3.       ATokenString, ATokenStyle: string);
  4.     procedure GetTokenAtPos(APos: TPoint; out APntFrom, APntTo: TPoint; out
  5.       ATokenString, ATokenStyle: string);
  6.     function GetTokenString(const token: TecSyntToken): string;
  7.     procedure GetTokenProps(const token: TecSyntToken; out APntFrom, APntTo: TPoint;
  8.       out ATokenString, ATokenStyle: string);
  9.  
« Last Edit: February 03, 2020, 09:41:37 pm by Alextp »

 

TinyPortal © 2005-2018