I would appreciate some help with a regex in a .lang file. I am writing a gedit syntax highlighter for the Atmel AVR assembly language. In this language, assembler directives all begin with a period, for example: .BYTE
I would like to instruct gedit 1) only to highlight these directives if they start with a period, and 2) to include the period in the highlighting. My test .lang file is:
<?xml version="1.0" encoding="UTF-8"?>
<!-- TODO Add Author and Licence -->
<language id="assembler-avr" _name="Assembler (Atmel AVR)" version="2.0" _section="Sources">
<style id="directive" _name="Assembler-directive" map-to="def:preprocessor"/>
<context id="assembler-avr" class="no-spell-check">
<!-- Assembler Directives -->
<context id="directive" style-ref="directive">
<keyword>BYTE</keyword> highlights 'BYTE', but ignores the period: .BYTE
<keyword>.BYTE</keyword> highlights 'aBYTE' as expected (match any single character): aBYTE
but not '.BYTE'
<keyword>\.BYTE</keyword> fails to highlights 'BYTE' or '.BYTE' but works if (spurious) characters are added: aa.BYTE
What expression do I need? or is the problem with how word boundaries are defined? I admit to being a noob at regular expressions, and if this is the wrong list, please advise.