mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-13 23:12:24 +00:00
94 lines
2.8 KiB
XML
94 lines
2.8 KiB
XML
|
<lexer>
|
||
|
<config>
|
||
|
<name>Rego</name>
|
||
|
<alias>rego</alias>
|
||
|
<filename>*.rego</filename>
|
||
|
</config>
|
||
|
<rules>
|
||
|
<state name="root">
|
||
|
<rule pattern="(package|import|as|not|with|default|else|some|in|if|contains)\b">
|
||
|
<token type="KeywordDeclaration"/>
|
||
|
</rule>
|
||
|
<!-- importing keywords should then show up as keywords -->
|
||
|
<rule pattern="(import)( future.keywords.)(\w+)">
|
||
|
<bygroups>
|
||
|
<token type="KeywordDeclaration"/>
|
||
|
<token type="Text"/>
|
||
|
<token type="KeywordDeclaration"/>
|
||
|
</bygroups>
|
||
|
</rule>
|
||
|
<rule pattern="#[^\r\n]*">
|
||
|
<token type="Comment"/>
|
||
|
</rule>
|
||
|
<rule pattern="(FIXME|TODO|XXX)\b( .*)$">
|
||
|
<bygroups>
|
||
|
<token type="Error"/>
|
||
|
<token type="CommentSpecial"/>
|
||
|
</bygroups>
|
||
|
</rule>
|
||
|
<rule pattern="(true|false|null)\b">
|
||
|
<token type="KeywordConstant"/>
|
||
|
</rule>
|
||
|
<rule pattern="\d+i">
|
||
|
<token type="LiteralNumber"/>
|
||
|
</rule>
|
||
|
<rule pattern="\d+\.\d*([Ee][-+]\d+)?i">
|
||
|
<token type="LiteralNumber"/>
|
||
|
</rule>
|
||
|
<rule pattern="\.\d+([Ee][-+]\d+)?i">
|
||
|
<token type="LiteralNumber"/>
|
||
|
</rule>
|
||
|
<rule pattern="\d+[Ee][-+]\d+i">
|
||
|
<token type="LiteralNumber"/>
|
||
|
</rule>
|
||
|
<rule pattern="\d+(\.\d+[eE][+\-]?\d+|\.\d*|[eE][+\-]?\d+)">
|
||
|
<token type="LiteralNumberFloat"/>
|
||
|
</rule>
|
||
|
<rule pattern="\.\d+([eE][+\-]?\d+)?">
|
||
|
<token type="LiteralNumberFloat"/>
|
||
|
</rule>
|
||
|
<rule pattern="(0|[1-9][0-9]*)">
|
||
|
<token type="LiteralNumberInteger"/>
|
||
|
</rule>
|
||
|
<rule pattern="""".*?"""">
|
||
|
<token type="LiteralStringDouble"/>
|
||
|
</rule>
|
||
|
<rule pattern=""(\\\\|\\"|[^"])*"">
|
||
|
<token type="LiteralStringDouble"/>
|
||
|
</rule>
|
||
|
<rule pattern="\$/((?!/\$).)*/\$">
|
||
|
<token type="LiteralString"/>
|
||
|
</rule>
|
||
|
<rule pattern="/(\\\\|\\"|[^/])*/">
|
||
|
<token type="LiteralString"/>
|
||
|
</rule>
|
||
|
<rule pattern="^(\w+)">
|
||
|
<token type="Name"/>
|
||
|
</rule>
|
||
|
<rule pattern="[a-z_-][\w-]*(?=\()">
|
||
|
<token type="NameFunction"/>
|
||
|
</rule>
|
||
|
<rule pattern="[\r\n\s]+">
|
||
|
<token type="TextWhitespace"/>
|
||
|
</rule>
|
||
|
<rule pattern="(package|import)(\s+)">
|
||
|
<bygroups>
|
||
|
<token type="KeywordDeclaration"/>
|
||
|
<token type="Text"/>
|
||
|
</bygroups>
|
||
|
</rule>
|
||
|
<rule pattern="[=<>!+-/*&|]">
|
||
|
<token type="Operator"/>
|
||
|
</rule>
|
||
|
<rule pattern=":=">
|
||
|
<token type="Operator"/>
|
||
|
</rule>
|
||
|
<rule pattern="[[\]{}():;]+">
|
||
|
<token type="Punctuation"/>
|
||
|
</rule>
|
||
|
<rule pattern="[$a-zA-Z_]\w*">
|
||
|
<token type="NameOther"/>
|
||
|
</rule>
|
||
|
</state>
|
||
|
</rules>
|
||
|
</lexer>
|