<?xml version="1.0" encoding="UTF-8"?> <language id="rever" _name="Rever" version="2.0" _section="Source"> <metadata> <property name="globs">*.rvr;*.rever</property> <property name="line-comment-start">#</property> <!-- <property name="block-comment-start">/*</property> <property name="block-comment-end">*/</property> --> </metadata> <styles> <style id="comment" _name="Comment" map-to="def:comment"/> <style id="string" _name="String" map-to="def:string"/> <style id="char" _name="Character" map-to="def:character"/> <style id="keyword" _name="Keyword" map-to="def:keyword"/> <style id="type" _name="Data Type" map-to="def:type"/> <style id="constant" _name="Constant value" map-to="def:special-constant"/> <style id="identifier" _name="Identifier" map-to="def:identifier"/> <style id="number" _name="Number" map-to="def:number"/> <style id="scope" _name="Scope" map-to="def:preprocessor"/> <style id="attribute" _name="Attribute" map-to="def:preprocessor"/> <style id="macro" _name="Macro" map-to="def:preprocessor"/> </styles> <definitions> <context id="line-comment" style-ref="comment" end-at-line-end="true" class-disabled="no-spell-check" class="comment"> <start>#</start> <include> <context ref="def:in-comment"/> </include> </context> <context id="keywords" style-ref="keyword"> <keyword>and</keyword> <keyword>as</keyword> <keyword>const</keyword> <keyword>do</keyword> <keyword>drop</keyword> <keyword>else</keyword> <keyword>end</keyword> <keyword>extern</keyword> <keyword>fi</keyword> <keyword>fn</keyword> <keyword>from</keyword> <keyword>if</keyword> <keyword>let</keyword> <keyword>loop</keyword> <keyword>module</keyword> <keyword>not</keyword> <keyword>or</keyword> <keyword>proc</keyword> <keyword>return</keyword> <keyword>skip</keyword> <keyword>undo</keyword> <keyword>until</keyword> <keyword>var</keyword> </context> <context id="reserved" style-ref="def:reserved"> <keyword>alias</keyword> <keyword>begin</keyword> <keyword>done</keyword> <keyword>for</keyword> <keyword>in</keyword> <keyword>macro</keyword> <keyword>match</keyword> <keyword>priv</keyword> <keyword>pub</keyword> <keyword>static</keyword> <keyword>tag</keyword> <keyword>then</keyword> <keyword>use</keyword> <!-- potential keywords from Rust --> <!-- <keyword>abstract</keyword> <keyword>become</keyword> <keyword>box</keyword> <keyword>break</keyword> <keyword>enum</keyword> <keyword>extern</keyword> <keyword>final</keyword> <keyword>impl</keyword> <keyword>move</keyword> <keyword>override</keyword> <keyword>ref</keyword> <keyword>struct</keyword> <keyword>super</keyword> <keyword>trait</keyword> <keyword>typeof</keyword> <keyword>unsafe</keyword> <keyword>unsized</keyword> <keyword>virtual</keyword> <keyword>where</keyword> <keyword>while</keyword> <keyword>yield</keyword> --> </context> <context id="types" style-ref="type"> <match extended="true"> \b(bool|u32|str|stack)\b </match> </context> <!-- <context id="self" style-ref="identifier"> <keyword>Self</keyword> <keyword>self</keyword> </context> --> <context id="constant" style-ref="constant"> <keyword>True</keyword> <keyword>False</keyword> <keyword>Some</keyword> <keyword>None</keyword> <keyword>Ok</keyword> <keyword>Err</keyword> </context> <define-regex id="int-suffix" extended="true"> (i8|i16|i32|i64|isize|u8|u16|u32|u64|usize) </define-regex> <define-regex id="num-suffix" extended="true"> \%{int-suffix} </define-regex> <define-regex id="hex-digit" extended="true"> [0-9a-fA-F] </define-regex> <context id="number" style-ref="number"> <match extended="true"> ((?<=\.\.)|(?<![\w\.])) ( 0[1-9aA']*\%{num-suffix}?| 0b[01']+\%{int-suffix}?| 0x(\%{hex-digit}|')+\%{int-suffix}? ) ((?![\w\.].)|(?=\.\.)) </match> </context> <!-- <context id="invalid-number" style-ref="error"> <match extended="true"> ((?<=\.\.)|(?<![\w\.])) ( 0[1-9aA']*(0[1-9aA']*)*\%{num-suffix}?| 0x(\%{hex-digit}|_)*(?!\%{hex-digit}|_).\w*\%{int-suffix}? ) ((?![\w\.].)|(?=\.\.)) </match> </context> --> <define-regex id="ident" extended="true"> ([^[:cntrl:][:space:][:punct:][:digit:]]|_)([^[:cntrl:][:punct:][:space:]]|_)* </define-regex> <context id="scope" style-ref="scope"> <match extended="true"> \%{ident}:: </match> </context> <context id="macro" style-ref="macro"> <match extended="true"> \%{ident}! </match> </context> <context id="lifetime" style-ref="keyword"> <match extended="true"> '\%{ident} </match> </context> <define-regex id="common-escape" extended="true"> '|"| \\|n|r|t|0| x\%{hex-digit}{2} </define-regex> <define-regex id="unicode-escape" extended="true"> u{\%{hex-digit}{1,6}} </define-regex> <context id="string-escape" style-ref="def:special-char"> <match>\\\%{common-escape}|\\\%{unicode-escape}</match> </context> <context id="byte-string-escape" style-ref="def:special-char"> <match>\\\%{common-escape}</match> </context> <context id="raw-string" style-ref="string" class="string" class-disabled="no-spell-check"> <start>b?r(#*)"</start> <end>"\%{1@start}</end> <include> <context ref="def:line-continue"/> </include> </context> <context id="string" style-ref="string" class="string" class-disabled="no-spell-check"> <start>"</start> <end>"</end> <include> <context ref="string-escape"/> <context ref="def:line-continue"/> </include> </context> <context id="byte-string" style-ref="string" class="string" class-disabled="no-spell-check"> <start>b"</start> <end>"</end> <include> <context ref="byte-string-escape"/> <context ref="def:line-continue"/> </include> </context> <context id="char" style-ref="char"> <match extended="true">'([^\\']|\\\%{common-escape}|\\\%{unicode-escape})'</match> </context> <context id="byte" style-ref="char"> <match extended="true">b'([^\\']|\\\%{common-escape})'</match> </context> <context id="attribute" style-ref="attribute" class="attribute"> <start extended="true">\#!?\[</start> <end>\]</end> <include> <context ref="def:in-comment"/> <context ref="string"/> <context ref="raw-string"/> </include> </context> <context id="rever" class="no-spell-check"> <include> <context ref="line-comment"/> <!-- <context ref="def:c-like-comment" style-ref="comment"/> <context ref="def:c-like-comment-multiline" style-ref="comment"/> <context ref="scope"/> <context ref="macro"/> --> <context ref="keywords"/> <context ref="reserved"/> <context ref="types"/> <context ref="number"/> <!-- <context ref="invalid-number"/> --> <context ref="string"/> <context ref="char"/> <!-- <context ref="self"/> <context ref="byte-string"/> <context ref="raw-string"/> <context ref="byte"/> <context ref="lifetime"/> --> <context ref="attribute"/> </include> </context> </definitions> </language>