mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-13 23:12:24 +00:00
118 lines
3.3 KiB
XML
118 lines
3.3 KiB
XML
<lexer>
|
|
<config>
|
|
<name>Protocol Buffer</name>
|
|
<alias>protobuf</alias>
|
|
<alias>proto</alias>
|
|
<filename>*.proto</filename>
|
|
</config>
|
|
<rules>
|
|
<state name="package">
|
|
<rule pattern="[a-zA-Z_]\w*">
|
|
<token type="NameNamespace"/>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
<rule>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
</state>
|
|
<state name="message">
|
|
<rule pattern="[a-zA-Z_]\w*">
|
|
<token type="NameClass"/>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
<rule>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
</state>
|
|
<state name="type">
|
|
<rule pattern="[a-zA-Z_]\w*">
|
|
<token type="Name"/>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
<rule>
|
|
<pop depth="1"/>
|
|
</rule>
|
|
</state>
|
|
<state name="root">
|
|
<rule pattern="[ \t]+">
|
|
<token type="Text"/>
|
|
</rule>
|
|
<rule pattern="[,;{}\[\]()<>]">
|
|
<token type="Punctuation"/>
|
|
</rule>
|
|
<rule pattern="/(\\\n)?/(\n|(.|\n)*?[^\\]\n)">
|
|
<token type="CommentSingle"/>
|
|
</rule>
|
|
<rule pattern="/(\\\n)?\*(.|\n)*?\*(\\\n)?/">
|
|
<token type="CommentMultiline"/>
|
|
</rule>
|
|
<rule pattern="\b(extensions|required|repeated|optional|returns|default|option|packed|import|ctype|oneof|max|rpc|to)\b">
|
|
<token type="Keyword"/>
|
|
</rule>
|
|
<rule pattern="(sfixed32|sfixed64|fixed32|fixed64|sint32|sint64|double|string|uint32|uint64|int32|float|int64|bytes|bool)\b">
|
|
<token type="KeywordType"/>
|
|
</rule>
|
|
<rule pattern="(true|false)\b">
|
|
<token type="KeywordConstant"/>
|
|
</rule>
|
|
<rule pattern="(package)(\s+)">
|
|
<bygroups>
|
|
<token type="KeywordNamespace"/>
|
|
<token type="Text"/>
|
|
</bygroups>
|
|
<push state="package"/>
|
|
</rule>
|
|
<rule pattern="(message|extend)(\s+)">
|
|
<bygroups>
|
|
<token type="KeywordDeclaration"/>
|
|
<token type="Text"/>
|
|
</bygroups>
|
|
<push state="message"/>
|
|
</rule>
|
|
<rule pattern="(enum|group|service)(\s+)">
|
|
<bygroups>
|
|
<token type="KeywordDeclaration"/>
|
|
<token type="Text"/>
|
|
</bygroups>
|
|
<push state="type"/>
|
|
</rule>
|
|
<rule pattern="\".*?\"">
|
|
<token type="LiteralString"/>
|
|
</rule>
|
|
<rule pattern="\'.*?\'">
|
|
<token type="LiteralString"/>
|
|
</rule>
|
|
<rule pattern="(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*">
|
|
<token type="LiteralNumberFloat"/>
|
|
</rule>
|
|
<rule pattern="(\d+\.\d*|\.\d+|\d+[fF])[fF]?">
|
|
<token type="LiteralNumberFloat"/>
|
|
</rule>
|
|
<rule pattern="(\-?(inf|nan))\b">
|
|
<token type="LiteralNumberFloat"/>
|
|
</rule>
|
|
<rule pattern="0x[0-9a-fA-F]+[LlUu]*">
|
|
<token type="LiteralNumberHex"/>
|
|
</rule>
|
|
<rule pattern="0[0-7]+[LlUu]*">
|
|
<token type="LiteralNumberOct"/>
|
|
</rule>
|
|
<rule pattern="\d+[LlUu]*">
|
|
<token type="LiteralNumberInteger"/>
|
|
</rule>
|
|
<rule pattern="[+-=]">
|
|
<token type="Operator"/>
|
|
</rule>
|
|
<rule pattern="([a-zA-Z_][\w.]*)([ \t]*)(=)">
|
|
<bygroups>
|
|
<token type="Name"/>
|
|
<token type="Text"/>
|
|
<token type="Operator"/>
|
|
</bygroups>
|
|
</rule>
|
|
<rule pattern="[a-zA-Z_][\w.]*">
|
|
<token type="Name"/>
|
|
</rule>
|
|
</state>
|
|
</rules>
|
|
</lexer> |