roulette/vendor/github.com/alecthomas/chroma/v2/lexers/embedded/hcl.xml

143 lines
3.4 KiB
XML
Raw Normal View History

2023-09-14 22:37:22 +00:00
<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="(&#34;.*&#34;)">
<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+)(&#34;.*&#34;)(\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>