Вопрос

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:

  • the parameters are defined by a mandatory first .param or .params (this is solved)
  • they cannot have spaces or any character like these -- [^\s><&(){};,=/+-*\^] -- inside their namings (solved)
  • they must have at least one space before to not "mingle" with the previous characters (solved)
  • the above condition has the "(" and "{" exceptions (solved)
  • they can have spaces between them and "=" (solved)

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.

Это было полезно?

Решение

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...

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top