You are not logged in.

#1 2006-12-31 23:30:10

martti1
Member
Registered: 2006-10-14
Posts: 38

nano syntax higlighting, regexp

I found this working example for Xdefaults highlighting

syntax "Xdefaults" "(.|/|)default.*$" "(.|/|)resource.$" "fonts.alias"
color magenta "XTerm"
color cyan "Rxvt"
color white "*(\.|[^'])*:"
color brightgreen "<(true)>"
color brightred "<(false)>"
color brightwhite "[0-9]"
color blue "!.*$"
color blue "#.*$"

color white "*(\.|[^'])*:" - If the line were "xterm*blah: something", then it would start to match from the *, as I understand. There's something about matching any characters but ', or matching  and one character. It doesn't make sense why you'd need to match a  there.

color brightgreen "<(true)>" - I understand what this matches, if it finds the word "true", then it's colored bright green, but what is the meaning of < and >. I didn't find them listed as special characters, but as soon as i remove the backslashes, it stops working.
I'd appreciate if someone could explain this a little bit.

I started my own too, so far I've got: color brightmagenta "(s{1}|s*[']).*$"

Edit: I guess I sort of figured out the first one and I find the part with the \. useless and just "*[^']:" is enough, still no clue about the other one, though.


Linux user #438799

Offline

Board footer

Powered by FluxBB