Recent

Author Topic: (SOLVED) TSynEdit new syntax  (Read 1891 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
(SOLVED) TSynEdit new syntax
« on: April 04, 2021, 10:58:11 pm »
Hello to all. I have a question. I would like to implement the syntax for cobol for the TSynEdit component. How can I do? I have always used this component very little.
« Last Edit: April 05, 2021, 05:49:54 pm by xinyiman »
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: TSynEdit new syntax
« Reply #1 on: April 04, 2021, 11:11:36 pm »
You'll have to either find or write a highlighter for COBOL.

For the first option there is (IIRC) one in the original SynEdit source tree or you might find others googling for "TSynCobolSyn" or "synedit cobol highlighter", though I don't know what degree of compatibility those might have with the LCL/Lazarus fork.

For the second option, you can by start looking at the section on Highlighters, in the SynEdit wiki page, and follow on to the SynEdit Highlighter one.

HTH!
« Last Edit: April 04, 2021, 11:15:31 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

sstvmaster

  • Sr. Member
  • ****
  • Posts: 299
greetings Maik

Windows 10,
- Lazarus 2.2.6 (stable) + fpc 3.2.2 (stable)
- Lazarus 2.2.7 (fixes) + fpc 3.3.1 (main/trunk)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9754
  • Debugger - SynEdit - and more
    • wiki
Re: TSynEdit new syntax
« Reply #3 on: April 05, 2021, 02:04:57 am »
Aside from potentially existing Highlighters, there is a tutorial:
https://wiki.lazarus.freepascal.org/SynEdit_Highlighter

Before starting the tutorial, you should read
https://wiki.lazarus.freepascal.org/SynEdit#Logical.2FPhysical_caret_position

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: TSynEdit new syntax
« Reply #4 on: April 05, 2021, 05:49:41 pm »
I solved it thanks to your indications. Thanks so much
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

MarkMLl

  • Hero Member
  • *****
  • Posts: 6646
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

MarkMLl

  • Hero Member
  • *****
  • Posts: 6646
Re: TSynEdit new syntax
« Reply #6 on: April 12, 2021, 10:09:15 pm »
Can I also mention https://bugs.freepascal.org/view.php?id=18248 please and the VHDL and Verilog highlighters in the final note?

Given an arbitrary collection of highlighters sitting on Github that probably predate the current IDE by years, how does one go about testing compilation and debugging them?

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9754
  • Debugger - SynEdit - and more
    • wiki
Re: (SOLVED) TSynEdit new syntax
« Reply #7 on: April 12, 2021, 11:38:39 pm »
1) Download and compile.

2) Run some test data.
- I wouldn't worry about registering them in the component palette. Create them from code.
- Set colors, if needed
- Put text in the editor, and see if the HL does something at all.
2a) Edit the text data. Undo/Redo....

3) Debugging, if needed...
Depends on each HL, but to know what SynEdit might call: https://wiki.lazarus.freepascal.org/SynEdit_Highlighter


If they are that old, they probably need at least be changed to the correct base class
« Last Edit: April 12, 2021, 11:41:50 pm by Martin_fr »

MarkMLl

  • Hero Member
  • *****
  • Posts: 6646
Re: (SOLVED) TSynEdit new syntax
« Reply #8 on: April 13, 2021, 09:37:51 am »
1) Download and compile.

2) Run some test data.
- I wouldn't worry about registering them in the component palette. Create them from code.
- Set colors, if needed
- Put text in the editor, and see if the HL does something at all.
2a) Edit the text data. Undo/Redo....

3) Debugging, if needed...
Depends on each HL, but to know what SynEdit might call: https://wiki.lazarus.freepascal.org/SynEdit_Highlighter


If they are that old, they probably need at least be changed to the correct base class

Are you saying they can be compiled in isolation, without being installed as packages?

I've really done /very/ little with packages, even as a user.

MarkMLl

MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9754
  • Debugger - SynEdit - and more
    • wiki
Re: (SOLVED) TSynEdit new syntax
« Reply #9 on: April 13, 2021, 02:33:00 pm »

Are you saying they can be compiled in isolation, without being installed as packages?

I've really done /very/ little with packages, even as a user.

Just put the unit in your projectj

Code: Pascal  [Select][+][-]
  1. uses SomeHilUnit;
  2.  
  3. Hl := TSomeHil.create(nil);
  4. SynEdit1.Highlighter := Hl;

MarkMLl

  • Hero Member
  • *****
  • Posts: 6646
Re: (SOLVED) TSynEdit new syntax
« Reply #10 on: April 13, 2021, 02:52:20 pm »
Thanks Martin, got it. Minor simulation project into which I'd also like to put a Verilog/VHDL editor.

(Later) I can confirm that the ExtraSyn components- which include a COBOL highlighter- compile and run with Lazarus 2.0.8.

MarkMLl
« Last Edit: April 13, 2021, 05:32:36 pm by MarkMLl »
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018