mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-10 13:32:24 +00:00
143 lines
3.4 KiB
XML
143 lines
3.4 KiB
XML
<lexer>
|
|
<config>
|
|
<name>HCL</name>
|
|
<alias>hcl</alias>
|
|
<filename>*.hcl</filename>
|
|
<mime_type>application/x-hcl</mime_type>
|
|
</config>
|
|
<rules>
|
|
<state name="punctuation">
|
|
<rule pattern="[\[\](),.]">
|
|
<token type="Punctuation"/>
|
|
</rule>
|
|
</state>
|
|
<state name="string">
|
|
<rule pattern="(".*")">
|
|
<bygroups>
|
|
<token type="LiteralStringDouble"/>
|
|
</bygroups>
|
|
</rule>
|
|
</state>
|
|
<state name="whitespace">
|
|
<rule pattern="\n">
|
|
<token type="Text"/>
|
|
</rule>
|
|
<rule pattern="\s+">
|
|
<token type="Text"/>
|
|
</rule>
|
|
<rule pattern="\\\n">
|
|
<token type="Text"/>
|
|
</rule>
|
|
</state>
|
|
<state name="root">
|
|
<rule>
|
|
<include state="string"/>
|
|
</rule>
|
|
<rule>
|
|
<include state="punctuation"/>
|
|
</rule>
|
|
<rule>
|
|
<include state="curly"/>
|
|
</rule>
|
|
<rule>
|
|
<include state="basic"/>
|
|
</rule>
|
|
<rule>
|
|
<include state="whitespace"/>
|
|
</rule>
|
|
<rule pattern="[0-9]+">
|
|
<token type="LiteralNumber"/>
|
|
</rule>
|
|
</state>
|
|
<state name="basic">
|
|
<rule pattern="\b(false|true)\b">
|
|
<token type="KeywordType"/>
|
|
</rule>
|
|
<rule pattern="\s*/\*">
|
|
<token type="CommentMultiline"/>
|
|
<push state="comment"/>
|
|
</rule>
|
|
<rule pattern="\s*#.*\n">
|
|
<token type="CommentSingle"/>
|
|
</rule>
|
|
<rule pattern="(.*?)(\s*)(=)">
|
|
<bygroups>
|
|
<token type="Name"/>
|
|
<token type="Text"/>
|
|
<token type="Operator"/>
|
|
</bygroups>
|
|
</rule>
|
|
<rule pattern="\d+">
|
|
<token type="LiteralNumber"/>
|
|
</rule>
|
|
<rule pattern="\b\w+\b">
|
|
<token type="Keyword"/>
|
|
</rule>
|
|
<rule pattern="\$\{">
|
|
<token type="LiteralStringInterpol"/>
|
|
<push state="var_builtin"/>
|
|
</rule>
|
|
</state>
|
|
<state name="curly">
|
|
<rule pattern="\{">
|
|
<token type="TextPunctuation"/>
|
|
</rule>
|
|
<rule pattern="\}">
|
|
<token type="TextPunctuation"/>
|
|
</rule>
|
|
</state>
|
|
<state name="function">
|
|
<rule pattern="(\s+)(".*")(\s+)">
|
|
<bygroups>
|
|
<token type="Text"/>
|
|
<token type="LiteralString"/>
|
|
<token type="Text"/>
|
|
</bygroups>
|
|
</rule>
|
|
<rule>
|
|
<include state="punctuation"/>
|
|
</rule>
|
|
<rule>
|
|
<include state="curly"/>
|
|
</rule>
|
|
</state>
|
|
<state name="var_builtin">
|
|
<rule pattern="\$\{">
|
|
<token type="LiteralStringInterpol"/>
|
|
<push/>
|
|
</rule>
|
|
<rule pattern="\b(element|concat|lookup|file|join)\b">
|
|
<token type="NameBuiltin"/>
|
|
</rule>
|
|
<rule>
|
|
<include state="string"/>
|
|
</rule>
|
|
<rule>
|
|
<include state="punctuation"/>
|
|
</rule>
|
|
<rule pattern="\s+">
|
|
<token type="Text"/>
|
|
</rule>
|
|
<rule pattern="\}">
|
|
<token type="LiteralStringInterpol"/>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
</state>
|
|
<state name="comment">
|
|
<rule pattern="[^*/]">
|
|
<token type="CommentMultiline"/>
|
|
</rule>
|
|
<rule pattern="/\*">
|
|
<token type="CommentMultiline"/>
|
|
<push/>
|
|
</rule>
|
|
<rule pattern="\*/">
|
|
<token type="CommentMultiline"/>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
<rule pattern="[*/]">
|
|
<token type="CommentMultiline"/>
|
|
</rule>
|
|
</state>
|
|
</rules>
|
|
</lexer> |