Bookstore

Recent

Author Topic: SynFacilSyn scripts converter to full Lazarus SynEdit units  (Read 469 times)

Saylo_49

  • New Member
  • *
  • Posts: 39
SynFacilSyn scripts converter to full Lazarus SynEdit units
« on: February 20, 2020, 05:30:55 pm »
Hello

When I was browsing the github repo of the Delphi's SynEdit version, I found SynGen

https://github.com/SynEdit/SynEdit

This little software use a text file containing instructions about Keywords, Colors, Styles, etc. To generate a full Pascal unit of language's specific syntax highlighting.

Is there any plan or effort to create something similar that can convert the SynFacil XML script containing lang. info, keywords, folding info, colors, ... to a full Pas unit to be implemented in the Lazarus package ??
Lazarus 2.0.2 - FPC 3.0.4 - Win32

Edson

  • Hero Member
  • *****
  • Posts: 1065
Re: SynFacilSyn scripts converter to full Lazarus SynEdit units
« Reply #1 on: February 21, 2020, 02:36:51 am »
I don't think someone is going to implement a conversor from SynFacilsyn XML files to Pascal units, because SynFacilSyn can work as faster as a hardcoded highlighter. Not worth it.

And is someone is animated to do something like this, probably will choose a different syntax, considering the SynFacilSyn XML syntax file is optimized to define a fast lexer, more than be flexible.

IMHO SynEdit architecture is some limited and has to be redesigned or replaced. Modern IDE requires powerful editor machines, with features like plugin support, graphic interaction, multi-languages support, solid API for completion, highlighters and codetools.
Lazarus 1.6 - FPC 3.0.0 - x86_64-win64 on  Windows 7

Saylo_49

  • New Member
  • *
  • Posts: 39
Re: SynFacilSyn scripts converter to full Lazarus SynEdit units
« Reply #2 on: February 21, 2020, 07:23:02 pm »
I don't think someone is going to implement a conversor from SynFacilsyn XML files to Pascal units, because SynFacilSyn can work as faster as a hardcoded highlighter. Not worth it.

And is someone is animated to do something like this, probably will choose a different syntax, considering the SynFacilSyn XML syntax file is optimized to define a fast lexer, more than be flexible.


Well, I wanted a coded Pascal units just to use the settings on object inspector during the runtime like the units implemented in the packages. For exemple, to enable the user on the runtime to change color and style for keywords and comments.


IMHO SynEdit architecture is some limited and has to be redesigned or replaced. Modern IDE requires powerful editor machines, with features like plugin support, graphic interaction, multi-languages support, solid API for completion, highlighters and codetools.


Since you mentionned that, please, can you suggest a good and useful Syntax Highlighting library or package that is easy to implement in a Lazarus project and is cross platform like the SynEdit
Lazarus 2.0.2 - FPC 3.0.4 - Win32

Edson

  • Hero Member
  • *****
  • Posts: 1065
Re: SynFacilSyn scripts converter to full Lazarus SynEdit units
« Reply #3 on: February 22, 2020, 01:06:51 am »
Well, I wanted a coded Pascal units just to use the settings on object inspector during the runtime like the units implemented in the packages. For exemple, to enable the user on the runtime to change color and style for keywords and comments.
I think I don't understand.
Do you refer to use the object inspector to change attributes in SynFacilSyn? Object Inspector is not used in runtime.
Do you refers to be able to have a "Setting form", for SynFacilSyn, to change the attribute properties in runtime?

Since you mentionned that, please, can you suggest a good and useful Syntax Highlighting library or package that is easy to implement in a Lazarus project and is cross platform like the SynEdit
I don't have nothing in special. Just to look some modern editors, like Atom, Brackets, or VSCode and check theirs libraries and syntax.
Lazarus 1.6 - FPC 3.0.0 - x86_64-win64 on  Windows 7

Saylo_49

  • New Member
  • *
  • Posts: 39
