mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-14 15:32:24 +00:00
55 lines
3.2 KiB
XML
55 lines
3.2 KiB
XML
|
|
||
|
<lexer>
|
||
|
<config>
|
||
|
<name>Velocity</name>
|
||
|
<alias>velocity</alias>
|
||
|
<filename>*.vm</filename>
|
||
|
<filename>*.fhtml</filename>
|
||
|
<dot_all>true</dot_all>
|
||
|
</config>
|
||
|
<rules>
|
||
|
<state name="root">
|
||
|
<rule pattern="[^{#$]+"><token type="Other"/></rule>
|
||
|
<rule pattern="(#)(\*.*?\*)(#)"><bygroups><token type="CommentPreproc"/><token type="Comment"/><token type="CommentPreproc"/></bygroups></rule>
|
||
|
<rule pattern="(##)(.*?$)"><bygroups><token type="CommentPreproc"/><token type="Comment"/></bygroups></rule>
|
||
|
<rule pattern="(#\{?)([a-zA-Z_]\w*)(\}?)(\s?\()"><bygroups><token type="CommentPreproc"/><token type="NameFunction"/><token type="CommentPreproc"/><token type="Punctuation"/></bygroups><push state="directiveparams"/></rule>
|
||
|
<rule pattern="(#\{?)([a-zA-Z_]\w*)(\}|\b)"><bygroups><token type="CommentPreproc"/><token type="NameFunction"/><token type="CommentPreproc"/></bygroups></rule>
|
||
|
<rule pattern="\$!?\{?"><token type="Punctuation"/><push state="variable"/></rule>
|
||
|
</state>
|
||
|
<state name="variable">
|
||
|
<rule pattern="[a-zA-Z_]\w*"><token type="NameVariable"/></rule>
|
||
|
<rule pattern="\("><token type="Punctuation"/><push state="funcparams"/></rule>
|
||
|
<rule pattern="(\.)([a-zA-Z_]\w*)"><bygroups><token type="Punctuation"/><token type="NameVariable"/></bygroups><push/></rule>
|
||
|
<rule pattern="\}"><token type="Punctuation"/><pop depth="1"/></rule>
|
||
|
<rule><pop depth="1"/></rule>
|
||
|
</state>
|
||
|
<state name="directiveparams">
|
||
|
<rule pattern="(&&|\|\||==?|!=?|[-<>+*%&|^/])|\b(eq|ne|gt|lt|ge|le|not|in)\b"><token type="Operator"/></rule>
|
||
|
<rule pattern="\["><token type="Operator"/><push state="rangeoperator"/></rule>
|
||
|
<rule pattern="\b[a-zA-Z_]\w*\b"><token type="NameFunction"/></rule>
|
||
|
<rule><include state="funcparams"/></rule>
|
||
|
</state>
|
||
|
<state name="rangeoperator">
|
||
|
<rule pattern="\.\."><token type="Operator"/></rule>
|
||
|
<rule><include state="funcparams"/></rule>
|
||
|
<rule pattern="\]"><token type="Operator"/><pop depth="1"/></rule>
|
||
|
</state>
|
||
|
<state name="funcparams">
|
||
|
<rule pattern="\$!?\{?"><token type="Punctuation"/><push state="variable"/></rule>
|
||
|
<rule pattern="\s+"><token type="Text"/></rule>
|
||
|
<rule pattern="[,:]"><token type="Punctuation"/></rule>
|
||
|
<rule pattern=""(\\\\|\\[^\\]|[^"\\])*""><token type="LiteralStringDouble"/></rule>
|
||
|
<rule pattern="'(\\\\|\\[^\\]|[^'\\])*'"><token type="LiteralStringSingle"/></rule>
|
||
|
<rule pattern="0[xX][0-9a-fA-F]+[Ll]?"><token type="LiteralNumber"/></rule>
|
||
|
<rule pattern="\b[0-9]+\b"><token type="LiteralNumber"/></rule>
|
||
|
<rule pattern="(true|false|null)\b"><token type="KeywordConstant"/></rule>
|
||
|
<rule pattern="\("><token type="Punctuation"/><push/></rule>
|
||
|
<rule pattern="\)"><token type="Punctuation"/><pop depth="1"/></rule>
|
||
|
<rule pattern="\{"><token type="Punctuation"/><push/></rule>
|
||
|
<rule pattern="\}"><token type="Punctuation"/><pop depth="1"/></rule>
|
||
|
<rule pattern="\["><token type="Punctuation"/><push/></rule>
|
||
|
<rule pattern="\]"><token type="Punctuation"/><pop depth="1"/></rule>
|
||
|
</state>
|
||
|
</rules>
|
||
|
</lexer>
|