tartrazine/lexers/hlb.xml

149 lines
4.3 KiB
XML

<lexer>
<config>
<name>HLB</name>
<alias>hlb</alias>
<filename>*.hlb</filename>
</config>
<rules>
<state name="root">
<rule pattern="(#.*)">
<bygroups>
<token type="CommentSingle"/>
</bygroups>
</rule>
<rule pattern="((\b(0(b|B|o|O|x|X)[a-fA-F0-9]+)\b)|(\b(0|[1-9][0-9]*)\b))">
<bygroups>
<token type="LiteralNumber"/>
</bygroups>
</rule>
<rule pattern="((\b(true|false)\b))">
<bygroups>
<token type="NameBuiltin"/>
</bygroups>
</rule>
<rule pattern="(\bstring\b|\bint\b|\bbool\b|\bfs\b|\boption\b)">
<bygroups>
<token type="KeywordType"/>
</bygroups>
</rule>
<rule pattern="(\b[a-zA-Z_][a-zA-Z0-9]*\b)(\()">
<bygroups>
<token type="NameFunction"/>
<token type="Punctuation"/>
</bygroups>
<push state="params"/>
</rule>
<rule pattern="(\{)">
<bygroups>
<token type="Punctuation"/>
</bygroups>
<push state="block"/>
</rule>
<rule pattern="(\n|\r|\r\n)">
<token type="Text"/>
</rule>
<rule pattern=".">
<token type="Text"/>
</rule>
</state>
<state name="string">
<rule pattern="&#34;">
<token type="LiteralString"/>
<pop depth="1"/>
</rule>
<rule pattern="\\&#34;">
<token type="LiteralString"/>
</rule>
<rule pattern="[^\\&#34;]+">
<token type="LiteralString"/>
</rule>
</state>
<state name="block">
<rule pattern="(\})">
<bygroups>
<token type="Punctuation"/>
</bygroups>
<pop depth="1"/>
</rule>
<rule pattern="(#.*)">
<bygroups>
<token type="CommentSingle"/>
</bygroups>
</rule>
<rule pattern="((\b(0(b|B|o|O|x|X)[a-fA-F0-9]+)\b)|(\b(0|[1-9][0-9]*)\b))">
<bygroups>
<token type="LiteralNumber"/>
</bygroups>
</rule>
<rule pattern="((\b(true|false)\b))">
<bygroups>
<token type="KeywordConstant"/>
</bygroups>
</rule>
<rule pattern="&#34;">
<token type="LiteralString"/>
<push state="string"/>
</rule>
<rule pattern="(with)">
<bygroups>
<token type="KeywordReserved"/>
</bygroups>
</rule>
<rule pattern="(as)([\t ]+)(\b[a-zA-Z_][a-zA-Z0-9]*\b)">
<bygroups>
<token type="KeywordReserved"/>
<token type="Text"/>
<token type="NameFunction"/>
</bygroups>
</rule>
<rule pattern="(\bstring\b|\bint\b|\bbool\b|\bfs\b|\boption\b)([\t ]+)(\{)">
<bygroups>
<token type="KeywordType"/>
<token type="Text"/>
<token type="Punctuation"/>
</bygroups>
<push state="block"/>
</rule>
<rule pattern="(?!\b(?:scratch|image|resolve|http|checksum|chmod|filename|git|keepGitDir|local|includePatterns|excludePatterns|followPaths|generate|frontendInput|shell|run|readonlyRootfs|env|dir|user|network|security|host|ssh|secret|mount|target|localPath|uid|gid|mode|readonly|tmpfs|sourcePath|cache|mkdir|createParents|chown|createdTime|mkfile|rm|allowNotFound|allowWildcards|copy|followSymlinks|contentsOnly|unpack|createDestPath)\b)(\b[a-zA-Z_][a-zA-Z0-9]*\b)">
<bygroups>
<token type="NameOther"/>
</bygroups>
</rule>
<rule pattern="(\n|\r|\r\n)">
<token type="Text"/>
</rule>
<rule pattern=".">
<token type="Text"/>
</rule>
</state>
<state name="params">
<rule pattern="(\))">
<bygroups>
<token type="Punctuation"/>
</bygroups>
<pop depth="1"/>
</rule>
<rule pattern="(variadic)">
<bygroups>
<token type="Keyword"/>
</bygroups>
</rule>
<rule pattern="(\bstring\b|\bint\b|\bbool\b|\bfs\b|\boption\b)">
<bygroups>
<token type="KeywordType"/>
</bygroups>
</rule>
<rule pattern="(\b[a-zA-Z_][a-zA-Z0-9]*\b)">
<bygroups>
<token type="NameOther"/>
</bygroups>
</rule>
<rule pattern="(\n|\r|\r\n)">
<token type="Text"/>
</rule>
<rule pattern=".">
<token type="Text"/>
</rule>
</state>
</rules>
</lexer>