help-nano
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-nano] C language color syntax highlighting


From: Geremy F.
Subject: Re: [Help-nano] C language color syntax highlighting
Date: Tue, 06 Jan 2004 15:18:50 -0500

Hi,

Thanks for the reply! I'm sorry I should have specified the problem better, but those three expressions did not work at all. The other syntex highlighting specified (comments, strings and preprocessor) worked great.

Thanks.

---
-Geremy-->





From: Neil Brown <address@hidden>
To: "Geremy F." <address@hidden>,address@hidden
Subject: Re: [Help-nano] C language color syntax highlighting
Date: Tue, 06 Jan 2004 20:22:03 +0000


All of the 'color' statements work EXCEPT for the following (cut'n'paste from the nanorc.sample file):
color red "\<[A-Z_]{2,}\>"
color green "\<(float|char|int|void|static|const|struct)\>"
color brightyellow "\<(if|while|do|else|case|switch)\>"

I have switched around the colors to make sure that all the colors can be displayed on my terminal setup.

If I change the second and third line to:
color green "(float|char|int|void|static|const|struct)"
color brightyellow "(if|while|do|else|case|switch)"

It works somewhat, but if those character strings are present inside a larger word they will be highlighted, which is obviously not desired behavior.

Basically I need to fix the two regexp expression to find the C keywords, and I need a better expression to find operator symbols (+,-,=,&,%,!,|,~,.) etc.

The \< and \> around the word, as it originally was, make the word only match if there are non-word characters both sides. Removing them as you did make the regexes stop working. When you say they didnt work (before the changes), do you mean that they didnt change to the right colour or they matched wrongly or something else?

Operator symbols can be done as simple regexes as long as you are wary of which ones are special regular expression characters. The main ones that I can remember that will be relevant are + . * ^

HTH,

Neil.


_________________________________________________________________
Take advantage of our limited-time introductory offer for dial-up Internet access. http://join.msn.com/?page=dept/dialup





reply via email to

[Prev in Thread] Current Thread [Next in Thread]