XYS Syntax Highlighting/Autocomplete for Akelpad [XY v26.40]

Discuss and share scripts and script files...
ren326
Posts: 4
Joined: 01 May 2024 10:02

Re: XYS Syntax Highlighting/Autocomplete for Akelpad [XY v25.90]

Post by ren326 »

Hi Flux,

pleased you liked my suggestion.
Same idea to highlight function name :

QuotesRE:
;==========================================================================
;Flags Pattern \BackRef=(FontStyle,ColorText,ColorBk) \BackRef=...
;==========================================================================
0 "(function)\s+(.+$)" "\1=(0,${IF},0) \2=(2,0,#0000FF)"

Bonne journée.

ren326
Posts: 4
Joined: 01 May 2024 10:02

Re: XYS Syntax Highlighting/Autocomplete for Akelpad [XY v25.90]

Post by ren326 »

ReHi,

better RegExp to isolate function name :

0 	"(function)\s+(.+\))\s+\{$"                	"\1=(0,${IF},0) \2=(2,0,#0000FF)"

ren326
Posts: 4
Joined: 01 May 2024 10:02

Re: XYS Syntax Highlighting/Autocomplete for Akelpad [XY v25.90]

Post by ren326 »

A little script to help decode highlight "flags values"
Copy + paste in a .js file under AkelPad\AkelFiles\Plugs\Scripts
Useful for me, maybe for you ?

Code: Select all

// Select flag value and call script.

var pSelText=AkelPad.GetSelText();
var nResult=0;
var flag=[];

flag[1]		= "case sensitive";
flag[2]		= "word is a composition of chars";
flag[4]		= "QE required";
flag[8]		= "QS is ignored, use last met delimiter as QS";
flag[16]	= "QE is ignored, use first met delimiter as QE";
flag[32]	= "don't highlight QS";
flag[64]	= "don't highlight QE";
flag[128]	= "don't catch and don't highlight QS";
flag[256]	= "don't catch and don't highlight QE";
flag[512]	= "QS, delimiter or word is at line start";
flag[1024]	= "QE, delimiter or word is at line end";
flag[2048]	= "QS is surrounded with delimiters";
flag[4096]	= "QE is surrounded with delimiters";
flag[8192]	= "quote doesn't contain delimiters";
flag[16384]	= "only QS string is catched";

if (pSelText) {
    nResult=DeSum(pSelText);
    WScript.Echo("[ QS/QE : Quote Start/End ]\n\n"+pSelText + " (sum of)" + nResult);
}
else {
    WScript.Echo("No value selected !");
}

function DeSum(value) {
    var b=1;
    var res=[];
    while (b<=value) {
	if (b&value) res.push("\n"+b+"\t : "+flag[b]);
	b<<=1;
    }
    return res;
}

FluxTorpedoe
Posts: 900
Joined: 05 Oct 2011 13:15

Re: XYS Syntax Highlighting/Autocomplete for Akelpad [XY v25.90]

Post by FluxTorpedoe »

@Horst
Thanks for the feedback, it’s always welcome! 😎

@ren
Interesting script for Akelpad, thanks!
Also, the highlight for function declarations could be a nice touch too (even though less useful in my case, I declare them at the bottom of my scripts).

@all
To make the new highlight for script captions more customizable, I tried to use theme variables instead of fixed colors, but obviously it depends on everyone’s theme. I may set it as default in the next update, so tell me if that would work for you.

Replace the active caption highlight after "; Quotes",
Default:

Code: Select all

517 1 #FFF #40639A `"` `"` "" "" "-"
with this:

Code: Select all

517 1 ${HighLight_CaretColor} ${ATTR} `"` `"` "" "" ""

JamesMcBride
Posts: 30
Joined: 20 May 2015 16:18

Re: XYS Syntax Highlighting/Autocomplete for Akelpad [XY v25.90]

Post by JamesMcBride »

I cannot seem to get the Toolbar Button to execute an XYS script to work.

The path to my XYPlorer executable is: "C:\Program Files (x86)\XYplorer"

So, the line that I added to the Toolbar editor is:
"XYplorer..." Exec('"%a\C:\Program Files (x86)\XYplorer\XYplorer.exe" /flg=2 /script="%f"') Icon("%a\C:\Program Files (x86)\XYplorer\XYplorer.exe")

What am I doing wrong here?

Thanks for your help!

-Jim

FluxTorpedoe
Posts: 900
Joined: 05 Oct 2011 13:15

Re: XYS Syntax Highlighting/Autocomplete for Akelpad [XY v25.90]

Post by FluxTorpedoe »

HI,

Goodness gracious me 🙃
It took me a while to figure it out, but the answer is simple: the first post is incorrect! 🙈

"%a" stands for "Akelpad directory": I use XYplorer as a portable package with some essential programs in sub or near folders, so all my paths are relative in general, and my line uses "%a\..\..\..\XYplorer.exe".

Just remove the %a\ and you should be fine and dandy.

Code: Select all

"XYplorer..." Exec('"C:\Program Files (x86)\XYplorer\XYplorer.exe" /flg=2 /script="%f"') Icon("C:\Program Files (x86)\XYplorer\XYplorer.exe")
Have a nice day,
   Flux

JamesMcBride
Posts: 30
Joined: 20 May 2015 16:18

Re: XYS Syntax Highlighting/Autocomplete for Akelpad [XY v25.90]

Post by JamesMcBride »

Thank you, Flux! And thank you so much for this XYS Lexer....I am really just learning to script in XYS, but I can tell that this is going to be very useful. I guess my first question should have been, what is the '%a'?, cause I really had no idea what it was for.
I knew that your revised line was gonna work when I saw the XYPlorer icon appear immediately on the menu bar....that made me a happy panda!

Thanks again

FluxTorpedoe
Posts: 900
Joined: 05 Oct 2011 13:15

Re: XYS Syntax Highlighting/Autocomplete for Akelpad [XY v26.40]

Post by FluxTorpedoe »

Hi everyone,

I just updated the file to XYplorer v26.40 (link to file and configuration tips available in first post).

— ⚠ This is a notable update (163 differences) —

Features:
 — Changes from 25.90
 — Updated and added LOTS of extra info (flags, modes, etc.), especially for complex commands (get(), rename, tab(), view()...)
 — Changed highlighting of script labels (main entries, and after load and sub), now colored based on theme
      Note: I tried to set the colors to the elements that work best (more or less) with all defaults themes, either light or dark
 — Added highlighting of function declaration names (also based on theme)
      Note: By default, only function name is highlighted.
      To highlight it also with parentheses, or to highlight full declaration, (un)comment the desired setting after "QuotesRE:"
 — Lots of small fixes

Have a nice day, 8)
Flux

Malarki
Posts: 203
Joined: 03 Dec 2019 02:51

Re: XYS Syntax Highlighting/Autocomplete for Akelpad [XY v26.40]

Post by Malarki »

Thanks for making this useful tool even more useful.

Post Reply