Re: SynFacilSyn scripts converter to full Lazarus SynEdit units
« Reply #4 on: February 22, 2020, 11:01:56 pm »
Well, I wanted a coded Pascal units just to use the settings on object inspector during the runtime like the units implemented in the packages. For exemple, to enable the user on the runtime to change color and style for keywords and comments.
I think I don't understand.
Do you refer to use the object inspector to change attributes in SynFacilSyn? Object Inspector is not used in runtime.
Do you refers to be able to have a "Setting form", for SynFacilSyn, to change the attribute properties in runtime?


I refered to enable changing the colors and styles of keywords and attribute while running the product app, like the settings in the Lazarus main options


Since you mentionned that, please, can you suggest a good and useful Syntax Highlighting library or package that is easy to implement in a Lazarus project and is cross platform like the SynEdit
I don't have nothing in special. Just to look some modern editors, like Atom, Brackets, or VSCode and check theirs libraries and syntax.


What they have in addition ? I think the multi-language support can be done with your SynFacil, even the completion API can be implemented in Lazarus.

The only fantastic stuff about Atom, VSCode, etc. is they have the stylish graphical user interface with the most-wanted dark theme.
BTW, why the lazarus lack the form style implementation ? For changing the color of menus, controls, background.
Delphi has this feature since D7 with its ColorMap, and actually it has a plenty of ready-to-use cross-platform styles to  be implement on any project.
Lazarus 2.0.2 - FPC 3.0.4 - Win32

Edson

  • Hero Member
  • *****
  • Posts: 1065
Re: SynFacilSyn scripts converter to full Lazarus SynEdit units
« Reply #5 on: February 23, 2020, 05:04:26 am »
I refered to enable changing the colors and styles of keywords and attribute while running the product app, like the settings in the Lazarus main options

To work with settings I've created a library: https://github.com/t-edson/MiConfig

With this library you can save/restore and show in a form, settings values.

This library is prepared to work with the complete flow: Disk <-> Value <-> Form

It makes very easy to show a property in a Config dialog, and read/save to disk in XML or INI format. And can be used to any setting value not only for SynFacilSyn.

For setting attributes in SynFacilSyn, using "MiConfig", you can see my project: https://github.com/t-edson/PicPas

There is a Dialog that can config highlighter attributes for all the languages defined in the folder /syntax.

Maybe you can use it as a model.

Lazarus 1.6 - FPC 3.0.0 - x86_64-win64 on  Windows 7

Saylo_49

  • New Member
  • *
  • Posts: 39
Re: SynFacilSyn scripts converter to full Lazarus SynEdit units
« Reply #6 on: February 23, 2020, 10:01:09 pm »
Well @Edson :) :) :)
You have a great software that I will dig about it

But, which component did you used for the tabs in the code editor ?

Is it possible to do that with the Tabbed documents interface (TDI notebook) available in SF Lazarus CCR ?

https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/tdi/
Lazarus 2.0.2 - FPC 3.0.4 - Win32

Edson

  • Hero Member
  • *****
  • Posts: 1065
Re: SynFacilSyn scripts converter to full Lazarus SynEdit units
« Reply #7 on: February 24, 2020, 03:42:35 am »
But, which component did you used for the tabs in the code editor ?

Is it possible to do that with the Tabbed documents interface (TDI notebook) available in SF Lazarus CCR ?

https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/tdi/

I used mi own unit for showing editors in tabs. It's defined in the unit "FrameEditView" of my project https://github.com/t-edson/PicPas

This unit, use another wrapper for SynFacilSyn: my library https://github.com/t-edson/SynFacilUtils who deals with dialogs, encoding, languages, file history, ...

I've considered to include "FrameEditView" in "SynFacilUtils" but it's a lot of work I haven't had time to do.

I think it's possible to use any container like Lazarus TPageControl to include several editors controlled by SynFacilSyn. You just have to  take care of managing the highlighter assignment.

By the way. I would recommend to use SynFacilCompletion instead of SynFacilSyn, to have the completion features in the editors, using the same XML syntax file.
« Last Edit: February 24, 2020, 03:46:57 am by Edson »
Lazarus 1.6 - FPC 3.0.0 - x86_64-win64 on  Windows 7