syntax-highlightinggtksourceview

GtkSourceView syntax highlighting - highlight until "=",


I have a custom SPICE (electronics) syntax highlighting for gEdit, it's working, but I would like to modify the highlighting for variables (and I don't know how to). What I have now is this:

<context id="variables" style-ref="string">
  <match extended="true">
    (\s[^\s&gt;&lt;&amp;(){};,=/+\-*\^]+|
    (?![({])\s*[^\s&gt;&lt;&amp;(){};,=/+\-*\^]+)
    \s*(\=)(?!(\s*\=))
  </match>
</context>

The parameters (variables) are defined like this:

.param Value=3.14

and, with the above code, "Value=" is highlighted, but I would like to omit the "=" from being coloured. I have tried (?!\=) on the last row, after 's*, plus a few combinations but... nothing.

In a more detailed way:

Please bear in mind that I have very little knowledge about PCRE, this is probably childish-looking but I don't mind as long as it's working. What I have now is done by too many trials-and-errors.


Solution

  • In the meantime I solved it with the help from jessevdk from #gedit on irc.gimp.org. The line

    \s*(\=)(?!(\s*\=))
    

    needs to be changed to

    (?=(\s*\=(?!(\s*\=))))
    

    Now I can update the file on https://bugzilla.gnome.org/show_bug.cgi?id=692822 and wait some more for acceptance...