I'm trying to extend the python.lang
file so that it will make methods like __init__
highlighted. I've been trying to come up with a Regex that will match all __privateMethods()
.
The python.lang
is a XML file containing all of the highlighting rules for python files. Ex:
<context id="special-variables" style-ref="special-variable">
<prefix>(?<![\w\.])</prefix>
<keyword>self</keyword>
<keyword>__name__</keyword>
<keyword>__debug__</keyword>
</context>
How can I extend this so that it matches double underscores?
[SOLUTION]: What I added to my python.lang
file (if anyone's interested):
First off you need to add this line near the top where the styles are defined.
<style id="private-methods" _name="Private Methods" map-to="def:special-constant"/>
Then you'll add the Regex that Carles provided in his answer:
<context id="private-methods" style-ref="private-methods">
<match>(__[a-zA-Z_]*(__)?)</match>
</context>
And here is what it looks like when your done!
It should rather be:
In order to match all of the following: