mirror of
https://github.com/cheat/cheat.git
synced 2024-12-25 14:09:44 +01:00
1790aec85d
Bump `alecthomas/chroma` to `v2`: https://github.com/cheat/cheat/issues/735
121 lines
3.3 KiB
XML
121 lines
3.3 KiB
XML
<lexer>
|
|
<config>
|
|
<name>Newspeak</name>
|
|
<alias>newspeak</alias>
|
|
<filename>*.ns2</filename>
|
|
<mime_type>text/x-newspeak</mime_type>
|
|
</config>
|
|
<rules>
|
|
<state name="root">
|
|
<rule pattern="\b(Newsqueak2)\b">
|
|
<token type="KeywordDeclaration"/>
|
|
</rule>
|
|
<rule pattern="'[^']*'">
|
|
<token type="LiteralString"/>
|
|
</rule>
|
|
<rule pattern="\b(class)(\s+)(\w+)(\s*)">
|
|
<bygroups>
|
|
<token type="KeywordDeclaration"/>
|
|
<token type="Text"/>
|
|
<token type="NameClass"/>
|
|
<token type="Text"/>
|
|
</bygroups>
|
|
</rule>
|
|
<rule pattern="\b(mixin|self|super|private|public|protected|nil|true|false)\b">
|
|
<token type="Keyword"/>
|
|
</rule>
|
|
<rule pattern="(\w+\:)(\s*)([a-zA-Z_]\w+)">
|
|
<bygroups>
|
|
<token type="NameFunction"/>
|
|
<token type="Text"/>
|
|
<token type="NameVariable"/>
|
|
</bygroups>
|
|
</rule>
|
|
<rule pattern="(\w+)(\s*)(=)">
|
|
<bygroups>
|
|
<token type="NameAttribute"/>
|
|
<token type="Text"/>
|
|
<token type="Operator"/>
|
|
</bygroups>
|
|
</rule>
|
|
<rule pattern="<\w+>">
|
|
<token type="CommentSpecial"/>
|
|
</rule>
|
|
<rule>
|
|
<include state="expressionstat"/>
|
|
</rule>
|
|
<rule>
|
|
<include state="whitespace"/>
|
|
</rule>
|
|
</state>
|
|
<state name="expressionstat">
|
|
<rule pattern="(\d+\.\d*|\.\d+|\d+[fF])[fF]?">
|
|
<token type="LiteralNumberFloat"/>
|
|
</rule>
|
|
<rule pattern="\d+">
|
|
<token type="LiteralNumberInteger"/>
|
|
</rule>
|
|
<rule pattern=":\w+">
|
|
<token type="NameVariable"/>
|
|
</rule>
|
|
<rule pattern="(\w+)(::)">
|
|
<bygroups>
|
|
<token type="NameVariable"/>
|
|
<token type="Operator"/>
|
|
</bygroups>
|
|
</rule>
|
|
<rule pattern="\w+:">
|
|
<token type="NameFunction"/>
|
|
</rule>
|
|
<rule pattern="\w+">
|
|
<token type="NameVariable"/>
|
|
</rule>
|
|
<rule pattern="\(|\)">
|
|
<token type="Punctuation"/>
|
|
</rule>
|
|
<rule pattern="\[|\]">
|
|
<token type="Punctuation"/>
|
|
</rule>
|
|
<rule pattern="\{|\}">
|
|
<token type="Punctuation"/>
|
|
</rule>
|
|
<rule pattern="(\^|\+|\/|~|\*|<|>|=|@|%|\||&|\?|!|,|-|:)">
|
|
<token type="Operator"/>
|
|
</rule>
|
|
<rule pattern="\.|;">
|
|
<token type="Punctuation"/>
|
|
</rule>
|
|
<rule>
|
|
<include state="whitespace"/>
|
|
</rule>
|
|
<rule>
|
|
<include state="literals"/>
|
|
</rule>
|
|
</state>
|
|
<state name="literals">
|
|
<rule pattern="\$.">
|
|
<token type="LiteralString"/>
|
|
</rule>
|
|
<rule pattern="'[^']*'">
|
|
<token type="LiteralString"/>
|
|
</rule>
|
|
<rule pattern="#'[^']*'">
|
|
<token type="LiteralStringSymbol"/>
|
|
</rule>
|
|
<rule pattern="#\w+:?">
|
|
<token type="LiteralStringSymbol"/>
|
|
</rule>
|
|
<rule pattern="#(\+|\/|~|\*|<|>|=|@|%|\||&|\?|!|,|-)+">
|
|
<token type="LiteralStringSymbol"/>
|
|
</rule>
|
|
</state>
|
|
<state name="whitespace">
|
|
<rule pattern="\s+">
|
|
<token type="Text"/>
|
|
</rule>
|
|
<rule pattern=""[^"]*"">
|
|
<token type="Comment"/>
|
|
</rule>
|
|
</state>
|
|
</rules>
|
|
</lexer> |