Re: [gedit-list] gtksourceview for backreferencing sub-patterns ?



2012/3/7 Paul Dugan <flyingdutchmanjb gmail com>
The following sample XML markup for c.lang will highlight "timeout" on
line 2 but will not highlight it ever again in the source code. Does
gtksourceview support some sort of backreference on the "sub-pattern"
that will match all instances throughout the file ?

No, you can't do that. It seems you are trying to make a semantic syntax highlighter in gsv, but this is unfortunately not supported at the moment.
 

http://developer.gnome.org/gtksourceview/stable/lang-reference.html

/usr/share/gtksourceview-2.0/language-specs/c.lang

<context id="struct" style-ref="struct">
    <match>\bstruct\b\s\w+\s(\w+)</match>
         <include>
              <context sub-pattern="1" style-ref="structname"/>
         </include>
</context>



Example source code:

1. int ns;
2. struct timeval timeout;
3. timeout.tv_sec = 1;
4. timeout.tv_usec = 0;
5.
6. setsockopt(ns, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout));
7. setsockopt(ns, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout));
_______________________________________________
gedit-list mailing list
gedit-list gnome org
http://mail.gnome.org/mailman/listinfo/gedit-list



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