Re: [patch] highlighting usertypes started with `_'

Lorenzo Bettini <[email protected]> Mon, 02 May 2011 15:40:37 +0200
Newsgroups gmane.comp.gnu.source-highlight.general
Message-ID <[email protected]>
Hi

thanks for the report; actually _ should be used also for detecting 
variable name, so the complete diff is

  (usertype,usertype,normal) =
-`([[:alpha:]](?:[^[:punct:][:space:]]|[_])*)
+`([[:alpha:]_](?:[^[:punct:][:space:]]|[_])*)
  ((?:<.*>)?)
-(\s+(?=[*&]*[[:alpha:]][^[:punct:][:space:]]*\s*[[:punct:]\[\]]+))`
+(\s+(?=[*&]*[[:alpha:]_][^[:punct:][:space:]]*\s*[[:punct:]\[\]]+))`

you can find it in git

cheers
	Lorenzo

On 05/01/2011 04:06 AM, Masatake YAMATO wrote:
> Hi,
>
> In C program usertypes started with `_' are not highlighted expectedly.
> e.g.
>
>      typedef i __i;
>      __i j = 1;
>
> here __i is not recognized as usertype.
> Usetype started with _ is popular in linux kernel.
>
> 2011-05-01  Masatake YAMATO<[email protected]>
>
> 	* src/clike_vardeclaration.lang: Accept a usertype started with _.
>
> diff --git a/src/clike_vardeclaration.lang b/src/clike_vardeclaration.lang
> index 620c45f..bbee078 100644
> --- a/src/clike_vardeclaration.lang
> +++ b/src/clike_vardeclaration.lang
> @@ -1,4 +1,4 @@
>   (usertype,usertype,normal) =
> -`([[:alpha:]](?:[^[:punct:][:space:]]|[_])*)
> +`([[:alpha:]_](?:[^[:punct:][:space:]]|[_])*)
>   ((?:<.*>)?)
>   (\s+(?=[*&]*[[:alpha:]][^[:punct:][:space:]]*\s*[[:punct:]\[\]]+))`
>
> _______________________________________________
> Help-source-highlight mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/help-source-highlight


-- 
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134     (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com  http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net