chore: modernize CI and update Go toolchain

- Bump Go from 1.19 to 1.26 and update all dependencies
- Rewrite CI workflow with matrix strategy (Linux, macOS, Windows)
- Update GitHub Actions to current versions (checkout@v4, setup-go@v5)
- Update CodeQL actions from v1 to v3
- Fix cross-platform bug in mock/path.go (path.Join -> filepath.Join)
- Clean up dependabot config (weekly schedule, remove stale ignore)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Christopher Allen Lane
2026-02-14 20:58:51 -05:00
parent cc85a4bdb1
commit 2a19755804
657 changed files with 49050 additions and 32001 deletions

View File

@@ -4,52 +4,82 @@ import (
. "github.com/alecthomas/chroma/v2" // nolint
)
// Matcher token stub for docs, or
// Named matcher: @name, or
// Path matcher: /foo, or
// Wildcard path matcher: *
// nolint: gosec
var caddyfileMatcherTokenRegexp = `(\[\<matcher\>\]|@[^\s]+|/[^\s]+|\*)`
// Comment at start of line, or
// Comment preceded by whitespace
var caddyfileCommentRegexp = `(^|\s+)#.*\n`
// caddyfileCommon are the rules common to both of the lexer variants
func caddyfileCommonRules() Rules {
return Rules{
"site_block_common": {
Include("site_body"),
// Any other directive
{`[^\s#]+`, Keyword, Push("directive")},
Include("base"),
},
"site_body": {
// Import keyword
{`(import)(\s+)([^\s]+)`, ByGroups(Keyword, Text, NameVariableMagic), nil},
{`\b(import|invoke)\b( [^\s#]+)`, ByGroups(Keyword, Text), Push("subdirective")},
// Matcher definition
{`@[^\s]+(?=\s)`, NameDecorator, Push("matcher")},
// Matcher token stub for docs
{`\[\<matcher\>\]`, NameDecorator, Push("matcher")},
// These cannot have matchers but may have things that look like
// matchers in their arguments, so we just parse as a subdirective.
{`try_files`, Keyword, Push("subdirective")},
{`\b(try_files|tls|log|bind)\b`, Keyword, Push("subdirective")},
// These are special, they can nest more directives
{`handle_errors|handle|route|handle_path|not`, Keyword, Push("nested_directive")},
// Any other directive
{`[^\s#]+`, Keyword, Push("directive")},
Include("base"),
{`\b(handle_errors|handle_path|handle_response|replace_status|handle|route)\b`, Keyword, Push("nested_directive")},
// uri directive has special syntax
{`\b(uri)\b`, Keyword, Push("uri_directive")},
},
"matcher": {
{`\{`, Punctuation, Push("block")},
// Not can be one-liner
{`not`, Keyword, Push("deep_not_matcher")},
// Heredoc for CEL expression
Include("heredoc"),
// Backtick for CEL expression
{"`", StringBacktick, Push("backticks")},
// Any other same-line matcher
{`[^\s#]+`, Keyword, Push("arguments")},
// Terminators
{`\n`, Text, Pop(1)},
{`\s*\n`, Text, Pop(1)},
{`\}`, Punctuation, Pop(1)},
Include("base"),
},
"block": {
{`\}`, Punctuation, Pop(2)},
// Using double quotes doesn't stop at spaces
{`"`, StringDouble, Push("double_quotes")},
// Using backticks doesn't stop at spaces
{"`", StringBacktick, Push("backticks")},
// Not can be one-liner
{`not`, Keyword, Push("not_matcher")},
// Any other subdirective
// Directives & matcher definitions
Include("site_body"),
// Any directive
{`[^\s#]+`, Keyword, Push("subdirective")},
Include("base"),
},
"nested_block": {
{`\}`, Punctuation, Pop(2)},
// Matcher definition
{`@[^\s]+(?=\s)`, NameDecorator, Push("matcher")},
// Something that starts with literally < is probably a docs stub
{`\<[^#]+\>`, Keyword, Push("nested_directive")},
// Any other directive
{`[^\s#]+`, Keyword, Push("nested_directive")},
// Using double quotes doesn't stop at spaces
{`"`, StringDouble, Push("double_quotes")},
// Using backticks doesn't stop at spaces
{"`", StringBacktick, Push("backticks")},
// Not can be one-liner
{`not`, Keyword, Push("not_matcher")},
// Directives & matcher definitions
Include("site_body"),
// Any other subdirective
{`[^\s#]+`, Keyword, Push("directive")},
Include("base"),
},
"not_matcher": {
@@ -66,69 +96,97 @@ func caddyfileCommonRules() Rules {
},
"directive": {
{`\{(?=\s)`, Punctuation, Push("block")},
Include("matcher_token"),
Include("comments_pop_1"),
{`\n`, Text, Pop(1)},
{caddyfileMatcherTokenRegexp, NameDecorator, Push("arguments")},
{caddyfileCommentRegexp, CommentSingle, Pop(1)},
{`\s*\n`, Text, Pop(1)},
Include("base"),
},
"nested_directive": {
{`\{(?=\s)`, Punctuation, Push("nested_block")},
Include("matcher_token"),
Include("comments_pop_1"),
{`\n`, Text, Pop(1)},
{caddyfileMatcherTokenRegexp, NameDecorator, Push("nested_arguments")},
{caddyfileCommentRegexp, CommentSingle, Pop(1)},
{`\s*\n`, Text, Pop(1)},
Include("base"),
},
"subdirective": {
{`\{(?=\s)`, Punctuation, Push("block")},
Include("comments_pop_1"),
{`\n`, Text, Pop(1)},
{caddyfileCommentRegexp, CommentSingle, Pop(1)},
{`\s*\n`, Text, Pop(1)},
Include("base"),
},
"arguments": {
{`\{(?=\s)`, Punctuation, Push("block")},
Include("comments_pop_2"),
{caddyfileCommentRegexp, CommentSingle, Pop(2)},
{`\\\n`, Text, nil}, // Skip escaped newlines
{`\n`, Text, Pop(2)},
{`\s*\n`, Text, Pop(2)},
Include("base"),
},
"nested_arguments": {
{`\{(?=\s)`, Punctuation, Push("nested_block")},
{caddyfileCommentRegexp, CommentSingle, Pop(2)},
{`\\\n`, Text, nil}, // Skip escaped newlines
{`\s*\n`, Text, Pop(2)},
Include("base"),
},
"deep_subdirective": {
{`\{(?=\s)`, Punctuation, Push("block")},
Include("comments_pop_3"),
{`\n`, Text, Pop(3)},
{caddyfileCommentRegexp, CommentSingle, Pop(3)},
{`\s*\n`, Text, Pop(3)},
Include("base"),
},
"matcher_token": {
{`@[^\s]+`, NameDecorator, Push("arguments")}, // Named matcher
{`/[^\s]+`, NameDecorator, Push("arguments")}, // Path matcher
{`\*`, NameDecorator, Push("arguments")}, // Wildcard path matcher
{`\[\<matcher\>\]`, NameDecorator, Push("arguments")}, // Matcher token stub for docs
"uri_directive": {
{`\{(?=\s)`, Punctuation, Push("block")},
{caddyfileMatcherTokenRegexp, NameDecorator, nil},
{`(strip_prefix|strip_suffix|replace|path_regexp)`, NameConstant, Push("arguments")},
{caddyfileCommentRegexp, CommentSingle, Pop(1)},
{`\s*\n`, Text, Pop(1)},
Include("base"),
},
"comments": {
{`^#.*\n`, CommentSingle, nil}, // Comment at start of line
{`\s+#.*\n`, CommentSingle, nil}, // Comment preceded by whitespace
"double_quotes": {
Include("placeholder"),
{`\\"`, StringDouble, nil},
{`[^"]`, StringDouble, nil},
{`"`, StringDouble, Pop(1)},
},
"comments_pop_1": {
{`^#.*\n`, CommentSingle, Pop(1)}, // Comment at start of line
{`\s+#.*\n`, CommentSingle, Pop(1)}, // Comment preceded by whitespace
"backticks": {
Include("placeholder"),
{"\\\\`", StringBacktick, nil},
{"[^`]", StringBacktick, nil},
{"`", StringBacktick, Pop(1)},
},
"comments_pop_2": {
{`^#.*\n`, CommentSingle, Pop(2)}, // Comment at start of line
{`\s+#.*\n`, CommentSingle, Pop(2)}, // Comment preceded by whitespace
"optional": {
// Docs syntax for showing optional parts with [ ]
{`\[`, Punctuation, Push("optional")},
Include("name_constants"),
{`\|`, Punctuation, nil},
{`[^\[\]\|]+`, String, nil},
{`\]`, Punctuation, Pop(1)},
},
"comments_pop_3": {
{`^#.*\n`, CommentSingle, Pop(3)}, // Comment at start of line
{`\s+#.*\n`, CommentSingle, Pop(3)}, // Comment preceded by whitespace
"heredoc": {
{`(<<([a-zA-Z0-9_-]+))(\n(.*|\n)*)(\s*)(\2)`, ByGroups(StringHeredoc, nil, String, String, String, StringHeredoc), nil},
},
"name_constants": {
{`\b(most_recently_modified|largest_size|smallest_size|first_exist|internal|disable_redirects|ignore_loaded_certs|disable_certs|private_ranges|first|last|before|after|on|off)\b(\||(?=\]|\s|$))`, ByGroups(NameConstant, Punctuation), nil},
},
"placeholder": {
// Placeholder with dots, colon for default value, brackets for args[0:]
{`\{[\w+.\[\]\:\$-]+\}`, StringEscape, nil},
// Handle opening brackets with no matching closing one
{`\{[^\}\s]*\b`, String, nil},
},
"base": {
Include("comments"),
{`(on|off|first|last|before|after|internal|strip_prefix|strip_suffix|replace)\b`, NameConstant, nil},
{`(https?://)?([a-z0-9.-]+)(:)([0-9]+)`, ByGroups(Name, Name, Punctuation, LiteralNumberInteger), nil},
{`[a-z-]+/[a-z-+]+`, LiteralString, nil},
{`[0-9]+[km]?\b`, LiteralNumberInteger, nil},
{`\{[\w+.\$-]+\}`, LiteralStringEscape, nil}, // Placeholder
{`\[(?=[^#{}$]+\])`, Punctuation, nil},
{`\]|\|`, Punctuation, nil},
{`[^\s#{}$\]]+`, LiteralString, nil},
{caddyfileCommentRegexp, CommentSingle, nil},
{`\[\<matcher\>\]`, NameDecorator, nil},
Include("name_constants"),
Include("heredoc"),
{`(https?://)?([a-z0-9.-]+)(:)([0-9]+)([^\s]*)`, ByGroups(Name, Name, Punctuation, NumberInteger, Name), nil},
{`\[`, Punctuation, Push("optional")},
{"`", StringBacktick, Push("backticks")},
{`"`, StringDouble, Push("double_quotes")},
Include("placeholder"),
{`[a-z-]+/[a-z-+]+`, String, nil},
{`[0-9]+([smhdk]|ns|us|µs|ms)?\b`, NumberInteger, nil},
{`[^\s\n#\{]+`, String, nil},
{`/[^\s#]*`, Name, nil},
{`\s+`, Text, nil},
},
@@ -149,27 +207,29 @@ var Caddyfile = Register(MustNewLexer(
func caddyfileRules() Rules {
return Rules{
"root": {
Include("comments"),
{caddyfileCommentRegexp, CommentSingle, nil},
// Global options block
{`^\s*(\{)\s*$`, ByGroups(Punctuation), Push("globals")},
// Top level import
{`(import)(\s+)([^\s]+)`, ByGroups(Keyword, Text, NameVariableMagic), nil},
// Snippets
{`(\([^\s#]+\))(\s*)(\{)`, ByGroups(NameVariableAnonymous, Text, Punctuation), Push("snippet")},
{`(&?\([^\s#]+\))(\s*)(\{)`, ByGroups(NameVariableAnonymous, Text, Punctuation), Push("snippet")},
// Site label
{`[^#{(\s,]+`, GenericHeading, Push("label")},
// Site label with placeholder
{`\{[\w+.\$-]+\}`, LiteralStringEscape, Push("label")},
{`\{[\w+.\[\]\:\$-]+\}`, StringEscape, Push("label")},
{`\s+`, Text, nil},
},
"globals": {
{`\}`, Punctuation, Pop(1)},
{`[^\s#]+`, Keyword, Push("directive")},
// Global options are parsed as subdirectives (no matcher)
{`[^\s#]+`, Keyword, Push("subdirective")},
Include("base"),
},
"snippet": {
{`\}`, Punctuation, Pop(1)},
// Matcher definition
{`@[^\s]+(?=\s)`, NameDecorator, Push("matcher")},
// Any directive
Include("site_body"),
// Any other directive
{`[^\s#]+`, Keyword, Push("directive")},
Include("base"),
},
@@ -179,7 +239,7 @@ func caddyfileRules() Rules {
{`,\s*\n?`, Text, nil},
{` `, Text, nil},
// Site label with placeholder
{`\{[\w+.\$-]+\}`, LiteralStringEscape, nil},
Include("placeholder"),
// Site label
{`[^#{(\s,]+`, GenericHeading, nil},
// Comment after non-block label (hack because comments end in \n)

View File

@@ -6,103 +6,104 @@
<rules>
<state name="attr">
<rule pattern="&#34;.*?&#34;">
<token type="LiteralString"/>
<pop depth="1"/>
<token type="LiteralString" />
<pop depth="1" />
</rule>
<rule pattern="&#39;.*?&#39;">
<token type="LiteralString"/>
<pop depth="1"/>
<token type="LiteralString" />
<pop depth="1" />
</rule>
<rule pattern="[^\s&gt;]+">
<token type="LiteralString"/>
<pop depth="1"/>
<token type="LiteralString" />
<pop depth="1" />
</rule>
</state>
<state name="root">
<rule pattern="[^{([*#]+">
<token type="Other"/>
<token type="Other" />
</rule>
<rule pattern="(\{\{)(\s*)">
<bygroups>
<token type="CommentPreproc"/>
<token type="Text"/>
<token type="CommentPreproc" />
<token type="Text" />
</bygroups>
<push state="ngExpression"/>
<push state="ngExpression" />
</rule>
<rule pattern="([([]+)([\w:.-]+)([\])]+)(\s*)(=)(\s*)">
<bygroups>
<token type="Punctuation"/>
<token type="NameAttribute"/>
<token type="Punctuation"/>
<token type="Text"/>
<token type="Operator"/>
<token type="Text"/>
<token type="Punctuation" />
<token type="NameAttribute" />
<token type="Punctuation" />
<token type="Text" />
<token type="Operator" />
<token type="Text" />
</bygroups>
<push state="attr"/>
<push state="attr" />
</rule>
<rule pattern="([([]+)([\w:.-]+)([\])]+)(\s*)">
<bygroups>
<token type="Punctuation"/>
<token type="NameAttribute"/>
<token type="Punctuation"/>
<token type="Text"/>
<token type="Punctuation" />
<token type="NameAttribute" />
<token type="Punctuation" />
<token type="TextWhitespace" />
</bygroups>
</rule>
<rule pattern="([*#])([\w:.-]+)(\s*)(=)(\s*)">
<bygroups>
<token type="Punctuation"/>
<token type="NameAttribute"/>
<token type="Punctuation"/>
<token type="Operator"/>
<token type="Punctuation" />
<token type="NameAttribute" />
<token type="Punctuation" />
<token type="Operator" />
<token type="TextWhitespace" />
</bygroups>
<push state="attr"/>
<push state="attr" />
</rule>
<rule pattern="([*#])([\w:.-]+)(\s*)">
<bygroups>
<token type="Punctuation"/>
<token type="NameAttribute"/>
<token type="Punctuation"/>
<token type="Punctuation" />
<token type="NameAttribute" />
<token type="Punctuation" />
</bygroups>
</rule>
</state>
<state name="ngExpression">
<rule pattern="\s+(\|\s+)?">
<token type="Text"/>
<token type="Text" />
</rule>
<rule pattern="\}\}">
<token type="CommentPreproc"/>
<pop depth="1"/>
<token type="CommentPreproc" />
<pop depth="1" />
</rule>
<rule pattern=":?(true|false)">
<token type="LiteralStringBoolean"/>
<token type="LiteralStringBoolean" />
</rule>
<rule pattern=":?&#34;(\\\\|\\&#34;|[^&#34;])*&#34;">
<token type="LiteralStringDouble"/>
<token type="LiteralStringDouble" />
</rule>
<rule pattern=":?&#39;(\\\\|\\&#39;|[^&#39;])*&#39;">
<token type="LiteralStringSingle"/>
<token type="LiteralStringSingle" />
</rule>
<rule pattern="[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?">
<token type="LiteralNumber"/>
<token type="LiteralNumber" />
</rule>
<rule pattern="[a-zA-Z][\w-]*(\(.*\))?">
<token type="NameVariable"/>
<token type="NameVariable" />
</rule>
<rule pattern="\.[\w-]+(\(.*\))?">
<token type="NameVariable"/>
<token type="NameVariable" />
</rule>
<rule pattern="(\?)(\s*)([^}\s]+)(\s*)(:)(\s*)([^}\s]+)(\s*)">
<bygroups>
<token type="Operator"/>
<token type="Text"/>
<token type="LiteralString"/>
<token type="Text"/>
<token type="Operator"/>
<token type="Text"/>
<token type="LiteralString"/>
<token type="Text"/>
<token type="Operator" />
<token type="Text" />
<token type="LiteralString" />
<token type="Text" />
<token type="Operator" />
<token type="Text" />
<token type="LiteralString" />
<token type="Text" />
</bygroups>
</rule>
</state>
</rules>
</lexer>
</lexer>

View File

@@ -8,123 +8,144 @@
<rules>
<state name="root">
<rule pattern="\s+">
<token type="Text"/>
<token type="Text" />
</rule>
<rule pattern="¬\n">
<token type="LiteralStringEscape"/>
<token type="LiteralStringEscape" />
</rule>
<rule pattern="&#39;s\s+">
<token type="Text"/>
<token type="Text" />
</rule>
<rule pattern="(--|#).*?$">
<token type="Comment"/>
<token type="Comment" />
</rule>
<rule pattern="\(\*">
<token type="CommentMultiline"/>
<push state="comment"/>
<token type="CommentMultiline" />
<push state="comment" />
</rule>
<rule pattern="[(){}!,.:]">
<token type="Punctuation"/>
<token type="Punctuation" />
</rule>
<rule pattern="(«)([^»]+)(»)">
<bygroups>
<token type="Text"/>
<token type="NameBuiltin"/>
<token type="Text"/>
<token type="Text" />
<token type="NameBuiltin" />
<token type="Text" />
</bygroups>
</rule>
<rule pattern="\b((?:considering|ignoring)\s*)(application responses|case|diacriticals|hyphens|numeric strings|punctuation|white space)">
<rule
pattern="\b((?:considering|ignoring)\s*)(application responses|case|diacriticals|hyphens|numeric strings|punctuation|white space)"
>
<bygroups>
<token type="Keyword"/>
<token type="NameBuiltin"/>
<token type="Keyword" />
<token type="NameBuiltin" />
</bygroups>
</rule>
<rule pattern="(-|\*|\+|&amp;|≠|&gt;=?|&lt;=?|=|≥|≤|/|÷|\^)">
<token type="Operator"/>
<token type="Operator" />
</rule>
<rule pattern="\b(and|or|is equal|equals|(is )?equal to|is not|isn&#39;t|isn&#39;t equal( to)?|is not equal( to)?|doesn&#39;t equal|does not equal|(is )?greater than|comes after|is not less than or equal( to)?|isn&#39;t less than or equal( to)?|(is )?less than|comes before|is not greater than or equal( to)?|isn&#39;t greater than or equal( to)?|(is )?greater than or equal( to)?|is not less than|isn&#39;t less than|does not come before|doesn&#39;t come before|(is )?less than or equal( to)?|is not greater than|isn&#39;t greater than|does not come after|doesn&#39;t come after|starts? with|begins? with|ends? with|contains?|does not contain|doesn&#39;t contain|is in|is contained by|is not in|is not contained by|isn&#39;t contained by|div|mod|not|(a )?(ref( to)?|reference to)|is|does)\b">
<token type="OperatorWord"/>
<rule
pattern="\b(and|or|is equal|equals|(is )?equal to|is not|isn&#39;t|isn&#39;t equal( to)?|is not equal( to)?|doesn&#39;t equal|does not equal|(is )?greater than|comes after|is not less than or equal( to)?|isn&#39;t less than or equal( to)?|(is )?less than|comes before|is not greater than or equal( to)?|isn&#39;t greater than or equal( to)?|(is )?greater than or equal( to)?|is not less than|isn&#39;t less than|does not come before|doesn&#39;t come before|(is )?less than or equal( to)?|is not greater than|isn&#39;t greater than|does not come after|doesn&#39;t come after|starts? with|begins? with|ends? with|contains?|does not contain|doesn&#39;t contain|is in|is contained by|is not in|is not contained by|isn&#39;t contained by|div|mod|not|(a )?(ref( to)?|reference to)|is|does)\b"
>
<token type="OperatorWord" />
</rule>
<rule pattern="^(\s*(?:on|end)\s+)(zoomed|write to file|will zoom|will show|will select tab view item|will resize( sub views)?|will resign active|will quit|will pop up|will open|will move|will miniaturize|will hide|will finish launching|will display outline cell|will display item cell|will display cell|will display browser cell|will dismiss|will close|will become active|was miniaturized|was hidden|update toolbar item|update parameters|update menu item|shown|should zoom|should selection change|should select tab view item|should select row|should select item|should select column|should quit( after last window closed)?|should open( untitled)?|should expand item|should end editing|should collapse item|should close|should begin editing|selection changing|selection changed|selected tab view item|scroll wheel|rows changed|right mouse up|right mouse dragged|right mouse down|resized( sub views)?|resigned main|resigned key|resigned active|read from file|prepare table drop|prepare table drag|prepare outline drop|prepare outline drag|prepare drop|plugin loaded|parameters updated|panel ended|opened|open untitled|number of rows|number of items|number of browser rows|moved|mouse up|mouse moved|mouse exited|mouse entered|mouse dragged|mouse down|miniaturized|load data representation|launched|keyboard up|keyboard down|items changed|item value changed|item value|item expandable|idle|exposed|end editing|drop|drag( (entered|exited|updated))?|double clicked|document nib name|dialog ended|deminiaturized|data representation|conclude drop|column resized|column moved|column clicked|closed|clicked toolbar item|clicked|choose menu item|child of item|changed|change item value|change cell value|cell value changed|cell value|bounds changed|begin editing|became main|became key|awake from nib|alert ended|activated|action|accept table drop|accept outline drop)">
<bygroups>
<token type="Keyword"/>
<token type="NameFunction"/>
</bygroups>
<rule
pattern="^(\s*(?:on|end)\s+)(zoomed|write to file|will zoom|will show|will select tab view item|will resize( sub views)?|will resign active|will quit|will pop up|will open|will move|will miniaturize|will hide|will finish launching|will display outline cell|will display item cell|will display cell|will display browser cell|will dismiss|will close|will become active|was miniaturized|was hidden|update toolbar item|update parameters|update menu item|shown|should zoom|should selection change|should select tab view item|should select row|should select item|should select column|should quit( after last window closed)?|should open( untitled)?|should expand item|should end editing|should collapse item|should close|should begin editing|selection changing|selection changed|selected tab view item|scroll wheel|rows changed|right mouse up|right mouse dragged|right mouse down|resized( sub views)?|resigned main|resigned key|resigned active|read from file|prepare table drop|prepare table drag|prepare outline drop|prepare outline drag|prepare drop|plugin loaded|parameters updated|panel ended|opened|open untitled|number of rows|number of items|number of browser rows|moved|mouse up|mouse moved|mouse exited|mouse entered|mouse dragged|mouse down|miniaturized|load data representation|launched|keyboard up|keyboard down|items changed|item value changed|item value|item expandable|idle|exposed|end editing|drop|drag( (entered|exited|updated))?|double clicked|document nib name|dialog ended|deminiaturized|data representation|conclude drop|column resized|column moved|column clicked|closed|clicked toolbar item|clicked|choose menu item|child of item|changed|change item value|change cell value|cell value changed|cell value|bounds changed|begin editing|became main|became key|awake from nib|alert ended|activated|action|accept table drop|accept outline drop)"
>
<token type="Keyword" />
</rule>
<rule pattern="^(\s*)(in|on|script|to)(\s+)">
<bygroups>
<token type="Text"/>
<token type="Keyword"/>
<token type="Text"/>
<token type="Text" />
<token type="Keyword" />
<token type="Text" />
</bygroups>
</rule>
<rule pattern="\b(as )(alias |application |boolean |class |constant |date |file |integer |list |number |POSIX file |real |record |reference |RGB color |script |text |unit types|(?:Unicode )?text|string)\b">
<rule
pattern="\b(as )(alias |application |boolean |class |constant |date |file |integer |list |number |POSIX file |real |record |reference |RGB color |script |text |unit types|(?:Unicode )?text|string)\b"
>
<bygroups>
<token type="Keyword"/>
<token type="NameClass"/>
<token type="Keyword" />
<token type="NameClass" />
</bygroups>
</rule>
<rule pattern="\b(AppleScript|current application|false|linefeed|missing value|pi|quote|result|return|space|tab|text item delimiters|true|version)\b">
<token type="NameConstant"/>
<rule
pattern="\b(AppleScript|current application|false|linefeed|missing value|pi|quote|result|return|space|tab|text item delimiters|true|version)\b"
>
<token type="NameConstant" />
</rule>
<rule pattern="\b(ASCII (character|number)|activate|beep|choose URL|choose application|choose color|choose file( name)?|choose folder|choose from list|choose remote application|clipboard info|close( access)?|copy|count|current date|delay|delete|display (alert|dialog)|do shell script|duplicate|exists|get eof|get volume settings|info for|launch|list (disks|folder)|load script|log|make|mount volume|new|offset|open( (for access|location))?|path to|print|quit|random number|read|round|run( script)?|say|scripting components|set (eof|the clipboard to|volume)|store script|summarize|system attribute|system info|the clipboard|time to GMT|write|quoted form)\b">
<token type="NameBuiltin"/>
<rule
pattern="\b(ASCII (character|number)|activate|beep|choose URL|choose application|choose color|choose file( name)?|choose folder|choose from list|choose remote application|clipboard info|close( access)?|copy|count|current date|delay|delete|display (alert|dialog)|do shell script|duplicate|exists|get eof|get volume settings|info for|launch|list (disks|folder)|load script|log|make|mount volume|new|offset|open( (for access|location))?|path to|print|quit|random number|read|round|run( script)?|say|scripting components|set (eof|the clipboard to|volume)|store script|summarize|system attribute|system info|the clipboard|time to GMT|write|quoted form)\b"
>
<token type="NameBuiltin" />
</rule>
<rule pattern="\b(considering|else|error|exit|from|if|ignoring|in|repeat|tell|then|times|to|try|until|using terms from|while|with|with timeout( of)?|with transaction|by|continue|end|its?|me|my|return|of|as)\b">
<token type="Keyword"/>
<rule
pattern="\b(considering|else|error|exit|from|if|ignoring|in|repeat|tell|then|times|to|try|until|using terms from|while|with|with timeout( of)?|with transaction|by|continue|end|its?|me|my|return|of|as)\b"
>
<token type="Keyword" />
</rule>
<rule pattern="\b(global|local|prop(erty)?|set|get)\b">
<token type="Keyword"/>
<token type="Keyword" />
</rule>
<rule pattern="\b(but|put|returning|the)\b">
<token type="NameBuiltin"/>
<token type="NameBuiltin" />
</rule>
<rule pattern="\b(attachment|attribute run|character|day|month|paragraph|word|year)s?\b">
<token type="NameBuiltin"/>
<token type="NameBuiltin" />
</rule>
<rule pattern="\b(about|above|against|apart from|around|aside from|at|below|beneath|beside|between|for|given|instead of|on|onto|out of|over|since)\b">
<token type="NameBuiltin"/>
<rule
pattern="\b(about|above|against|apart from|around|aside from|at|below|beneath|beside|between|for|given|instead of|on|onto|out of|over|since)\b"
>
<token type="NameBuiltin" />
</rule>
<rule pattern="\b(accepts arrow key|action method|active|alignment|allowed identifiers|allows branch selection|allows column reordering|allows column resizing|allows column selection|allows customization|allows editing text attributes|allows empty selection|allows mixed state|allows multiple selection|allows reordering|allows undo|alpha( value)?|alternate image|alternate increment value|alternate title|animation delay|associated file name|associated object|auto completes|auto display|auto enables items|auto repeat|auto resizes( outline column)?|auto save expanded items|auto save name|auto save table columns|auto saves configuration|auto scroll|auto sizes all columns to fit|auto sizes cells|background color|bezel state|bezel style|bezeled|border rect|border type|bordered|bounds( rotation)?|box type|button returned|button type|can choose directories|can choose files|can draw|can hide|cell( (background color|size|type))?|characters|class|click count|clicked( data)? column|clicked data item|clicked( data)? row|closeable|collating|color( (mode|panel))|command key down|configuration|content(s| (size|view( margins)?))?|context|continuous|control key down|control size|control tint|control view|controller visible|coordinate system|copies( on scroll)?|corner view|current cell|current column|current( field)? editor|current( menu)? item|current row|current tab view item|data source|default identifiers|delta (x|y|z)|destination window|directory|display mode|displayed cell|document( (edited|rect|view))?|double value|dragged column|dragged distance|dragged items|draws( cell)? background|draws grid|dynamically scrolls|echos bullets|edge|editable|edited( data)? column|edited data item|edited( data)? row|enabled|enclosing scroll view|ending page|error handling|event number|event type|excluded from windows menu|executable path|expanded|fax number|field editor|file kind|file name|file type|first responder|first visible column|flipped|floating|font( panel)?|formatter|frameworks path|frontmost|gave up|grid color|has data items|has horizontal ruler|has horizontal scroller|has parent data item|has resize indicator|has shadow|has sub menu|has vertical ruler|has vertical scroller|header cell|header view|hidden|hides when deactivated|highlights by|horizontal line scroll|horizontal page scroll|horizontal ruler view|horizontally resizable|icon image|id|identifier|ignores multiple clicks|image( (alignment|dims when disabled|frame style|scaling))?|imports graphics|increment value|indentation per level|indeterminate|index|integer value|intercell spacing|item height|key( (code|equivalent( modifier)?|window))?|knob thickness|label|last( visible)? column|leading offset|leaf|level|line scroll|loaded|localized sort|location|loop mode|main( (bunde|menu|window))?|marker follows cell|matrix mode|maximum( content)? size|maximum visible columns|menu( form representation)?|miniaturizable|miniaturized|minimized image|minimized title|minimum column width|minimum( content)? size|modal|modified|mouse down state|movie( (controller|file|rect))?|muted|name|needs display|next state|next text|number of tick marks|only tick mark values|opaque|open panel|option key down|outline table column|page scroll|pages across|pages down|palette label|pane splitter|parent data item|parent window|pasteboard|path( (names|separator))?|playing|plays every frame|plays selection only|position|preferred edge|preferred type|pressure|previous text|prompt|properties|prototype cell|pulls down|rate|released when closed|repeated|requested print time|required file type|resizable|resized column|resource path|returns records|reuses columns|rich text|roll over|row height|rulers visible|save panel|scripts path|scrollable|selectable( identifiers)?|selected cell|selected( data)? columns?|selected data items?|selected( data)? rows?|selected item identifier|selection by rect|send action on arrow key|sends action when done editing|separates columns|separator item|sequence number|services menu|shared frameworks path|shared support path|sheet|shift key down|shows alpha|shows state by|size( mode)?|smart insert delete enabled|sort case sensitivity|sort column|sort order|sort type|sorted( data rows)?|sound|source( mask)?|spell checking enabled|starting page|state|string value|sub menu|super menu|super view|tab key traverses cells|tab state|tab type|tab view|table view|tag|target( printer)?|text color|text container insert|text container origin|text returned|tick mark position|time stamp|title(d| (cell|font|height|position|rect))?|tool tip|toolbar|trailing offset|transparent|treat packages as directories|truncated labels|types|unmodified characters|update views|use sort indicator|user defaults|uses data source|uses ruler|uses threaded animation|uses title from previous column|value wraps|version|vertical( (line scroll|page scroll|ruler view))?|vertically resizable|view|visible( document rect)?|volume|width|window|windows menu|wraps|zoomable|zoomed)\b">
<token type="NameAttribute"/>
<rule
pattern="\b(accepts arrow key|action method|active|alignment|allowed identifiers|allows branch selection|allows column reordering|allows column resizing|allows column selection|allows customization|allows editing text attributes|allows empty selection|allows mixed state|allows multiple selection|allows reordering|allows undo|alpha( value)?|alternate image|alternate increment value|alternate title|animation delay|associated file name|associated object|auto completes|auto display|auto enables items|auto repeat|auto resizes( outline column)?|auto save expanded items|auto save name|auto save table columns|auto saves configuration|auto scroll|auto sizes all columns to fit|auto sizes cells|background color|bezel state|bezel style|bezeled|border rect|border type|bordered|bounds( rotation)?|box type|button returned|button type|can choose directories|can choose files|can draw|can hide|cell( (background color|size|type))?|characters|class|click count|clicked( data)? column|clicked data item|clicked( data)? row|closeable|collating|color( (mode|panel))|command key down|configuration|content(s| (size|view( margins)?))?|context|continuous|control key down|control size|control tint|control view|controller visible|coordinate system|copies( on scroll)?|corner view|current cell|current column|current( field)? editor|current( menu)? item|current row|current tab view item|data source|default identifiers|delta (x|y|z)|destination window|directory|display mode|displayed cell|document( (edited|rect|view))?|double value|dragged column|dragged distance|dragged items|draws( cell)? background|draws grid|dynamically scrolls|echos bullets|edge|editable|edited( data)? column|edited data item|edited( data)? row|enabled|enclosing scroll view|ending page|error handling|event number|event type|excluded from windows menu|executable path|expanded|fax number|field editor|file kind|file name|file type|first responder|first visible column|flipped|floating|font( panel)?|formatter|frameworks path|frontmost|gave up|grid color|has data items|has horizontal ruler|has horizontal scroller|has parent data item|has resize indicator|has shadow|has sub menu|has vertical ruler|has vertical scroller|header cell|header view|hidden|hides when deactivated|highlights by|horizontal line scroll|horizontal page scroll|horizontal ruler view|horizontally resizable|icon image|id|identifier|ignores multiple clicks|image( (alignment|dims when disabled|frame style|scaling))?|imports graphics|increment value|indentation per level|indeterminate|index|integer value|intercell spacing|item height|key( (code|equivalent( modifier)?|window))?|knob thickness|label|last( visible)? column|leading offset|leaf|level|line scroll|loaded|localized sort|location|loop mode|main( (bunde|menu|window))?|marker follows cell|matrix mode|maximum( content)? size|maximum visible columns|menu( form representation)?|miniaturizable|miniaturized|minimized image|minimized title|minimum column width|minimum( content)? size|modal|modified|mouse down state|movie( (controller|file|rect))?|muted|name|needs display|next state|next text|number of tick marks|only tick mark values|opaque|open panel|option key down|outline table column|page scroll|pages across|pages down|palette label|pane splitter|parent data item|parent window|pasteboard|path( (names|separator))?|playing|plays every frame|plays selection only|position|preferred edge|preferred type|pressure|previous text|prompt|properties|prototype cell|pulls down|rate|released when closed|repeated|requested print time|required file type|resizable|resized column|resource path|returns records|reuses columns|rich text|roll over|row height|rulers visible|save panel|scripts path|scrollable|selectable( identifiers)?|selected cell|selected( data)? columns?|selected data items?|selected( data)? rows?|selected item identifier|selection by rect|send action on arrow key|sends action when done editing|separates columns|separator item|sequence number|services menu|shared frameworks path|shared support path|sheet|shift key down|shows alpha|shows state by|size( mode)?|smart insert delete enabled|sort case sensitivity|sort column|sort order|sort type|sorted( data rows)?|sound|source( mask)?|spell checking enabled|starting page|state|string value|sub menu|super menu|super view|tab key traverses cells|tab state|tab type|tab view|table view|tag|target( printer)?|text color|text container insert|text container origin|text returned|tick mark position|time stamp|title(d| (cell|font|height|position|rect))?|tool tip|toolbar|trailing offset|transparent|treat packages as directories|truncated labels|types|unmodified characters|update views|use sort indicator|user defaults|uses data source|uses ruler|uses threaded animation|uses title from previous column|value wraps|version|vertical( (line scroll|page scroll|ruler view))?|vertically resizable|view|visible( document rect)?|volume|width|window|windows menu|wraps|zoomable|zoomed)\b"
>
<token type="NameAttribute" />
</rule>
<rule pattern="\b(action cell|alert reply|application|box|browser( cell)?|bundle|button( cell)?|cell|clip view|color well|color-panel|combo box( item)?|control|data( (cell|column|item|row|source))?|default entry|dialog reply|document|drag info|drawer|event|font(-panel)?|formatter|image( (cell|view))?|matrix|menu( item)?|item|movie( view)?|open-panel|outline view|panel|pasteboard|plugin|popup button|progress indicator|responder|save-panel|scroll view|secure text field( cell)?|slider|sound|split view|stepper|tab view( item)?|table( (column|header cell|header view|view))|text( (field( cell)?|view))?|toolbar( item)?|user-defaults|view|window)s?\b">
<token type="NameBuiltin"/>
<rule
pattern="\b(action cell|alert reply|application|box|browser( cell)?|bundle|button( cell)?|cell|clip view|color well|color-panel|combo box( item)?|control|data( (cell|column|item|row|source))?|default entry|dialog reply|document|drag info|drawer|event|font(-panel)?|formatter|image( (cell|view))?|matrix|menu( item)?|item|movie( view)?|open-panel|outline view|panel|pasteboard|plugin|popup button|progress indicator|responder|save-panel|scroll view|secure text field( cell)?|slider|sound|split view|stepper|tab view( item)?|table( (column|header cell|header view|view))|text( (field( cell)?|view))?|toolbar( item)?|user-defaults|view|window)s?\b"
>
<token type="NameBuiltin" />
</rule>
<rule pattern="\b(animate|append|call method|center|close drawer|close panel|display|display alert|display dialog|display panel|go|hide|highlight|increment|item for|load image|load movie|load nib|load panel|load sound|localized string|lock focus|log|open drawer|path for|pause|perform action|play|register|resume|scroll|select( all)?|show|size to fit|start|step back|step forward|stop|synchronize|unlock focus|update)\b">
<token type="NameBuiltin"/>
<rule
pattern="\b(animate|append|call method|center|close drawer|close panel|display|display alert|display dialog|display panel|go|hide|highlight|increment|item for|load image|load movie|load nib|load panel|load sound|localized string|lock focus|log|open drawer|path for|pause|perform action|play|register|resume|scroll|select( all)?|show|size to fit|start|step back|step forward|stop|synchronize|unlock focus|update)\b"
>
<token type="NameBuiltin" />
</rule>
<rule pattern="\b((in )?back of|(in )?front of|[0-9]+(st|nd|rd|th)|first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|after|back|before|behind|every|front|index|last|middle|some|that|through|thru|where|whose)\b">
<token type="NameBuiltin"/>
<rule
pattern="\b((in )?back of|(in )?front of|[0-9]+(st|nd|rd|th)|first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|after|back|before|behind|every|front|index|last|middle|some|that|through|thru|where|whose)\b"
>
<token type="NameBuiltin" />
</rule>
<rule pattern="&#34;(\\\\|\\&#34;|[^&#34;])*&#34;">
<token type="LiteralStringDouble"/>
<token type="LiteralStringDouble" />
</rule>
<rule pattern="\b([a-zA-Z]\w*)\b">
<token type="NameVariable"/>
<token type="NameVariable" />
</rule>
<rule pattern="[-+]?(\d+\.\d*|\d*\.\d+)(E[-+][0-9]+)?">
<token type="LiteralNumberFloat"/>
<token type="LiteralNumberFloat" />
</rule>
<rule pattern="[-+]?\d+">
<token type="LiteralNumberInteger"/>
<token type="LiteralNumberInteger" />
</rule>
</state>
<state name="comment">
<rule pattern="\(\*">
<token type="CommentMultiline"/>
<push/>
<token type="CommentMultiline" />
<push />
</rule>
<rule pattern="\*\)">
<token type="CommentMultiline"/>
<pop depth="1"/>
<token type="CommentMultiline" />
<pop depth="1" />
</rule>
<rule pattern="[^*(]+">
<token type="CommentMultiline"/>
<token type="CommentMultiline" />
</rule>
<rule pattern="[*(]">
<token type="CommentMultiline"/>
<token type="CommentMultiline" />
</rule>
</state>
</rules>
</lexer>
</lexer>

View File

@@ -152,7 +152,7 @@
<rule pattern="(?-i)(?:CURRENT|NEW|OLD)\b">
<token type="NameBuiltinPseudo"/>
</rule>
<rule pattern="(?:to_bool|to_number|to_string|to_array|to_list|is_null|is_bool|is_number|is_string|is_array|is_list|is_object|is_document|is_datestring|typename|json_stringify|json_parse|concat|concat_separator|char_length|lower|upper|substring|substring_bytes|left|right|trim|reverse|contains|log|log2|log10|exp|exp2|sin|cos|tan|asin|acos|atan|atan2|radians|degrees|pi|regex_test|regex_replace|like|floor|ceil|round|abs|rand|sqrt|pow|length|count|min|max|average|avg|sum|product|median|variance_population|variance_sample|variance|percentile|bit_and|bit_or|bit_xor|bit_negate|bit_test|bit_popcount|bit_shift_left|bit_shift_right|bit_construct|bit_deconstruct|bit_to_string|bit_from_string|first|last|unique|outersection|interleave|in_range|jaccard|matches|merge|merge_recursive|has|attributes|keys|values|unset|unset_recursive|keep|keep_recursive|near|within|within_rectangle|is_in_polygon|distance|fulltext|stddev_sample|stddev_population|stddev|slice|nth|position|contains_array|translate|zip|call|apply|push|append|pop|shift|unshift|remove_value|remove_values|remove_nth|replace_nth|date_now|date_timestamp|date_iso8601|date_dayofweek|date_year|date_month|date_day|date_hour|date_minute|date_second|date_millisecond|date_dayofyear|date_isoweek|date_isoweekyear|date_leapyear|date_quarter|date_days_in_month|date_trunc|date_round|date_add|date_subtract|date_diff|date_compare|date_format|date_utctolocal|date_localtoutc|date_timezone|date_timezones|fail|passthru|v8|sleep|schema_get|schema_validate|shard_id|version|noopt|noeval|not_null|first_list|first_document|parse_identifier|current_user|current_database|collection_count|pregel_result|collections|document|decode_rev|range|union|union_distinct|minus|intersection|flatten|is_same_collection|check_document|ltrim|rtrim|find_first|find_last|split|substitute|ipv4_to_number|ipv4_from_number|is_ipv4|md5|sha1|sha256|sha512|crc32|fnv64|hash|random_token|to_base64|to_hex|encode_uri_component|soundex|assert|warn|is_key|sorted|sorted_unique|count_distinct|count_unique|levenshtein_distance|levenshtein_match|regex_matches|regex_split|ngram_match|ngram_similarity|ngram_positional_similarity|uuid|tokens|exists|starts_with|phrase|min_match|bm25|tfidf|boost|analyzer|offset_info|value|cosine_similarity|decay_exp|decay_gauss|decay_linear|l1_distance|l2_distance|minhash|minhash_count|minhash_error|minhash_match|geo_point|geo_multipoint|geo_polygon|geo_multipolygon|geo_linestring|geo_multilinestring|geo_contains|geo_intersects|geo_equals|geo_distance|geo_area|geo_in_range)(?=\s*\()">
<rule pattern="(?:to_bool|to_number|to_char|to_string|to_array|to_list|is_null|is_bool|is_number|is_string|is_array|is_list|is_object|is_document|is_datestring|typename|json_stringify|json_parse|concat|concat_separator|char_length|lower|upper|substring|substring_bytes|left|right|trim|reverse|repeat|contains|log|log2|log10|exp|exp2|sin|cos|tan|asin|acos|atan|atan2|radians|degrees|pi|regex_test|regex_replace|like|floor|ceil|round|abs|rand|random|sqrt|pow|length|count|min|max|average|avg|sum|product|median|variance_population|variance_sample|variance|percentile|bit_and|bit_or|bit_xor|bit_negate|bit_test|bit_popcount|bit_shift_left|bit_shift_right|bit_construct|bit_deconstruct|bit_to_string|bit_from_string|first|last|unique|outersection|interleave|in_range|jaccard|matches|merge|merge_recursive|has|attributes|keys|values|entries|unset|unset_recursive|keep|keep_recursive|near|within|within_rectangle|is_in_polygon|distance|fulltext|stddev_sample|stddev_population|stddev|slice|nth|position|contains_array|translate|zip|call|apply|push|append|pop|shift|unshift|remove_value|remove_values|remove_nth|replace_nth|date_now|date_timestamp|date_iso8601|date_dayofweek|date_year|date_month|date_day|date_hour|date_minute|date_second|date_millisecond|date_dayofyear|date_isoweek|date_isoweekyear|date_leapyear|date_quarter|date_days_in_month|date_trunc|date_round|date_add|date_subtract|date_diff|date_compare|date_format|date_utctolocal|date_localtoutc|date_timezone|date_timezones|fail|passthru|v8|sleep|schema_get|schema_validate|shard_id|version|noopt|noeval|not_null|first_list|first_document|parse_identifier|parse_collection|parse_key|current_user|current_database|collection_count|pregel_result|collections|document|decode_rev|range|union|union_distinct|minus|intersection|flatten|is_same_collection|check_document|ltrim|rtrim|find_first|find_last|split|substitute|ipv4_to_number|ipv4_from_number|is_ipv4|md5|sha1|sha256|sha512|crc32|fnv64|hash|random_token|to_base64|to_hex|encode_uri_component|soundex|assert|warn|is_key|sorted|sorted_unique|count_distinct|count_unique|levenshtein_distance|levenshtein_match|regex_matches|regex_split|ngram_match|ngram_similarity|ngram_positional_similarity|uuid|tokens|exists|starts_with|phrase|min_match|bm25|tfidf|boost|analyzer|offset_info|value|cosine_similarity|decay_exp|decay_gauss|decay_linear|l1_distance|l2_distance|minhash|minhash_count|minhash_error|minhash_match|geo_point|geo_multipoint|geo_polygon|geo_multipolygon|geo_linestring|geo_multilinestring|geo_contains|geo_intersects|geo_equals|geo_distance|geo_area|geo_in_range)(?=\s*\()">
<token type="NameFunction"/>
</rule>
<rule pattern="&#34;">

View File

@@ -9,301 +9,314 @@
<rules>
<state name="whitespace">
<rule pattern="^#if\s+0">
<token type="CommentPreproc"/>
<push state="if0"/>
<token type="CommentPreproc" />
<push state="if0" />
</rule>
<rule pattern="^#">
<token type="CommentPreproc"/>
<push state="macro"/>
<token type="CommentPreproc" />
<push state="macro" />
</rule>
<rule pattern="^(\s*(?:/[*].*?[*]/\s*)?)(#if\s+0)">
<bygroups>
<usingself state="root"/>
<token type="CommentPreproc"/>
<usingself state="root" />
<token type="CommentPreproc" />
</bygroups>
<push state="if0"/>
<push state="if0" />
</rule>
<rule pattern="^(\s*(?:/[*].*?[*]/\s*)?)(#)">
<bygroups>
<usingself state="root"/>
<token type="CommentPreproc"/>
<usingself state="root" />
<token type="CommentPreproc" />
</bygroups>
<push state="macro"/>
<push state="macro" />
</rule>
<rule pattern="\n">
<token type="Text"/>
<token type="Text" />
</rule>
<rule pattern="\s+">
<token type="Text"/>
<token type="Text" />
</rule>
<rule pattern="\\\n">
<token type="Text"/>
<token type="Text" />
</rule>
<rule pattern="//(\n|[\w\W]*?[^\\]\n)">
<token type="CommentSingle"/>
<token type="CommentSingle" />
</rule>
<rule pattern="/(\\\n)?[*][\w\W]*?[*](\\\n)?/">
<token type="CommentMultiline"/>
<token type="CommentMultiline" />
</rule>
<rule pattern="/(\\\n)?[*][\w\W]*">
<token type="CommentMultiline"/>
<token type="CommentMultiline" />
</rule>
</state>
<state name="string">
<rule pattern="&#34;">
<token type="LiteralString"/>
<pop depth="1"/>
<token type="LiteralString" />
<pop depth="1" />
</rule>
<rule pattern="\\([\\abfnrtv&#34;\&#39;]|x[a-fA-F0-9]{2,4}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})">
<token type="LiteralStringEscape"/>
<token type="LiteralStringEscape" />
</rule>
<rule pattern="[^\\&#34;\n]+">
<token type="LiteralString"/>
<token type="LiteralString" />
</rule>
<rule pattern="\\\n">
<token type="LiteralString"/>
<token type="LiteralString" />
</rule>
<rule pattern="\\">
<token type="LiteralString"/>
<token type="LiteralString" />
</rule>
</state>
<state name="macro">
<rule pattern="(include)(\s*(?:/[*].*?[*]/\s*)?)([^\n]+)">
<bygroups>
<token type="CommentPreproc"/>
<token type="Text"/>
<token type="CommentPreprocFile"/>
<token type="CommentPreproc" />
<token type="Text" />
<token type="CommentPreprocFile" />
</bygroups>
</rule>
<rule pattern="[^/\n]+">
<token type="CommentPreproc"/>
<token type="CommentPreproc" />
</rule>
<rule pattern="/[*](.|\n)*?[*]/">
<token type="CommentMultiline"/>
<token type="CommentMultiline" />
</rule>
<rule pattern="//.*?\n">
<token type="CommentSingle"/>
<pop depth="1"/>
<token type="CommentSingle" />
<pop depth="1" />
</rule>
<rule pattern="/">
<token type="CommentPreproc"/>
<token type="CommentPreproc" />
</rule>
<rule pattern="(?&lt;=\\)\n">
<token type="CommentPreproc"/>
<token type="CommentPreproc" />
</rule>
<rule pattern="\n">
<token type="CommentPreproc"/>
<pop depth="1"/>
<token type="CommentPreproc" />
<pop depth="1" />
</rule>
</state>
<state name="statements">
<rule pattern="(reinterpret_cast|static_assert|dynamic_cast|thread_local|static_cast|const_cast|protected|constexpr|namespace|restrict|noexcept|override|operator|typename|template|explicit|decltype|nullptr|private|alignof|virtual|mutable|alignas|typeid|friend|throws|export|public|delete|final|using|throw|catch|this|try|new)\b">
<token type="Keyword"/>
<rule
pattern="(reinterpret_cast|static_assert|dynamic_cast|thread_local|static_cast|const_cast|protected|constexpr|namespace|restrict|noexcept|override|operator|typename|template|explicit|decltype|nullptr|private|alignof|virtual|mutable|alignas|typeid|friend|throws|export|public|delete|final|using|throw|catch|this|try|new)\b"
>
<token type="Keyword" />
</rule>
<rule pattern="char(16_t|32_t)\b">
<token type="KeywordType"/>
<token type="KeywordType" />
</rule>
<rule pattern="(class)\b">
<bygroups>
<token type="Keyword"/>
<token type="Text"/>
<token type="Keyword" />
</bygroups>
<push state="classname"/>
<push state="classname" />
</rule>
<rule pattern="(R)(&#34;)([^\\()\s]{,16})(\()((?:.|\n)*?)(\)\3)(&#34;)">
<bygroups>
<token type="LiteralStringAffix"/>
<token type="LiteralString"/>
<token type="LiteralStringDelimiter"/>
<token type="LiteralStringDelimiter"/>
<token type="LiteralString"/>
<token type="LiteralStringDelimiter"/>
<token type="LiteralString"/>
<token type="LiteralStringAffix" />
<token type="LiteralString" />
<token type="LiteralStringDelimiter" />
<token type="LiteralStringDelimiter" />
<token type="LiteralString" />
<token type="LiteralStringDelimiter" />
<token type="LiteralString" />
</bygroups>
</rule>
<rule pattern="(u8|u|U)(&#34;)">
<bygroups>
<token type="LiteralStringAffix"/>
<token type="LiteralString"/>
<token type="LiteralStringAffix" />
<token type="LiteralString" />
</bygroups>
<push state="string"/>
<push state="string" />
</rule>
<rule pattern="(L?)(&#34;)">
<bygroups>
<token type="LiteralStringAffix"/>
<token type="LiteralString"/>
<token type="LiteralStringAffix" />
<token type="LiteralString" />
</bygroups>
<push state="string"/>
<push state="string" />
</rule>
<rule pattern="(L?)(&#39;)(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\&#39;\n])(&#39;)">
<bygroups>
<token type="LiteralStringAffix"/>
<token type="LiteralStringChar"/>
<token type="LiteralStringChar"/>
<token type="LiteralStringChar"/>
<token type="LiteralStringAffix" />
<token type="LiteralStringChar" />
<token type="LiteralStringChar" />
<token type="LiteralStringChar" />
</bygroups>
</rule>
<rule pattern="(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*">
<token type="LiteralNumberFloat"/>
<token type="LiteralNumberFloat" />
</rule>
<rule pattern="(\d+\.\d*|\.\d+|\d+[fF])[fF]?">
<token type="LiteralNumberFloat"/>
<token type="LiteralNumberFloat" />
</rule>
<rule pattern="0x[0-9a-fA-F]+[LlUu]*">
<token type="LiteralNumberHex"/>
<token type="LiteralNumberHex" />
</rule>
<rule pattern="0[0-7]+[LlUu]*">
<token type="LiteralNumberOct"/>
<token type="LiteralNumberOct" />
</rule>
<rule pattern="\d+[LlUu]*">
<token type="LiteralNumberInteger"/>
<token type="LiteralNumberInteger" />
</rule>
<rule pattern="\*/">
<token type="Error"/>
<token type="Error" />
</rule>
<rule pattern="[~!%^&amp;*+=|?:&lt;&gt;/-]">
<token type="Operator"/>
<token type="Operator" />
</rule>
<rule pattern="[()\[\],.]">
<token type="Punctuation"/>
<token type="Punctuation" />
</rule>
<rule pattern="(restricted|volatile|continue|register|default|typedef|struct|extern|switch|sizeof|static|return|union|while|const|break|goto|enum|else|case|auto|for|asm|if|do)\b">
<token type="Keyword"/>
<rule
pattern="(restricted|volatile|continue|register|default|typedef|struct|extern|switch|sizeof|static|return|union|while|const|break|goto|enum|else|case|auto|for|asm|if|do)\b"
>
<token type="Keyword" />
</rule>
<rule pattern="(_Bool|_Complex|_Imaginary|array|atomic_bool|atomic_char|atomic_int|atomic_llong|atomic_long|atomic_schar|atomic_short|atomic_uchar|atomic_uint|atomic_ullong|atomic_ulong|atomic_ushort|auto|bool|boolean|BooleanVariables|Byte|byte|Char|char|char16_t|char32_t|class|complex|Const|const|const_cast|delete|double|dynamic_cast|enum|explicit|extern|Float|float|friend|inline|Int|int|int16_t|int32_t|int64_t|int8_t|Long|long|new|NULL|null|operator|private|PROGMEM|protected|public|register|reinterpret_cast|short|signed|sizeof|Static|static|static_cast|String|struct|typedef|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|virtual|Void|void|Volatile|volatile|word)\b">
<token type="KeywordType"/>
<rule
pattern="(_Bool|_Complex|_Imaginary|array|atomic_bool|atomic_char|atomic_int|atomic_llong|atomic_long|atomic_schar|atomic_short|atomic_uchar|atomic_uint|atomic_ullong|atomic_ulong|atomic_ushort|auto|bool|boolean|BooleanVariables|Byte|byte|Char|char|char16_t|char32_t|class|complex|Const|const|const_cast|delete|double|dynamic_cast|enum|explicit|extern|Float|float|friend|inline|Int|int|int16_t|int32_t|int64_t|int8_t|Long|long|new|NULL|null|operator|private|PROGMEM|protected|public|register|reinterpret_cast|short|signed|sizeof|Static|static|static_cast|String|struct|typedef|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|virtual|Void|void|Volatile|volatile|word)\b"
>
<token type="KeywordType" />
</rule>
<rule pattern="(and|final|If|Loop|loop|not|or|override|setup|Setup|throw|try|xor)\b">
<token type="Keyword"/>
<token type="Keyword" />
</rule>
<rule pattern="(ANALOG_MESSAGE|BIN|CHANGE|DEC|DEFAULT|DIGITAL_MESSAGE|EXTERNAL|FALLING|FIRMATA_STRING|HALF_PI|HEX|HIGH|INPUT|INPUT_PULLUP|INTERNAL|INTERNAL1V1|INTERNAL1V1|INTERNAL2V56|INTERNAL2V56|LED_BUILTIN|LED_BUILTIN_RX|LED_BUILTIN_TX|LOW|LSBFIRST|MSBFIRST|OCT|OUTPUT|PI|REPORT_ANALOG|REPORT_DIGITAL|RISING|SET_PIN_MODE|SYSEX_START|SYSTEM_RESET|TWO_PI)\b">
<token type="KeywordConstant"/>
<rule
pattern="(ANALOG_MESSAGE|BIN|CHANGE|DEC|DEFAULT|DIGITAL_MESSAGE|EXTERNAL|FALLING|FIRMATA_STRING|HALF_PI|HEX|HIGH|INPUT|INPUT_PULLUP|INTERNAL|INTERNAL1V1|INTERNAL1V1|INTERNAL2V56|INTERNAL2V56|LED_BUILTIN|LED_BUILTIN_RX|LED_BUILTIN_TX|LOW|LSBFIRST|MSBFIRST|OCT|OUTPUT|PI|REPORT_ANALOG|REPORT_DIGITAL|RISING|SET_PIN_MODE|SYSEX_START|SYSTEM_RESET|TWO_PI)\b"
>
<token type="KeywordConstant" />
</rule>
<rule pattern="(boolean|const|byte|word|string|String|array)\b">
<token type="NameVariable"/>
<token type="NameVariable" />
</rule>
<rule pattern="(Keyboard|KeyboardController|MouseController|SoftwareSerial|EthernetServer|EthernetClient|LiquidCrystal|RobotControl|GSMVoiceCall|EthernetUDP|EsploraTFT|HttpClient|RobotMotor|WiFiClient|GSMScanner|FileSystem|Scheduler|GSMServer|YunClient|YunServer|IPAddress|GSMClient|GSMModem|Keyboard|Ethernet|Console|GSMBand|Esplora|Stepper|Process|WiFiUDP|GSM_SMS|Mailbox|USBHost|Firmata|PImage|Client|Server|GSMPIN|FileIO|Bridge|Serial|EEPROM|Stream|Mouse|Audio|Servo|File|Task|GPRS|WiFi|Wire|TFT|GSM|SPI|SD)\b">
<token type="NameClass"/>
<rule
pattern="(Keyboard|KeyboardController|MouseController|SoftwareSerial|EthernetServer|EthernetClient|LiquidCrystal|RobotControl|GSMVoiceCall|EthernetUDP|EsploraTFT|HttpClient|RobotMotor|WiFiClient|GSMScanner|FileSystem|Scheduler|GSMServer|YunClient|YunServer|IPAddress|GSMClient|GSMModem|Keyboard|Ethernet|Console|GSMBand|Esplora|Stepper|Process|WiFiUDP|GSM_SMS|Mailbox|USBHost|Firmata|PImage|Client|Server|GSMPIN|FileIO|Bridge|Serial|EEPROM|Stream|Mouse|Audio|Servo|File|Task|GPRS|WiFi|Wire|TFT|GSM|SPI|SD)\b"
>
<token type="NameClass" />
</rule>
<rule pattern="(abs|Abs|accept|ACos|acos|acosf|addParameter|analogRead|AnalogRead|analogReadResolution|AnalogReadResolution|analogReference|AnalogReference|analogWrite|AnalogWrite|analogWriteResolution|AnalogWriteResolution|answerCall|asin|ASin|asinf|atan|ATan|atan2|ATan2|atan2f|atanf|attach|attached|attachGPRS|attachInterrupt|AttachInterrupt|autoscroll|available|availableForWrite|background|beep|begin|beginPacket|beginSD|beginSMS|beginSpeaker|beginTFT|beginTransmission|beginWrite|bit|Bit|BitClear|bitClear|bitRead|BitRead|bitSet|BitSet|BitWrite|bitWrite|blink|blinkVersion|BSSID|buffer|byte|cbrt|cbrtf|Ceil|ceil|ceilf|changePIN|char|charAt|checkPIN|checkPUK|checkReg|circle|cityNameRead|cityNameWrite|clear|clearScreen|click|close|compareTo|compassRead|concat|config|connect|connected|constrain|Constrain|copysign|copysignf|cos|Cos|cosf|cosh|coshf|countryNameRead|countryNameWrite|createChar|cursor|debugPrint|degrees|Delay|delay|DelayMicroseconds|delayMicroseconds|detach|DetachInterrupt|detachInterrupt|DigitalPinToInterrupt|digitalPinToInterrupt|DigitalRead|digitalRead|DigitalWrite|digitalWrite|disconnect|display|displayLogos|drawBMP|drawCompass|encryptionType|end|endPacket|endSMS|endsWith|endTransmission|endWrite|equals|equalsIgnoreCase|exists|exitValue|Exp|exp|expf|fabs|fabsf|fdim|fdimf|fill|find|findUntil|float|floor|Floor|floorf|flush|fma|fmaf|fmax|fmaxf|fmin|fminf|fmod|fmodf|gatewayIP|get|getAsynchronously|getBand|getButton|getBytes|getCurrentCarrier|getIMEI|getKey|getModifiers|getOemKey|getPINUsed|getResult|getSignalStrength|getSocket|getVoiceCallStatus|getXChange|getYChange|hangCall|height|highByte|HighByte|home|hypot|hypotf|image|indexOf|int|interrupts|IPAddress|IRread|isActionDone|isAlpha|isAlphaNumeric|isAscii|isControl|isDigit|isDirectory|isfinite|isGraph|isHexadecimalDigit|isinf|isListening|isLowerCase|isnan|isPIN|isPressed|isPrintable|isPunct|isSpace|isUpperCase|isValid|isWhitespace|keyboardRead|keyPressed|keyReleased|knobRead|lastIndexOf|ldexp|ldexpf|leftToRight|length|line|lineFollowConfig|listen|listenOnLocalhost|loadImage|localIP|log|Log|log10|log10f|logf|long|lowByte|LowByte|lrint|lrintf|lround|lroundf|macAddress|maintain|map|Map|Max|max|messageAvailable|Micros|micros|millis|Millis|Min|min|mkdir|motorsStop|motorsWrite|mouseDragged|mouseMoved|mousePressed|mouseReleased|move|noAutoscroll|noBlink|noBuffer|noCursor|noDisplay|noFill|noInterrupts|NoInterrupts|noListenOnLocalhost|noStroke|noTone|NoTone|onReceive|onRequest|open|openNextFile|overflow|parseCommand|parseFloat|parseInt|parsePacket|pauseMode|peek|PinMode|pinMode|playFile|playMelody|point|pointTo|position|Pow|pow|powf|prepare|press|print|printFirmwareVersion|println|printVersion|process|processInput|PulseIn|pulseIn|pulseInLong|PulseInLong|put|radians|random|Random|randomSeed|RandomSeed|read|readAccelerometer|readBlue|readButton|readBytes|readBytesUntil|readGreen|readJoystickButton|readJoystickSwitch|readJoystickX|readJoystickY|readLightSensor|readMessage|readMicrophone|readNetworks|readRed|readSlider|readString|readStringUntil|readTemperature|ready|rect|release|releaseAll|remoteIP|remoteNumber|remotePort|remove|replace|requestFrom|retrieveCallingNumber|rewindDirectory|rightToLeft|rmdir|robotNameRead|robotNameWrite|round|roundf|RSSI|run|runAsynchronously|running|runShellCommand|runShellCommandAsynchronously|scanNetworks|scrollDisplayLeft|scrollDisplayRight|seek|sendAnalog|sendDigitalPortPair|sendDigitalPorts|sendString|sendSysex|Serial_Available|Serial_Begin|Serial_End|Serial_Flush|Serial_Peek|Serial_Print|Serial_Println|Serial_Read|serialEvent|setBand|setBitOrder|setCharAt|setClockDivider|setCursor|setDataMode|setDNS|setFirmwareVersion|setMode|setPINUsed|setSpeed|setTextSize|setTimeout|ShiftIn|shiftIn|ShiftOut|shiftOut|shutdown|signbit|sin|Sin|sinf|sinh|sinhf|size|sizeof|Sq|sq|Sqrt|sqrt|sqrtf|SSID|startLoop|startsWith|step|stop|stroke|subnetMask|substring|switchPIN|tan|Tan|tanf|tanh|tanhf|tempoWrite|text|toCharArray|toInt|toLowerCase|tone|Tone|toUpperCase|transfer|trim|trunc|truncf|tuneWrite|turn|updateIR|userNameRead|userNameWrite|voiceCall|waitContinue|width|WiFiServer|word|write|writeBlue|writeGreen|writeJSON|writeMessage|writeMicroseconds|writeRed|writeRGB|yield|Yield)\b">
<token type="NameFunction"/>
<rule
pattern="(abs|Abs|accept|ACos|acos|acosf|addParameter|analogRead|AnalogRead|analogReadResolution|AnalogReadResolution|analogReference|AnalogReference|analogWrite|AnalogWrite|analogWriteResolution|AnalogWriteResolution|answerCall|asin|ASin|asinf|atan|ATan|atan2|ATan2|atan2f|atanf|attach|attached|attachGPRS|attachInterrupt|AttachInterrupt|autoscroll|available|availableForWrite|background|beep|begin|beginPacket|beginSD|beginSMS|beginSpeaker|beginTFT|beginTransmission|beginWrite|bit|Bit|BitClear|bitClear|bitRead|BitRead|bitSet|BitSet|BitWrite|bitWrite|blink|blinkVersion|BSSID|buffer|byte|cbrt|cbrtf|Ceil|ceil|ceilf|changePIN|char|charAt|checkPIN|checkPUK|checkReg|circle|cityNameRead|cityNameWrite|clear|clearScreen|click|close|compareTo|compassRead|concat|config|connect|connected|constrain|Constrain|copysign|copysignf|cos|Cos|cosf|cosh|coshf|countryNameRead|countryNameWrite|createChar|cursor|debugPrint|degrees|Delay|delay|DelayMicroseconds|delayMicroseconds|detach|DetachInterrupt|detachInterrupt|DigitalPinToInterrupt|digitalPinToInterrupt|DigitalRead|digitalRead|DigitalWrite|digitalWrite|disconnect|display|displayLogos|drawBMP|drawCompass|encryptionType|end|endPacket|endSMS|endsWith|endTransmission|endWrite|equals|equalsIgnoreCase|exists|exitValue|Exp|exp|expf|fabs|fabsf|fdim|fdimf|fill|find|findUntil|float|floor|Floor|floorf|flush|fma|fmaf|fmax|fmaxf|fmin|fminf|fmod|fmodf|gatewayIP|get|getAsynchronously|getBand|getButton|getBytes|getCurrentCarrier|getIMEI|getKey|getModifiers|getOemKey|getPINUsed|getResult|getSignalStrength|getSocket|getVoiceCallStatus|getXChange|getYChange|hangCall|height|highByte|HighByte|home|hypot|hypotf|image|indexOf|int|interrupts|IPAddress|IRread|isActionDone|isAlpha|isAlphaNumeric|isAscii|isControl|isDigit|isDirectory|isfinite|isGraph|isHexadecimalDigit|isinf|isListening|isLowerCase|isnan|isPIN|isPressed|isPrintable|isPunct|isSpace|isUpperCase|isValid|isWhitespace|keyboardRead|keyPressed|keyReleased|knobRead|lastIndexOf|ldexp|ldexpf|leftToRight|length|line|lineFollowConfig|listen|listenOnLocalhost|loadImage|localIP|log|Log|log10|log10f|logf|long|lowByte|LowByte|lrint|lrintf|lround|lroundf|macAddress|maintain|map|Map|Max|max|messageAvailable|Micros|micros|millis|Millis|Min|min|mkdir|motorsStop|motorsWrite|mouseDragged|mouseMoved|mousePressed|mouseReleased|move|noAutoscroll|noBlink|noBuffer|noCursor|noDisplay|noFill|noInterrupts|NoInterrupts|noListenOnLocalhost|noStroke|noTone|NoTone|onReceive|onRequest|open|openNextFile|overflow|parseCommand|parseFloat|parseInt|parsePacket|pauseMode|peek|PinMode|pinMode|playFile|playMelody|point|pointTo|position|Pow|pow|powf|prepare|press|print|printFirmwareVersion|println|printVersion|process|processInput|PulseIn|pulseIn|pulseInLong|PulseInLong|put|radians|random|Random|randomSeed|RandomSeed|read|readAccelerometer|readBlue|readButton|readBytes|readBytesUntil|readGreen|readJoystickButton|readJoystickSwitch|readJoystickX|readJoystickY|readLightSensor|readMessage|readMicrophone|readNetworks|readRed|readSlider|readString|readStringUntil|readTemperature|ready|rect|release|releaseAll|remoteIP|remoteNumber|remotePort|remove|replace|requestFrom|retrieveCallingNumber|rewindDirectory|rightToLeft|rmdir|robotNameRead|robotNameWrite|round|roundf|RSSI|run|runAsynchronously|running|runShellCommand|runShellCommandAsynchronously|scanNetworks|scrollDisplayLeft|scrollDisplayRight|seek|sendAnalog|sendDigitalPortPair|sendDigitalPorts|sendString|sendSysex|Serial_Available|Serial_Begin|Serial_End|Serial_Flush|Serial_Peek|Serial_Print|Serial_Println|Serial_Read|serialEvent|setBand|setBitOrder|setCharAt|setClockDivider|setCursor|setDataMode|setDNS|setFirmwareVersion|setMode|setPINUsed|setSpeed|setTextSize|setTimeout|ShiftIn|shiftIn|ShiftOut|shiftOut|shutdown|signbit|sin|Sin|sinf|sinh|sinhf|size|sizeof|Sq|sq|Sqrt|sqrt|sqrtf|SSID|startLoop|startsWith|step|stop|stroke|subnetMask|substring|switchPIN|tan|Tan|tanf|tanh|tanhf|tempoWrite|text|toCharArray|toInt|toLowerCase|tone|Tone|toUpperCase|transfer|trim|trunc|truncf|tuneWrite|turn|updateIR|userNameRead|userNameWrite|voiceCall|waitContinue|width|WiFiServer|word|write|writeBlue|writeGreen|writeJSON|writeMessage|writeMicroseconds|writeRed|writeRGB|yield|Yield)\b"
>
<token type="NameFunction" />
</rule>
<rule pattern="(typename|__inline|restrict|_inline|thread|inline|naked)\b">
<token type="KeywordReserved"/>
<token type="KeywordReserved" />
</rule>
<rule pattern="(__m(128i|128d|128|64))\b">
<token type="KeywordReserved"/>
<token type="KeywordReserved" />
</rule>
<rule pattern="__(forceinline|identifier|unaligned|declspec|fastcall|finally|stdcall|wchar_t|assume|except|int32|cdecl|int16|leave|based|raise|int64|noop|int8|w64|try|asm)\b">
<token type="KeywordReserved"/>
<rule
pattern="__(forceinline|identifier|unaligned|declspec|fastcall|finally|stdcall|wchar_t|assume|except|int32|cdecl|int16|leave|based|raise|int64|noop|int8|w64|try|asm)\b"
>
<token type="KeywordReserved" />
</rule>
<rule pattern="(true|false|NULL)\b">
<token type="NameBuiltin"/>
<token type="NameBuiltin" />
</rule>
<rule pattern="([a-zA-Z_]\w*)(\s*)(:)(?!:)">
<bygroups>
<token type="NameLabel"/>
<token type="Text"/>
<token type="Punctuation"/>
<token type="NameLabel" />
<token type="Text" />
<token type="Punctuation" />
</bygroups>
</rule>
<rule pattern="[a-zA-Z_]\w*">
<token type="Name"/>
<token type="Name" />
</rule>
</state>
<state name="function">
<rule>
<include state="whitespace"/>
<include state="whitespace" />
</rule>
<rule>
<include state="statements"/>
<include state="statements" />
</rule>
<rule pattern=";">
<token type="Punctuation"/>
<token type="Punctuation" />
</rule>
<rule pattern="\{">
<token type="Punctuation"/>
<push/>
<token type="Punctuation" />
<push />
</rule>
<rule pattern="\}">
<token type="Punctuation"/>
<pop depth="1"/>
<token type="Punctuation" />
<pop depth="1" />
</rule>
</state>
<state name="if0">
<rule pattern="^\s*#if.*?(?&lt;!\\)\n">
<token type="CommentPreproc"/>
<push/>
<token type="CommentPreproc" />
<push />
</rule>
<rule pattern="^\s*#el(?:se|if).*\n">
<token type="CommentPreproc"/>
<pop depth="1"/>
<token type="CommentPreproc" />
<pop depth="1" />
</rule>
<rule pattern="^\s*#endif.*?(?&lt;!\\)\n">
<token type="CommentPreproc"/>
<pop depth="1"/>
<token type="CommentPreproc" />
<pop depth="1" />
</rule>
<rule pattern=".*?\n">
<token type="Comment"/>
<token type="Comment" />
</rule>
</state>
<state name="classname">
<rule pattern="[a-zA-Z_]\w*">
<token type="NameClass"/>
<pop depth="1"/>
<token type="NameClass" />
<pop depth="1" />
</rule>
<rule pattern="\s*(?=&gt;)">
<token type="Text"/>
<pop depth="1"/>
<token type="Text" />
<pop depth="1" />
</rule>
</state>
<state name="statement">
<rule>
<include state="whitespace"/>
<include state="whitespace" />
</rule>
<rule>
<include state="statements"/>
<include state="statements" />
</rule>
<rule pattern="[{}]">
<token type="Punctuation"/>
<token type="Punctuation" />
</rule>
<rule pattern=";">
<token type="Punctuation"/>
<pop depth="1"/>
<token type="Punctuation" />
<pop depth="1" />
</rule>
</state>
<state name="root">
<rule>
<include state="whitespace"/>
<include state="whitespace" />
</rule>
<rule pattern="((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))([^;{]*)(\{)">
<bygroups>
<usingself state="root"/>
<token type="NameFunction"/>
<usingself state="root"/>
<usingself state="root"/>
<token type="Punctuation"/>
<usingself state="root" />
<token type="NameFunction" />
<usingself state="root" />
<usingself state="root" />
<token type="Punctuation" />
</bygroups>
<push state="function"/>
<push state="function" />
</rule>
<rule pattern="((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))([^;]*)(;)">
<bygroups>
<usingself state="root"/>
<token type="NameFunction"/>
<usingself state="root"/>
<usingself state="root"/>
<token type="Punctuation"/>
<usingself state="root" />
<token type="NameFunction" />
<usingself state="root" />
<usingself state="root" />
<token type="Punctuation" />
</bygroups>
</rule>
<rule>
<push state="statement"/>
<push state="statement" />
</rule>
<rule pattern="__(multiple_inheritance|virtual_inheritance|single_inheritance|interface|uuidof|super|event)\b">
<token type="KeywordReserved"/>
<token type="KeywordReserved" />
</rule>
<rule pattern="__(offload|blockingoffload|outer)\b">
<token type="KeywordPseudo"/>
<token type="KeywordPseudo" />
</rule>
</state>
</rules>
</lexer>
</lexer>

View File

@@ -11,116 +11,116 @@
<rules>
<state name="root">
<rule>
<include state="commentsandwhitespace"/>
<include state="commentsandwhitespace" />
</rule>
<rule pattern="(\.\w+)([ \t]+\w+\s+?)?">
<bygroups>
<token type="KeywordNamespace"/>
<token type="NameLabel"/>
<token type="KeywordNamespace" />
<token type="NameLabel" />
</bygroups>
</rule>
<rule pattern="(\w+)(:)(\s+\.\w+\s+)">
<bygroups>
<token type="NameLabel"/>
<token type="Punctuation"/>
<token type="KeywordNamespace"/>
<token type="NameLabel" />
<token type="Punctuation" />
<token type="KeywordNamespace" />
</bygroups>
<push state="literal"/>
<push state="literal" />
</rule>
<rule pattern="(\w+)(:)">
<bygroups>
<token type="NameLabel"/>
<token type="Punctuation"/>
<token type="NameLabel" />
<token type="Punctuation" />
</bygroups>
</rule>
<rule pattern="svc\s+\w+">
<token type="NameNamespace"/>
<token type="NameNamespace" />
</rule>
<rule pattern="[a-zA-Z]+">
<token type="Text"/>
<push state="opcode"/>
<token type="Text" />
<push state="opcode" />
</rule>
</state>
<state name="commentsandwhitespace">
<rule pattern="\s+">
<token type="Text"/>
<token type="Text" />
</rule>
<rule pattern="[@;].*?\n">
<token type="CommentSingle"/>
<token type="CommentSingle" />
</rule>
<rule pattern="/\*.*?\*/">
<token type="CommentMultiline"/>
<token type="CommentMultiline" />
</rule>
</state>
<state name="literal">
<rule pattern="0b[01]+">
<token type="LiteralNumberBin"/>
<pop depth="1"/>
<token type="LiteralNumberBin" />
<pop depth="1" />
</rule>
<rule pattern="0x\w{1,8}">
<token type="LiteralNumberHex"/>
<pop depth="1"/>
<token type="LiteralNumberHex" />
<pop depth="1" />
</rule>
<rule pattern="0\d+">
<token type="LiteralNumberOct"/>
<pop depth="1"/>
<token type="LiteralNumberOct" />
<pop depth="1" />
</rule>
<rule pattern="\d+?\.\d+?">
<token type="LiteralNumberFloat"/>
<pop depth="1"/>
<token type="LiteralNumberFloat" />
<pop depth="1" />
</rule>
<rule pattern="\d+">
<token type="LiteralNumberInteger"/>
<pop depth="1"/>
<token type="LiteralNumberInteger" />
<pop depth="1" />
</rule>
<rule pattern="(&#34;)(.+)(&#34;)">
<bygroups>
<token type="Punctuation"/>
<token type="LiteralStringDouble"/>
<token type="Punctuation"/>
<token type="Punctuation" />
<token type="LiteralStringDouble" />
<token type="Punctuation" />
</bygroups>
<pop depth="1"/>
<pop depth="1" />
</rule>
<rule pattern="(&#39;)(.{1}|\\.{1})(&#39;)">
<bygroups>
<token type="Punctuation"/>
<token type="LiteralStringChar"/>
<token type="Punctuation"/>
<token type="Punctuation" />
<token type="LiteralStringChar" />
<token type="Punctuation" />
</bygroups>
<pop depth="1"/>
<pop depth="1" />
</rule>
</state>
<state name="opcode">
<rule pattern="\n">
<token type="Text"/>
<pop depth="1"/>
<token type="Text" />
<pop depth="1" />
</rule>
<rule pattern="(@|;).*\n">
<token type="CommentSingle"/>
<pop depth="1"/>
<token type="CommentSingle" />
<pop depth="1" />
</rule>
<rule pattern="(\s+|,)">
<token type="Text"/>
<token type="Text" />
</rule>
<rule pattern="[rapcfxwbhsdqv]\d{1,2}">
<token type="NameClass"/>
<token type="NameClass" />
</rule>
<rule pattern="=0x\w+">
<rule pattern="(=)(0x\w+)">
<bygroups>
<token type="Text"/>
<token type="NameLabel"/>
<token type="Text" />
<token type="NameLabel" />
</bygroups>
</rule>
<rule pattern="(=)(\w+)">
<bygroups>
<token type="Text"/>
<token type="NameLabel"/>
<token type="Text" />
<token type="NameLabel" />
</bygroups>
</rule>
<rule pattern="#">
<token type="Text"/>
<push state="literal"/>
<token type="Text" />
<push state="literal" />
</rule>
</state>
</rules>
</lexer>
</lexer>

View File

@@ -0,0 +1,165 @@
<lexer>
<config>
<name>ATL</name>
<alias>atl</alias>
<filename>*.atl</filename>
<mime_type>text/x-atl</mime_type>
<dot_all>true</dot_all>
</config>
<rules>
<state name="root">
<rule pattern="(--.*?)(\n)">
<bygroups>
<token type="CommentSingle" />
<token type="TextWhitespace" />
</bygroups>
</rule>
<rule pattern="(and|distinct|endif|else|for|foreach|if|implies|in|let|not|or|self|super|then|thisModule|xor)\b">
<token type="Keyword" />
</rule>
<rule pattern="(OclUndefined|true|false|#\w+)\b">
<token type="KeywordConstant" />
</rule>
<rule pattern="(module|query|library|create|from|to|uses)\b">
<token type="KeywordNamespace" />
</rule>
<rule pattern="(do)(\s*)({)">
<bygroups>
<token type="KeywordNamespace" />
<token type="TextWhitespace" />
<token type="Punctuation" />
</bygroups>
</rule>
<rule pattern="(abstract|endpoint|entrypoint|lazy|unique)(\s+)">
<bygroups>
<token type="KeywordDeclaration" />
<token type="TextWhitespace" />
</bygroups>
</rule>
<rule pattern="(rule)(\s+)">
<bygroups>
<token type="KeywordNamespace" />
<token type="TextWhitespace" />
</bygroups>
</rule>
<rule pattern="(helper)(\s+)">
<bygroups>
<token type="KeywordNamespace" />
<token type="TextWhitespace" />
</bygroups>
</rule>
<rule pattern="(context)(\s+)">
<bygroups>
<token type="KeywordNamespace" />
<token type="TextWhitespace" />
</bygroups>
</rule>
<rule pattern="(def)(\s*)(:)(\s*)">
<bygroups>
<token type="KeywordNamespace" />
<token type="TextWhitespace" />
<token type="Punctuation" />
<token type="TextWhitespace" />
</bygroups>
</rule>
<rule pattern="(Bag|Boolean|Integer|OrderedSet|Real|Sequence|Set|String|Tuple)">
<token type="KeywordType" />
</rule>
<rule pattern="(\w+)(\s*)(&lt;-|&lt;:=)">
<bygroups>
<token type="NameNamespace" />
<token type="TextWhitespace" />
<token type="Punctuation" />
</bygroups>
</rule>
<rule pattern="#&quot;">
<token type="KeywordConstant" />
<push state="quotedenumliteral" />
</rule>
<rule pattern="&quot;">
<token type="NameNamespace" />
<push state="quotedname" />
</rule>
<rule pattern="[^\S\n]+">
<token type="TextWhitespace" />
</rule>
<rule pattern="&#x27;">
<token type="LiteralString" />
<push state="string" />
</rule>
<rule
pattern="[0-9]*\.[0-9]+">
<token type="LiteralNumberFloat" />
</rule>
<rule pattern="0|[1-9][0-9]*">
<token type="LiteralNumberInteger" />
</rule>
<rule pattern="[*&lt;&gt;+=/-]">
<token type="Operator" />
</rule>
<rule pattern="([{}();:.,!|]|-&gt;)">
<token type="Punctuation" />
</rule>
<rule pattern="\n">
<token type="TextWhitespace" />
</rule>
<rule pattern="\w+">
<token type="NameNamespace" />
</rule>
</state>
<state name="string">
<rule pattern="[^\\&#x27;]+">
<token type="LiteralString" />
</rule>
<rule pattern="\\\\">
<token type="LiteralString" />
</rule>
<rule pattern="\\&#x27;">
<token type="LiteralString" />
</rule>
<rule pattern="\\">
<token type="LiteralString" />
</rule>
<rule pattern="&#x27;">
<token type="LiteralString" />
<pop depth="1" />
</rule>
</state>
<state name="quotedname">
<rule pattern="[^\\&quot;]+">
<token type="NameNamespace" />
</rule>
<rule pattern="\\\\">
<token type="NameNamespace" />
</rule>
<rule pattern="\\&quot;">
<token type="NameNamespace" />
</rule>
<rule pattern="\\">
<token type="NameNamespace" />
</rule>
<rule pattern="&quot;">
<token type="NameNamespace" />
<pop depth="1" />
</rule>
</state>
<state name="quotedenumliteral">
<rule pattern="[^\\&quot;]+">
<token type="KeywordConstant" />
</rule>
<rule pattern="\\\\">
<token type="KeywordConstant" />
</rule>
<rule pattern="\\&quot;">
<token type="KeywordConstant" />
</rule>
<rule pattern="\\">
<token type="KeywordConstant" />
</rule>
<rule pattern="&quot;">
<token type="KeywordConstant" />
<pop depth="1" />
</rule>
</state>
</rules>
</lexer>

View File

@@ -12,6 +12,7 @@
<filename>*.ebuild</filename>
<filename>*.eclass</filename>
<filename>.env</filename>
<filename>.env.*</filename>
<filename>*.env</filename>
<filename>*.exheres-0</filename>
<filename>*.exlib</filename>
@@ -23,6 +24,7 @@
<filename>bash_*</filename>
<filename>zshrc</filename>
<filename>.zshrc</filename>
<filename>APKBUILD</filename>
<filename>PKGBUILD</filename>
<mime_type>application/x-sh</mime_type>
<mime_type>application/x-shellscript</mime_type>
@@ -217,4 +219,4 @@
</rule>
</state>
</rules>
</lexer>
</lexer>

View File

@@ -0,0 +1,120 @@
<lexer>
<config>
<name>Beef</name>
<alias>beef</alias>
<filename>*.bf</filename>
<mime_type>text/x-beef</mime_type>
<dot_all>true</dot_all>
<ensure_nl>true</ensure_nl>
</config>
<rules>
<state name="root">
<rule pattern="^\s*\[.*?\]">
<token type="NameAttribute"/>
</rule>
<rule pattern="[^\S\n]+">
<token type="Text"/>
</rule>
<rule pattern="\\\n">
<token type="Text"/>
</rule>
<rule pattern="///[^\n\r]*">
<token type="CommentSpecial"/>
</rule>
<rule pattern="//[^\n\r]*">
<token type="CommentSingle"/>
</rule>
<rule pattern="/[*].*?[*]/">
<token type="CommentMultiline"/>
</rule>
<rule pattern="\n">
<token type="Text"/>
</rule>
<rule pattern="[~!%^&amp;*()+=|\[\]:;,.&lt;&gt;/?-]">
<token type="Punctuation"/>
</rule>
<rule pattern="[{}]">
<token type="Punctuation"/>
</rule>
<rule pattern="@&#34;(&#34;&#34;|[^&#34;])*&#34;">
<token type="LiteralString"/>
</rule>
<rule pattern="\$@?&#34;(&#34;&#34;|[^&#34;])*&#34;">
<token type="LiteralString"/>
</rule>
<rule pattern="&#34;(\\\\|\\&#34;|[^&#34;\n])*[&#34;\n]">
<token type="LiteralString"/>
</rule>
<rule pattern="&#39;\\.&#39;|&#39;[^\\]&#39;">
<token type="LiteralStringChar"/>
</rule>
<rule pattern="0[xX][0-9a-fA-F]+[Ll]?|\d[_\d]*(\.\d*)?([eE][+-]?\d+)?[flFLdD]?">
<token type="LiteralNumber"/>
</rule>
<rule pattern="#[ \t]*(if|endif|else|elif|define|undef|line|error|warning|region|endregion|pragma|nullable)\b">
<token type="CommentPreproc"/>
</rule>
<rule pattern="\b(extern)(\s+)(alias)\b">
<bygroups>
<token type="Keyword"/>
<token type="Text"/>
<token type="Keyword"/>
</bygroups>
</rule>
<rule pattern="(as|await|base|break|by|case|catch|checked|continue|default|delegate|else|event|finally|fixed|for|repeat|goto|if|in|init|is|let|lock|new|scope|on|out|params|readonly|ref|return|sizeof|stackalloc|switch|this|throw|try|typeof|unchecked|virtual|void|while|get|set|new|yield|add|remove|value|alias|ascending|descending|from|group|into|orderby|select|thenby|where|join|equals)\b">
<token type="Keyword"/>
</rule>
<rule pattern="(global)(::)">
<bygroups>
<token type="Keyword"/>
<token type="Punctuation"/>
</bygroups>
</rule>
<rule pattern="(abstract|async|const|enum|explicit|extern|implicit|internal|operator|override|partial|extension|private|protected|public|static|sealed|unsafe|volatile)\b">
<token type="KeywordDeclaration"/>
</rule>
<rule pattern="(bool|byte|char8|char16|char32|decimal|double|float|int|int8|int16|int32|int64|long|object|sbyte|short|string|uint|uint8|uint16|uint32|uint64|uint|let|var)\b\??">
<token type="KeywordType"/>
</rule>
<rule pattern="(true|false|null)\b">
<token type="KeywordConstant"/>
</rule>
<rule pattern="(class|struct|record|interface)(\s+)">
<bygroups>
<token type="Keyword"/>
<token type="Text"/>
</bygroups>
<push state="class"/>
</rule>
<rule pattern="(namespace|using)(\s+)">
<bygroups>
<token type="Keyword"/>
<token type="Text"/>
</bygroups>
<push state="namespace"/>
</rule>
<rule pattern="@?[_a-zA-Z]\w*">
<token type="Name"/>
</rule>
</state>
<state name="class">
<rule pattern="@?[_a-zA-Z]\w*">
<token type="NameClass"/>
<pop depth="1"/>
</rule>
<rule>
<pop depth="1"/>
</rule>
</state>
<state name="namespace">
<rule pattern="(?=\()">
<token type="Text"/>
<pop depth="1"/>
</rule>
<rule pattern="(@?[_a-zA-Z]\w*|\.)+">
<token type="NameNamespace"/>
<pop depth="1"/>
</rule>
</state>
</rules>
</lexer>

View File

@@ -19,10 +19,10 @@
<rule pattern="\\\n">
<token type="Text"/>
</rule>
<rule pattern="///[^\n\r]+">
<rule pattern="///[^\n\r]*">
<token type="CommentSpecial"/>
</rule>
<rule pattern="//[^\n\r]+">
<rule pattern="//[^\n\r]*">
<token type="CommentSingle"/>
</rule>
<rule pattern="/[*].*?[*]/">

View File

@@ -0,0 +1,374 @@
<lexer>
<config>
<name>C3</name>
<alias>c3</alias>
<filename>*.c3</filename>
<filename>*.c3i</filename>
<filename>*.c3t</filename>
<dot_all>true</dot_all>
</config>
<rules>
<state name="vector">
<rule pattern="&#62;\]">
<token type="Punctuation" />
<pop depth="1" />
</rule>
<rule pattern="&#34;(\\\\|\\&#34;|[^&#34;])*&#34;">
<token type="LiteralStringDouble" />
</rule>
<rule pattern="&#39;(\\\\|\\&#39;|[^&#39;])*&#39;">
<token type="LiteralStringChar" />
</rule>
<rule pattern="`(\\\\|\\`|[^`])*`">
<token type="LiteralStringDouble" />
</rule>
<rule pattern="[+-]?(?:0(?:[xX][0-9a-fA-F](?:_*[0-9a-fA-F])*|[oO][0-7](?:_*[0-7])*|[bB][10](?:_*[10])*)|[0-9](?:_*[0-9])*(?:_*[eE][+-]?[0-9]+)?)(?:[iIuU](?:8|16|32|64|128)?|[fF](?:32|64)?|[uU][lL])?">
<token type="LiteralNumber" />
</rule>
<rule pattern="\*">
<token type="LiteralNumber" />
</rule>
<rule pattern="[$]{2}(C_INT_SIZE|C_SHORT_SIZE|C_LONG_SIZE|C_LONG_LONG_SIZE|C_CHAR_IS_SIGNED|JMP_BUF_SIZE|BUILD_HASH|BUILD_DATE|OS_TYPE|ARCH_TYPE|MAX_VECTOR_SIZE|REGISTER_SIZE |REGISTER_SIZE |COMPILER_LIBC_AVAILABLE|COMPILER_LIBC_AVAILABLE|COMPILER_OPT_LEVEL|PLATFORM_BIG_ENDIAN|PLATFORM_I128_SUPPORTED|PLATFORM_F16_SUPPORTED|PLATFORM_F128_SUPPORTED|REGISTER_SIZE|COMPILER_SAFE_MODE|DEBUG_SYMBOLS|BACKTRACE|LLVM_VERSION|BENCHMARKING|TESTING|PANIC_MSG|MEMORY_ENVIRONMENT|ADDRESS_SANITIZER|MEMORY_SANITIZER|THREAD_SANITIZER|LANGUAGE_DEV_VERSION|AUTHORS|AUTHOR_EMAILS|PROJECT_VERSION)">
<token type="NameBuiltin" />
</rule>
<rule pattern="(\$alignof|\$assert|\$assignable|\$case|\$default|\$defined|\$echo|\$else|\$embed|\$endforeach|\$endfor|\$endif|\$endswitch|\$eval|\$evaltype|\$error|\$exec|\$extnameof|\$feature|\$foreach|\$for|\$if|\$include|\$is_const|\$nameof|\$offsetof|\$qnameof|\$sizeof|\$stringify|\$switch|\$typefrom|\$typeof|\$vacount|\$vatype|\$vaconst|\$vaarg|\$vaexpr|\$vasplat|alias|assert|asm|attrdef|bitstruct|break|case|catch|continue|default|defer|do|else|enum|extern|false|faultdef|foreach_r|foreach|for|fn|tlocal|if|inline|import|macro|module|nextcase|null|interface|return|static|struct|switch|true|try|typedef|union|while)(?!\w)">
<token type="Keyword" />
</rule>
<rule pattern="[$#@]*[_a-z][a-z0-9A-Z_]*">
<token type="NameOther" />
</rule>
<rule pattern="([$@]?(?:_)?[A-Z][a-z0-9A-Z_]*)(\s*)(\?)?">
<bygroups>
<token type="NameClass" />
<token type="Text" />
<token type="NameClass" />
</bygroups>
</rule>
<rule pattern="[$]?(_)?[A-Z][0-9A-Z_]*">
<token type="NameConstant" />
</rule>
<rule pattern="\[&#60;">
<token type="Punctuation" />
<push state="vector" />
</rule>
<rule pattern="\[">
<token type="Punctuation" />
<push state="index" />
</rule>
<rule pattern="(--|&#61;&#62;|&#62;&#61;|&#60;&#61;|(\||&amp;|\+){1,3}|\?:|\?\?|\.\.)|[:?&#61;&#60;&#62;%/\-\^!~]">
<token type="Operator" />
</rule>
<rule pattern="[(){},;.!]">
<token type="Punctuation" />
</rule>
<rule pattern="\s+">
<token type="Text" />
</rule>
</state>
<state name="index">
<rule pattern="\]">
<token type="Punctuation" />
<pop depth="1" />
</rule>
<rule pattern="&#34;(\\\\|\\&#34;|[^&#34;])*&#34;">
<token type="LiteralStringDouble" />
</rule>
<rule pattern="&#39;(\\\\|\\&#39;|[^&#39;])*&#39;">
<token type="LiteralStringChar" />
</rule>
<rule pattern="`(\\\\|\\`|[^`])*`">
<token type="LiteralStringDouble" />
</rule>
<rule pattern="[+-]?(?:0(?:[xX][0-9a-fA-F](?:_*[0-9a-fA-F])*|[oO][0-7](?:_*[0-7])*|[bB][10](?:_*[10])*)|[0-9](?:_*[0-9])*(?:_*[eE][+-]?[0-9]+)?)(?:[iIuU](?:8|16|32|64|128)?|[fF](?:32|64)?|[uU][lL])?">
<token type="LiteralNumber" />
</rule>
<rule pattern="\*">
<token type="LiteralNumber" />
</rule>
<rule pattern="[$]{2}(C_INT_SIZE|C_SHORT_SIZE|C_LONG_SIZE|C_LONG_LONG_SIZE|C_CHAR_IS_SIGNED|JMP_BUF_SIZE|BUILD_HASH|BUILD_DATE|OS_TYPE|ARCH_TYPE|MAX_VECTOR_SIZE|REGISTER_SIZE |REGISTER_SIZE |COMPILER_LIBC_AVAILABLE|COMPILER_LIBC_AVAILABLE|COMPILER_OPT_LEVEL|PLATFORM_BIG_ENDIAN|PLATFORM_I128_SUPPORTED|PLATFORM_F16_SUPPORTED|PLATFORM_F128_SUPPORTED|REGISTER_SIZE|COMPILER_SAFE_MODE|DEBUG_SYMBOLS|BACKTRACE|LLVM_VERSION|BENCHMARKING|TESTING|PANIC_MSG|MEMORY_ENVIRONMENT|ADDRESS_SANITIZER|MEMORY_SANITIZER|THREAD_SANITIZER|LANGUAGE_DEV_VERSION|AUTHORS|AUTHOR_EMAILS|PROJECT_VERSION)">
<token type="NameBuiltin" />
</rule>
<rule pattern="(\$alignof|\$assert|\$assignable|\$case|\$default|\$defined|\$echo|\$else|\$embed|\$endforeach|\$endfor|\$endif|\$endswitch|\$eval|\$evaltype|\$error|\$exec|\$extnameof|\$feature|\$foreach|\$for|\$if|\$include|\$is_const|\$nameof|\$offsetof|\$qnameof|\$sizeof|\$stringify|\$switch|\$typefrom|\$typeof|\$vacount|\$vatype|\$vaconst|\$vaarg|\$vaexpr|\$vasplat|alias|assert|asm|attrdef|bitstruct|break|case|catch|continue|default|defer|do|else|enum|extern|false|faultdef|foreach_r|foreach|for|fn|tlocal|if|inline|import|macro|module|nextcase|null|interface|return|static|struct|switch|true|try|typedef|union|while)(?!\w)">
<token type="Keyword" />
</rule>
<rule pattern="[$#@]*[_a-z][a-z0-9A-Z_]*">
<token type="NameOther" />
</rule>
<rule pattern="([$@]?(?:_)?[A-Z][a-z0-9A-Z_]*)(\s*)(\?)?">
<bygroups>
<token type="NameClass" />
<token type="Text" />
<token type="NameClass" />
</bygroups>
</rule>
<rule pattern="[$]?(_)?[A-Z][0-9A-Z_]*">
<token type="NameConstant" />
</rule>
<rule pattern="\[&#60;">
<token type="Punctuation" />
<push state="vector" />
</rule>
<rule pattern="\[">
<token type="Punctuation" />
<push state="index" />
</rule>
<rule pattern="(--|&#61;&#62;|&#62;&#61;|&#60;&#61;|(\||&amp;|\+){1,3}|\?:|\?\?|\.\.)|[:?&#61;&#60;&#62;%/\-\^!~]">
<token type="Operator" />
</rule>
<rule pattern="[(){},;.!]">
<token type="Punctuation" />
</rule>
<rule pattern="\s+">
<token type="Text" />
</rule>
</state>
<state name="function_type">
<rule pattern="void|bool|char|double|float|float16|bfloat|int128|ichar|int|iptr|isz|long|short|uint128|uint|ulong|uptr|ushort|usz|float128|any|fault|typeid">
<token type="NameBuiltin" />
</rule>
<rule pattern="\[&#60;">
<token type="Punctuation" />
<push state="vector" />
</rule>
<rule pattern="\[">
<token type="Punctuation" />
<push state="index" />
</rule>
<rule pattern="\s*\(">
<token type="Punctuation" />
<pop depth="1" />
</rule>
<rule pattern="\.">
<token type="Punctuation" />
</rule>
<rule pattern="\s*(\*)">
<token type="Operator" />
</rule>
<rule pattern="[$@]?(_)?[A-Z][a-zA-Z_0-9]*">
<token type="NameClass" />
</rule>
<rule pattern="\s*\?">
<token type="NameClass" />
</rule>
<rule pattern="\s+">
<token type="Text" />
<push state="function_name" />
</rule>
<rule pattern="[@]?[_a-z][a-zA-Z_0-9]*">
<token type="NameFunction" />
<pop depth="1" />
</rule>
<rule pattern="[$]?[_a-z][a-zA-Z_0-9]*">
<token type="Keyword" />
<pop depth="1" />
</rule>
</state>
<state name="function_name">
<rule pattern="(void|bool|char|double|float|float16|bfloat|int128|ichar|int|iptr|isz|long|short|uint128|uint|ulong|uptr|ushort|usz|float128|any|fault|typeid)(?![a-zA-Z_0-9])">
<token type="NameBuiltin" />
</rule>
<rule pattern="[@]?[_a-z][a-zA-Z_0-9]*">
<token type="NameFunction" />
<pop depth="2" />
</rule>
<rule pattern="([$@]?(?:_)?[A-Z][a-zA-Z_0-9]*)">
<token type="NameClass" />
</rule>
<rule pattern="\.|\s*(\*)">
<token type="Punctuation" />
</rule>
<rule pattern="\[&#60;">
<token type="Punctuation" />
<push state="vector" />
</rule>
<rule pattern="\[">
<token type="Punctuation" />
<push state="index" />
</rule>
<rule pattern="\(">
<token type="Punctuation" />
<pop depth="1" />
</rule>
</state>
<state name="path_segment">
<rule pattern="[_a-z][a-z0-9_]*">
<token type="NameNamespace" />
</rule>
<rule pattern="(::|,)">
<token type="Punctuation" />
</rule>
<rule pattern="&#34;(\\\\|\\&#34;|[^&#34;])*&#34;">
<token type="LiteralStringDouble" />
</rule>
<rule pattern="&#39;(\\\\|\\&#39;|[^&#39;])*&#39;">
<token type="LiteralStringChar" />
</rule>
<rule pattern="`(\\\\|\\`|[^`])*`">
<token type="LiteralStringDouble" />
</rule>
<rule pattern="(\s*)(\{)(\s*)([$@]?(?:_)?[A-Z][a-zA-Z_0-9]*)(?:(\s*)(,)(\s*)([$@]?(?:_)?[A-Z][a-zA-Z_0-9]*))*(\s*)(\})">
<bygroups>
<token type="Text" />
<token type="Punctuation" />
<token type="Text" />
<token type="NameClass" />
<token type="Text" />
<token type="Punctuation" />
<token type="Text" />
<token type="NameClass" />
<token type="Text" />
<token type="Punctuation" />
</bygroups>
</rule>
<rule pattern="@align|@benchmark|@bigendian|@builtin|@callconv|@compact|@const|@deprecated|@dynamic|@export|@extern|@finalizer|@format|@if|@inline|@init|@link|@littleendian|@local|@maydiscard|@naked|@noalias|@nodiscard|@noinit|@noinline|@nopadding|@norecurse|@noreturn|@nosanitize|@nostrip|@obfuscate|@operator|@operator_r|@operator_s|@optional|@overlap|@packed|@private|@public|@pure|@reflect|@safemacro|@section|@tag|@test|@unused|@used|@wasm|@weak|@winmain">
<token type="NameAttribute" />
</rule>
<rule pattern="(([\^&amp;|+\-*/%=!]|(&#60;|&#62;){2})=|--|&#61;&#62;|&#62;&#61;|&#60;&#61;|(\||&amp;|\+){1,3}|\?:|\?\?)|[?&#61;&#60;&#62;%/\-\^*!~]">
<token type="Operator" />
</rule>
<rule pattern="[(){}[\],*:.!]">
<token type="Punctuation" />
</rule>
<rule pattern="(\$alignof|\$assert|\$assignable|\$case|\$default|\$defined|\$echo|\$else|\$embed|\$endforeach|\$endfor|\$endif|\$endswitch|\$eval|\$evaltype|\$error|\$exec|\$extnameof|\$feature|\$foreach|\$for|\$if|\$include|\$is_const|\$nameof|\$offsetof|\$qnameof|\$sizeof|\$stringify|\$switch|\$typefrom|\$typeof|\$vacount|\$vatype|\$vaconst|\$vaarg|\$vaexpr|\$vasplat|alias|assert|asm|attrdef|bitstruct|break|case|catch|continue|default|defer|do|else|enum|extern|false|faultdef|foreach_r|foreach|for|fn|tlocal|if|inline|import|macro|module|nextcase|null|interface|return|static|struct|switch|true|try|typedef|union|while)(?!\w)">
<token type="Keyword" />
</rule>
<rule pattern="([$#@]*[_a-z][a-z0-9A-Z_]*)(\s*)(\()">
<bygroups>
<token type="NameFunction" />
<token type="Text" />
<token type="Punctuation" />
</bygroups>
</rule>
<rule pattern="[$#@]*[_a-z][a-z0-9A-Z_]*">
<token type="NameOther" />
</rule>
<rule pattern="([$@]?(?:_)?[A-Z][a-z0-9A-Z_]*)(\s*)(\?)?">
<bygroups>
<token type="NameClass" />
<token type="Text" />
<token type="NameClass" />
</bygroups>
</rule>
<rule pattern="[$]?(_)?[A-Z][0-9A-Z_]*">
<token type="NameConstant" />
</rule>
<rule pattern="\[&#60;">
<token type="Punctuation" />
<push state="vector" />
</rule>
<rule pattern="[;]">
<token type="Punctuation" />
<pop depth="1" />
</rule>
<rule pattern="\s+">
<token type="Text" />
</rule>
</state>
<state name="root">
<rule pattern="//.*?\n">
<token type="CommentSingle"/>
</rule>
<rule pattern="/\*.*?\*/">
<token type="CommentMultiline"/>
</rule>
<rule pattern="&#60;\*.*?\*&#62;">
<token type="CommentMultiline"/>
</rule>
<rule pattern="(module|import)(\s+)">
<bygroups>
<token type="Keyword" />
<token type="Text" />
</bygroups>
<push state="path_segment" />
</rule>
<rule pattern="(extern)?(fn|macro)(\s+)">
<bygroups>
<token type="Keyword" />
<token type="Keyword" />
<token type="Text" />
</bygroups>
<push state="function_type" />
</rule>
<rule pattern="[$]{2}(C_INT_SIZE|C_SHORT_SIZE|C_LONG_SIZE|C_LONG_LONG_SIZE|C_CHAR_IS_SIGNED|JMP_BUF_SIZE|BUILD_HASH|BUILD_DATE|OS_TYPE|ARCH_TYPE|MAX_VECTOR_SIZE|REGISTER_SIZE |REGISTER_SIZE |COMPILER_LIBC_AVAILABLE|COMPILER_LIBC_AVAILABLE|COMPILER_OPT_LEVEL|PLATFORM_BIG_ENDIAN|PLATFORM_I128_SUPPORTED|PLATFORM_F16_SUPPORTED|PLATFORM_F128_SUPPORTED|REGISTER_SIZE|COMPILER_SAFE_MODE|DEBUG_SYMBOLS|BACKTRACE|LLVM_VERSION|BENCHMARKING|TESTING|PANIC_MSG|MEMORY_ENVIRONMENT|ADDRESS_SANITIZER|MEMORY_SANITIZER|THREAD_SANITIZER|LANGUAGE_DEV_VERSION|AUTHORS|AUTHOR_EMAILS|PROJECT_VERSION)">
<token type="NameBuiltin" />
</rule>
<rule pattern="(void|bool|char|double|float|float16|bfloat|int128|ichar|int|iptr|isz|long|short|uint128|uint|ulong|uptr|ushort|usz|float128|any|fault|typeid)(\s*)(\?)?">
<bygroups>
<token type="NameBuiltin" />
<token type="Text" />
<token type="NameClass" />
</bygroups>
</rule>
<rule pattern="(\$alignof|\$assert|\$assignable|\$case|\$default|\$defined|\$echo|\$else|\$embed|\$endforeach|\$endfor|\$endif|\$endswitch|\$eval|\$evaltype|\$error|\$exec|\$extnameof|\$feature|\$foreach|\$for|\$if|\$include|\$is_const|\$nameof|\$offsetof|\$qnameof|\$sizeof|\$stringify|\$switch|\$typefrom|\$typeof|\$vacount|\$vatype|\$vaconst|\$vaarg|\$vaexpr|\$vasplat|alias|assert|asm|attrdef|bitstruct|break|case|catch|continue|default|defer|do|else|enum|extern|false|faultdef|foreach_r|foreach|for|fn|tlocal|if|inline|import|macro|module|nextcase|null|interface|return|static|struct|switch|true|try|typedef|union|while)(?!\w)">
<token type="Keyword" />
</rule>
<rule pattern="var|const">
<token type="KeywordDeclaration" />
</rule>
<rule pattern="\A#! ?/.*?\n">
<token type="CommentHashbang" />
</rule>
<rule pattern="&#34;(\\\\|\\&#34;|[^&#34;])*&#34;">
<token type="LiteralStringDouble" />
</rule>
<rule pattern="&#39;(\\\\|\\&#39;|[^&#39;])*&#39;">
<token type="LiteralStringChar" />
</rule>
<rule pattern="`(\\\\|\\`|[^`])*`">
<token type="LiteralStringDouble" />
</rule>
<rule pattern="([_a-z][a-z0-9_]*)(::)">
<bygroups>
<token type="NameNamespace" />
<token type="Punctuation" />
</bygroups>
</rule>
<rule pattern="[+-]?(?:0(?:[xX][0-9a-fA-F](?:_*[0-9a-fA-F])*|[oO][0-7](?:_*[0-7])*|[bB][10](?:_*[10])*)|[0-9](?:_*[0-9])*(?:_*[eE][+-]?[0-9]+)?)(?:[iIuU](?:8|16|32|64|128)?|[fF](?:32|64)?|[uU][lL])?">
<token type="LiteralNumber" />
</rule>
<rule pattern="@align|@benchmark|@bigendian|@builtin|@callconv|@compact|@const|@deprecated|@dynamic|@export|@extern|@finalizer|@format|@if|@inline|@init|@link|@littleendian|@local|@maydiscard|@naked|@noalias|@nodiscard|@noinit|@noinline|@nopadding|@norecurse|@noreturn|@nosanitize|@nostrip|@obfuscate|@operator|@operator_r|@operator_s|@optional|@overlap|@packed|@private|@public|@pure|@reflect|@safemacro|@section|@tag|@test|@unused|@used|@wasm|@weak|@winmain">
<token type="NameAttribute" />
</rule>
<rule pattern="\$\$abs|\$\$any_make|\$\$atomic_load|\$\$atomic_store|\$\$atomic_fetch_exchange|\$\$atomic_fetch_add|\$\$atomic_fetch_sub|\$\$atomic_fetch_and|\$\$atomic_fetch_nand|\$\$atomic_fetch_or|\$\$atomic_fetch_xor|\$\$atomic_fetch_max|\$\$atomic_fetch_min|\$\$atomic_fetch_inc_wrap|\$\$atomic_fetch_dec_wrap|\$\$bitreverse|\$\$breakpoint|\$\$bswap|\$\$ceil|\$\$compare_exchange|\$\$copysign|\$\$cos|\$\$clz|\$\$ctz|\$\$add|\$\$div|\$\$mod|\$\$mul|\$\$neg|\$\$sub|\$\$exp|\$\$exp2|\$\$expect|\$\$expect_with_probability|\$\$floor|\$\$fma|\$\$fmuladd|\$\$frameaddress|\$\$fshl|\$\$fshr|\$\$gather|\$\$get_rounding_mode|\$\$log|\$\$log10|\$\$log2|\$\$masked_load|\$\$masked_store|\$\$max|\$\$memcpy|\$\$memcpy_inline|\$\$memmove|\$\$memset|\$\$memset_inline|\$\$min|\$\$nearbyint|\$\$overflow_add|\$\$overflow_mul|\$\$overflow_sub|\$\$popcount|\$\$pow|\$\$pow_int|\$\$prefetch|\$\$reduce_add|\$\$reduce_and|\$\$reduce_fadd|\$\$reduce_fmul|\$\$reduce_max|\$\$reduce_min|\$\$reduce_mul|\$\$reduce_or|\$\$reduce_xor|\$\$reverse|\$\$returnaddress|\$\$rint|\$\$round|\$\$roundeven|\$\$sat_add|\$\$sat_shl|\$\$sat_sub|\$\$scatter|\$\$select|\$\$set_rounding_mode|\$\$str_hash|\$\$str_upper|\$\$str_lower|\$\$str_find|\$\$swizzle|\$\$swizzle2|\$\$sin|\$\$sqrt|\$\$syscall|\$\$sysclock|\$\$trap|\$\$trunc|\$\$unaligned_load|\$\$unaligned_store|\$\$unreachable|\$\$veccomplt|\$\$veccomple|\$\$veccompgt|\$\$veccompge|\$\$veccompeq|\$\$veccompne|\$\$volatile_load|\$\$volatile_store|\$\$wasm_memory_size|\$\$wasm_memory_grow|\$\$wstr16|\$\$wstr32|\$\$DATE|\$\$FILE|\$\$FILEPATH|\$\$FUNC|\$\$FUNCTION|\$\$LINE|\$\$LINE_RAW|\$\$MODULE|\$\$BENCHMARK_NAMES|\$\$BENCHMARK_FNS|\$\$TEST_NAMES|\$\$TEST_FNS|\$\$TIME">
<token type="NameBuiltin" />
</rule>
<rule pattern="([$#@]*[_a-z][a-z0-9A-Z_]*)(\s*)(\()">
<bygroups>
<token type="NameFunction" />
<token type="Text" />
<token type="Punctuation" />
</bygroups>
</rule>
<rule pattern="[$#@]*[_a-z][a-z0-9A-Z_]*">
<token type="NameOther" />
</rule>
<rule pattern="([$@]?(?:_)?[A-Z][a-z0-9A-Z_]*)(\s*)(\?)?">
<bygroups>
<token type="NameClass" />
<token type="Text" />
<token type="NameClass" />
</bygroups>
</rule>
<rule pattern="[$]?(_)?[A-Z][0-9A-Z_]*">
<token type="NameConstant" />
</rule>
<rule pattern="\[&#60;">
<token type="Punctuation" />
<push state="vector" />
</rule>
<rule pattern="\[">
<token type="Punctuation" />
<push state="index" />
</rule>
<rule pattern="(([\^&amp;|+\-*/%=!]|(&#60;|&#62;){2})=|--|&#61;&#62;|&#62;&#61;|&#60;&#61;|(\||&amp;|\+){1,3}|\?:|\?\?)|[?&#61;&#60;&#62;%/\-\^*!~]">
<token type="Operator" />
</rule>
<rule pattern="[(){},;*:.!]">
<token type="Punctuation" />
</rule>
<rule pattern="\s+">
<token type="Text" />
</rule>
</state>
</rules>
</lexer>

View File

@@ -0,0 +1,79 @@
<lexer>
<config>
<name>Core</name>
<alias>core</alias>
<filename>*.core</filename>
<mime_type>text/x-core</mime_type>
</config>
<rules>
<state name="root">
<rule pattern="\s+">
<token type="TextWhitespace"/>
</rule>
<rule pattern="//(.*?)\n">
<token type="CommentSingle"/>
</rule>
<rule pattern="(class|value|union|trait|impl|annotation)\b">
<token type="KeywordDeclaration"/>
</rule>
<rule pattern="(fun|let|var)\b">
<token type="KeywordDeclaration"/>
</rule>
<rule pattern="(mod|import)\b">
<token type="KeywordNamespace"/>
</rule>
<rule pattern="(if|else|is|for|in|while|return)\b">
<token type="Keyword"/>
</rule>
<rule pattern="(true|false|self)\b">
<token type="KeywordConstant"/>
</rule>
<rule pattern="0[b][01](_?[01])*(i32|i64|u8|f32|f64)?">
<token type="LiteralNumberBin"/>
</rule>
<rule pattern="0[x][\da-fA-F](_?[\dA-Fa-f])*(i32|i64|u8|f32|f64)?">
<token type="LiteralNumberHex"/>
</rule>
<rule pattern="\d(_?\d)*\.\d(_?\d)*([eE][-+]?\d(_?\d)*)?(f32|f64)?">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="\d(_?\d)*(i32|i64|u8|f32|f64)?">
<token type="LiteralNumberInteger"/>
</rule>
<rule pattern="&#34;">
<token type="LiteralString"/>
<push state="string"/>
</rule>
<rule pattern="@([a-z_]\w*[!?]?)">
<token type="NameAttribute"/>
</rule>
<rule pattern="===|!==|==|!=|&gt;=|&lt;=|[&gt;&lt;*/+-=&amp;|^]">
<token type="Operator"/>
</rule>
<rule pattern="[A-Z][A-Za-z0-9_]*">
<token type="NameClass"/>
</rule>
<rule pattern="([a-z_]\w*[!?]?)">
<token type="Name"/>
</rule>
<rule pattern="[(){}\[\],.;]">
<token type="Punctuation"/>
</rule>
</state>
<state name="string">
<rule pattern="&#34;">
<token type="LiteralString"/>
<pop depth="1"/>
</rule>
<rule pattern="\\[&#34;\\fnrt]|\\u\{[\da-fA-F]{1,6}\}">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="[^\\&#34;]+">
<token type="LiteralString"/>
</rule>
<rule pattern="\\">
<token type="LiteralString"/>
</rule>
</state>
</rules>
</lexer>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,53 @@
<!--
Lexer for RFC-4180 compliant CSV subject to the following additions:
- UTF-8 encoding is accepted (the RFC requires 7-bit ASCII)
- The line terminator character can be LF or CRLF (the RFC allows CRLF only)
Link to the RFC-4180 specification: https://tools.ietf.org/html/rfc4180
Additions inspired by:
https://github.com/frictionlessdata/datapackage/issues/204#issuecomment-193242077
Future improvements:
- Identify non-quoted numbers as LiteralNumber
- Identify y as an error in "x"y. Currently it's identified as another string
literal.
-->
<lexer>
<config>
<name>CSV</name>
<alias>csv</alias>
<filename>*.csv</filename>
<mime_type>text/csv</mime_type>
</config>
<rules>
<state name="root">
<rule pattern="\r?\n">
<token type="Punctuation" />
</rule>
<rule pattern=",">
<token type="Punctuation" />
</rule>
<rule pattern="&quot;">
<token type="LiteralStringDouble" />
<push state="escaped" />
</rule>
<rule pattern="[^\r\n,]+">
<token type="LiteralString" />
</rule>
</state>
<state name="escaped">
<rule pattern="&quot;&quot;">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="&quot;">
<token type="LiteralStringDouble" />
<pop depth="1"/>
</rule>
<rule pattern="[^&quot;]+">
<token type="LiteralStringDouble" />
</rule>
</state>
</rules>
</lexer>

View File

@@ -49,7 +49,7 @@
<rule pattern="(true|false|null|_)\b">
<token type="KeywordConstant"/>
</rule>
<rule pattern="[_a-zA-Z]\w*">
<rule pattern="[@#]?[_a-zA-Z$]\w*">
<token type="Name"/>
</rule>
</state>

View File

@@ -15,10 +15,10 @@
<rule pattern="//.*?\n">
<token type="CommentSingle"/>
</rule>
<rule pattern="/\*.*?\*/">
<rule pattern="/\*[\s\S]*?\*/">
<token type="CommentMultiline"/>
</rule>
<rule pattern="/\+.*?\+/">
<rule pattern="/\+[\s\S]*?\+/">
<token type="CommentMultiline"/>
</rule>
<rule pattern="(asm|assert|body|break|case|cast|catch|continue|default|debug|delete|do|else|finally|for|foreach|foreach_reverse|goto|if|in|invariant|is|macro|mixin|new|out|pragma|return|super|switch|this|throw|try|typeid|typeof|version|while|with)\b">
@@ -130,4 +130,4 @@
</rule>
</state>
</rules>
</lexer>
</lexer>

View File

@@ -0,0 +1,17 @@
<lexer>
<config>
<name>Desktop file</name>
<alias>desktop</alias>
<alias>desktop_entry</alias>
<filename>*.desktop</filename>
<mime_type>application/x-desktop</mime_type>
</config>
<rules>
<state name="root">
<rule pattern="^[ \t]*\n"><token type="TextWhitespace"/></rule>
<rule pattern="^(#.*)(\n)"><bygroups><token type="CommentSingle"/><token type="TextWhitespace"/></bygroups></rule>
<rule pattern="(\[[^\]\n]+\])(\n)"><bygroups><token type="Keyword"/><token type="TextWhitespace"/></bygroups></rule>
<rule pattern="([-A-Za-z0-9]+)(\[[^\] \t=]+\])?([ \t]*)(=)([ \t]*)([^\n]*)([ \t\n]*\n)"><bygroups><token type="NameAttribute"/><token type="NameNamespace"/><token type="TextWhitespace"/><token type="Operator"/><token type="TextWhitespace"/><token type="LiteralString"/><token type="TextWhitespace"/></bygroups></rule>
</state>
</rules>
</lexer>

View File

@@ -0,0 +1,251 @@
<lexer>
<config>
<name>Devicetree</name>
<alias>devicetree</alias>
<alias>dts</alias>
<filename>*.dts</filename>
<filename>*.dtsi</filename>
<mime_type>text/x-devicetree</mime_type>
</config>
<rules>
<state name="whitespace">
<rule pattern="\n">
<token type="TextWhitespace" />
</rule>
<rule pattern="\s+">
<token type="TextWhitespace" />
</rule>
<rule pattern="\\\n">
<token type="Text" />
</rule>
<rule pattern="//(\n|[\w\W]*?[^\\]\n)">
<token type="CommentSingle" />
</rule>
<rule pattern="/(\\\n)?[*][\w\W]*?[*](\\\n)?/">
<token type="CommentMultiline" />
</rule>
</state>
<state name="macro">
<rule pattern="(#include)(\s*(?:/[*][^*/]*?[*]/\s*)*)([^\n]+)">
<bygroups>
<token type="CommentPreproc" />
<token type="CommentMultiline" />
<token type="CommentPreprocFile" />
</bygroups>
</rule>
<rule pattern="(#define)(\s*(?:/[*][^*/]*?[*]/\s*)*)([^\n]+)">
<bygroups>
<token type="CommentPreproc" />
<token type="CommentMultiline" />
<token type="CommentPreproc" />
</bygroups>
</rule>
<rule pattern="/dts-v1/">
<token type="CommentPreproc" />
</rule>
<rule pattern="/memreserve/">
<token type="CommentPreproc" />
</rule>
<rule pattern="/delete-node/">
<token type="CommentPreproc" />
</rule>
<rule pattern="/delete-property/">
<token type="CommentPreproc" />
</rule>
<rule pattern="(/include/)(\s*(?:/[*][^*/]*?[*]/\s*)*)(&quot;[^\n]+&quot;)">
<bygroups>
<token type="CommentPreproc" />
<token type="CommentMultiline" />
<token type="CommentPreprocFile" />
</bygroups>
</rule>
</state>
<state name="basic_statements">
<rule pattern="&amp;[a-zA-Z0-9_]+">
<token type="NameLabel" />
</rule>
<rule pattern="[a-zA-Z0-9_]+:">
<token type="NameLabel" />
</rule>
<rule pattern="(L?)(&quot;)">
<bygroups>
<token type="LiteralStringAffix" />
<token type="LiteralString" />
</bygroups>
<push state="string" />
</rule>
<rule pattern="0x[0-9a-fA-F]+">
<token type="LiteralNumberHex" />
</rule>
<rule pattern="\d+">
<token type="LiteralNumberInteger" />
</rule>
<rule pattern="status\b">
<token type="KeywordReserved" />
<push state="status_property" />
</rule>
<rule pattern="([~!%^&amp;*+=|?:&lt;&gt;/#-])">
<token type="Operator" />
</rule>
<rule pattern="[()\[\]{},.]">
<token type="Punctuation" />
</rule>
<rule
pattern="[a-zA-Z_][\w-]*(?=(?:\s*,\s*[a-zA-Z_][\w-]*|(?:\s*(?:/[*][^*/]*?[*]/\s*)*))*\s*[=;])">
<token type="NameAttribute" />
</rule>
<rule pattern="[a-zA-Z_][\w-]*">
<token type="Name" />
</rule>
</state>
<state name="status_property">
<rule>
<include state="whitespace" />
</rule>
<rule pattern="=">
<token type="Operator" />
</rule>
<rule pattern="&quot;okay&quot;">
<token type="LiteralString" />
<pop depth="1" />
</rule>
<rule pattern="&quot;disabled&quot;">
<token type="KeywordType" />
<pop depth="1" />
</rule>
<rule pattern="&quot;reserved&quot;">
<token type="NameDecorator" />
<pop depth="1" />
</rule>
<rule pattern="&quot;fail&quot;">
<token type="GenericError" />
<pop depth="1" />
</rule>
<rule pattern="&quot;fail-[^\&quot;]+&quot;">
<token type="GenericTraceback" />
<pop depth="1" />
</rule>
<rule pattern="&quot;">
<token type="LiteralString" />
<push state="string" />
</rule>
<rule pattern=";">
<pop depth="1" />
</rule>
</state>
<state name="root">
<rule>
<include state="whitespace" />
</rule>
<rule>
<include state="macro" />
</rule>
<rule pattern="([^/*@\s&amp;]+|/)(@?)((?:0x)?[0-9a-fA-F,]*)(\s*(?:/[*][^*/]*?[*]/\s*)*)(\{)">
<bygroups>
<token type="NameFunction" />
<token type="Operator" />
<token type="LiteralNumberInteger" />
<token type="CommentMultiline" />
<token type="Punctuation" />
</bygroups>
<push state="node" />
</rule>
<rule>
<push state="statement" />
</rule>
</state>
<state name="node">
<rule>
<include state="whitespace" />
</rule>
<rule>
<include state="macro" />
</rule>
<rule pattern="([^/*@\s&amp;]+|/)(@?)((?:0x)?[0-9a-fA-F,]*)(\s*(?:/[*][^*/]*?[*]/\s*)*)(\{)">
<bygroups>
<token type="NameFunction" />
<token type="Operator" />
<token type="LiteralNumberInteger" />
<token type="CommentMultiline" />
<token type="Punctuation" />
</bygroups>
<push />
</rule>
<rule pattern="([a-zA-Z0-9_]+)(\s*)(:)">
<bygroups>
<token type="NameLabel" />
<token type="Text" />
<token type="Punctuation" />
</bygroups>
</rule>
<rule pattern="\}">
<token type="Punctuation" />
<pop depth="1" />
</rule>
<rule>
<include state="basic_statements" />
</rule>
<rule pattern=";">
<token type="Punctuation" />
</rule>
</state>
<state name="statement">
<rule>
<include state="whitespace" />
</rule>
<rule pattern="([a-zA-Z0-9_]+)(\s*)(:)">
<bygroups>
<token type="NameLabel" />
<token type="Text" />
<token type="Punctuation" />
</bygroups>
<pop depth="1" />
</rule>
<rule>
<include state="basic_statements" />
</rule>
<rule pattern=";">
<token type="Punctuation" />
<pop depth="1" />
</rule>
</state>
<state name="string">
<rule pattern="&quot;">
<token type="LiteralString" />
<pop depth="1" />
</rule>
<rule
pattern="\\([\\abfnrtv&quot;\&#x27;]|x[a-fA-F0-9]{2,4}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})">
<token type="LiteralStringEscape" />
</rule>
<rule pattern="[^\\&quot;\n]+">
<token type="LiteralString" />
</rule>
<rule pattern="\\\n">
<token type="LiteralString" />
</rule>
<rule pattern="\\">
<token type="LiteralString" />
</rule>
</state>
</rules>
</lexer>

View File

@@ -3,55 +3,66 @@
<name>Docker</name>
<alias>docker</alias>
<alias>dockerfile</alias>
<alias>containerfile</alias>
<filename>Dockerfile</filename>
<filename>Dockerfile.*</filename>
<filename>*.Dockerfile</filename>
<filename>*.docker</filename>
<filename>Containerfile</filename>
<filename>Containerfile.*</filename>
<filename>*.Containerfile</filename>
<mime_type>text/x-dockerfile-config</mime_type>
<case_insensitive>true</case_insensitive>
</config>
<rules>
<state name="root">
<rule pattern="#.*">
<token type="Comment"/>
<token type="Comment" />
</rule>
<rule pattern="(ONBUILD)((?:\s*\\?\s*))">
<bygroups>
<token type="Keyword"/>
<using lexer="Bash"/>
<token type="Keyword" />
<using lexer="Bash" />
</bygroups>
</rule>
<rule pattern="(HEALTHCHECK)(((?:\s*\\?\s*)--\w+=\w+(?:\s*\\?\s*))*)">
<rule pattern="(HEALTHCHECK)((?:(?:\s*\\?\s*)--\w+=\w+(?:\s*\\?\s*))*)">
<bygroups>
<token type="Keyword"/>
<using lexer="Bash"/>
<token type="Keyword" />
<using lexer="Bash" />
</bygroups>
</rule>
<rule pattern="(VOLUME|ENTRYPOINT|CMD|SHELL)((?:\s*\\?\s*))(\[.*?\])">
<bygroups>
<token type="Keyword"/>
<using lexer="Bash"/>
<using lexer="JSON"/>
<token type="Keyword" />
<using lexer="Bash" />
<using lexer="JSON" />
</bygroups>
</rule>
<rule pattern="(LABEL|ENV|ARG)((?:(?:\s*\\?\s*)\w+=\w+(?:\s*\\?\s*))*)">
<bygroups>
<token type="Keyword"/>
<using lexer="Bash"/>
<token type="Keyword" />
<using lexer="Bash" />
</bygroups>
</rule>
<rule pattern="((?:FROM|MAINTAINER|EXPOSE|WORKDIR|USER|STOPSIGNAL)|VOLUME)\b(.*)">
<rule
pattern="((?:FROM|MAINTAINER|EXPOSE|WORKDIR|USER|STOPSIGNAL)|VOLUME)\b(\s)([\S]*)\b(?:(\s)(AS)\b(\s)([\S]*))?\b"
>
<bygroups>
<token type="Keyword"/>
<token type="LiteralString"/>
<token type="Keyword" />
<token type="TextWhitespace" />
<token type="LiteralString" />
<token type="TextWhitespace" />
<token type="Keyword" />
<token type="TextWhitespace" />
<token type="LiteralString" />
</bygroups>
</rule>
<rule pattern="((?:RUN|CMD|ENTRYPOINT|ENV|ARG|LABEL|ADD|COPY))">
<token type="Keyword"/>
<token type="Keyword" />
</rule>
<rule pattern="(.*\\\n)*.+">
<using lexer="Bash"/>
<using lexer="Bash" />
</rule>
</state>
</rules>
</lexer>
</lexer>

View File

@@ -0,0 +1,100 @@
<lexer>
<config>
<name>Gleam</name>
<alias>gleam</alias>
<filename>*.gleam</filename>
<mime_type>text/x-gleam</mime_type>
</config>
<rules>
<state name="root">
<rule pattern="\s+">
<token type="TextWhitespace"/>
</rule>
<rule pattern="///(.*?)\n">
<token type="LiteralStringDoc"/>
</rule>
<rule pattern="//(.*?)\n">
<token type="CommentSingle"/>
</rule>
<rule pattern="(as|assert|case|opaque|panic|pub|todo)\b">
<token type="Keyword"/>
</rule>
<rule pattern="(import|use)\b">
<token type="KeywordNamespace"/>
</rule>
<rule pattern="(auto|const|delegate|derive|echo|else|if|implement|macro|test)\b">
<token type="KeywordReserved"/>
</rule>
<rule pattern="(let)\b">
<token type="KeywordDeclaration"/>
</rule>
<rule pattern="(fn)\b">
<token type="Keyword"/>
</rule>
<rule pattern="(type)\b">
<token type="Keyword"/>
</rule>
<rule pattern="(True|False)\b">
<token type="KeywordConstant"/>
</rule>
<rule pattern="0[bB][01](_?[01])*">
<token type="LiteralNumberBin"/>
</rule>
<rule pattern="0[oO][0-7](_?[0-7])*">
<token type="LiteralNumberOct"/>
</rule>
<rule pattern="0[xX][\da-fA-F](_?[\dA-Fa-f])*">
<token type="LiteralNumberHex"/>
</rule>
<rule pattern="\d(_?\d)*\.\d(_?\d)*([eE][-+]?\d(_?\d)*)?">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="\d(_?\d)*">
<token type="LiteralNumberInteger"/>
</rule>
<rule pattern="&#34;">
<token type="LiteralString"/>
<push state="string"/>
</rule>
<rule pattern="@([a-z_]\w*[!?]?)">
<token type="NameAttribute"/>
</rule>
<rule pattern="[{}()\[\],]|[#(]|\.\.|&lt;&gt;|&lt;&lt;|&gt;&gt;">
<token type="Punctuation"/>
</rule>
<rule pattern=":|-&gt;">
<token type="Operator"/>
</rule>
<rule pattern="[+\-*/%!=&lt;&gt;&amp;|.]|&lt;-">
<token type="Operator"/>
</rule>
<rule pattern="([a-z_][A-Za-z0-9_]*)(\()">
<bygroups>
<token type="NameFunction"/>
<token type="Punctuation"/>
</bygroups>
</rule>
<rule pattern="[A-Z][A-Za-z0-9_]*">
<token type="NameClass"/>
</rule>
<rule pattern="([a-z_]\w*[!?]?)">
<token type="Name"/>
</rule>
</state>
<state name="string">
<rule pattern="&#34;">
<token type="LiteralString"/>
<pop depth="1"/>
</rule>
<rule pattern="\\[&#34;\\fnrt]|\\u\{[\da-fA-F]{1,6}\}">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="[^\\&#34;]+">
<token type="LiteralString"/>
</rule>
<rule pattern="\\">
<token type="LiteralString"/>
</rule>
</state>
</rules>
</lexer>

View File

@@ -84,7 +84,7 @@
<token type="Punctuation" />
</bygroups>
</rule>
<rule pattern="(str|size|rune|bool|int|uint|uintptr|u8|u16|u32|u64|i8|i16|i32|i64|f32|f64|null|void|nullable|valist|opaque|never)\b">
<rule pattern="(str|size|rune|bool|int|uint|uintptr|u8|u16|u32|u64|i8|i16|i32|i64|f32|f64|null|void|done|nullable|valist|opaque|never)\b">
<token type="KeywordType"/>
</rule>
<rule pattern="(true|false)\b">

View File

@@ -86,7 +86,7 @@
<rule pattern="\\(?![:!#$%&amp;*+.\\/&lt;=&gt;?@^|~-]+)">
<token type="NameFunction"/>
</rule>
<rule pattern="(&lt;-|::|-&gt;|=&gt;|=)(?![:!#$%&amp;*+.\\/&lt;=&gt;?@^|~-]+)">
<rule pattern="(&lt;-|::|-&gt;|=&gt;|=|'([:!#$%&amp;*+.\\/&lt;=&gt;?@^|~-]+))(?![:!#$%&amp;*+.\\/&lt;=&gt;?@^|~-]+)">
<token type="OperatorWord"/>
</rule>
<rule pattern=":[:!#$%&amp;*+.\\/&lt;=&gt;?@^|~-]*">
@@ -95,19 +95,22 @@
<rule pattern="[:!#$%&amp;*+.\\/&lt;=&gt;?@^|~-]+">
<token type="Operator"/>
</rule>
<rule pattern="\d+[eE][+-]?\d+">
<rule pattern="\d+_*[eE][+-]?\d+">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="\d+\.\d+([eE][+-]?\d+)?">
<rule pattern="\d+(_+[\d]+)*\.\d+(_+[\d]+)*([eE][+-]?\d+)?">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="0[oO][0-7]+">
<rule pattern="0[oO](_*[0-7])+">
<token type="LiteralNumberOct"/>
</rule>
<rule pattern="0[xX][\da-fA-F]+">
<rule pattern="0[xX](_*[\da-fA-F])+">
<token type="LiteralNumberHex"/>
</rule>
<rule pattern="\d+">
<rule pattern="0[bB](_*[01])+">
<token type="LiteralNumberBin"/>
</rule>
<rule pattern="\d+(_*[\d])*">
<token type="LiteralNumberInteger"/>
</rule>
<rule pattern="&#39;">

View File

@@ -7,143 +7,125 @@
<rules>
<state name="root">
<rule pattern="(#.*)">
<bygroups>
<token type="CommentSingle"/>
</bygroups>
<token type="CommentSingle" />
</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>
<token type="LiteralNumber" />
</rule>
<rule pattern="((\b(true|false)\b))">
<bygroups>
<token type="NameBuiltin"/>
</bygroups>
<token type="NameBuiltin" />
</rule>
<rule pattern="(\bstring\b|\bint\b|\bbool\b|\bfs\b|\boption\b)">
<bygroups>
<token type="KeywordType"/>
</bygroups>
<token type="KeywordType" />
</rule>
<rule pattern="(\b[a-zA-Z_][a-zA-Z0-9]*\b)(\()">
<bygroups>
<token type="NameFunction"/>
<token type="Punctuation"/>
<token type="NameFunction" />
<token type="Punctuation" />
</bygroups>
<push state="params"/>
<push state="params" />
</rule>
<rule pattern="(\{)">
<bygroups>
<token type="Punctuation"/>
</bygroups>
<push state="block"/>
<token type="Punctuation" />
<push state="block" />
</rule>
<rule pattern="(\n|\r|\r\n)">
<token type="Text"/>
<token type="Text" />
</rule>
<rule pattern=".">
<token type="Text"/>
<token type="Text" />
</rule>
</state>
<state name="string">
<rule pattern="&#34;">
<token type="LiteralString"/>
<pop depth="1"/>
<token type="LiteralString" />
<pop depth="1" />
</rule>
<rule pattern="\\&#34;">
<token type="LiteralString"/>
<token type="LiteralString" />
</rule>
<rule pattern="[^\\&#34;]+">
<token type="LiteralString"/>
<token type="LiteralString" />
</rule>
</state>
<state name="block">
<rule pattern="(\})">
<bygroups>
<token type="Punctuation"/>
</bygroups>
<pop depth="1"/>
<token type="Punctuation" />
<pop depth="1" />
</rule>
<rule pattern="(#.*)">
<bygroups>
<token type="CommentSingle"/>
</bygroups>
<token type="CommentSingle" />
</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>
<token type="LiteralNumber" />
</rule>
<rule pattern="((\b(true|false)\b))">
<bygroups>
<token type="KeywordConstant"/>
</bygroups>
<token type="KeywordConstant" />
</rule>
<rule pattern="&#34;">
<token type="LiteralString"/>
<push state="string"/>
<token type="LiteralString" />
<push state="string" />
</rule>
<rule pattern="(with)">
<bygroups>
<token type="KeywordReserved"/>
</bygroups>
<token type="KeywordReserved" />
</rule>
<rule pattern="(as)([\t ]+)(\b[a-zA-Z_][a-zA-Z0-9]*\b)">
<bygroups>
<token type="KeywordReserved"/>
<token type="Text"/>
<token type="NameFunction"/>
<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"/>
<token type="KeywordType" />
<token type="Text" />
<token type="Punctuation" />
</bygroups>
<push state="block"/>
<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)">
<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"/>
<token type="NameOther" />
</bygroups>
</rule>
<rule pattern="(\n|\r|\r\n)">
<token type="Text"/>
<token type="Text" />
</rule>
<rule pattern=".">
<token type="Text"/>
<token type="Text" />
</rule>
</state>
<state name="params">
<rule pattern="(\))">
<bygroups>
<token type="Punctuation"/>
<token type="Punctuation" />
</bygroups>
<pop depth="1"/>
<pop depth="1" />
</rule>
<rule pattern="(variadic)">
<bygroups>
<token type="Keyword"/>
<token type="Keyword" />
</bygroups>
</rule>
<rule pattern="(\bstring\b|\bint\b|\bbool\b|\bfs\b|\boption\b)">
<bygroups>
<token type="KeywordType"/>
<token type="KeywordType" />
</bygroups>
</rule>
<rule pattern="(\b[a-zA-Z_][a-zA-Z0-9]*\b)">
<bygroups>
<token type="NameOther"/>
<token type="NameOther" />
</bygroups>
</rule>
<rule pattern="(\n|\r|\r\n)">
<token type="Text"/>
<token type="Text" />
</rule>
<rule pattern=".">
<token type="Text"/>
<token type="Text" />
</rule>
</state>
</rules>
</lexer>
</lexer>

View File

@@ -9,6 +9,13 @@
<filename>*.inf</filename>
<filename>*.service</filename>
<filename>*.socket</filename>
<filename>*.container</filename>
<filename>*.network</filename>
<filename>*.build</filename>
<filename>*.pod</filename>
<filename>*.kube</filename>
<filename>*.volume</filename>
<filename>*.image</filename>
<filename>.gitconfig</filename>
<filename>.editorconfig</filename>
<filename>pylintrc</filename>
@@ -42,4 +49,4 @@
</rule>
</state>
</rules>
</lexer>
</lexer>

File diff suppressed because one or more lines are too long

View File

@@ -3,6 +3,8 @@
<name>JSON</name>
<alias>json</alias>
<filename>*.json</filename>
<filename>*.jsonc</filename>
<filename>*.avsc</filename>
<mime_type>application/json</mime_type>
<dot_all>true</dot_all>
<not_multiline>true</not_multiline>
@@ -107,4 +109,4 @@
</rule>
</state>
</rules>
</lexer>
</lexer>

View File

@@ -0,0 +1,83 @@
<lexer>
<config>
<name>JSONata</name>
<alias>jsonata</alias>
<filename>*.jsonata</filename>
<dot_all>true</dot_all>
</config>
<rules>
<state name="root">
<rule pattern="/\*.*?\*/">
<token type="CommentMultiline"/>
</rule>
<rule pattern="[{}()\[\]:;,\.=]">
<token type="Punctuation"/>
</rule>
<rule pattern="\.\."> // Spread operator
<token type="Operator"/>
</rule>
<rule pattern="\^(?=\()"> // Sort operator
<token type="Operator"/>
</rule>
<rule pattern="\*\*|\*(?=\.)|\*"> // Descendant | Wildcard | Multiplication
<token type="Operator"/>
</rule>
<rule pattern="\/(?!\*)"> // Division
<token type="Operator"/>
</rule>
<rule pattern="[&lt;&gt;!]=?"> // Comparison operators
<token type="Operator"/>
</rule>
<rule pattern="~>">
<token type="Operator"/>
</rule>
<rule pattern="\b(and|or|in)\b">
<token type="Operator"/>
</rule>
<rule pattern="[%@#&amp;?]|\+(?!\d)|\-(?!\d)">
<token type="Operator"/>
</rule>
<rule pattern="\$[a-zA-Z0-9_]*(?![\w\(])">
<token type="NameVariable"/>
</rule>
<rule pattern="\$\w*(?=\()">
<token type="NameFunction"/>
</rule>
<rule pattern="\s+">
<token type="Text"/>
</rule>
<rule pattern="(true|false)\b">
<token type="KeywordConstant"/>
</rule>
<rule pattern="\b(function)\b">
<token type="Keyword"/>
</rule>
<rule pattern="(\+|-)?(0|[1-9]\d*)(\.\d+[eE](\+|-)?\d+|[eE](\+|-)?\d+|\.\d+)">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="(\+|-)?(0|[1-9]\d*)">
<token type="LiteralNumberInteger"/>
</rule>
<!-- NOTE: This expression matches all object keys (NameTags), which are essentially strings with double quotes
that should only be captured on the left side of a colon (:) within a JSON-like object.
Therefore, this expression must preceed the one for all LiteralStringDouble -->
<rule pattern="&#34;(\\.|[^\\&#34;\r\n])*&#34;(?=\s*:)">
<token type="NameTag"/>
</rule>
<rule pattern="&#34;(\\\\|\\&#34;|[^&#34;])*&#34;">
<token type="LiteralStringDouble"/>
</rule>
<rule pattern="&#39;(\\|\\&#39;|[^&#39;])*&#39;">
<token type="LiteralStringSingle"/>
</rule>
<rule pattern="`.*`">
<token type="LiteralStringBacktick"/>
</rule>
<!-- NOTE: This expression matches everything remaining, which should be only JSONata names.
Therefore, it has been left as last intentionally -->
<rule pattern="[a-zA-Z0-9_]*">
<token type="Name"/>
</rule>
</state>
</rules>
</lexer>

View File

@@ -0,0 +1,138 @@
<lexer>
<config>
<name>Jsonnet</name>
<alias>jsonnet</alias>
<filename>*.jsonnet</filename>
<filename>*.libsonnet</filename>
</config>
<rules>
<state name="_comments">
<rule pattern="(//|#).*\n"><token type="CommentSingle"/></rule>
<rule pattern="/\*\*([^/]|/(?!\*))*\*/"><token type="LiteralStringDoc"/></rule>
<rule pattern="/\*([^/]|/(?!\*))*\*/"><token type="Comment"/></rule>
</state>
<state name="root">
<rule><include state="_comments"/></rule>
<rule pattern="@&#x27;.*&#x27;"><token type="LiteralString"/></rule>
<rule pattern="@&quot;.*&quot;"><token type="LiteralString"/></rule>
<rule pattern="&#x27;"><token type="LiteralString"/><push state="singlestring"/></rule>
<rule pattern="&quot;"><token type="LiteralString"/><push state="doublestring"/></rule>
<rule pattern="\|\|\|(.|\n)*\|\|\|"><token type="LiteralString"/></rule>
<rule pattern="[+-]?[0-9]+(.[0-9])?"><token type="LiteralNumberFloat"/></rule>
<rule pattern="[!$~+\-&amp;|^=&lt;&gt;*/%]"><token type="Operator"/></rule>
<rule pattern="\{"><token type="Punctuation"/><push state="object"/></rule>
<rule pattern="\["><token type="Punctuation"/><push state="array"/></rule>
<rule pattern="local\b"><token type="Keyword"/><push state="local_name"/></rule>
<rule pattern="assert\b"><token type="Keyword"/><push state="assert"/></rule>
<rule pattern="(assert|else|error|false|for|if|import|importstr|in|null|tailstrict|then|self|super|true)\b"><token type="Keyword"/></rule>
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
<rule pattern="function(?=\()"><token type="Keyword"/><push state="function_params"/></rule>
<rule pattern="std\.[^\W\d]\w*(?=\()"><token type="NameBuiltin"/><push state="function_args"/></rule>
<rule pattern="[^\W\d]\w*(?=\()"><token type="NameFunction"/><push state="function_args"/></rule>
<rule pattern="[^\W\d]\w*"><token type="NameVariable"/></rule>
<rule pattern="[\.()]"><token type="Punctuation"/></rule>
</state>
<state name="singlestring">
<rule pattern="[^&#x27;\\]"><token type="LiteralString"/></rule>
<rule pattern="\\."><token type="LiteralStringEscape"/></rule>
<rule pattern="&#x27;"><token type="LiteralString"/><pop depth="1"/></rule>
</state>
<state name="doublestring">
<rule pattern="[^&quot;\\]"><token type="LiteralString"/></rule>
<rule pattern="\\."><token type="LiteralStringEscape"/></rule>
<rule pattern="&quot;"><token type="LiteralString"/><pop depth="1"/></rule>
</state>
<state name="array">
<rule pattern=","><token type="Punctuation"/></rule>
<rule pattern="\]"><token type="Punctuation"/><pop depth="1"/></rule>
<rule><include state="root"/></rule>
</state>
<state name="local_name">
<rule pattern="[^\W\d]\w*(?=\()"><token type="NameFunction"/><push state="function_params"/></rule>
<rule pattern="[^\W\d]\w*"><token type="NameVariable"/></rule>
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
<rule pattern="(?==)"><token type="TextWhitespace"/><push state="#pop" state="local_value"/></rule>
</state>
<state name="local_value">
<rule pattern="="><token type="Operator"/></rule>
<rule pattern=";"><token type="Punctuation"/><pop depth="1"/></rule>
<rule><include state="root"/></rule>
</state>
<state name="assert">
<rule pattern=":"><token type="Punctuation"/></rule>
<rule pattern=";"><token type="Punctuation"/><pop depth="1"/></rule>
<rule><include state="root"/></rule>
</state>
<state name="function_params">
<rule pattern="[^\W\d]\w*"><token type="NameVariable"/></rule>
<rule pattern="\("><token type="Punctuation"/></rule>
<rule pattern="\)"><token type="Punctuation"/><pop depth="1"/></rule>
<rule pattern=","><token type="Punctuation"/></rule>
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
<rule pattern="="><token type="Operator"/><push state="function_param_default"/></rule>
</state>
<state name="function_args">
<rule pattern="\("><token type="Punctuation"/></rule>
<rule pattern="\)"><token type="Punctuation"/><pop depth="1"/></rule>
<rule pattern=","><token type="Punctuation"/></rule>
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
<rule><include state="root"/></rule>
</state>
<state name="object">
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
<rule pattern="local\b"><token type="Keyword"/><push state="object_local_name"/></rule>
<rule pattern="assert\b"><token type="Keyword"/><push state="object_assert"/></rule>
<rule pattern="\["><token type="Operator"/><push state="field_name_expr"/></rule>
<rule pattern="(?=[^\W\d]\w*)"><token type="Text"/><push state="field_name"/></rule>
<rule pattern="\}"><token type="Punctuation"/><pop depth="1"/></rule>
<rule pattern="&quot;"><token type="NameVariable"/><push state="double_field_name"/></rule>
<rule pattern="&#x27;"><token type="NameVariable"/><push state="single_field_name"/></rule>
<rule><include state="_comments"/></rule>
</state>
<state name="field_name">
<rule pattern="[^\W\d]\w*(?=\()"><token type="NameFunction"/><push state="field_separator" state="function_params"/></rule>
<rule pattern="[^\W\d]\w*"><token type="NameVariable"/><push state="field_separator"/></rule>
</state>
<state name="double_field_name">
<rule pattern="([^&quot;\\]|\\.)*&quot;"><token type="NameVariable"/><push state="field_separator"/></rule>
</state>
<state name="single_field_name">
<rule pattern="([^&#x27;\\]|\\.)*&#x27;"><token type="NameVariable"/><push state="field_separator"/></rule>
</state>
<state name="field_name_expr">
<rule pattern="\]"><token type="Operator"/><push state="field_separator"/></rule>
<rule><include state="root"/></rule>
</state>
<state name="function_param_default">
<rule pattern="(?=[,\)])"><token type="TextWhitespace"/><pop depth="1"/></rule>
<rule><include state="root"/></rule>
</state>
<state name="field_separator">
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
<rule pattern="\+?::?:?"><token type="Punctuation"/><push state="#pop" state="#pop" state="field_value"/></rule>
<rule><include state="_comments"/></rule>
</state>
<state name="field_value">
<rule pattern=","><token type="Punctuation"/><pop depth="1"/></rule>
<rule pattern="\}"><token type="Punctuation"/><pop depth="2"/></rule>
<rule><include state="root"/></rule>
</state>
<state name="object_assert">
<rule pattern=":"><token type="Punctuation"/></rule>
<rule pattern=","><token type="Punctuation"/><pop depth="1"/></rule>
<rule><include state="root"/></rule>
</state>
<state name="object_local_name">
<rule pattern="[^\W\d]\w*"><token type="NameVariable"/><push state="#pop" state="object_local_value"/></rule>
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
</state>
<state name="object_local_value">
<rule pattern="="><token type="Operator"/></rule>
<rule pattern=","><token type="Punctuation"/><pop depth="1"/></rule>
<rule pattern="\}"><token type="Punctuation"/><pop depth="2"/></rule>
<rule><include state="root"/></rule>
</state>
</rules>
</lexer>

View File

@@ -0,0 +1,96 @@
<lexer>
<config>
<name>Kakoune</name>
<alias>kak</alias>
<alias>kakoune</alias>
<alias>kakrc</alias>
<alias>kakscript</alias>
<filename>*.kak</filename>
<filename>kakrc</filename>
<mime_type>application/x-sh</mime_type>
<mime_type>application/x-shellscript</mime_type>
<mime_type>text/x-shellscript</mime_type>
</config>
<rules>
<state name="root">
<rule pattern="\b(add\-highlighter|alias|arrange\-buffers|buffer|buffer\-next|buffer\-previous|catch|change\-directory|colorscheme|debug|declare\-option|declare\-user\-mode|define\-command|complete\-command|delete\-buffer|delete\-buffer!|echo|edit|edit!|enter\-user\-mode|evaluate\-commands|execute\-keys|fail|hook|info|kill|kill!|map|nop|on\-key|prompt|provide\-module|quit|quit!|remove\-highlighter|remove\-hooks|rename\-buffer|rename\-client|rename\-session|require\-module|select|set\-face|set\-option|set\-register|source|trigger\-user\-hook|try|unalias|unmap|unset\-face|unset\-option|update\-option|write|write!|write\-all|write\-all\-quit|write\-quit|write\-quit!)\b"><token type="Keyword"/></rule>
<rule pattern="\b(global|buffer|window|current|normal|insert|prompt|goto|view|user|object|number\-lines|show\-matching|show\-whitespaces|fill|regex|dynregex|group|flag\-lines|ranges|line|column|wrap|ref|regions|region|default\-region|replace\-ranges)\b"><token type="NameAttribute"/></rule>
<rule pattern="\b(int|bool|str|regex|int\-list|str\-list|completions|line\-specs|range\-specs|str\-to\-str\-map)\b"><token type="NameClass"/></rule>
<rule pattern="\b(default|black|red|green|yellow|blue|magenta|cyan|white|yes|no|false|true)\b"><token type="Literal"/></rule>
<rule pattern="\brgba?:[0-9a-fA-F]{6,8}\b"><token type="LiteralNumberHex"/></rule>
<rule pattern="(-params )(\b\d+)(\.\.)(\d+\b)"><bygroups><token type="Text"/><token type="LiteralNumber"/><token type="Text"/><token type="LiteralNumber"/></bygroups></rule>
<rule pattern="&quot;(&quot;&quot;|[^&quot;])*&quot;"><token type="LiteralString"/></rule>
<rule pattern="&#x27;(&#x27;&#x27;|[^&#x27;])*&#x27;"><token type="LiteralString"/></rule>
<rule><include state="basic"/></rule>
<rule pattern="`"><token type="LiteralStringBacktick"/><push state="backticks"/></rule>
<rule><include state="data"/></rule>
<rule><include state="interp"/></rule>
</state>
<state name="interp">
<rule pattern="\$\(\("><token type="Keyword"/><push state="math"/></rule>
<rule pattern="\$\("><token type="Keyword"/><push state="paren"/></rule>
<rule pattern="\$\{#?"><token type="LiteralStringInterpol"/><push state="curly"/></rule>
<rule pattern="\$[a-zA-Z_]\w*"><token type="NameVariable"/></rule>
<rule pattern="\$(?:\d+|[#$?!_*@-])"><token type="NameVariable"/></rule>
<rule pattern="\$"><token type="Text"/></rule>
</state>
<state name="basic">
<rule pattern="\b(if|fi|else|while|in|do|done|for|then|return|function|case|select|break|continue|until|esac|elif)(\s*)\b"><bygroups><token type="Keyword"/><token type="TextWhitespace"/></bygroups></rule>
<rule pattern="\b(alias|bg|bind|builtin|caller|cd|command|compgen|complete|declare|dirs|disown|echo|enable|eval|exec|exit|export|false|fc|fg|getopts|hash|help|history|jobs|kill|let|local|logout|popd|printf|pushd|pwd|read|readonly|set|shift|shopt|source|suspend|test|time|times|trap|true|type|typeset|ulimit|umask|unalias|unset|wait)(?=[\s)`])"><token type="NameBuiltin"/></rule>
<rule pattern="\A#!.+\n"><token type="CommentHashbang"/></rule>
<rule pattern="#.*\n"><token type="CommentSingle"/></rule>
<rule pattern="\\[\w\W]"><token type="LiteralStringEscape"/></rule>
<rule pattern="(\b\w+)(\s*)(\+?=)"><bygroups><token type="NameVariable"/><token type="TextWhitespace"/><token type="Operator"/></bygroups></rule>
<rule pattern="[\[\]{}()=]"><token type="Operator"/></rule>
<rule pattern="&lt;&lt;&lt;"><token type="Operator"/></rule>
<rule pattern="&lt;&lt;-?\s*(\&#x27;?)\\?(\w+)[\w\W]+?\2"><token type="LiteralString"/></rule>
<rule pattern="&amp;&amp;|\|\|"><token type="Operator"/></rule>
</state>
<state name="data">
<rule pattern="(?s)\$?&quot;(\\.|[^&quot;\\$])*&quot;"><token type="LiteralStringDouble"/></rule>
<rule pattern="&quot;"><token type="LiteralStringDouble"/><push state="string"/></rule>
<rule pattern="(?s)\$&#x27;(\\\\|\\[0-7]+|\\.|[^&#x27;\\])*&#x27;"><token type="LiteralStringSingle"/></rule>
<rule pattern="(?s)&#x27;.*?&#x27;"><token type="LiteralStringSingle"/></rule>
<rule pattern=";"><token type="Punctuation"/></rule>
<rule pattern="&amp;"><token type="Punctuation"/></rule>
<rule pattern="\|"><token type="Punctuation"/></rule>
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
<rule pattern="\d+\b"><token type="LiteralNumber"/></rule>
<rule pattern="[^=\s\[\]{}()$&quot;\&#x27;`\\&lt;&amp;|;]+"><token type="Text"/></rule>
<rule pattern="&lt;"><token type="Text"/></rule>
</state>
<state name="string">
<rule pattern="&quot;"><token type="LiteralStringDouble"/><pop depth="1"/></rule>
<rule pattern="(?s)(\\\\|\\[0-7]+|\\.|[^&quot;\\$])+"><token type="LiteralStringDouble"/></rule>
<rule><include state="interp"/></rule>
</state>
<state name="curly">
<rule pattern="\}"><token type="LiteralStringInterpol"/><pop depth="1"/></rule>
<rule pattern=":-"><token type="Keyword"/></rule>
<rule pattern="\w+"><token type="NameVariable"/></rule>
<rule pattern="[^}:&quot;\&#x27;`$\\]+"><token type="Punctuation"/></rule>
<rule pattern=":"><token type="Punctuation"/></rule>
<rule><include state="root"/></rule>
</state>
<state name="paren">
<rule pattern="\)"><token type="Keyword"/><pop depth="1"/></rule>
<rule><include state="root"/></rule>
</state>
<state name="math">
<rule pattern="\)\)"><token type="Keyword"/><pop depth="1"/></rule>
<rule pattern="\*\*|\|\||&lt;&lt;|&gt;&gt;|[-+*/%^|&amp;&lt;&gt;]"><token type="Operator"/></rule>
<rule pattern="\d+#[\da-zA-Z]+"><token type="LiteralNumber"/></rule>
<rule pattern="\d+#(?! )"><token type="LiteralNumber"/></rule>
<rule pattern="0[xX][\da-fA-F]+"><token type="LiteralNumber"/></rule>
<rule pattern="\d+"><token type="LiteralNumber"/></rule>
<rule pattern="[a-zA-Z_]\w*"><token type="NameVariable"/></rule>
<rule><include state="root"/></rule>
</state>
<state name="backticks">
<rule pattern="`"><token type="LiteralStringBacktick"/><pop depth="1"/></rule>
<rule><include state="root"/></rule>
</state>
</rules>
</lexer>

View File

@@ -0,0 +1,75 @@
<lexer>
<config>
<name>KDL</name>
<alias>kdl</alias>
<filename>*.kdl</filename>
</config>
<rules>
<state name="root">
<rule pattern="((?&lt;={|;)|^)\s*(?![/\\\{\}#;\[\]\=])[&lt;&gt;:\w\-_~,\&#x27;`!\?@\$%^&amp;*+|\.\(\)\x{0080}-\x{0001f645}]+\d*?[&lt;&gt;:\w\-_~,\&#x27;`!\?@\$%^&amp;*+|\.\(\)\x{0080}-\x{0001f645}]*?"><token type="NameLabel"/></rule>
<rule pattern="(#true|#false|#null|#nan|#inf|#-inf)\b"><token type="KeywordConstant"/></rule>
<rule pattern="[{}=;\\]"><token type="Operator"/></rule>
<rule pattern="(\b([0-9-\+]|-|\+)[0-9_]*?\.[0-9][0-9_]*?([eE][+-]?[0-9_]+)?\b|\b[0-9][0-9_]*?(\.[0-9][0-9_]*?)?[eE][+-]?[0-9_]+\b)"><token type="LiteralNumberFloat"/></rule>
<rule pattern="\b[0-9\-\+][0-9_]*\b"><token type="LiteralNumber"/></rule>
<rule pattern="\b0x[a-fA-F0-9][a-fA-F0-9_]*?\b"><token type="LiteralNumberHex"/></rule>
<rule pattern="\b0o[0-7][0-7_]*\b"><token type="LiteralNumberOct"/></rule>
<rule pattern="\b0b[01][01_]*?\b"><token type="LiteralNumberBin"/></rule>
<rule pattern="#+(\&quot;&quot;&quot;|&quot;).*?(&quot;&quot;&quot;|&quot;)#+"><token type="LiteralString"/></rule>
<rule pattern="#?&quot;&quot;&quot;"><token type="LiteralString"/><push state="multiline_string"/></rule>
<rule pattern="#?&quot;"><token type="LiteralString"/><push state="string"/></rule>
<rule pattern="/\*"><token type="CommentMultiline"/><push state="comment"/></rule>
<rule pattern="/\*!"><token type="LiteralStringDoc"/><push state="doccomment"/></rule>
<rule pattern="/-\s*{"><token type="CommentMultiline"/><push state="slashdash_block_comment"/></rule>
<rule pattern="\s*/-\s?[^\s=]*?\s?{"><token type="CommentMultiline"/><push state="slashdash_node_comment"/></rule>
<rule pattern="(?&lt;!^)\s*/-\s*(&quot;.*&quot;|.*?)?\s"><token type="CommentSingle"/></rule>
<rule pattern="(?&lt;=^)\s*/-[^{]+{"><token type="CommentMultiline"/><push state="slashdash_node_with_children_comment"/></rule>
<rule pattern="(\/\/(.*?)\n|(?&lt;!^)\s*/-\s*?\s)"><token type="CommentSingle"/></rule>
<rule pattern="(?![/\\\{\}#;\[\]\=])[&lt;&gt;:\w\-_~,\&#x27;`!\?@\$%^&amp;*+|.\(\)\x{0080}-\x{0001f645}]+\d*?[&lt;&gt;:\w\-_~,\&#x27;`!\?@\$%^&amp;*+|.\(\)\x{0080}-\x{0001f645}]*(=)"><token type="NameAttribute"/></rule>
<rule pattern="(?![/\\{\}#;\[\]\=])[&lt;&gt;:\w\-_~,\&#x27;`!\?@\$%^&amp;*+|.\(\)\x{0080}-\x{0001f645}]+\d*[&lt;&gt;:\w\-_~,\&#x27;`!\?@\$%^&amp;*+|.\(\)\x{0080}-\x{0001f645}]*?"><token type="LiteralString"/></rule>
<rule pattern="\s"><token type="TextWhitespace"/></rule>
</state>
<state name="string">
<rule pattern="&quot;#?"><token type="LiteralString"/><pop depth="1"/></rule>
<rule pattern="\\[&#x27;&quot;\\nrt]|\\x[0-7][0-9a-fA-F]|\\0|\\u\{[0-9a-fA-F]{1,6}\}"><token type="LiteralStringEscape"/></rule>
<rule pattern="[^\\&quot;]+"><token type="LiteralString"/></rule>
<rule pattern="\\"><token type="LiteralString"/></rule>
</state>
<state name="multiline_string">
<rule pattern="&quot;&quot;&quot;#?"><token type="LiteralString"/><pop depth="1"/></rule>
<rule pattern="\\[&#x27;&quot;\\nrt]|\\x[0-7][0-9a-fA-F]|\\0|\\u\{[0-9a-fA-F]{1,6}\}"><token type="LiteralStringEscape"/></rule>
<rule pattern="&quot;"><token type="LiteralString"/></rule>
<rule pattern="[^\\&quot;]+"><token type="LiteralString"/></rule>
<rule pattern="\\"><token type="LiteralString"/></rule>
</state>
<state name="slashdash_block_comment">
<rule pattern="[^}]+"><token type="CommentMultiline"/></rule>
<rule pattern="/-\s*{"><token type="CommentMultiline"/><push/></rule>
<rule pattern="\}"><token type="CommentMultiline"/><pop depth="1"/></rule>
<rule pattern="[\}]"><token type="CommentMultiline"/></rule>
</state>
<state name="slashdash_node_comment">
<rule pattern="[^\}]+"><token type="CommentMultiline"/></rule>
<rule pattern="^\s*?/-.*?\s?{"><token type="CommentMultiline"/><push/></rule>
<rule pattern="\}"><token type="CommentMultiline"/><pop depth="1"/></rule>
<rule pattern="[\}]"><token type="CommentMultiline"/></rule>
</state>
<state name="slashdash_node_with_children_comment">
<rule pattern="[^\}]+"><token type="CommentMultiline"/></rule>
<rule pattern="(?&lt;=^)\s*/-[^{]+{"><token type="CommentMultiline"/><push/></rule>
<rule pattern="\}"><token type="CommentMultiline"/><pop depth="1"/></rule>
<rule pattern="[\}]"><token type="CommentMultiline"/></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>
<state name="doccomment">
<rule pattern="[^*/]+"><token type="LiteralStringDoc"/></rule>
<rule pattern="/\*"><token type="LiteralStringDoc"/><push/></rule>
<rule pattern="\*/"><token type="LiteralStringDoc"/><pop depth="1"/></rule>
<rule pattern="[*/]"><token type="LiteralStringDoc"/></rule>
</state>
</rules>
</lexer>

View File

@@ -3,6 +3,7 @@
<name>Kotlin</name>
<alias>kotlin</alias>
<filename>*.kt</filename>
<filename>*.kts</filename>
<mime_type>text/x-kotlin</mime_type>
<dot_all>true</dot_all>
</config>
@@ -112,9 +113,7 @@
<rule pattern="%=|&amp;&amp;|\*=|\+\+|\+=|--|-=|-&gt;|\.\.|\/=|::|&lt;=|==|&gt;=|!!|!=|\|\||\?[:.]">
<token type="Operator"/>
</rule>
<rule pattern="[~!%^&amp;*()+=|\[\]:;,.&lt;&gt;\/?-]">
<token type="Punctuation"/>
</rule>
<rule pattern="[{}]">
<token type="Punctuation"/>
</rule>
@@ -136,8 +135,20 @@
<rule pattern="&#39;\\.&#39;|&#39;[^\\]&#39;">
<token type="LiteralStringChar"/>
</rule>
<rule pattern="0[xX][0-9a-fA-F]+[Uu]?[Ll]?|[0-9]+(\.[0-9]*)?([eE][+-][0-9]+)?[fF]?[Uu]?[Ll]?">
<token type="LiteralNumber"/>
<rule pattern="0[xX][0-9a-fA-F]+(_+[0-9a-fA-F]+)*[uU]?L?">
<token type="LiteralNumberHex"/>
</rule>
<rule pattern="0[bB][01]+(_+[01]+)*[uU]?L?">
<token type="LiteralNumberBin"/>
</rule>
<rule pattern="[0-9]+(_+[0-9]+)*\.[0-9]+(_+[0-9]+)*([eE][+-]?[0-9]+(_+[0-9]+)*)?[fF]?|\.[0-9]+(_+[0-9]+)*([eE][+-]?[0-9]+(_+[0-9]+)*)?[fF]?|[0-9]+(_+[0-9]+)*[eE][+-]?[0-9]+(_+[0-9]+)*[fF]?|[0-9]+(_+[0-9]+)*[fF]">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="[0-9]+(_+[0-9]+)*[uU]?L?">
<token type="LiteralNumberInteger"/>
</rule>
<rule pattern="[~!%^&amp;*()+=|\[\]:;,.&lt;&gt;\/?-]">
<token type="Punctuation"/>
</rule>
<rule pattern="(companion)(\s+)(object)">
<bygroups>

View File

@@ -0,0 +1,56 @@
<lexer>
<config>
<name>Lean4</name>
<alias>lean4</alias>
<alias>lean</alias>
<filename>*.lean</filename>
<mime_type>text/x-lean4</mime_type>
<mime_type>text/x-lean</mime_type>
</config>
<rules>
<state name="expression">
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
<rule pattern="/--"><token type="LiteralStringDoc"/><push state="docstring"/></rule>
<rule pattern="/-"><token type="Comment"/><push state="comment"/></rule>
<rule pattern="--.*$"><token type="CommentSingle"/></rule>
<rule pattern="\b(Type|Prop|Sort)\b"><token type="KeywordType"/></rule>
<rule pattern="\b(sorry|admit)\b"><token type="GenericError"/></rule>
<rule pattern="(!=|\#|\&amp;|\&amp;\&amp;|\*|\+|\-|/|@|!|\-\.|\-&gt;|\.|\.\.|\.\.\.|::|:&gt;|;|;;|&lt;|&lt;\-|=|==|&gt;|_|\||\|\||\~|=&gt;|&lt;=|&gt;=|/\\|\\/|∀|Π|λ|↔|∧||≠|≤|≥|¬|⁻¹|⬝|▸|→|∃|≈|×|⌞|⌟|≡|⟨|⟩|↦)"><token type="NameBuiltinPseudo"/></rule>
<rule pattern="(\(|\)|:|\{|\}|\[|\]|⦃|⦄|:=|,)"><token type="Operator"/></rule>
<rule pattern="(?![λΠΣ])[_a-zA-Zα-ωΑ-Ωϊ-ϻἀ-῾℀-⅏𝒜-𝖟](?:(?![λΠΣ])[_a-zA-Zα-ωΑ-Ωϊ-ϻἀ-῾℀-⅏𝒜-𝖟0-9&#x27;ⁿ-₉ₐ-ₜᵢ-ᵪ!?])*"><token type="Name"/></rule>
<rule pattern="``?(?![λΠΣ])[_a-zA-Zα-ωΑ-Ωϊ-ϻἀ-῾℀-⅏𝒜-𝖟](?:(?![λΠΣ])[_a-zA-Zα-ωΑ-Ωϊ-ϻἀ-῾℀-⅏𝒜-𝖟0-9&#x27;ⁿ-₉ₐ-ₜᵢ-ᵪ!?])*(\.(?![λΠΣ])[_a-zA-Zα-ωΑ-Ωϊ-ϻἀ-῾℀-⅏𝒜-𝖟](?:(?![λΠΣ])[_a-zA-Zα-ωΑ-Ωϊ-ϻἀ-῾℀-⅏𝒜-𝖟0-9&#x27;ⁿ-₉ₐ-ₜᵢ-ᵪ!?])*)*"><token type="LiteralStringSymbol"/></rule>
<rule pattern="(?&lt;=\.)\d+"><token type="LiteralNumber"/></rule>
<rule pattern="(\d+\.\d*)([eE][+-]?[0-9]+)?"><token type="LiteralNumberFloat"/></rule>
<rule pattern="\d+"><token type="LiteralNumberInteger"/></rule>
<rule pattern="&quot;"><token type="LiteralStringDouble"/><push state="string"/></rule>
<rule pattern="[~?][a-z][\w\&#x27;]*:"><token type="NameVariable"/></rule>
<rule pattern="\S"><token type="NameBuiltinPseudo"/></rule>
</state>
<state name="root">
<rule pattern="\b(import|unif_hint|renaming|inline|hiding|lemma|variable|theorem|axiom|inductive|structure|universe|alias|\#help|precedence|postfix|prefix|infix|infixl|infixr|notation|\#eval|\#check|\#reduce|\#exit|end|private|using|namespace|instance|section|protected|export|set_option|extends|open|example|\#print|opaque|def|macro|elab|syntax|macro_rules|\#reduce|where|abbrev|noncomputable|class|attribute|\#synth|mutual|scoped|local)\b"><token type="KeywordNamespace"/></rule>
<rule pattern="\b(forall|fun|obtain|from|have|show|assume|let|if|else|then|by|in|with|calc|match|nomatch|do|at)\b"><token type="Keyword"/></rule>
<rule pattern="@\["><token type="KeywordDeclaration"/><push state="attribute"/></rule>
<rule><include state="expression"/></rule>
</state>
<state name="attribute">
<rule pattern="\]"><token type="KeywordDeclaration"/><pop depth="1"/></rule>
<rule><include state="expression"/></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>
<state name="docstring">
<rule pattern="[^/-]+"><token type="LiteralStringDoc"/></rule>
<rule pattern="-/"><token type="LiteralStringDoc"/><pop depth="1"/></rule>
<rule pattern="[/-]"><token type="LiteralStringDoc"/></rule>
</state>
<state name="string">
<rule pattern="[^\\&quot;]+"><token type="LiteralStringDouble"/></rule>
<rule pattern="\\[n&quot;\\\n]"><token type="LiteralStringEscape"/></rule>
<rule pattern="&quot;"><token type="LiteralStringDouble"/><pop depth="1"/></rule>
</state>
</rules>
</lexer>

View File

@@ -0,0 +1,78 @@
<lexer>
<config>
<name>lox</name>
<filename>*.lox</filename>
<dot_all>true</dot_all>
<ensure_nl>true</ensure_nl>
</config>
<rules>
<state name="whitespace">
<rule pattern="\n">
<token type="Text"/>
</rule>
<rule pattern="\s+">
<token type="Text"/>
</rule>
</state>
<state name="root">
<rule>
<include state="whitespace"/>
</rule>
<rule pattern="//.*?\n">
<token type="CommentSingle"/>
</rule>
<rule pattern="(and|break|case|continue|default|else|for|if|or|print|return|super|switch|this|while)\b">
<token type="Keyword"/>
</rule>
<rule pattern="(false|nil|true)\b">
<token type="KeywordConstant"/>
</rule>
<rule pattern="(class)(\s+)([a-zA-Z_]\w*)">
<bygroups>
<token type="KeywordDeclaration"/>
<token type="Text"/>
<token type="NameClass"/>
</bygroups>
</rule>
<rule pattern="(fun)(\s+)([a-zA-Z_]\w*)">
<bygroups>
<token type="KeywordDeclaration"/>
<token type="Text"/>
<token type="NameFunction"/>
</bygroups>
</rule>
<rule pattern="(const)(\s+)([a-zA-Z_]\w*)">
<bygroups>
<token type="KeywordDeclaration"/>
<token type="Text"/>
<token type="NameConstant"/>
</bygroups>
</rule>
<rule pattern="(var)(\s+)([a-zA-Z_]\w*)">
<bygroups>
<token type="KeywordDeclaration"/>
<token type="Text"/>
<token type="NameVariable"/>
</bygroups>
</rule>
<rule pattern="\d+(\.\d*|[eE][+\-]?\d+)">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="[0-9][0-9]*">
<token type="LiteralNumberInteger"/>
</rule>
<rule pattern="&#34;(\\\\|\\&#34;|[^&#34;])*&#34;">
<token type="LiteralStringDouble"/>
</rule>
<rule pattern="!|\+|-|\*|/|&lt;|&gt;|=">
<token type="Operator"/>
</rule>
<rule pattern="[{}():;.,]">
<token type="Punctuation"/>
</rule>
<rule pattern="[a-zA-Z_]\w*">
<token type="NameVariable"/>
</rule>
</state>
</rules>
</lexer>

View File

@@ -2,8 +2,10 @@
<config>
<name>Lua</name>
<alias>lua</alias>
<alias>luau</alias>
<filename>*.lua</filename>
<filename>*.wlua</filename>
<filename>*.luau</filename>
<mime_type>text/x-lua</mime_type>
<mime_type>application/x-lua</mime_type>
</config>

View File

@@ -0,0 +1,155 @@
<lexer>
<config>
<name>Materialize SQL dialect</name>
<mime_type>text/x-materializesql</mime_type>
<case_insensitive>true</case_insensitive>
<not_multiline>true</not_multiline>
<alias>materialize</alias>
<alias>mzsql</alias>
</config>
<rules>
<state name="root">
<rule pattern="\s+">
<token type="Text" />
</rule>
<rule pattern="--.*\n?">
<token type="CommentSingle" />
</rule>
<rule pattern="/\*">
<token type="CommentMultiline" />
<push state="multiline-comments" />
</rule>
<rule pattern="(bigint|bigserial|bit|bit\s+varying|bool|boolean|box|bytea|char|character|character\s+varying|cidr|circle|date|decimal|double\s+precision|float4|float8|inet|int|int2|int4|int8|integer|interval|json|jsonb|line|lseg|macaddr|money|numeric|path|pg_lsn|point|polygon|real|serial|serial2|serial4|serial8|smallint|smallserial|text|time|timestamp|timestamptz|timetz|tsquery|tsvector|txid_snapshot|uuid|varbit|varchar|with\s+time\s+zone|without\s+time\s+zone|xml|anyarray|anyelement|anyenum|anynonarray|anyrange|cstring|fdw_handler|internal|language_handler|opaque|record|void)\b">
<token type="NameBuiltin" />
</rule>
<rule pattern="(?s)(DO)(\s+)(?:(LANGUAGE)?(\s+)('?)(\w+)?('?)(\s+))?(\$)([^$]*)(\$)(.*?)(\$)(\10)(\$)">
<usingbygroup>
<sublexer_name_group>6</sublexer_name_group>
<code_group>12</code_group>
<emitters>
<token type="Keyword" />
<token type="Text" />
<token type="Keyword" />
<token type="Text" />
<token type="LiteralStringSingle" />
<token type="LiteralStringSingle" />
<token type="LiteralStringSingle" />
<token type="Text" />
<token type="LiteralStringHeredoc" />
<token type="LiteralStringHeredoc" />
<token type="LiteralStringHeredoc" />
<token type="LiteralStringHeredoc" />
<token type="LiteralStringHeredoc" />
<token type="LiteralStringHeredoc" />
<token type="LiteralStringHeredoc" />
</emitters>
</usingbygroup>
</rule>
<rule pattern="(ACCESS|ADD|ADDRESSES|AGGREGATE|ALIGNED|ALL|ALTER|ANALYSIS|AND|ANY|ARITY|ARN|ARRANGEMENT|ARRAY|AS|ASC|ASSERT|ASSUME|AT|AUCTION|AUTHORITY|AVAILABILITY|AVRO|AWS|BATCH|BEGIN|BETWEEN|BIGINT|BILLED|BODY|BOOLEAN|BOTH|BPCHAR|BROKEN|BROKER|BROKERS|BY|BYTES|CARDINALITY|CASCADE|CASE|CAST|CERTIFICATE|CHAIN|CHAINS|CHAR|CHARACTER|CHARACTERISTICS|CHECK|CLASS|CLIENT|CLOCK|CLOSE|CLUSTER|CLUSTERS|COALESCE|COLLATE|COLUMN|COLUMNS|COMMENT|COMMIT|COMMITTED|COMPACTION|COMPATIBILITY|COMPRESSION|COMPUTE|COMPUTECTL|CONFIG|CONFLUENT|CONNECTION|CONNECTIONS|CONSTRAINT|CONTINUAL|COPY|COUNT|COUNTER|CREATE|CREATECLUSTER|CREATEDB|CREATEROLE|CREATION|CROSS|CSV|CURRENT|CURSOR|DATABASE|DATABASES|DATUMS|DAY|DAYS|DEALLOCATE|DEBEZIUM|DEBUG|DEBUGGING|DEC|DECIMAL|DECLARE|DECODING|DECORRELATED|DEFAULT|DEFAULTS|DELETE|DELIMITED|DELIMITER|DELTA|DESC|DETAILS|DISCARD|DISK|DISTINCT|DOC|DOT|DOUBLE|DROP|EAGER|ELEMENT|ELSE|ENABLE|END|ENDPOINT|ENFORCED|ENVELOPE|ERROR|ERRORS|ESCAPE|ESTIMATE|EVERY|EXCEPT|EXCLUDE|EXECUTE|EXISTS|EXPECTED|EXPLAIN|EXPOSE|EXPRESSIONS|EXTERNAL|EXTRACT|FACTOR|FALSE|FAST|FEATURES|FETCH|FIELDS|FILE|FILTER|FIRST|FIXPOINT|FLOAT|FOLLOWING|FOR|FOREIGN|FORMAT|FORWARD|FROM|FULL|FULLNAME|FUNCTION|FUSION|GENERATOR|GRANT|GREATEST|GROUP|GROUPS|HAVING|HEADER|HEADERS|HISTORY|HOLD|HOST|HOUR|HOURS|HUMANIZED|HYDRATION|ID|IDENTIFIERS|IDS|IF|IGNORE|ILIKE|IMPLEMENTATIONS|IMPORTED|IN|INCLUDE|INDEX|INDEXES|INFO|INHERIT|INLINE|INNER|INPUT|INSERT|INSIGHTS|INSPECT|INT|INTEGER|INTERNAL|INTERSECT|INTERVAL|INTO|INTROSPECTION|IS|ISNULL|ISOLATION|JOIN|JOINS|JSON|KAFKA|KEY|KEYS|LAST|LATERAL|LATEST|LEADING|LEAST|LEFT|LEGACY|LETREC|LEVEL|LIKE|LIMIT|LINEAR|LIST|LOAD|LOCAL|LOCALLY|LOG|LOGICAL|LOGIN|LOWERING|MANAGED|MANUAL|MAP|MARKETING|MATERIALIZE|MATERIALIZED|MAX|MECHANISMS|MEMBERSHIP|MESSAGE|METADATA|MINUTE|MINUTES|MODE|MONTH|MONTHS|MUTUALLY|MYSQL|NAME|NAMES|NATURAL|NEGATIVE|NEW|NEXT|NO|NOCREATECLUSTER|NOCREATEDB|NOCREATEROLE|NODE|NOINHERIT|NOLOGIN|NON|NONE|NOSUPERUSER|NOT|NOTICE|NOTICES|NULL|NULLIF|NULLS|OBJECTS|OF|OFFSET|ON|ONLY|OPERATOR|OPTIMIZED|OPTIMIZER|OPTIONS|OR|ORDER|ORDINALITY|OUTER|OVER|OWNED|OWNER|PARTITION|PARTITIONS|PASSWORD|PATH|PHYSICAL|PLAN|PLANS|PORT|POSITION|POSTGRES|PRECEDING|PRECISION|PREFIX|PREPARE|PRIMARY|PRIVATELINK|PRIVILEGES|PROGRESS|PROTOBUF|PROTOCOL|PUBLIC|PUBLICATION|PUSHDOWN|QUERY|QUOTE|RAISE|RANGE|RATE|RAW|READ|READY|REAL|REASSIGN|RECURSION|RECURSIVE|REDACTED|REDUCE|REFERENCE|REFERENCES|REFRESH|REGEX|REGION|REGISTRY|RENAME|REOPTIMIZE|REPEATABLE|REPLACE|REPLAN|REPLICA|REPLICAS|REPLICATION|RESET|RESPECT|RESTRICT|RETAIN|RETURN|RETURNING|REVOKE|RIGHT|ROLE|ROLES|ROLLBACK|ROTATE|ROUNDS|ROW|ROWS|SASL|SCALE|SCHEDULE|SCHEMA|SCHEMAS|SECOND|SECONDS|SECRET|SECRETS|SECURITY|SEED|SELECT|SEQUENCES|SERIALIZABLE|SERVICE|SESSION|SET|SHARD|SHOW|SINK|SINKS|SIZE|SMALLINT|SNAPSHOT|SOME|SOURCE|SOURCES|SSH|SSL|START|STDIN|STDOUT|STORAGE|STORAGECTL|STRATEGY|STRICT|STRING|STRONG|SUBSCRIBE|SUBSOURCE|SUBSOURCES|SUBSTRING|SUBTREE|SUPERUSER|SWAP|SYNTAX|SYSTEM|TABLE|TABLES|TAIL|TASK|TEMP|TEMPORARY|TEXT|THEN|TICK|TIES|TIME|TIMELINE|TIMEOUT|TIMESTAMP|TIMESTAMPTZ|TIMING|TO|TOKEN|TOPIC|TPCH|TRACE|TRAILING|TRANSACTION|TRANSACTIONAL|TRIM|TRUE|TUNNEL|TYPE|TYPES|UNBOUNDED|UNCOMMITTED|UNION|UNIQUE|UNKNOWN|UNNEST|UNTIL|UP|UPDATE|UPSERT|URL|USAGE|USER|USERNAME|USERS|USING|VALIDATE|VALUE|VALUES|VARCHAR|VARIADIC|VARYING|VERSION|VIEW|VIEWS|WAIT|WARNING|WEBHOOK|WHEN|WHERE|WINDOW|WIRE|WITH|WITHIN|WITHOUT|WORK|WORKERS|WORKLOAD|WRITE|YEAR|YEARS|YUGABYTE|ZONE|ZONES)\b">
<token type="Keyword" />
</rule>
<rule pattern="[+*/&lt;&gt;=~!@#%^&amp;|`?-]+">
<token type="Operator" />
</rule>
<rule pattern="::">
<token type="Operator" />
</rule>
<rule pattern="\$\d+">
<token type="NameVariable" />
</rule>
<rule pattern="([0-9]*\.[0-9]*|[0-9]+)(e[+-]?[0-9]+)?">
<token type="LiteralNumberFloat" />
</rule>
<rule pattern="[0-9]+">
<token type="LiteralNumberInteger" />
</rule>
<rule pattern="((?:E|U&amp;)?)(')">
<bygroups>
<token type="LiteralStringAffix" />
<token type="LiteralStringSingle" />
</bygroups>
<push state="string" />
</rule>
<rule pattern="((?:U&amp;)?)(&quot;)">
<bygroups>
<token type="LiteralStringAffix" />
<token type="LiteralStringName" />
</bygroups>
<push state="quoted-ident" />
</rule>
<rule pattern="(?s)(\$)([^$]*)(\$)(.*?)(\$)(\2)(\$)(\s+)(LANGUAGE)?(\s+)('?)(\w+)?('?)">
<usingbygroup>
<sublexer_name_group>12</sublexer_name_group>
<code_group>4</code_group>
<emitters>
<token type="LiteralStringHeredoc" />
<token type="LiteralStringHeredoc" />
<token type="LiteralStringHeredoc" />
<token type="LiteralStringHeredoc" />
<token type="LiteralStringHeredoc" />
<token type="LiteralStringHeredoc" />
<token type="LiteralStringHeredoc" />
<token type="Text" />
<token type="Keyword" />
<token type="Text" />
<token type="LiteralStringSingle" />
<token type="LiteralStringSingle" />
<token type="LiteralStringSingle" />
</emitters>
</usingbygroup>
</rule>
<rule pattern="(?s)(\$)([^$]*)(\$)(.*?)(\$)(\2)(\$)">
<token type="LiteralStringHeredoc" />
</rule>
<rule pattern="[a-z_]\w*">
<token type="Name" />
</rule>
<rule pattern=":(['&quot;]?)[a-z]\w*\b\1">
<token type="NameVariable" />
</rule>
<rule pattern="[;:()\[\]{},.]">
<token type="Punctuation" />
</rule>
</state>
<state name="multiline-comments">
<rule pattern="/\*">
<token type="CommentMultiline" />
<push state="multiline-comments" />
</rule>
<rule pattern="\*/">
<token type="CommentMultiline" />
<pop depth="1" />
</rule>
<rule pattern="[^/*]+">
<token type="CommentMultiline" />
</rule>
<rule pattern="[/*]">
<token type="CommentMultiline" />
</rule>
</state>
<state name="string">
<rule pattern="[^']+">
<token type="LiteralStringSingle" />
</rule>
<rule pattern="''">
<token type="LiteralStringSingle" />
</rule>
<rule pattern="'">
<token type="LiteralStringSingle" />
<pop depth="1" />
</rule>
</state>
<state name="quoted-ident">
<rule pattern="[^&quot;]+">
<token type="LiteralStringName" />
</rule>
<rule pattern="&quot;&quot;">
<token type="LiteralStringName" />
</rule>
<rule pattern="&quot;">
<token type="LiteralStringName" />
<pop depth="1" />
</rule>
</state>
</rules>
</lexer>

View File

@@ -1,182 +1,138 @@
<lexer>
<config>
<name>mcfunction</name>
<name>MCFunction</name>
<alias>mcfunction</alias>
<alias>mcf</alias>
<filename>*.mcfunction</filename>
<dot_all>true</dot_all>
<not_multiline>true</not_multiline>
<mime_type>text/mcfunction</mime_type>
</config>
<rules>
<state name="nbtobjectvalue">
<rule pattern="(&#34;(\\\\|\\&#34;|[^&#34;])*&#34;|[a-zA-Z0-9_]+)">
<token type="NameTag"/>
<push state="nbtobjectattribute"/>
</rule>
<rule pattern="\}">
<token type="Punctuation"/>
<pop depth="1"/>
</rule>
</state>
<state name="nbtarrayvalue">
<rule>
<include state="nbtvalue"/>
</rule>
<rule pattern=",">
<token type="Punctuation"/>
</rule>
<rule pattern="\]">
<token type="Punctuation"/>
<pop depth="1"/>
</rule>
</state>
<state name="nbtvalue">
<rule>
<include state="simplevalue"/>
</rule>
<rule pattern="\{">
<token type="Punctuation"/>
<push state="nbtobjectvalue"/>
</rule>
<rule pattern="\[">
<token type="Punctuation"/>
<push state="nbtarrayvalue"/>
</rule>
</state>
<state name="argumentvalue">
<rule>
<include state="simplevalue"/>
</rule>
<rule pattern=",">
<token type="Punctuation"/>
<pop depth="1"/>
</rule>
<rule pattern="[}\]]">
<token type="Punctuation"/>
<pop depth="2"/>
</rule>
</state>
<state name="argumentlist">
<rule pattern="(nbt)(={)">
<bygroups>
<token type="NameAttribute"/>
<token type="Punctuation"/>
</bygroups>
<push state="nbtobjectvalue"/>
</rule>
<rule pattern="([A-Za-z0-9/_!]+)(={)">
<bygroups>
<token type="NameAttribute"/>
<token type="Punctuation"/>
</bygroups>
<push state="argumentlist"/>
</rule>
<rule pattern="([A-Za-z0-9/_!]+)(=)">
<bygroups>
<token type="NameAttribute"/>
<token type="Punctuation"/>
</bygroups>
<push state="argumentvalue"/>
</rule>
<rule>
<include state="simplevalue"/>
</rule>
<rule pattern=",">
<token type="Punctuation"/>
</rule>
<rule pattern="[}\]]">
<token type="Punctuation"/>
<pop depth="1"/>
</rule>
</state>
<state name="root">
<rule pattern="#.*?\n">
<token type="CommentSingle"/>
</rule>
<rule pattern="/?(geteduclientinfo|clearspawnpoint|defaultgamemode|transferserver|toggledownfall|immutableworld|detectredstone|setidletimeout|playanimation|classroommode|spreadplayers|testforblocks|setmaxplayers|setworldspawn|testforblock|worldbuilder|createagent|worldborder|camerashake|advancement|raytracefog|locatebiome|tickingarea|replaceitem|attributes|spawnpoint|difficulty|experience|scoreboard|whitelist|structure|playsound|stopsound|forceload|spectate|gamerule|function|schedule|wsserver|teleport|position|save-off|particle|setblock|datapack|mobevent|transfer|gamemode|save-all|bossbar|enchant|trigger|collect|execute|weather|teammsg|tpagent|banlist|dropall|publish|tellraw|testfor|save-on|destroy|ability|locate|summon|remove|effect|reload|ban-ip|recipe|pardon|detect|music|clear|clone|event|mixer|debug|title|ride|stop|list|turn|data|team|kick|loot|tell|help|give|flog|fill|move|time|seed|kill|save|item|deop|code|tag|ban|msg|say|tp|me|op|xp|w|place)\b">
<token type="KeywordReserved"/>
</rule>
<rule pattern="(@p|@r|@a|@e|@s|@c|@v)">
<token type="KeywordConstant"/>
</rule>
<rule pattern="\[">
<token type="Punctuation"/>
<push state="argumentlist"/>
</rule>
<rule pattern="{">
<token type="Punctuation"/>
<push state="nbtobjectvalue"/>
</rule>
<rule pattern="~">
<token type="NameBuiltin"/>
</rule>
<rule pattern="([a-zA-Z_]+:)?[a-zA-Z_]+\b">
<token type="Text"/>
</rule>
<rule pattern="([a-z]+)(\.)([0-9]+)\b">
<bygroups>
<token type="Text"/>
<token type="Punctuation"/>
<token type="LiteralNumber"/>
</bygroups>
</rule>
<rule pattern="([&lt;&gt;=]|&lt;=|&gt;=)">
<token type="Punctuation"/>
</rule>
<rule>
<include state="simplevalue"/>
</rule>
<rule pattern="\s+">
<token type="TextWhitespace"/>
</rule>
<rule><include state="names"/></rule>
<rule><include state="comments"/></rule>
<rule><include state="literals"/></rule>
<rule><include state="whitespace"/></rule>
<rule><include state="property"/></rule>
<rule><include state="operators"/></rule>
<rule><include state="selectors"/></rule>
</state>
<state name="simplevalue">
<rule pattern="(true|false)">
<token type="KeywordConstant"/>
</rule>
<rule pattern="[01]b">
<token type="LiteralNumber"/>
</rule>
<rule pattern="-?(0|[1-9]\d*)(\.\d+[eE](\+|-)?\d+|[eE](\+|-)?\d+|\.\d+)">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="(-?\d+)(\.\.)(-?\d+)">
<bygroups>
<token type="LiteralNumberInteger"/>
<token type="Punctuation"/>
<token type="LiteralNumberInteger"/>
</bygroups>
</rule>
<rule pattern="-?(0|[1-9]\d*)">
<token type="LiteralNumberInteger"/>
</rule>
<rule pattern="&#34;(\\\\|\\&#34;|[^&#34;])*&#34;">
<token type="LiteralStringDouble"/>
</rule>
<rule pattern="&#39;[^&#39;]+&#39;">
<token type="LiteralStringSingle"/>
</rule>
<rule pattern="([!#]?)(\w+)">
<bygroups>
<token type="Punctuation"/>
<token type="Text"/>
</bygroups>
</rule>
<state name="names">
<rule pattern="^(\s*)([a-z_]+)"><bygroups><token type="TextWhitespace"/><token type="NameBuiltin"/></bygroups></rule>
<rule pattern="(?&lt;=run)\s+[a-z_]+"><token type="NameBuiltin"/></rule>
<rule pattern="\b[0-9a-fA-F]+(?:-[0-9a-fA-F]+){4}\b"><token type="NameVariable"/></rule>
<rule><include state="resource-name"/></rule>
<rule pattern="[A-Za-z_][\w.#%$]+"><token type="KeywordConstant"/></rule>
<rule pattern="[#%$][\w.#%$]+"><token type="NameVariableMagic"/></rule>
</state>
<state name="nbtobjectattribute">
<rule>
<include state="nbtvalue"/>
</rule>
<rule pattern=":">
<token type="Punctuation"/>
</rule>
<rule pattern=",">
<token type="Punctuation"/>
<pop depth="1"/>
</rule>
<rule pattern="\}">
<token type="Punctuation"/>
<pop depth="2"/>
</rule>
<state name="resource-name">
<rule pattern="#?[a-z_][a-z_.-]*:[a-z0-9_./-]+"><token type="NameFunction"/></rule>
<rule pattern="#?[a-z0-9_\.\-]+\/[a-z0-9_\.\-\/]+"><token type="NameFunction"/></rule>
</state>
<state name="whitespace">
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
</state>
<state name="comments">
<rule pattern="^\s*(#[&gt;!])"><token type="CommentMultiline"/><push state="comments.block" state="comments.block.emphasized"/></rule>
<rule pattern="#.*$"><token type="CommentSingle"/></rule>
</state>
<state name="comments.block">
<rule pattern="^\s*#[&gt;!]"><token type="CommentMultiline"/><push state="comments.block.emphasized"/></rule>
<rule pattern="^\s*#"><token type="CommentMultiline"/><push state="comments.block.normal"/></rule>
<rule><pop depth="1"/></rule>
</state>
<state name="comments.block.normal">
<rule><include state="comments.block.special"/></rule>
<rule pattern="\S+"><token type="CommentMultiline"/></rule>
<rule pattern="\n"><token type="Text"/><pop depth="1"/></rule>
<rule><include state="whitespace"/></rule>
</state>
<state name="comments.block.emphasized">
<rule><include state="comments.block.special"/></rule>
<rule pattern="\S+"><token type="LiteralStringDoc"/></rule>
<rule pattern="\n"><token type="Text"/><pop depth="1"/></rule>
<rule><include state="whitespace"/></rule>
</state>
<state name="comments.block.special">
<rule pattern="@\S+"><token type="NameDecorator"/></rule>
<rule><include state="resource-name"/></rule>
<rule pattern="[#%$][\w.#%$]+"><token type="NameVariableMagic"/></rule>
</state>
<state name="operators">
<rule pattern="[\-~%^?!+*&lt;&gt;\\/|&amp;=.]"><token type="Operator"/></rule>
</state>
<state name="literals">
<rule pattern="\.\."><token type="Literal"/></rule>
<rule pattern="(true|false)"><token type="KeywordPseudo"/></rule>
<rule pattern="[A-Za-z_]+"><token type="NameVariableClass"/></rule>
<rule pattern="[0-7]b"><token type="LiteralNumberByte"/></rule>
<rule pattern="[+-]?\d*\.?\d+([eE]?[+-]?\d+)?[df]?\b"><token type="LiteralNumberFloat"/></rule>
<rule pattern="[+-]?\d+\b"><token type="LiteralNumberInteger"/></rule>
<rule pattern="&quot;"><token type="LiteralStringDouble"/><push state="literals.string-double"/></rule>
<rule pattern="&#x27;"><token type="LiteralStringSingle"/><push state="literals.string-single"/></rule>
</state>
<state name="literals.string-double">
<rule pattern="\\."><token type="LiteralStringEscape"/></rule>
<rule pattern="[^\\&quot;\n]+"><token type="LiteralStringDouble"/></rule>
<rule pattern="&quot;"><token type="LiteralStringDouble"/><pop depth="1"/></rule>
</state>
<state name="literals.string-single">
<rule pattern="\\."><token type="LiteralStringEscape"/></rule>
<rule pattern="[^\\&#x27;\n]+"><token type="LiteralStringSingle"/></rule>
<rule pattern="&#x27;"><token type="LiteralStringSingle"/><pop depth="1"/></rule>
</state>
<state name="selectors">
<rule pattern="@[a-z]"><token type="NameVariable"/></rule>
</state>
<state name="property">
<rule pattern="\{"><token type="Punctuation"/><push state="property.curly" state="property.key"/></rule>
<rule pattern="\["><token type="Punctuation"/><push state="property.square" state="property.key"/></rule>
</state>
<state name="property.curly">
<rule><include state="whitespace"/></rule>
<rule><include state="property"/></rule>
<rule pattern="\}"><token type="Punctuation"/><pop depth="1"/></rule>
</state>
<state name="property.square">
<rule><include state="whitespace"/></rule>
<rule><include state="property"/></rule>
<rule pattern="\]"><token type="Punctuation"/><pop depth="1"/></rule>
<rule pattern=","><token type="Punctuation"/></rule>
</state>
<state name="property.key">
<rule><include state="whitespace"/></rule>
<rule pattern="#?[a-z_][a-z_\.\-]*\:[a-z0-9_\.\-/]+(?=\s*\=)"><token type="NameAttribute"/><push state="property.delimiter"/></rule>
<rule pattern="#?[a-z_][a-z0-9_\.\-/]+"><token type="NameAttribute"/><push state="property.delimiter"/></rule>
<rule pattern="[A-Za-z_\-\+]+"><token type="NameAttribute"/><push state="property.delimiter"/></rule>
<rule pattern="&quot;"><token type="NameAttribute"/><push state="property.delimiter"/></rule>
<rule pattern="&#x27;"><token type="NameAttribute"/><push state="property.delimiter"/></rule>
<rule pattern="-?\d+"><token type="LiteralNumberInteger"/><push state="property.delimiter"/></rule>
<rule><pop depth="1"/></rule>
</state>
<state name="property.key.string-double">
<rule pattern="\\."><token type="LiteralStringEscape"/></rule>
<rule pattern="[^\\&quot;\n]+"><token type="NameAttribute"/></rule>
<rule pattern="&quot;"><token type="NameAttribute"/><pop depth="1"/></rule>
</state>
<state name="property.key.string-single">
<rule pattern="\\."><token type="LiteralStringEscape"/></rule>
<rule pattern="[^\\&#x27;\n]+"><token type="NameAttribute"/></rule>
<rule pattern="&#x27;"><token type="NameAttribute"/><pop depth="1"/></rule>
</state>
<state name="property.delimiter">
<rule><include state="whitespace"/></rule>
<rule pattern="[:=]!?"><token type="Punctuation"/><push state="property.value"/></rule>
<rule pattern=","><token type="Punctuation"/></rule>
<rule><pop depth="1"/></rule>
</state>
<state name="property.value">
<rule><include state="whitespace"/></rule>
<rule pattern="#?[a-z_][a-z_\.\-]*\:[a-z0-9_\.\-/]+"><token type="NameTag"/></rule>
<rule pattern="#?[a-z_][a-z0-9_\.\-/]+"><token type="NameTag"/></rule>
<rule><include state="literals"/></rule>
<rule><include state="property"/></rule>
<rule><pop depth="1"/></rule>
</state>
</rules>
</lexer>

View File

@@ -0,0 +1,139 @@
<lexer>
<config>
<name>microcad</name>
<alias>µcad</alias>
<filename>*.µcad</filename>
<filename>*.ucad</filename>
<filename>*.mcad</filename>
<mime_type>text/microcad</mime_type>
<ensure_nl>true</ensure_nl>
</config>
<rules>
<!-- Root state -->
<state name="root">
<rule pattern="\n">
<token type="TextWhitespace"/>
</rule>
<rule pattern="\s+">
<token type="TextWhitespace"/>
</rule>
<!-- COMMENTS -->
<rule pattern="///.*">
<token type="LiteralStringDoc"/>
</rule>
<rule pattern="//.*">
<token type="CommentSingle"/>
</rule>
<rule pattern="/\*.*">
<token type="CommentMultiline"/>
<push state="comment"/>
</rule>
<!-- KEYWORDS -->
<rule pattern="\b(pub|sketch|part|op|mod|use|fn|const|prop|init|return|if|else|mat|__builtin|or|and|not|as)\b">
<token type="Keyword"/>
</rule>
<!-- TYPES -->
<rule pattern="\b(Integer|Scalar|String|Color|Length|Area|Volume|Angle|Weight|Density|Bool|Matrix[0-9])\b">
<token type="KeywordType"/>
</rule>
<!-- FUNCTION NAMES -->
<rule pattern="\b([a-z_][a-zA-Z0-9_]*)\s*(?=\()">
<token type="NameFunction"/>
</rule>
<!-- OPERATORS -->
<rule pattern="[+\-*/%&amp;|&lt;&gt;^!@=]">
<token type="Operator"/>
</rule>
<!-- NUMBERS + UNITS -->
<rule pattern="\b(([0-9]+(\.[0-9]+)?)(%|m²|cm²|mm²|µm²|in²|ft²|yd²|m³|cm³|mm³|µm³|in³|ft³|yd³|ml|cl|l|µl|cm|mm|m|µm|in|ft|yd|deg|°|grad|turn|rad|g|kg|lb|oz)?)|true|false\b">
<token type="LiteralNumber"/>
</rule>
<!-- NAMESPACES -->
<rule pattern="([a-z_][a-z0-9_]*)(::)">
<bygroups>
<token type="NameNamespace"/>
<token type="Operator"/>
</bygroups>
</rule>
<!-- CONSTANTS (ALL CAPS) -->
<rule pattern="\b([A-Z_][A-Z0-9_]*)\b">
<token type="NameConstant"/>
</rule>
<!-- CUSTOM TYPES (Capitalized identifiers) -->
<rule pattern="\b([A-Z_][a-zA-Z0-9_]*)\b">
<token type="NameClass"/>
</rule>
<!-- VARIABLES -->
<rule pattern="\b([a-z_][a-zA-Z0-9_]*)\b">
<token type="Name"/>
</rule>
<!-- STRINGS -->
<rule pattern="&quot;[^&quot;]*&quot;">
<token type="LiteralString"/>
</rule>
<!-- PAREN GROUP -->
<rule pattern="[{}()\[\],.;:]">
<token type="Punctuation"/>
</rule>
<!-- BRACE GROUP -->
<rule pattern="\{">
<token type="Punctuation"/>
<push state="brace"/>
</rule>
<rule pattern="[\}\)]">
<token type="Punctuation"/>
</rule>
</state>
<!-- Parenthesized expression -->
<state name="paren">
<rule pattern="\)">
<token type="Punctuation"/>
<pop/>
</rule>
<rule>
<include state="root"/>
</rule>
</state>
<!-- Braced expression -->
<state name="brace">
<rule pattern="\}">
<token type="Punctuation"/>
<pop/>
</rule>
<rule>
<include state="root"/>
</rule>
</state>
<state name="comment">
<!-- End of comment -->
<rule pattern="\*/">
<token type="CommentMultiline"/>
<pop/>
</rule>
</state>
</rules>
</lexer>

View File

@@ -0,0 +1,106 @@
<lexer>
<config>
<name>Modelica</name>
<alias>modelica</alias>
<filename>*.mo</filename>
<mime_type>text/x-modelica</mime_type>
<dot_all>true</dot_all>
<ensure_nl>true</ensure_nl>
</config>
<rules>
<state name="root">
<!-- Comments -->
<rule pattern="//[^\n\r]*">
<token type="CommentSingle"/>
</rule>
<rule pattern="/[*].*?[*]/">
<token type="CommentMultiline"/>
</rule>
<!-- Whitespace and newlines -->
<rule pattern="\s+">
<token type="Text"/>
</rule>
<rule pattern="\n">
<token type="Text"/>
</rule>
<!-- Keywords (Modelica specific) -->
<rule pattern="\b(model|equation|end|extends|function|type|record|connector|parameter|constant|if|then|else|for|in|when|assert|outer|algorithm|flow|discrete|input|output|loop|elseif|return|public|protected|external|real|integer|boolean|string|array|complex|union|tuple|class|der|time|tstart|tstop)\b">
<token type="Keyword"/>
</rule>
<!-- Type definitions -->
<rule pattern="\b(boolean|integer|real|string|array|record|complex|union|tuple)\b">
<token type="KeywordType"/>
</rule>
<!-- Preprocessor directives -->
<rule pattern="#[ \t]*(if|else|endif|define|include|error)\b">
<token type="CommentPreproc"/>
</rule>
<!-- Literals -->
<rule pattern="\\&quot;[^&quot;\n]*\\&quot;">
<token type="LiteralString"/>
</rule>
<rule pattern="'[^'\n]'">
<token type="LiteralStringChar"/>
</rule>
<rule pattern="\d+(\.\d+)?([eE][+-]?\d+)?">
<token type="LiteralNumber"/>
</rule>
<!-- Identifiers and names -->
<rule pattern="@[A-Za-z_]\w*">
<token type="Name"/>
</rule>
<rule pattern="[A-Za-z_]\w*">
<token type="Name"/>
</rule>
<!-- Punctuation -->
<rule pattern="[{}(),;=.+\-*/&amp;|!&lt;&gt;^%]">
<token type="Punctuation"/>
</rule>
<!-- Operators -->
<rule pattern="(\+|\-|\*|\/|\^|\&amp;|\||\&lt;|\&gt;|\%|\=|\!=|\&lt;\=|\&gt;\=)">
<token type="Operator"/>
</rule>
</state>
<state name="function">
<!-- Function name -->
<rule pattern="[A-Za-z_]\w*">
<token type="NameFunction"/>
<pop depth="1"/>
</rule>
<rule>
<pop depth="1"/>
</rule>
</state>
<state name="type">
<!-- Type definition -->
<rule pattern="[A-Za-z_]\w*">
<token type="NameClass"/>
<pop depth="1"/>
</rule>
<rule>
<pop depth="1"/>
</rule>
</state>
<state name="record">
<!-- Record definition -->
<rule pattern="[A-Za-z_]\w*">
<token type="NameClass"/>
<pop depth="1"/>
</rule>
<rule>
<pop depth="1"/>
</rule>
</state>
</rules>
</lexer>

View File

@@ -0,0 +1,228 @@
<lexer>
<config>
<name>Mojo</name>
<alias>mojo</alias>
<alias>🔥</alias>
<filename>*.mojo</filename>
<filename>*.🔥</filename>
<mime_type>text/x-mojo</mime_type>
<mime_type>application/x-mojo</mime_type>
</config>
<rules>
<state name="root">
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
<rule pattern="^(\s*)([rRuUbB]{,2})(&quot;&quot;&quot;(?:.|\n)*?&quot;&quot;&quot;)"><bygroups><token type="TextWhitespace"/><token type="LiteralStringAffix"/><token type="LiteralStringDoc"/></bygroups></rule>
<rule pattern="^(\s*)([rRuUbB]{,2})(&#x27;&#x27;&#x27;(?:.|\n)*?&#x27;&#x27;&#x27;)"><bygroups><token type="TextWhitespace"/><token type="LiteralStringAffix"/><token type="LiteralStringDoc"/></bygroups></rule>
<rule pattern="\A#!.+$"><token type="CommentHashbang"/></rule>
<rule pattern="#.*$"><token type="CommentSingle"/></rule>
<rule pattern="\\\n"><token type="TextWhitespace"/></rule>
<rule pattern="\\"><token type="TextWhitespace"/></rule>
<rule><include state="keywords"/></rule>
<rule><include state="soft-keywords"/></rule>
<rule pattern="(alias)(\s+)"><bygroups><token type="Keyword"/><token type="TextWhitespace"/></bygroups><push state="varname"/></rule>
<rule pattern="(var)(\s+)"><bygroups><token type="Keyword"/><token type="TextWhitespace"/></bygroups><push state="varname"/></rule>
<rule pattern="(def)(\s+)"><bygroups><token type="Keyword"/><token type="TextWhitespace"/></bygroups><push state="funcname"/></rule>
<rule pattern="(fn)(\s+)"><bygroups><token type="Keyword"/><token type="TextWhitespace"/></bygroups><push state="funcname"/></rule>
<rule pattern="(class)(\s+)"><bygroups><token type="Keyword"/><token type="TextWhitespace"/></bygroups><push state="classname"/></rule>
<rule pattern="(struct)(\s+)"><bygroups><token type="Keyword"/><token type="TextWhitespace"/></bygroups><push state="structname"/></rule>
<rule pattern="(trait)(\s+)"><bygroups><token type="Keyword"/><token type="TextWhitespace"/></bygroups><push state="structname"/></rule>
<rule pattern="(from)(\s+)"><bygroups><token type="KeywordNamespace"/><token type="TextWhitespace"/></bygroups><push state="fromimport"/></rule>
<rule pattern="(import)(\s+)"><bygroups><token type="KeywordNamespace"/><token type="TextWhitespace"/></bygroups><push state="import"/></rule>
<rule><include state="expr"/></rule>
</state>
<state name="expr">
<rule pattern="(?i)(rf|fr)(&quot;&quot;&quot;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringDouble"/></bygroups><combined state="rfstringescape" state="tdqf"/></rule>
<rule pattern="(?i)(rf|fr)(&#x27;&#x27;&#x27;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringSingle"/></bygroups><combined state="rfstringescape" state="tsqf"/></rule>
<rule pattern="(?i)(rf|fr)(&quot;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringDouble"/></bygroups><combined state="rfstringescape" state="dqf"/></rule>
<rule pattern="(?i)(rf|fr)(&#x27;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringSingle"/></bygroups><combined state="rfstringescape" state="sqf"/></rule>
<rule pattern="([fF])(&quot;&quot;&quot;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringDouble"/></bygroups><combined state="fstringescape" state="tdqf"/></rule>
<rule pattern="([fF])(&#x27;&#x27;&#x27;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringSingle"/></bygroups><combined state="fstringescape" state="tsqf"/></rule>
<rule pattern="([fF])(&quot;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringDouble"/></bygroups><combined state="fstringescape" state="dqf"/></rule>
<rule pattern="([fF])(&#x27;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringSingle"/></bygroups><combined state="fstringescape" state="sqf"/></rule>
<rule pattern="(?i)(rb|br|r)(&quot;&quot;&quot;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringDouble"/></bygroups><push state="tdqs"/></rule>
<rule pattern="(?i)(rb|br|r)(&#x27;&#x27;&#x27;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringSingle"/></bygroups><push state="tsqs"/></rule>
<rule pattern="(?i)(rb|br|r)(&quot;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringDouble"/></bygroups><push state="dqs"/></rule>
<rule pattern="(?i)(rb|br|r)(&#x27;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringSingle"/></bygroups><push state="sqs"/></rule>
<rule pattern="([uU]?)(&quot;&quot;&quot;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringDouble"/></bygroups><combined state="stringescape" state="tdqs"/></rule>
<rule pattern="([uU]?)(&#x27;&#x27;&#x27;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringSingle"/></bygroups><combined state="stringescape" state="tsqs"/></rule>
<rule pattern="([uU]?)(&quot;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringDouble"/></bygroups><combined state="stringescape" state="dqs"/></rule>
<rule pattern="([uU]?)(&#x27;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringSingle"/></bygroups><combined state="stringescape" state="sqs"/></rule>
<rule pattern="([bB])(&quot;&quot;&quot;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringDouble"/></bygroups><combined state="bytesescape" state="tdqs"/></rule>
<rule pattern="([bB])(&#x27;&#x27;&#x27;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringSingle"/></bygroups><combined state="bytesescape" state="tsqs"/></rule>
<rule pattern="([bB])(&quot;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringDouble"/></bygroups><combined state="bytesescape" state="dqs"/></rule>
<rule pattern="([bB])(&#x27;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringSingle"/></bygroups><combined state="bytesescape" state="sqs"/></rule>
<rule pattern="[^\S\n]+"><token type="Text"/></rule>
<rule><include state="numbers"/></rule>
<rule pattern="!=|==|&lt;&lt;|&gt;&gt;|:=|[-~+/*%=&lt;&gt;&amp;^|.]"><token type="Operator"/></rule>
<rule pattern="([]{}:\(\),;[])+"><token type="Punctuation"/></rule>
<rule pattern="(in|is|and|or|not)\b"><token type="OperatorWord"/></rule>
<rule><include state="expr-keywords"/></rule>
<rule><include state="builtins"/></rule>
<rule><include state="magicfuncs"/></rule>
<rule><include state="magicvars"/></rule>
<rule><include state="name"/></rule>
</state>
<state name="expr-inside-fstring">
<rule pattern="[{([]"><token type="Punctuation"/><push state="expr-inside-fstring-inner"/></rule>
<rule pattern="(=\s*)?(\![sraf])?\}"><token type="LiteralStringInterpol"/><pop depth="1"/></rule>
<rule pattern="(=\s*)?(\![sraf])?:"><token type="LiteralStringInterpol"/><pop depth="1"/></rule>
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
<rule><include state="expr"/></rule>
</state>
<state name="expr-inside-fstring-inner">
<rule pattern="[{([]"><token type="Punctuation"/><push state="expr-inside-fstring-inner"/></rule>
<rule pattern="[])}]"><token type="Punctuation"/><pop depth="1"/></rule>
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
<rule><include state="expr"/></rule>
</state>
<state name="expr-keywords">
<rule pattern="(async\ for|async\ with|await|else|for|if|lambda|yield|yield\ from)\b"><token type="Keyword"/></rule>
<rule pattern="(True|False|None)\b"><token type="KeywordConstant"/></rule>
</state>
<state name="keywords">
<rule pattern="(assert|async|await|borrowed|break|continue|del|elif|else|except|finally|for|global|if|lambda|pass|raise|nonlocal|return|try|while|yield|yield\ from|as|with)\b"><token type="Keyword"/></rule>
<rule pattern="(True|False|None)\b"><token type="KeywordConstant"/></rule>
</state>
<state name="soft-keywords">
<rule pattern="(^[ \t]*)(match|case)\b(?![ \t]*(?:[:,;=^&amp;|@~)\]}]|(?:and|as|assert|async|await|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|raise|return|try|while|with|yield)\b))"><bygroups><token type="TextWhitespace"/><token type="Keyword"/></bygroups><push state="soft-keywords-inner"/></rule>
</state>
<state name="soft-keywords-inner">
<rule pattern="(\s+)([^\n_]*)(_\b)"><bygroups><token type="TextWhitespace"/><usingself state="root"/><token type="Keyword"/></bygroups></rule>
<rule><pop depth="1"/></rule>
</state>
<state name="builtins">
<rule pattern="(?&lt;!\.)(__import__|abs|aiter|all|any|bin|bool|bytearray|breakpoint|bytes|callable|chr|classmethod|compile|complex|delattr|dict|dir|divmod|enumerate|eval|filter|float|format|frozenset|getattr|globals|hasattr|hash|hex|id|input|int|isinstance|issubclass|iter|len|list|locals|map|max|memoryview|min|next|object|oct|open|ord|pow|print|property|range|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|vars|zip|AnyType|Coroutine|DType|Error|Int|List|ListLiteral|Scalar|Int8|UInt8|Int16|UInt16|Int32|UInt32|Int64|UInt64|BFloat16|Float16|Float32|Float64|SIMD|String|Tensor|Tuple|Movable|Copyable|CollectionElement)\b"><token type="NameBuiltin"/></rule>
<rule pattern="(?&lt;!\.)(self|Ellipsis|NotImplemented|cls)\b"><token type="NameBuiltinPseudo"/></rule>
<rule pattern="(?&lt;!\.)(Error)\b"><token type="NameException"/></rule>
</state>
<state name="magicfuncs">
<rule pattern="(__abs__|__add__|__aenter__|__aexit__|__aiter__|__and__|__anext__|__await__|__bool__|__bytes__|__call__|__complex__|__contains__|__del__|__delattr__|__delete__|__delitem__|__dir__|__divmod__|__enter__|__eq__|__exit__|__float__|__floordiv__|__format__|__ge__|__get__|__getattr__|__getattribute__|__getitem__|__gt__|__hash__|__iadd__|__iand__|__ifloordiv__|__ilshift__|__imatmul__|__imod__|__imul__|__index__|__init__|__instancecheck__|__int__|__invert__|__ior__|__ipow__|__irshift__|__isub__|__iter__|__itruediv__|__ixor__|__le__|__len__|__length_hint__|__lshift__|__lt__|__matmul__|__missing__|__mod__|__mul__|__ne__|__neg__|__new__|__next__|__or__|__pos__|__pow__|__prepare__|__radd__|__rand__|__rdivmod__|__repr__|__reversed__|__rfloordiv__|__rlshift__|__rmatmul__|__rmod__|__rmul__|__ror__|__round__|__rpow__|__rrshift__|__rshift__|__rsub__|__rtruediv__|__rxor__|__set__|__setattr__|__setitem__|__str__|__sub__|__subclasscheck__|__truediv__|__xor__)\b"><token type="NameFunctionMagic"/></rule>
</state>
<state name="magicvars">
<rule pattern="(__annotations__|__bases__|__class__|__closure__|__code__|__defaults__|__dict__|__doc__|__file__|__func__|__globals__|__kwdefaults__|__module__|__mro__|__name__|__objclass__|__qualname__|__self__|__slots__|__weakref__)\b"><token type="NameVariableMagic"/></rule>
</state>
<state name="numbers">
<rule pattern="(\d(?:_?\d)*\.(?:\d(?:_?\d)*)?|(?:\d(?:_?\d)*)?\.\d(?:_?\d)*)([eE][+-]?\d(?:_?\d)*)?"><token type="LiteralNumberFloat"/></rule>
<rule pattern="\d(?:_?\d)*[eE][+-]?\d(?:_?\d)*j?"><token type="LiteralNumberFloat"/></rule>
<rule pattern="0[oO](?:_?[0-7])+"><token type="LiteralNumberOct"/></rule>
<rule pattern="0[bB](?:_?[01])+"><token type="LiteralNumberBin"/></rule>
<rule pattern="0[xX](?:_?[a-fA-F0-9])+"><token type="LiteralNumberHex"/></rule>
<rule pattern="\d(?:_?\d)*"><token type="LiteralNumberInteger"/></rule>
</state>
<state name="name">
<rule pattern="@[_\p{L}][_\p{L}\p{N}]*(\s*\.\s*[_\p{L}][_\p{L}\p{N}]*)*"><token type="NameDecorator"/></rule>
<rule pattern="@"><token type="Operator"/></rule>
<rule pattern="[_\p{L}][_\p{L}\p{N}]*(\s*\.\s*[_\p{L}][_\p{L}\p{N}]*)*"><token type="Name"/></rule>
</state>
<state name="varname">
<rule pattern="[_\p{L}][_\p{L}\p{N}]*(\s*\.\s*[_\p{L}][_\p{L}\p{N}]*)*"><token type="NameVariable"/><pop depth="1"/></rule>
</state>
<state name="funcname">
<rule><include state="magicfuncs"/></rule>
<rule pattern="[_\p{L}][_\p{L}\p{N}]*(\s*\.\s*[_\p{L}][_\p{L}\p{N}]*)*"><token type="NameFunction"/><pop depth="1"/></rule>
<rule><pop depth="1"/></rule>
</state>
<state name="classname">
<rule pattern="[_\p{L}][_\p{L}\p{N}]*(\s*\.\s*[_\p{L}][_\p{L}\p{N}]*)*"><token type="NameClass"/><pop depth="1"/></rule>
</state>
<state name="structname">
<rule pattern="[_\p{L}][_\p{L}\p{N}]*(\s*\.\s*[_\p{L}][_\p{L}\p{N}]*)*"><token type="NameClass"/><pop depth="1"/></rule>
</state>
<state name="import">
<rule pattern="(\s+)(as)(\s+)"><bygroups><token type="TextWhitespace"/><token type="Keyword"/><token type="TextWhitespace"/></bygroups></rule>
<rule pattern="\."><token type="NameNamespace"/></rule>
<rule pattern="[_\p{L}][_\p{L}\p{N}]*(\s*\.\s*[_\p{L}][_\p{L}\p{N}]*)*"><token type="NameNamespace"/></rule>
<rule pattern="(\s*)(,)(\s*)"><bygroups><token type="TextWhitespace"/><token type="Operator"/><token type="TextWhitespace"/></bygroups></rule>
<rule><pop depth="1"/></rule>
</state>
<state name="fromimport">
<rule pattern="(\s+)(import)\b"><bygroups><token type="TextWhitespace"/><token type="KeywordNamespace"/></bygroups><pop depth="1"/></rule>
<rule pattern="\."><token type="NameNamespace"/></rule>
<rule pattern="None\b"><token type="KeywordConstant"/><pop depth="1"/></rule>
<rule pattern="[_\p{L}][_\p{L}\p{N}]*(\s*\.\s*[_\p{L}][_\p{L}\p{N}]*)*"><token type="NameNamespace"/></rule>
<rule><pop depth="1"/></rule>
</state>
<state name="rfstringescape">
<rule pattern="\{\{"><token type="LiteralStringEscape"/></rule>
<rule pattern="\}\}"><token type="LiteralStringEscape"/></rule>
</state>
<state name="fstringescape">
<rule><include state="rfstringescape"/></rule>
<rule><include state="stringescape"/></rule>
</state>
<state name="bytesescape">
<rule pattern="\\([\\abfnrtv&quot;\&#x27;]|\n|x[a-fA-F0-9]{2}|[0-7]{1,3})"><token type="LiteralStringEscape"/></rule>
</state>
<state name="stringescape">
<rule pattern="\\(N\{.*?\}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8})"><token type="LiteralStringEscape"/></rule>
<rule><include state="bytesescape"/></rule>
</state>
<state name="fstrings-single">
<rule pattern="\}"><token type="LiteralStringInterpol"/></rule>
<rule pattern="\{"><token type="LiteralStringInterpol"/><push state="expr-inside-fstring"/></rule>
<rule pattern="[^\\\&#x27;&quot;{}\n]+"><token type="LiteralStringSingle"/></rule>
<rule pattern="[\&#x27;&quot;\\]"><token type="LiteralStringSingle"/></rule>
</state>
<state name="fstrings-double">
<rule pattern="\}"><token type="LiteralStringInterpol"/></rule>
<rule pattern="\{"><token type="LiteralStringInterpol"/><push state="expr-inside-fstring"/></rule>
<rule pattern="[^\\\&#x27;&quot;{}\n]+"><token type="LiteralStringDouble"/></rule>
<rule pattern="[\&#x27;&quot;\\]"><token type="LiteralStringDouble"/></rule>
</state>
<state name="strings-single">
<rule pattern="%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsaux%]"><token type="LiteralStringInterpol"/></rule>
<rule pattern="\{((\w+)((\.\w+)|(\[[^\]]+\]))*)?(\![sra])?(\:(.?[&lt;&gt;=\^])?[-+ ]?#?0?(\d+)?,?(\.\d+)?[E-GXb-gnosx%]?)?\}"><token type="LiteralStringInterpol"/></rule>
<rule pattern="[^\\\&#x27;&quot;%{\n]+"><token type="LiteralStringSingle"/></rule>
<rule pattern="[\&#x27;&quot;\\]"><token type="LiteralStringSingle"/></rule>
<rule pattern="%|(\{{1,2})"><token type="LiteralStringSingle"/></rule>
</state>
<state name="strings-double">
<rule pattern="%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsaux%]"><token type="LiteralStringInterpol"/></rule>
<rule pattern="\{((\w+)((\.\w+)|(\[[^\]]+\]))*)?(\![sra])?(\:(.?[&lt;&gt;=\^])?[-+ ]?#?0?(\d+)?,?(\.\d+)?[E-GXb-gnosx%]?)?\}"><token type="LiteralStringInterpol"/></rule>
<rule pattern="[^\\\&#x27;&quot;%{\n]+"><token type="LiteralStringDouble"/></rule>
<rule pattern="[\&#x27;&quot;\\]"><token type="LiteralStringDouble"/></rule>
<rule pattern="%|(\{{1,2})"><token type="LiteralStringDouble"/></rule>
</state>
<state name="dqf">
<rule pattern="&quot;"><token type="LiteralStringDouble"/><pop depth="1"/></rule>
<rule pattern="\\\\|\\&quot;|\\\n"><token type="LiteralStringEscape"/></rule>
<rule><include state="fstrings-double"/></rule>
</state>
<state name="sqf">
<rule pattern="&#x27;"><token type="LiteralStringSingle"/><pop depth="1"/></rule>
<rule pattern="\\\\|\\&#x27;|\\\n"><token type="LiteralStringEscape"/></rule>
<rule><include state="fstrings-single"/></rule>
</state>
<state name="dqs">
<rule pattern="&quot;"><token type="LiteralStringDouble"/><pop depth="1"/></rule>
<rule pattern="\\\\|\\&quot;|\\\n"><token type="LiteralStringEscape"/></rule>
<rule><include state="strings-double"/></rule>
</state>
<state name="sqs">
<rule pattern="&#x27;"><token type="LiteralStringSingle"/><pop depth="1"/></rule>
<rule pattern="\\\\|\\&#x27;|\\\n"><token type="LiteralStringEscape"/></rule>
<rule><include state="strings-single"/></rule>
</state>
<state name="tdqf">
<rule pattern="&quot;&quot;&quot;"><token type="LiteralStringDouble"/><pop depth="1"/></rule>
<rule><include state="fstrings-double"/></rule>
<rule pattern="\n"><token type="LiteralStringDouble"/></rule>
</state>
<state name="tsqf">
<rule pattern="&#x27;&#x27;&#x27;"><token type="LiteralStringSingle"/><pop depth="1"/></rule>
<rule><include state="fstrings-single"/></rule>
<rule pattern="\n"><token type="LiteralStringSingle"/></rule>
</state>
<state name="tdqs">
<rule pattern="&quot;&quot;&quot;"><token type="LiteralStringDouble"/><pop depth="1"/></rule>
<rule><include state="strings-double"/></rule>
<rule pattern="\n"><token type="LiteralStringDouble"/></rule>
</state>
<state name="tsqs">
<rule pattern="&#x27;&#x27;&#x27;"><token type="LiteralStringSingle"/><pop depth="1"/></rule>
<rule><include state="strings-single"/></rule>
<rule pattern="\n"><token type="LiteralStringSingle"/></rule>
</state>
</rules>
</lexer>

View File

@@ -0,0 +1,75 @@
<lexer>
<config>
<name>MoonBit</name>
<alias>moonbit</alias>
<alias>mbt</alias>
<filename>*.mbt</filename>
<ensure_nl>true</ensure_nl>
</config>
<rules>
<state name="root">
<rule pattern="#.*$"><token type="CommentPreproc"/></rule>
<rule pattern="//.*$"><token type="CommentSingle"/></rule>
<rule pattern="b?\&#x27;.*\&#x27;"><token type="Literal"/></rule>
<rule pattern="#\|.*$"><token type="LiteralString"/></rule>
<rule pattern="(b)(\&quot;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralString"/></bygroups><push state="string.inline"/></rule>
<rule pattern="&quot;"><token type="LiteralString"/><push state="string.inline"/></rule>
<rule pattern="\$\|"><token type="LiteralString"/><push state="string.multiline"/></rule>
<rule pattern="0(b|B)[01]+"><token type="LiteralNumberBin"/></rule>
<rule pattern="0(o|O)[0-7]+"><token type="LiteralNumberOct"/></rule>
<rule pattern="0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\.[0-9a-fA-F][0-9a-fA-F_]*(P|p)(\+|\-)?[0-9][0-9]*"><token type="LiteralNumberFloat"/></rule>
<rule pattern="0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\.?(P|p)(\+|\-)?[0-9][0-9]*"><token type="LiteralNumberFloat"/></rule>
<rule pattern="0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\.[0-9a-fA-F][0-9a-fA-F_]*"><token type="LiteralNumberFloat"/></rule>
<rule pattern="0(x|X)[0-9a-fA-F][0-9a-fA-F_]*\."><token type="LiteralNumberFloat"/></rule>
<rule pattern="0(x|X)[0-9a-fA-F][0-9a-fA-F_]*"><token type="LiteralNumberHex"/></rule>
<rule pattern="\d(_|\d)*U?L"><token type="LiteralNumberIntegerLong"/></rule>
<rule pattern="\d(_|\d)*U?"><token type="LiteralNumberInteger"/></rule>
<rule pattern="\d+(.\d+)?"><token type="LiteralNumber"/></rule>
<rule pattern="(type|type!|enum|struct|trait|typealias|traitalias)\b"><token type="KeywordDeclaration"/></rule>
<rule pattern="(async|fn|const|let|mut|impl|with|derive|fnalias)\b"><token type="KeywordDeclaration"/></rule>
<rule pattern="(self|Self)\b"><token type="Keyword"/></rule>
<rule pattern="(guard|if|while|match|else|loop|for|in|is)\b"><token type="Keyword"/></rule>
<rule pattern="(return|break|continue)\b"><token type="Keyword"/></rule>
<rule pattern="(try|catch|raise|noraise)\b"><token type="Keyword"/></rule>
<rule pattern="\bas\b"><token type="Keyword"/></rule>
<rule pattern="(extern|pub|priv|pub\(all\)|pub\(readonly\)|pub\(open\)|test)\b"><token type="Keyword"/></rule>
<rule pattern="(true|false)\b"><token type="KeywordConstant"/></rule>
<rule pattern="(Eq|Compare|Hash|Show|Default|ToJson|FromJson)\b"><token type="NameBuiltin"/></rule>
<rule pattern="(Array|FixedArray|Int|Int64|UInt|UInt64|Option|Result|Byte|Bool|Unit|String|Float|Double)\b"><token type="NameBuiltin"/></rule>
<rule pattern="(\+|\-|\*|/|%|\|&gt;|&gt;&gt;|&lt;&lt;|\&amp;\&amp;|\|\||\&amp;|\||&lt;|&gt;|==)"><token type="Operator"/></rule>
<rule pattern="(not|lsl|lsr|asr|op_add|op_sub|op_div|op_mul|op_mod|\.\.\.)"><token type="OperatorWord"/></rule>
<rule pattern="@[A-Za-z][A-Za-z0-9_/]*\."><token type="NameNamespace"/></rule>
<rule pattern="([a-z][A-Za-z0-9_]*)(\s+)(as)(\s+)([a-z][A-Za-z0-9_]*)"><bygroups><token type="NameFunction"/><token type="TextWhitespace"/><token type="Keyword"/><token type="TextWhitespace"/><token type="NameFunction"/></bygroups></rule>
<rule pattern="([A-Za-z][A-Za-z0-9_]*)(::)([A-Za-z][A-Za-z0-9_]*)(\s+)(as)(\s+)([a-z][A-Za-z0-9_]*)"><bygroups><token type="NameClass"/><token type="Punctuation"/><token type="NameFunction"/><token type="TextWhitespace"/><token type="Keyword"/><token type="TextWhitespace"/><token type="NameFunction"/></bygroups></rule>
<rule pattern="([A-Za-z][A-Za-z0-9_]*)(::)([A-Za-z][A-Za-z0-9_]*)"><bygroups><token type="NameClass"/><token type="Punctuation"/><token type="NameFunction"/></bygroups></rule>
<rule pattern="([a-z][A-Za-z0-9_]*)(?=!?\()"><token type="NameFunction"/></rule>
<rule pattern="Error"><token type="NameException"/></rule>
<rule pattern="(=&gt;)|(-&gt;)|[\(\)\{\}\[\]:,\.=!?~;]"><token type="Punctuation"/></rule>
<rule pattern="[a-z][a-zA-Z0-9_]*"><token type="NameVariable"/></rule>
<rule pattern="[A-Z_][a-zA-Z0-9_]*"><token type="NameClass"/></rule>
<rule pattern="[\s]"><token type="TextWhitespace"/></rule>
</state>
<state name="string.inline">
<rule><include state="escape"/></rule>
<rule pattern="\\{"><token type="LiteralStringEscape"/><push state="interpolation"/></rule>
<rule pattern="&quot;"><token type="LiteralString"/><pop depth="1"/></rule>
<rule pattern="."><token type="LiteralStringDouble"/></rule>
</state>
<state name="string.multiline">
<rule><include state="escape"/></rule>
<rule pattern="\\{"><token type="LiteralStringEscape"/><push state="interpolation"/></rule>
<rule pattern="\Z"><token type="LiteralString"/><pop depth="1"/></rule>
<rule pattern="."><token type="LiteralString"/></rule>
</state>
<state name="interpolation">
<rule pattern="}"><token type="LiteralStringEscape"/><pop depth="1"/></rule>
<rule><include state="root"/></rule>
</state>
<state name="escape">
<rule pattern="\\[0\\tnrb\&quot;&#x27;]"><token type="LiteralStringEscape"/></rule>
<rule pattern="\\x[0-9a-fA-f]{2}"><token type="LiteralStringEscape"/></rule>
<rule pattern="\\u[0-9a-fA-f]{4}"><token type="LiteralStringEscape"/></rule>
<rule pattern="\\u[0-9a-fA-f]*"><token type="LiteralStringEscape"/></rule>
</state>
</rules>
</lexer>

View File

@@ -0,0 +1,83 @@
<lexer>
<config>
<name>MoonScript</name>
<alias>moonscript</alias>
<alias>moon</alias>
<filename>*.moon</filename>
<mime_type>text/x-moonscript</mime_type>
<mime_type>application/x-moonscript</mime_type>
</config>
<rules>
<state name="root">
<rule pattern="#!(.*?)$"><token type="CommentPreproc"/></rule>
<rule><push state="base"/></rule>
</state>
<state name="base">
<rule pattern="--.*$"><token type="CommentSingle"/></rule>
<rule pattern="(?i)(\d*\.\d+|\d+\.\d*)(e[+-]?\d+)?"><token type="LiteralNumberFloat"/></rule>
<rule pattern="(?i)\d+e[+-]?\d+"><token type="LiteralNumberFloat"/></rule>
<rule pattern="(?i)0x[0-9a-f]*"><token type="LiteralNumberHex"/></rule>
<rule pattern="\d+"><token type="LiteralNumberInteger"/></rule>
<rule pattern="\n"><token type="TextWhitespace"/></rule>
<rule pattern="[^\S\n]+"><token type="Text"/></rule>
<rule pattern="(?s)\[(=*)\[.*?\]\1\]"><token type="LiteralString"/></rule>
<rule pattern="(-&gt;|=&gt;)"><token type="NameFunction"/></rule>
<rule pattern=":[a-zA-Z_]\w*"><token type="NameVariable"/></rule>
<rule pattern="(==|!=|~=|&lt;=|&gt;=|\.\.\.|\.\.|[=+\-*/%^&lt;&gt;#!.\\:])"><token type="Operator"/></rule>
<rule pattern="[;,]"><token type="Punctuation"/></rule>
<rule pattern="[\[\]{}()]"><token type="KeywordType"/></rule>
<rule pattern="[a-zA-Z_]\w*:"><token type="NameVariable"/></rule>
<rule pattern="(class|extends|if|then|super|do|with|import|export|while|elseif|return|for|in|from|when|using|else|switch|break)\b"><token type="Keyword"/></rule>
<rule pattern="(true|false|nil)\b"><token type="KeywordConstant"/></rule>
<rule pattern="(and|or|not)\b"><token type="OperatorWord"/></rule>
<rule pattern="(self)\b"><token type="NameBuiltinPseudo"/></rule>
<rule pattern="@@?([a-zA-Z_]\w*)?"><token type="NameVariableClass"/></rule>
<rule pattern="[A-Z]\w*"><token type="NameClass"/></rule>
<rule pattern="(_G|_VERSION|assert|collectgarbage|dofile|error|getmetatable|ipairs|load|loadfile|next|pairs|pcall|print|rawequal|rawget|rawlen|rawset|select|setmetatable|tonumber|tostring|type|warn|xpcall|bit32\.arshift|bit32\.band|bit32\.bnot|bit32\.bor|bit32\.btest|bit32\.bxor|bit32\.extract|bit32\.lrotate|bit32\.lshift|bit32\.replace|bit32\.rrotate|bit32\.rshift|coroutine\.close|coroutine\.create|coroutine\.isyieldable|coroutine\.resume|coroutine\.running|coroutine\.status|coroutine\.wrap|coroutine\.yield|debug\.debug|debug\.gethook|debug\.getinfo|debug\.getlocal|debug\.getmetatable|debug\.getregistry|debug\.getupvalue|debug\.getuservalue|debug\.sethook|debug\.setlocal|debug\.setmetatable|debug\.setupvalue|debug\.setuservalue|debug\.traceback|debug\.upvalueid|debug\.upvaluejoin|io\.close|io\.flush|io\.input|io\.lines|io\.open|io\.output|io\.popen|io\.read|io\.stderr|io\.stdin|io\.stdout|io\.tmpfile|io\.type|io\.write|math\.abs|math\.acos|math\.asin|math\.atan|math\.atan2|math\.ceil|math\.cos|math\.cosh|math\.deg|math\.exp|math\.floor|math\.fmod|math\.frexp|math\.huge|math\.ldexp|math\.log|math\.max|math\.maxinteger|math\.min|math\.mininteger|math\.modf|math\.pi|math\.pow|math\.rad|math\.random|math\.randomseed|math\.sin|math\.sinh|math\.sqrt|math\.tan|math\.tanh|math\.tointeger|math\.type|math\.ult|package\.config|package\.cpath|package\.loaded|package\.loadlib|package\.path|package\.preload|package\.searchers|package\.searchpath|require|os\.clock|os\.date|os\.difftime|os\.execute|os\.exit|os\.getenv|os\.remove|os\.rename|os\.setlocale|os\.time|os\.tmpname|string\.byte|string\.char|string\.dump|string\.find|string\.format|string\.gmatch|string\.gsub|string\.len|string\.lower|string\.match|string\.pack|string\.packsize|string\.rep|string\.reverse|string\.sub|string\.unpack|string\.upper|table\.concat|table\.insert|table\.move|table\.pack|table\.remove|table\.sort|table\.unpack|utf8\.char|utf8\.charpattern|utf8\.codepoint|utf8\.codes|utf8\.len|utf8\.offset)\b"><token type="NameBuiltin"/></rule>
<rule pattern="[A-Za-z_]\w*"><token type="Name"/></rule>
<rule pattern="&#x27;"><token type="LiteralStringSingle"/><combined state="stringescape" state="sqs"/></rule>
<rule pattern="&quot;"><token type="LiteralStringDouble"/><combined state="stringescape" state="dqs"/></rule>
</state>
<state name="stringescape">
<rule pattern="\\([abfnrtv\\&quot;\&#x27;]|\d{1,3})"><token type="LiteralStringEscape"/></rule>
</state>
<state name="sqs">
<rule pattern="&#x27;"><token type="LiteralStringSingle"/><pop depth="1"/></rule>
<rule pattern="[^\\&#x27;]+"><token type="LiteralString"/></rule>
</state>
<state name="dqs">
<rule pattern="&quot;"><token type="LiteralStringDouble"/><pop depth="1"/></rule>
<rule pattern="[^\\&quot;]+"><token type="LiteralString"/></rule>
</state>
<state name="ws">
<rule pattern="(?:--\[(?&lt;level&gt;=*)\[[\w\W]*?\](\k&lt;level&gt;)\])"><token type="CommentMultiline"/></rule>
<rule pattern="(?:--.*$)"><token type="CommentSingle"/></rule>
<rule pattern="(?:\s+)"><token type="TextWhitespace"/></rule>
</state>
<state name="varname">
<rule><include state="ws"/></rule>
<rule pattern="\.\."><token type="Operator"/><pop depth="1"/></rule>
<rule pattern="[.:]"><token type="Punctuation"/></rule>
<rule pattern="(?:[^\W\d]\w*)(?=(?:(?:--\[(?&lt;level&gt;=*)\[[\w\W]*?\](\k&lt;level&gt;)\])|(?:--.*$)|(?:\s+))*[.:])"><token type="NameProperty"/></rule>
<rule pattern="(?:[^\W\d]\w*)(?=(?:(?:--\[(?&lt;level&gt;=*)\[[\w\W]*?\](\k&lt;level&gt;)\])|(?:--.*$)|(?:\s+))*\()"><token type="NameFunction"/><pop depth="1"/></rule>
<rule pattern="(?:[^\W\d]\w*)"><token type="NameProperty"/><pop depth="1"/></rule>
</state>
<state name="funcname">
<rule><include state="ws"/></rule>
<rule pattern="[.:]"><token type="Punctuation"/></rule>
<rule pattern="(?:[^\W\d]\w*)(?=(?:(?:--\[(?&lt;level&gt;=*)\[[\w\W]*?\](\k&lt;level&gt;)\])|(?:--.*$)|(?:\s+))*[.:])"><token type="NameClass"/></rule>
<rule pattern="(?:[^\W\d]\w*)"><token type="NameFunction"/><pop depth="1"/></rule>
<rule pattern="\("><token type="Punctuation"/><pop depth="1"/></rule>
</state>
<state name="goto">
<rule><include state="ws"/></rule>
<rule pattern="(?:[^\W\d]\w*)"><token type="NameLabel"/><pop depth="1"/></rule>
</state>
<state name="label">
<rule><include state="ws"/></rule>
<rule pattern="::"><token type="Punctuation"/><pop depth="1"/></rule>
<rule pattern="(?:[^\W\d]\w*)"><token type="NameLabel"/></rule>
</state>
</rules>
</lexer>

View File

@@ -0,0 +1,123 @@
<lexer>
<config>
<name>NDISASM</name>
<alias>ndisasm</alias>
<mime_type>text/x-disasm</mime_type>
<case_insensitive>true</case_insensitive>
<priority>0.5</priority> <!-- Lower than NASM -->
</config>
<rules>
<state name="root">
<rule pattern="^[0-9A-Za-z]+">
<token type="CommentSpecial"/>
<push state="offset"/>
</rule>
</state>
<state name="offset">
<rule pattern="[0-9A-Za-z]+">
<token type="CommentSpecial"/>
<push state="assembly"/>
</rule>
<rule>
<include state="whitespace"/>
</rule>
</state>
<state name="punctuation">
<rule pattern="[,():\[\]]+">
<token type="Punctuation"/>
</rule>
<rule pattern="[&amp;|^&lt;&gt;+*/%~-]+">
<token type="Operator"/>
</rule>
<rule pattern="[$]+">
<token type="KeywordConstant"/>
</rule>
<rule pattern="seg|wrt|strict">
<token type="OperatorWord"/>
</rule>
<rule pattern="byte|[dq]?word">
<token type="KeywordType"/>
</rule>
</state>
<state name="assembly">
<rule>
<include state="whitespace"/>
</rule>
<rule pattern="[a-z$._?][\w$.?#@~]*:">
<token type="NameLabel"/>
</rule>
<rule pattern="([a-z$._?][\w$.?#@~]*)(\s+)(equ)">
<bygroups>
<token type="NameConstant"/>
<token type="KeywordDeclaration"/>
<token type="KeywordDeclaration"/>
</bygroups>
<push state="instruction-args"/>
</rule>
<rule pattern="BITS|USE16|USE32|SECTION|SEGMENT|ABSOLUTE|EXTERN|GLOBAL|ORG|ALIGN|STRUC|ENDSTRUC|COMMON|CPU|GROUP|UPPERCASE|IMPORT|EXPORT|LIBRARY|MODULE">
<token type="Keyword"/>
<push state="instruction-args"/>
</rule>
<rule pattern="(?:res|d)[bwdqt]|times">
<token type="KeywordDeclaration"/>
<push state="instruction-args"/>
</rule>
<rule pattern="[a-z$._?][\w$.?#@~]*">
<token type="NameFunction"/>
<push state="instruction-args"/>
</rule>
<rule pattern="[\r\n]+">
<token type="Text"/>
<pop depth="2"/>
</rule>
</state>
<state name="instruction-args">
<rule pattern="&#34;(\\&#34;|[^&#34;\n])*&#34;|&#39;(\\&#39;|[^&#39;\n])*&#39;|`(\\`|[^`\n])*`">
<token type="LiteralString"/>
</rule>
<rule pattern="(?:0x[0-9a-f]+|$0[0-9a-f]*|[0-9]+[0-9a-f]*h)">
<token type="LiteralNumberHex"/>
</rule>
<rule pattern="[0-7]+q">
<token type="LiteralNumberOct"/>
</rule>
<rule pattern="[01]+b">
<token type="LiteralNumberBin"/>
</rule>
<rule pattern="[0-9]+\.e?[0-9]+">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="[0-9]+">
<token type="LiteralNumberInteger"/>
</rule>
<rule>
<include state="punctuation"/>
</rule>
<rule pattern="r[0-9][0-5]?[bwd]|[a-d][lh]|[er]?[a-d]x|[er]?[sb]p|[er]?[sd]i|[c-gs]s|st[0-7]|mm[0-7]|cr[0-4]|dr[0-367]|tr[3-7]">
<token type="NameBuiltin"/>
</rule>
<rule pattern="[a-z$._?][\w$.?#@~]*">
<token type="NameVariable"/>
</rule>
<rule pattern="[\r\n]+">
<token type="Text"/>
<pop depth="3"/>
</rule>
<rule>
<include state="whitespace"/>
</rule>
</state>
<state name="whitespace">
<rule pattern="\n">
<token type="Text"/>
<pop depth="2"/>
</rule>
<rule pattern="[ \t]+">
<token type="Text"/>
</rule>
<rule pattern=";.*">
<token type="CommentSingle"/>
</rule>
</state>
</rules>
</lexer>

View File

@@ -58,6 +58,9 @@
<rule pattern="\$[^\s;#()]+">
<token type="NameVariable"/>
</rule>
<rule pattern="(\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b)">
<token type="Name"/>
</rule>
<rule pattern="([a-z0-9.-]+)(:)([0-9]+)">
<bygroups>
<token type="Name"/>

View File

@@ -106,7 +106,7 @@
</bygroups>
<push state="interpol"/>
</rule>
<rule pattern="(&amp;&amp;|&gt;=|&lt;=|\+\+|-&gt;|!=|\|\||//|==|@|!|\+|\?|&lt;|\.|&gt;|\*)">
<rule pattern="(&amp;&amp;|&gt;=|&lt;=|\+\+|-&gt;|!=|=|\|\||//|==|@|!|\+|\?|&lt;|\.|&gt;|\*)">
<token type="Operator"/>
</rule>
<rule pattern="[;:]">

View File

@@ -0,0 +1,59 @@
<lexer>
<config>
<name>NSIS</name>
<alias>nsis</alias>
<alias>nsi</alias>
<alias>nsh</alias>
<filename>*.nsi</filename>
<filename>*.nsh</filename>
<mime_type>text/x-nsis</mime_type>
<case_insensitive>true</case_insensitive>
<not_multiline>true</not_multiline>
</config>
<rules>
<state name="root">
<rule pattern="([;#].*)(\n)"><bygroups><token type="Comment"/><token type="TextWhitespace"/></bygroups></rule>
<rule pattern="&#x27;.*?&#x27;"><token type="LiteralStringSingle"/></rule>
<rule pattern="&quot;"><token type="LiteralStringDouble"/><push state="str_double"/></rule>
<rule pattern="`"><token type="LiteralStringBacktick"/><push state="str_backtick"/></rule>
<rule><include state="macro"/></rule>
<rule><include state="interpol"/></rule>
<rule><include state="basic"/></rule>
<rule pattern="\$\{[a-z_|][\w|]*\}"><token type="KeywordPseudo"/></rule>
<rule pattern="/[a-z_]\w*"><token type="NameAttribute"/></rule>
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
<rule pattern="[\w.]+"><token type="Text"/></rule>
</state>
<state name="basic">
<rule pattern="(\n)(Function)(\s+)([._a-z][.\w]*)\b"><bygroups><token type="TextWhitespace"/><token type="Keyword"/><token type="TextWhitespace"/><token type="NameFunction"/></bygroups></rule>
<rule pattern="\b([_a-z]\w*)(::)([a-z][a-z0-9]*)\b"><bygroups><token type="KeywordNamespace"/><token type="Punctuation"/><token type="NameFunction"/></bygroups></rule>
<rule pattern="\b([_a-z]\w*)(:)"><bygroups><token type="NameLabel"/><token type="Punctuation"/></bygroups></rule>
<rule pattern="(\b[ULS]|\B)([!&lt;&gt;=]?=|\&lt;\&gt;?|\&gt;)\B"><token type="Operator"/></rule>
<rule pattern="[|+-]"><token type="Operator"/></rule>
<rule pattern="\\"><token type="Punctuation"/></rule>
<rule pattern="\b(Abort|Add(?:BrandingImage|Size)|Allow(?:RootDirInstall|SkipFiles)|AutoCloseWindow|BG(?:Font|Gradient)|BrandingText|BringToFront|Call(?:InstDLL)?|(?:Sub)?Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|Create(?:Directory|Font|Shortcut)|Delete(?:INI(?:Sec|Str)|Reg(?:Key|Value))?|DetailPrint|DetailsButtonText|Dir(?:Show|Text|Var|Verify)|(?:Disabled|Enabled)Bitmap|EnableWindow|EnumReg(?:Key|Value)|Exch|Exec(?:Shell|Wait)?|ExpandEnvStrings|File(?:BufSize|Close|ErrorText|Open|Read(?:Byte)?|Seek|Write(?:Byte)?)?|Find(?:Close|First|Next|Window)|FlushINI|Function(?:End)?|Get(?:CurInstType|CurrentAddress|DlgItem|DLLVersion(?:Local)?|ErrorLevel|FileTime(?:Local)?|FullPathName|FunctionAddress|InstDirError|LabelAddress|TempFileName)|Goto|HideWindow|Icon|If(?:Abort|Errors|FileExists|RebootFlag|Silent)|InitPluginsDir|Install(?:ButtonText|Colors|Dir(?:RegKey)?)|Inst(?:ProgressFlags|Type(?:[GS]etText)?)|Int(?:CmpU?|Fmt|Op)|IsWindow|LangString(?:UP)?|License(?:BkColor|Data|ForceSelection|LangString|Text)|LoadLanguageFile|LockWindow|Log(?:Set|Text)|MessageBox|MiscButtonText|Name|Nop|OutFile|(?:Uninst)?Page(?:Ex(?:End)?)?|PluginDir|Pop|Push|Quit|Read(?:(?:Env|INI|Reg)Str|RegDWORD)|Reboot|(?:Un)?RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|Section(?:Divider|End|(?:(?:Get|Set)(?:Flags|InstTypes|Size|Text))|Group(?:End)?|In)?|SendMessage|Set(?:AutoClose|BrandingImage|Compress(?:ionLevel|or(?:DictSize)?)?|CtlColors|CurInstType|DatablockOptimize|DateSave|Details(?:Print|View)|Error(?:s|Level)|FileAttributes|Font|OutPath|Overwrite|PluginUnload|RebootFlag|ShellVarContext|Silent|StaticBkColor)|Show(?:(?:I|Uni)nstDetails|Window)|Silent(?:Un)?Install|Sleep|SpaceTexts|Str(?:CmpS?|Cpy|Len)|SubSection(?:End)?|Uninstall(?:ButtonText|(?:Sub)?Caption|EXEName|Icon|Text)|UninstPage|Var|VI(?:AddVersionKey|ProductVersion)|WindowIcon|Write(?:INIStr|Reg(:?Bin|DWORD|(?:Expand)?Str)|Uninstaller)|XPStyle)\b"><token type="Keyword"/></rule>
<rule pattern="\b(CUR|END|(?:FILE_ATTRIBUTE_)?(?:ARCHIVE|HIDDEN|NORMAL|OFFLINE|READONLY|SYSTEM|TEMPORARY)|HK(CC|CR|CU|DD|LM|PD|U)|HKEY_(?:CLASSES_ROOT|CURRENT_(?:CONFIG|USER)|DYN_DATA|LOCAL_MACHINE|PERFORMANCE_DATA|USERS)|ID(?:ABORT|CANCEL|IGNORE|NO|OK|RETRY|YES)|MB_(?:ABORTRETRYIGNORE|DEFBUTTON[1-4]|ICON(?:EXCLAMATION|INFORMATION|QUESTION|STOP)|OK(?:CANCEL)?|RETRYCANCEL|RIGHT|SETFOREGROUND|TOPMOST|USERICON|YESNO(?:CANCEL)?)|SET|SHCTX|SW_(?:HIDE|SHOW(?:MAXIMIZED|MINIMIZED|NORMAL))|admin|all|auto|both|bottom|bzip2|checkbox|colored|current|false|force|hide|highest|if(?:diff|newer)|lastused|leave|left|listonly|lzma|nevershow|none|normal|off|on|pop|push|radiobuttons|right|show|silent|silentlog|smooth|textonly|top|true|try|user|zlib)\b"><token type="NameConstant"/></rule>
</state>
<state name="macro">
<rule pattern="\!(addincludedir(?:dir)?|addplugindir|appendfile|cd|define|delfilefile|echo(?:message)?|else|endif|error|execute|if(?:macro)?n?(?:def)?|include|insertmacro|macro(?:end)?|packhdr|search(?:parse|replace)|system|tempfilesymbol|undef|verbose|warning)\b"><token type="CommentPreproc"/></rule>
</state>
<state name="interpol">
<rule pattern="\$(R?[0-9])"><token type="NameBuiltinPseudo"/></rule>
<rule pattern="\$(ADMINTOOLS|APPDATA|CDBURN_AREA|COOKIES|COMMONFILES(?:32|64)|DESKTOP|DOCUMENTS|EXE(?:DIR|FILE|PATH)|FAVORITES|FONTS|HISTORY|HWNDPARENT|INTERNET_CACHE|LOCALAPPDATA|MUSIC|NETHOOD|PICTURES|PLUGINSDIR|PRINTHOOD|PROFILE|PROGRAMFILES(?:32|64)|QUICKLAUNCH|RECENT|RESOURCES(?:_LOCALIZED)?|SENDTO|SM(?:PROGRAMS|STARTUP)|STARTMENU|SYSDIR|TEMP(?:LATES)?|VIDEOS|WINDIR|\{NSISDIR\})"><token type="NameBuiltin"/></rule>
<rule pattern="\$(CMDLINE|INSTDIR|OUTDIR|LANGUAGE)"><token type="NameVariableGlobal"/></rule>
<rule pattern="\$[a-z_]\w*"><token type="NameVariable"/></rule>
</state>
<state name="str_double">
<rule pattern="&quot;"><token type="LiteralStringDouble"/><pop depth="1"/></rule>
<rule pattern="\$(\\[nrt&quot;]|\$)"><token type="LiteralStringEscape"/></rule>
<rule><include state="interpol"/></rule>
<rule pattern="[^&quot;]+"><token type="LiteralStringDouble"/></rule>
</state>
<state name="str_backtick">
<rule pattern="`"><token type="LiteralStringDouble"/><pop depth="1"/></rule>
<rule pattern="\$(\\[nrt&quot;]|\$)"><token type="LiteralStringEscape"/></rule>
<rule><include state="interpol"/></rule>
<rule pattern="[^`]+"><token type="LiteralStringDouble"/></rule>
</state>
</rules>
</lexer>

View File

@@ -0,0 +1,121 @@
<lexer>
<config>
<name>Nu</name>
<alias>nu</alias>
<filename>*.nu</filename>
<mime_type>text/plain</mime_type>
</config>
<rules>
<state name="root">
<rule><include state="basic" /></rule>
<rule><include state="data" /></rule>
</state>
<state name="basic">
<rule
pattern="\b(alias|all|ansi|ansi gradient|ansi link|ansi strip|any|append|ast|attr category|attr deprecated|attr example|attr search-terms|banner|bits|bits and|bits not|bits or|bits rol|bits ror|bits shl|bits shr|bits xor|break|bytes|bytes add|bytes at|bytes build|bytes collect|bytes ends-with|bytes index-of|bytes length|bytes remove|bytes replace|bytes reverse|bytes split|bytes starts-with|cal|cd|char|chunk-by|chunks|clear|collect|columns|commandline|commandline edit|commandline get-cursor|commandline set-cursor|compact|complete|config|config env|config flatten|config nu|config reset|config use-colors|const|continue|cp|date|date format|date from-human|date humanize|date list-timezone|date now|date to-timezone|debug|debug env|debug info|debug profile|decode|decode base32|decode base32hex|decode base64|decode hex|def|default|describe|detect columns|do|drop|drop column|drop nth|du|each|each while|echo|encode|encode base32|encode base32hex|encode base64|encode hex|enumerate|error make|every|exec|exit|explain|explore|export|export alias|export const|export def|export extern|export module|export use|export-env|extern|fill|filter|find|first|flatten|for|format|format bits|format date|format duration|format filesize|format number|format pattern|from|from csv|from json|from msgpack|from msgpackz|from nuon|from ods|from ssv|from toml|from tsv|from url|from xlsx|from xml|from yaml|from yml|generate|get|glob|grid|group-by|hash|hash md5|hash sha256|headers|help|help aliases|help commands|help escapes|help externs|help modules|help operators|help pipe-and-redirect|hide|hide-env|histogram|history|history import|history session|http|http delete|http get|http head|http options|http patch|http post|http put|if|ignore|input|input list|input listen|insert|inspect|interleave|into|into binary|into bool|into cell-path|into datetime|into duration|into filesize|into float|into glob|into int|into record|into sqlite|into string|into value|is-admin|is-empty|is-not-empty|is-terminal|items|job|job flush|job id|job kill|job list|job recv|job send|job spawn|job tag|job unfreeze|join|keybindings|keybindings default|keybindings list|keybindings listen|kill|last|length|let|let-env|lines|load-env|loop|ls|match|math|math abs|math arccos|math arccosh|math arcsin|math arcsinh|math arctan|math arctanh|math avg|math ceil|math cos|math cosh|math exp|math floor|math ln|math log|math max|math median|math min|math mode|math product|math round|math sin|math sinh|math sqrt|math stddev|math sum|math tan|math tanh|math variance|merge|merge deep|metadata|metadata access|metadata set|mkdir|mktemp|module|move|mut|mv|nu-check|nu-highlight|open|overlay|overlay hide|overlay list|overlay new|overlay use|panic|par-each|parse|path|path basename|path dirname|path exists|path expand|path join|path parse|path relative-to|path self|path split|path type|plugin|plugin add|plugin list|plugin rm|plugin stop|plugin use|port|prepend|print|ps|pwd|query db|random|random binary|random bool|random chars|random dice|random float|random int|random uuid|reduce|reject|rename|return|reverse|rm|roll|roll down|roll left|roll right|roll up|rotate|run-external|save|schema|scope|scope aliases|scope commands|scope engine-stats|scope externs|scope modules|scope variables|select|seq|seq char|seq date|shuffle|skip|skip until|skip while|sleep|slice|sort|sort-by|source|source-env|split|split cell-path|split chars|split column|split list|split row|split words|start|stor|stor create|stor delete|stor export|stor import|stor insert|stor open|stor reset|stor update|str|str camel-case|str capitalize|str contains|str distance|str downcase|str ends-with|str expand|str index-of|str join|str kebab-case|str length|str pascal-case|str replace|str reverse|str screaming-snake-case|str snake-case|str starts-with|str stats|str substring|str title-case|str trim|str upcase|sys|sys cpu|sys disks|sys host|sys mem|sys net|sys temp|sys users|table|take|take until|take while|tee|term|term query|term size|timeit|to|to csv|to html|to json|to md|to msgpack|to msgpackz|to nuon|to text|to toml|to tsv|to xml|to yaml|to yml|touch|transpose|try|tutor|ulimit|uname|uniq|uniq-by|update|update cells|upsert|url|url build-query|url decode|url encode|url join|url parse|url split-query|use|values|version|version check|view|view blocks|view files|view ir|view source|view span|watch|where|which|while|whoami|window|with-env|wrap|zip)(\s*)\b"
><bygroups><token type="Keyword" /><token
type="TextWhitespace"
/></bygroups></rule>
<rule pattern="\A#!.+\n"><token type="CommentHashbang" /></rule>
<rule pattern="#.*\n"><token type="CommentSingle" /></rule>
<rule pattern="\\[\w\W]"><token type="LiteralStringEscape" /></rule>
<rule pattern="(\b\w+)(\s*)(\+?=)"><bygroups><token
type="NameVariable"
/><token type="TextWhitespace" /><token
type="Operator"
/></bygroups></rule>
<rule pattern="[\[\]{}()=]"><token type="Operator" /></rule>
<rule pattern="&lt;&lt;&lt;"><token type="Operator" /></rule>
<rule pattern="&lt;&lt;-?\s*(\&#x27;?)\\?(\w+)[\w\W]+?\2"><token
type="LiteralString"
/></rule>
<rule pattern="&amp;&amp;|\|\|"><token type="Operator" /></rule>
<rule pattern="\$[a-zA-Z_]\w*"><token type="NameVariable" /></rule>
</state>
<state name="data">
<rule pattern="\$&quot;"><token type="LiteralStringDouble" /><push
state="interpolated_string"
/></rule>
<rule pattern="(?s)&quot;(\\.|[^&quot;\\])*&quot;"><token
type="LiteralStringDouble"
/></rule>
<rule pattern="&quot;"><token type="LiteralStringDouble" /><push
state="string"
/></rule>
<rule pattern="(?s)\$&#x27;(\\\\|\\[0-7]+|\\.|[^&#x27;\\])*&#x27;"><token
type="LiteralStringSingle"
/></rule>
<rule pattern="(?s)&#x27;.*?&#x27;"><token
type="LiteralStringSingle"
/></rule>
<rule pattern=";"><token type="Punctuation" /></rule>
<rule pattern="&amp;"><token type="Punctuation" /></rule>
<rule pattern="\|"><token type="Punctuation" /></rule>
<rule pattern="\s+"><token type="TextWhitespace" /></rule>
<rule pattern="\d+\b"><token type="LiteralNumber" /></rule>
<rule pattern="[^=\s\[\]{}()$&quot;\&#x27;`\\&lt;&amp;|;]+"><token
type="Text"
/></rule>
<rule pattern="&lt;"><token type="Text" /></rule>
</state>
<state name="string">
<rule pattern="&quot;"><token type="LiteralStringDouble" /><pop
depth="1"
/></rule>
<rule pattern="(?s)(\\\\|\\[0-7]+|\\.|[^&quot;\\$])+"><token
type="LiteralStringDouble"
/></rule>
</state>
<state name="interpolated_string">
<rule pattern="&quot;"><token type="LiteralStringDouble" /><pop
depth="1"
/></rule>
<rule pattern="\("><token type="LiteralStringInterpol" /><push
state="interpolation"
/></rule>
<rule pattern="(?s)(\\\\|\\[0-7]+|\\.|[^&quot;\\(])+"><token
type="LiteralStringDouble"
/></rule>
</state>
<state name="interpolation">
<rule pattern="\)"><token type="LiteralStringInterpol" /><pop
depth="1"
/></rule>
<rule><include state="root" /></rule>
</state>
<state name="curly">
<rule pattern="\}"><token type="LiteralStringInterpol" /><pop
depth="1"
/></rule>
<rule pattern=":-"><token type="Keyword" /></rule>
<rule pattern="\w+"><token type="NameVariable" /></rule>
<rule pattern="[^}:&quot;\&#x27;`$\\]+"><token
type="Punctuation"
/></rule>
<rule pattern=":"><token type="Punctuation" /></rule>
<rule><include state="root" /></rule>
</state>
<state name="paren">
<rule pattern="\)"><token type="Keyword" /><pop depth="1" /></rule>
<rule><include state="root" /></rule>
</state>
<state name="math">
<rule pattern="\)\)"><token type="Keyword" /><pop depth="1" /></rule>
<rule pattern="\*\*|\|\||&lt;&lt;|&gt;&gt;|[-+*/%^|&amp;&lt;&gt;]"><token
type="Operator"
/></rule>
<rule pattern="\d+#[\da-zA-Z]+"><token type="LiteralNumber" /></rule>
<rule pattern="\d+#(?! )"><token type="LiteralNumber" /></rule>
<rule pattern="0[xX][\da-fA-F]+"><token type="LiteralNumber" /></rule>
<rule pattern="\d+"><token type="LiteralNumber" /></rule>
<rule pattern="[a-zA-Z_]\w*"><token type="NameVariable" /></rule>
<rule><include state="root" /></rule>
</state>
<state name="backticks">
<rule pattern="`"><token type="LiteralStringBacktick" /><pop
depth="1"
/></rule>
<rule><include state="root" /></rule>
</state>
</rules>
</lexer>

View File

@@ -31,12 +31,9 @@
<rule pattern="\{[$].*?\}|\{[-](NOD|EXT|OBJ).*?\}|\([*][$].*?[*]\)">
<token type="CommentPreproc" />
</rule>
<!-- Comment Single -->
<rule pattern="(//.*?)(\n)">
<bygroups>
<token type="CommentSingle" />
<token type="TextWhitespace" />
</bygroups>
<!-- Comment -->
<rule pattern="//.*">
<token type="CommentSingle" />
</rule>
<!-- Comment Multiline Block -->
<rule pattern="\([*](.|\n)*?[*]\)">

View File

@@ -41,6 +41,14 @@
<rule pattern="\b(as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|false|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|match|method|module|mutable|new|object|of|open|private|raise|rec|sig|struct|then|to|true|try|type|value|val|virtual|when|while|with)\b">
<token type="Keyword"/>
</rule>
<rule pattern="({([a-z_]*)\|)([\s\S]+?)(?=\|\2})(\|\2})">
<bygroups>
<token type="LiteralStringAffix"/>
<token type="Ignore"/>
<token type="LiteralString"/>
<token type="LiteralStringAffix"/>
</bygroups>
</rule>
<rule pattern="(~|\}|\|]|\||\{&lt;|\{|`|_|]|\[\||\[&gt;|\[&lt;|\[|\?\?|\?|&gt;\}|&gt;]|&gt;|=|&lt;-|&lt;|;;|;|:&gt;|:=|::|:|\.\.|\.|-&gt;|-\.|-|,|\+|\*|\)|\(|&amp;&amp;|&amp;|#|!=)">
<token type="Operator"/>
</rule>

View File

@@ -51,6 +51,20 @@
<rule pattern = "\#[a-zA-Z_]+\b">
<token type = "NameDecorator"/>
</rule>
<rule pattern = "^\#\+\w+\s*$">
<token type = "NameAttribute"/>
</rule>
<rule pattern = "^(\#\+\w+)(\s+)(\!)?([A-Za-z0-9-_!]+)(?:(,)(\!)?([A-Za-z0-9-_!]+))*\s*$">
<bygroups>
<token type = "NameAttribute"/>
<token type = "TextWhitespace"/>
<token type = "Operator"/>
<token type = "Name"/>
<token type = "Punctuation"/>
<token type = "Operator"/>
<token type = "Name"/>
</bygroups>
</rule>
<rule pattern = "\@(\([a-zA-Z_]+\b\s*.*\)|\(?[a-zA-Z_]+\)?)">
<token type = "NameAttribute"/>
</rule>

View File

@@ -228,42 +228,42 @@
</rule>
</state>
<state name="inline">
<rule pattern="(\s)*(\*[^ \n*][^*]+?[^ \n*]\*)((?=\W|\n|$))">
<rule pattern="(\s*)(\*[^ \n*][^*]+?[^ \n*]\*)((?=\W|\n|$))">
<bygroups>
<token type="Text"/>
<token type="GenericStrong"/>
<token type="Text"/>
</bygroups>
</rule>
<rule pattern="(\s)*(/[^/]+?/)((?=\W|\n|$))">
<rule pattern="(\s*)(/[^/]+?/)((?=\W|\n|$))">
<bygroups>
<token type="Text"/>
<token type="GenericEmph"/>
<token type="Text"/>
</bygroups>
</rule>
<rule pattern="(\s)*(=[^\n=]+?=)((?=\W|\n|$))">
<rule pattern="(\s*)(=[^\n=]+?=)((?=\W|\n|$))">
<bygroups>
<token type="Text"/>
<token type="NameClass"/>
<token type="Text"/>
</bygroups>
</rule>
<rule pattern="(\s)*(~[^\n~]+?~)((?=\W|\n|$))">
<rule pattern="(\s*)(~[^\n~]+?~)((?=\W|\n|$))">
<bygroups>
<token type="Text"/>
<token type="NameClass"/>
<token type="Text"/>
</bygroups>
</rule>
<rule pattern="(\s)*(\+[^+]+?\+)((?=\W|\n|$))">
<rule pattern="(\s*)(\+[^+]+?\+)((?=\W|\n|$))">
<bygroups>
<token type="Text"/>
<token type="GenericDeleted"/>
<token type="Text"/>
</bygroups>
</rule>
<rule pattern="(\s)*(_[^_]+?_)((?=\W|\n|$))">
<rule pattern="(\s*)(_[^_]+?_)((?=\W|\n|$))">
<bygroups>
<token type="Text"/>
<token type="GenericUnderline"/>

View File

@@ -0,0 +1,119 @@
<lexer>
<config>
<name>Promela</name>
<alias>promela</alias>
<filename>*.pml</filename>
<filename>*.prom</filename>
<filename>*.prm</filename>
<filename>*.promela</filename>
<filename>*.pr</filename>
<filename>*.pm</filename>
<mime_type>text/x-promela</mime_type>
</config>
<rules>
<state name="statements">
<rule pattern="(\[\]|&lt;&gt;|/\\|\\/)|(U|W|V)\b"><token type="Operator"/></rule>
<rule pattern="@"><token type="Punctuation"/></rule>
<rule pattern="(\.)([a-zA-Z_]\w*)"><bygroups><token type="Operator"/><token type="NameAttribute"/></bygroups></rule>
<rule><include state="keywords"/></rule>
<rule><include state="types"/></rule>
<rule pattern="([LuU]|u8)?(&quot;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralString"/></bygroups><push state="string"/></rule>
<rule pattern="([LuU]|u8)?(&#x27;)(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\&#x27;\n])(&#x27;)"><bygroups><token type="LiteralStringAffix"/><token type="LiteralStringChar"/><token type="LiteralStringChar"/><token type="LiteralStringChar"/></bygroups></rule>
<rule pattern="0[xX]([0-9a-fA-F](\&#x27;?[0-9a-fA-F])*\.[0-9a-fA-F](\&#x27;?[0-9a-fA-F])*|\.[0-9a-fA-F](\&#x27;?[0-9a-fA-F])*|[0-9a-fA-F](\&#x27;?[0-9a-fA-F])*)[pP][+-]?[0-9a-fA-F](\&#x27;?[0-9a-fA-F])*[lL]?"><token type="LiteralNumberFloat"/></rule>
<rule pattern="(-)?(\d(\&#x27;?\d)*\.\d(\&#x27;?\d)*|\.\d(\&#x27;?\d)*|\d(\&#x27;?\d)*)[eE][+-]?\d(\&#x27;?\d)*[fFlL]?"><token type="LiteralNumberFloat"/></rule>
<rule pattern="(-)?((\d(\&#x27;?\d)*\.(\d(\&#x27;?\d)*)?|\.\d(\&#x27;?\d)*)[fFlL]?)|(\d(\&#x27;?\d)*[fFlL])"><token type="LiteralNumberFloat"/></rule>
<rule pattern="(-)?0[xX][0-9a-fA-F](\&#x27;?[0-9a-fA-F])*(([uU][lL]{0,2})|[lL]{1,2}[uU]?)?"><token type="LiteralNumberHex"/></rule>
<rule pattern="(-)?0[bB][01](\&#x27;?[01])*(([uU][lL]{0,2})|[lL]{1,2}[uU]?)?"><token type="LiteralNumberBin"/></rule>
<rule pattern="(-)?0(\&#x27;?[0-7])+(([uU][lL]{0,2})|[lL]{1,2}[uU]?)?"><token type="LiteralNumberOct"/></rule>
<rule pattern="(-)?\d(\&#x27;?\d)*(([uU][lL]{0,2})|[lL]{1,2}[uU]?)?"><token type="LiteralNumberInteger"/></rule>
<rule pattern="[~!%^&amp;*+=|?:&lt;&gt;/-]"><token type="Operator"/></rule>
<rule pattern="[()\[\],.]"><token type="Punctuation"/></rule>
<rule pattern="(true|false|NULL)\b"><token type="NameBuiltin"/></rule>
<rule pattern="(?!\d)(?:[\w$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8})+"><token type="Name"/></rule>
</state>
<state name="types">
<rule pattern="(bit|bool|byte|pid|short|int|unsigned)\b"><token type="KeywordType"/></rule>
</state>
<state name="keywords">
<rule pattern="(atomic|break|d_step|do|od|for|in|goto|if|fi|unless)\b"><token type="Keyword"/></rule>
<rule pattern="(assert|get_priority|printf|printm|set_priority)\b"><token type="NameFunction"/></rule>
<rule pattern="(c_code|c_decl|c_expr|c_state|c_track)\b"><token type="Keyword"/></rule>
<rule pattern="(_|_last|_nr_pr|_pid|_priority|else|np_|STDIN)\b"><token type="NameBuiltin"/></rule>
<rule pattern="(empty|enabled|eval|full|len|nempty|nfull|pc_value)\b"><token type="NameFunction"/></rule>
<rule pattern="run\b"><token type="OperatorWord"/></rule>
<rule pattern="(active|chan|D_proctype|hidden|init|local|mtype|never|notrace|proctype|show|trace|typedef|xr|xs)\b"><token type="KeywordDeclaration"/></rule>
<rule pattern="(priority|provided)\b"><token type="Keyword"/></rule>
<rule pattern="(inline|ltl|select)\b"><token type="KeywordDeclaration"/></rule>
<rule pattern="skip\b"><token type="Keyword"/></rule>
</state>
<state name="whitespace">
<rule pattern="^#if\s+0"><token type="CommentPreproc"/><push state="if0"/></rule>
<rule pattern="^#"><token type="CommentPreproc"/><push state="macro"/></rule>
<rule pattern="^(\s*(?:/[*].*?[*]/\s*)?)(#if\s+0)"><bygroups><usingself state="root"/><token type="CommentPreproc"/></bygroups><push state="if0"/></rule>
<rule pattern="^(\s*(?:/[*].*?[*]/\s*)?)(#)"><bygroups><usingself state="root"/><token type="CommentPreproc"/></bygroups><push state="macro"/></rule>
<rule pattern="(^[ \t]*)(?!(?:public|private|protected|default)\b)((?!\d)(?:[\w$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8})+)(\s*)(:)(?!:)"><bygroups><token type="TextWhitespace"/><token type="NameLabel"/><token type="TextWhitespace"/><token type="Punctuation"/></bygroups></rule>
<rule pattern="\n"><token type="TextWhitespace"/></rule>
<rule pattern="[^\S\n]+"><token type="TextWhitespace"/></rule>
<rule pattern="\\\n"><token type="Text"/></rule>
<rule pattern="//(?:.|(?&lt;=\\)\n)*\n"><token type="CommentSingle"/></rule>
<rule pattern="/(?:\\\n)?[*](?:[^*]|[*](?!(?:\\\n)?/))*[*](?:\\\n)?/"><token type="CommentMultiline"/></rule>
<rule pattern="/(\\\n)?[*][\w\W]*"><token type="CommentMultiline"/></rule>
</state>
<state name="root">
<rule><include state="whitespace"/></rule>
<rule><include state="keywords"/></rule>
<rule pattern="((?!\d)(?:[\w$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|::)+(?:[&amp;*\s])+)(\s*(?:(?:(?://(?:.|(?&lt;=\\)\n)*\n)|(?:/(?:\\\n)?[*](?:[^*]|[*](?!(?:\\\n)?/))*[*](?:\\\n)?/))\s*)*)((?!\d)(?:[\w$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|::)+)(\s*(?:(?:(?://(?:.|(?&lt;=\\)\n)*\n)|(?:/(?:\\\n)?[*](?:[^*]|[*](?!(?:\\\n)?/))*[*](?:\\\n)?/))\s*)*)(\([^;&quot;\&#x27;)]*?\))(\s*(?:(?:(?://(?:.|(?&lt;=\\)\n)*\n)|(?:/(?:\\\n)?[*](?:[^*]|[*](?!(?:\\\n)?/))*[*](?:\\\n)?/))\s*)*)([^;{/&quot;\&#x27;]*)(\{)"><bygroups><usingself state="root"/><usingself state="whitespace"/><token type="NameFunction"/><usingself state="whitespace"/><usingself state="root"/><usingself state="whitespace"/><usingself state="root"/><token type="Punctuation"/></bygroups><push state="function"/></rule>
<rule pattern="((?!\d)(?:[\w$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|::)+(?:[&amp;*\s])+)(\s*(?:(?:(?://(?:.|(?&lt;=\\)\n)*\n)|(?:/(?:\\\n)?[*](?:[^*]|[*](?!(?:\\\n)?/))*[*](?:\\\n)?/))\s*)*)((?!\d)(?:[\w$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|::)+)(\s*(?:(?:(?://(?:.|(?&lt;=\\)\n)*\n)|(?:/(?:\\\n)?[*](?:[^*]|[*](?!(?:\\\n)?/))*[*](?:\\\n)?/))\s*)*)(\([^;&quot;\&#x27;)]*?\))(\s*(?:(?:(?://(?:.|(?&lt;=\\)\n)*\n)|(?:/(?:\\\n)?[*](?:[^*]|[*](?!(?:\\\n)?/))*[*](?:\\\n)?/))\s*)*)([^;/&quot;\&#x27;]*)(;)"><bygroups><usingself state="root"/><usingself state="whitespace"/><token type="NameFunction"/><usingself state="whitespace"/><usingself state="root"/><usingself state="whitespace"/><usingself state="root"/><token type="Punctuation"/></bygroups></rule>
<rule><include state="types"/></rule>
<rule><push state="statement"/></rule>
</state>
<state name="statement">
<rule><include state="whitespace"/></rule>
<rule><include state="statements"/></rule>
<rule pattern="\}"><token type="Punctuation"/></rule>
<rule pattern="[{;]"><token type="Punctuation"/><pop depth="1"/></rule>
</state>
<state name="function">
<rule><include state="whitespace"/></rule>
<rule><include state="statements"/></rule>
<rule pattern=";"><token type="Punctuation"/></rule>
<rule pattern="\{"><token type="Punctuation"/><push/></rule>
<rule pattern="\}"><token type="Punctuation"/><pop depth="1"/></rule>
</state>
<state name="string">
<rule pattern="&quot;"><token type="LiteralString"/><pop depth="1"/></rule>
<rule pattern="\\([\\abfnrtv&quot;\&#x27;]|x[a-fA-F0-9]{2,4}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})"><token type="LiteralStringEscape"/></rule>
<rule pattern="[^\\&quot;\n]+"><token type="LiteralString"/></rule>
<rule pattern="\\\n"><token type="LiteralString"/></rule>
<rule pattern="\\"><token type="LiteralString"/></rule>
</state>
<state name="macro">
<rule pattern="(\s*(?:/[*].*?[*]/\s*)?)(include)(\s*(?:/[*].*?[*]/\s*)?)(&quot;[^&quot;]+&quot;)([^\n]*)"><bygroups><usingself state="root"/><token type="CommentPreproc"/><usingself state="root"/><token type="CommentPreprocFile"/><token type="CommentSingle"/></bygroups></rule>
<rule pattern="(\s*(?:/[*].*?[*]/\s*)?)(include)(\s*(?:/[*].*?[*]/\s*)?)(&lt;[^&gt;]+&gt;)([^\n]*)"><bygroups><usingself state="root"/><token type="CommentPreproc"/><usingself state="root"/><token type="CommentPreprocFile"/><token type="CommentSingle"/></bygroups></rule>
<rule pattern="[^/\n]+"><token type="CommentPreproc"/></rule>
<rule pattern="/[*](.|\n)*?[*]/"><token type="CommentMultiline"/></rule>
<rule pattern="//.*?\n"><token type="CommentSingle"/><pop depth="1"/></rule>
<rule pattern="/"><token type="CommentPreproc"/></rule>
<rule pattern="(?&lt;=\\)\n"><token type="CommentPreproc"/></rule>
<rule pattern="\n"><token type="CommentPreproc"/><pop depth="1"/></rule>
</state>
<state name="if0">
<rule pattern="^\s*#if.*?(?&lt;!\\)\n"><token type="CommentPreproc"/><push/></rule>
<rule pattern="^\s*#el(?:se|if).*\n"><token type="CommentPreproc"/><pop depth="1"/></rule>
<rule pattern="^\s*#endif.*?(?&lt;!\\)\n"><token type="CommentPreproc"/><pop depth="1"/></rule>
<rule pattern=".*?\n"><token type="Comment"/></rule>
</state>
<state name="classname">
<rule pattern="(?!\d)(?:[\w$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8})+"><token type="NameClass"/><pop depth="1"/></rule>
<rule pattern="\s*(?=&gt;)"><token type="Text"/><pop depth="1"/></rule>
<rule><pop depth="1"/></rule>
</state>
<state name="case-value">
<rule pattern="(?&lt;!:)(:)(?!:)"><token type="Punctuation"/><pop depth="1"/></rule>
<rule pattern="(?!\d)(?:[\w$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8})+"><token type="NameConstant"/></rule>
<rule><include state="whitespace"/></rule>
<rule><include state="statements"/></rule>
</state>
</rules>
</lexer>

View File

@@ -6,6 +6,7 @@
<alias>sage</alias>
<alias>python3</alias>
<alias>py3</alias>
<alias>starlark</alias>
<filename>*.py</filename>
<filename>*.pyi</filename>
<filename>*.pyw</filename>
@@ -19,6 +20,11 @@
<filename>BUILD</filename>
<filename>BUILD.bazel</filename>
<filename>WORKSPACE</filename>
<filename>WORKSPACE.bzlmod</filename>
<filename>WORKSPACE.bazel</filename>
<filename>MODULE.bazel</filename>
<filename>REPO.bazel</filename>
<filename>*.star</filename>
<filename>*.tac</filename>
<mime_type>text/x-python</mime_type>
<mime_type>application/x-python</mime_type>
@@ -586,4 +592,4 @@
</rule>
</state>
</rules>
</lexer>
</lexer>

View File

@@ -0,0 +1,94 @@
<lexer>
<config>
<name>Rego</name>
<alias>rego</alias>
<filename>*.rego</filename>
</config>
<rules>
<state name="root">
<rule pattern="(package|import|as|not|with|default|else|some|in|if|contains)\b">
<token type="KeywordDeclaration"/>
</rule>
<!-- importing keywords should then show up as keywords -->
<rule pattern="(import)( future.keywords.)(\w+)">
<bygroups>
<token type="KeywordDeclaration"/>
<token type="Text"/>
<token type="KeywordDeclaration"/>
</bygroups>
</rule>
<rule pattern="#[^\r\n]*">
<token type="Comment"/>
</rule>
<rule pattern="(FIXME|TODO|XXX)\b( .*)$">
<bygroups>
<token type="Error"/>
<token type="CommentSpecial"/>
</bygroups>
</rule>
<rule pattern="(true|false|null)\b">
<token type="KeywordConstant"/>
</rule>
<rule pattern="\d+i">
<token type="LiteralNumber"/>
</rule>
<rule pattern="\d+\.\d*([Ee][-+]\d+)?i">
<token type="LiteralNumber"/>
</rule>
<rule pattern="\.\d+([Ee][-+]\d+)?i">
<token type="LiteralNumber"/>
</rule>
<rule pattern="\d+[Ee][-+]\d+i">
<token type="LiteralNumber"/>
</rule>
<rule pattern="\d+(\.\d+[eE][+\-]?\d+|\.\d*|[eE][+\-]?\d+)">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="\.\d+([eE][+\-]?\d+)?">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="(0|[1-9][0-9]*)">
<token type="LiteralNumberInteger"/>
</rule>
<rule pattern="&#34;&#34;&#34;.*?&#34;&#34;&#34;">
<token type="LiteralStringDouble"/>
</rule>
<rule pattern="&#34;(\\\\|\\&#34;|[^&#34;])*&#34;">
<token type="LiteralStringDouble"/>
</rule>
<rule pattern="\$/((?!/\$).)*/\$">
<token type="LiteralString"/>
</rule>
<rule pattern="/(\\\\|\\&#34;|[^/])*/">
<token type="LiteralString"/>
</rule>
<rule pattern="^(\w+)">
<token type="Name"/>
</rule>
<rule pattern="[a-z_-][\w-]*(?=\()">
<token type="NameFunction"/>
</rule>
<rule pattern="[\r\n\s]+">
<token type="TextWhitespace"/>
</rule>
<rule pattern="(package|import)(\s+)">
<bygroups>
<token type="KeywordDeclaration"/>
<token type="Text"/>
</bygroups>
</rule>
<rule pattern="[=&lt;&gt;!+-/*&amp;|]">
<token type="Operator"/>
</rule>
<rule pattern=":=">
<token type="Operator"/>
</rule>
<rule pattern="[[\]{}():;]+">
<token type="Punctuation"/>
</rule>
<rule pattern="[$a-zA-Z_]\w*">
<token type="NameOther"/>
</rule>
</state>
</rules>
</lexer>

View File

@@ -0,0 +1,239 @@
<lexer>
<config>
<name>RGBDS Assembly</name>
<alias>rgbasm</alias>
<filename>*.asm</filename>
<priority>0.5</priority>
<case_insensitive>true</case_insensitive>
</config>
<rules>
<!-- Symbol state for parsing anything between curly brackets -->
<state name="symbol">
<rule pattern="[^{}]+">
<token type="NameVariable"/>
</rule>
<rule pattern="{">
<token type="Punctuation"/>
<push state="symbol"/>
</rule>
<rule pattern="}">
<token type="Punctuation"/>
<pop depth="1"/>
</rule>
</state>
<!-- String states for parsing quote-delimited text that may contain symbols -->
<state name="string">
<rule pattern="[^{&#34;\n\\]+">
<token type="LiteralString"/>
</rule>
<rule pattern="\\.">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="{">
<token type="Punctuation"/>
<push state="symbol"/>
</rule>
<rule pattern="(&#34;|\n)">
<token type="LiteralString"/>
<pop depth="1"/>
</rule>
</state>
<state name="stringmultiline">
<rule pattern="&#34;{3}">
<token type="LiteralString"/>
<pop depth="1"/>
</rule>
<rule pattern="[^{\\]+?">
<token type="LiteralString"/>
</rule>
<rule pattern="\\.">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="{">
<token type="Punctuation"/>
<push state="symbol"/>
</rule>
</state>
<!-- Root state -->
<state name="root">
<!-- Comments -->
<rule pattern=";.*?$">
<token type="CommentSingle"/>
</rule>
<rule pattern="/[*](.|\n)*?[*]/">
<token type="CommentMultiline"/>
</rule>
<!-- Local label -->
<rule pattern="^(\.)(\w+)(:?)">
<bygroups>
<token type="Punctuation"/>
<token type="NameLabel"/>
<token type="Punctuation"/>
</bygroups>
</rule>
<!-- Global label (with optional local) -->
<rule pattern="(^\w+)(?:(\.)(\w+))?(::?)">
<bygroups>
<token type="NameLabel"/>
<token type="Punctuation"/>
<token type="NameLabel"/>
<token type="Punctuation"/>
</bygroups>
</rule>
<!-- Symbols delimited by curly brackets -->
<rule pattern="{">
<token type="Punctuation"/>
<push state="symbol"/>
</rule>
<!-- Numeric types (can contain '_' except at the beginning) -->
<rule pattern="(0x|\$)[0-9a-fA-F][0-9a-fA-F_]*">
<token type="LiteralNumberHex"/>
</rule>
<rule pattern="[0-9a-fA-F][0-9a-fA-F_]*h\b">
<token type="LiteralNumberHex"/>
</rule>
<rule pattern="(0o|&amp;)[0-7][0-7_]*">
<token type="LiteralNumberOct"/>
</rule>
<rule pattern="(0b|%)[01][01_]*">
<token type="LiteralNumberBin"/>
</rule>
<rule pattern="-?[0-9][0-9_]*\.[0-9_]+(q[0-9]+)?">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="-?[0-9][0-9_]*">
<token type="LiteralNumberInteger"/>
</rule>
<!-- "Game Boy graphics" format, which can be made of user-defined symbols -->
<rule pattern="`[^\s]+">
<token type="LiteralNumberInteger"/>
</rule>
<!-- #-prefixed raw string (multiline) -->
<rule pattern="(#)(&#34;{3}(?:.|\n)*?&#34;{3})">
<bygroups>
<token type="LiteralStringAffix"/>
<token type="LiteralString"/>
</bygroups>
</rule>
<!-- #-prefixed raw string -->
<rule pattern="(#)(&#34;.*?&#34;)">
<bygroups>
<token type="LiteralStringAffix"/>
<token type="LiteralString"/>
</bygroups>
</rule>
<!-- Start of quote-delimited (non-raw) strings -->
<rule pattern="&#34;{3}">
<token type="LiteralString"/>
<push state="stringmultiline"/>
</rule>
<rule pattern="&#34;">
<token type="LiteralString"/>
<push state="string"/>
</rule>
<!-- Macro arguments (single character) -->
<rule pattern="\\[1-9@#]">
<token type="NameVariableMagic"/>
</rule>
<!-- Macro arguments (bracketed) -->
<rule pattern="(\\&lt;)([^&gt;]+)(&gt;)">
<bygroups>
<token type="NameVariableMagic"/>
<usingself state="root"/>
<token type="NameVariableMagic"/>
</bygroups>
</rule>
<!-- LDI/LDD alternate formats -->
<rule pattern="(\[)(hl\+|hl-|hli|hld)(\])">
<bygroups>
<token type="Punctuation"/>
<token type="Keyword"/>
<token type="Punctuation"/>
</bygroups>
</rule>
<!-- Punctuation (excluding period which is used in predeclared symbols) -->
<rule pattern="[\[\],()\\:]">
<token type="Punctuation"/>
</rule>
<!-- Variable definitions that can contain RL, which is also an opcode -->
<rule pattern="((?:re)?def)([\t ]+)([\w{}:]+)([\t ]+)(rb|rw|rl|equs|equ)?">
<bygroups>
<token type="NameBuiltin"/>
<token type="TextWhitespace"/>
<usingself state="root"/>
<token type="TextWhitespace"/>
<token type="NameBuiltin"/>
</bygroups>
</rule>
<!-- Specific rule for some names that are both built-ins and functions -->
<rule pattern="\b(bank|section)(\()\b">
<bygroups>
<token type="NameFunction"/>
<token type="Punctuation"/>
</bygroups>
</rule>
<!-- Specific rule for options redefinitions -->
<rule pattern="\b(opt|pusho)([\t ]+)([^,\s]+)(?:(,)([\t ]*)([^,\s]+))*">
<bygroups>
<token type="NameBuiltin"/>
<token type="TextWhitespace"/>
<token type="Literal"/>
<token type="Punctuation"/>
<token type="TextWhitespace"/>
<token type="Literal"/>
</bygroups>
</rule>
<!-- Predeclared symbols -->
<rule pattern="\b(_rs|_narg|__date__|__time__|__iso_8601_local__|__iso_8601_utc__|__utc_year__|__utc_month__|__utc_day__|__utc_hour__|__utc_minute__|__utc_second__|__rgbds_major__|__rgbds_minor__|__rgbds_patch__|__rgbds_rc__|__rgbds_version__)\b">
<token type="NameVariableMagic"/>
</rule>
<!-- Built-in statements -->
<rule pattern="\b(align|assert|bank|break|charmap|db|dl|ds|dw|elif|else|endc|endl|endm|endr|endsection|endu|export|fail|fatal|for|fragment|hram|if|incbin|include|load|macro|newcharmap|nextu|oam|popc|popo|pops|println|print|purge|pushc|pusho|pushs|redef|rept|rom0|romx|rsreset|rsset|section|setcharmap|shift|sram|static_assert|union|vram|warn|wram0|wramx)">
<token type="NameBuiltin"/>
</rule>
<!-- Integer functions -->
<rule pattern="\b(high|low|bitwidth|tzcount)\b">
<token type="NameFunction"/>
</rule>
<!-- Fixed-point functions -->
<rule pattern="\b(div|mul|fmod|pow|log|round|ceil|floor|sin|cos|tan|asin|acos|atan|atan2)\b">
<token type="NameFunction"/>
</rule>
<!-- String functions -->
<rule pattern="\b(strcat|strupr|strlwr|strslice|strrpl|strfmt|strchar|revchar|strlen|strcmp|strfind|strrfind|incharmap|charlen|charcmp|charsize|strsub|strin|strrin|charsub)\b">
<token type="NameFunction"/>
</rule>
<!-- Other functions, excluding some that are the same as built-ins (BANK and SECTION) -->
<rule pattern="\b(def|isconst|sizeof|startof)">
<token type="NameFunction"/>
</rule>
<!-- Opcodes -->
<rule pattern="\b(adc|add|and|bit|call|ccf|cp|cpl|daa|dec|di|ei|halt|inc|jp|jr|ld|ldd|ldh|ldi|nop|or|pop|push|res|ret|reti|rlca|rla|rlc|rl|rr|rra|rrc|rrca|rst|sbc|scf|set|sla|sra|srl|stop|sub|swap|xor)\b">
<token type="Keyword"/>
</rule>
<!-- Registers and flags -->
<rule pattern="\b(a|f|b|c|d|e|h|l|af|bc|de|hl|sp|pc|z|nz|nc)\b">
<token type="Keyword"/>
</rule>
<!-- Operators -->
<rule pattern="[-%!+/*~\^&amp;|=&lt;&gt;]">
<token type="Operator"/>
</rule>
<!-- Reference to label -->
<rule pattern="(\.)?(\w+)">
<bygroups>
<token type="Punctuation"/>
<token type="Name"/>
</bygroups>
</rule>
<!-- Predeclared symbols (non-words) -->
<rule pattern="(@|\.|\.\.)">
<token type="NameVariableMagic"/>
</rule>
<!-- Default text -->
<rule pattern="\s+">
<token type="TextWhitespace"/>
</rule>
</state>
</rules>
</lexer>

View File

@@ -0,0 +1,74 @@
<lexer>
<config>
<name>Ring</name>
<alias>ring</alias>
<filename>*.ring</filename>
<filename>*.rh</filename>
<filename>*.rform</filename>
<mime_type>text/x-ring</mime_type>
<case_insensitive>true</case_insensitive>
</config>
<rules>
<state name="root">
<rule pattern="\s+"><token type="Text"/></rule>
<rule pattern="//.*?\n"><token type="CommentSingle"/></rule>
<rule pattern="#.*?\n"><token type="CommentSingle"/></rule>
<rule pattern="/\*"><token type="CommentMultiline"/><push state="comment"/></rule>
<rule pattern="^\s*(changeringkeyword|changeringoperator|disablehashcomments|enablehashcomments|loadsyntax)\b"><token type="CommentPreproc"/></rule>
<rule pattern=":[a-zA-Z_@$][\w@$]*"><token type="LiteralStringSymbol"/></rule>
<rule pattern="&quot;"><token type="LiteralStringDouble"/><push state="string-double"/></rule>
<rule pattern="&#x27;"><token type="LiteralStringSingle"/><push state="string-single"/></rule>
<rule pattern="`"><token type="LiteralStringBacktick"/><push state="string-backtick"/></rule>
<rule pattern="(\bclass)(\s+)(\w+)"><bygroups><token type="KeywordDeclaration"/><token type="Text"/><token type="NameClass"/></bygroups></rule>
<rule pattern="(\bfrom)(\s+)(\w+)"><bygroups><token type="KeywordDeclaration"/><token type="Text"/><token type="NameClass"/></bygroups></rule>
<rule pattern="(\bfunc|def|function)(\s+)(\w+)"><bygroups><token type="KeywordDeclaration"/><token type="Text"/><token type="NameFunction"/></bygroups></rule>
<rule pattern="(\bpackage|import)(\s+)([a-zA-Z_@$][\w@$.]*)"><bygroups><token type="KeywordNamespace"/><token type="Text"/><token type="NameNamespace"/></bygroups></rule>
<rule pattern="(\bnew)(\s+)(\w+)"><bygroups><token type="KeywordPseudo"/><token type="Text"/><token type="NameClass"/></bygroups></rule>
<rule pattern="\b(if|but|elseif|else|other|ok|endif|end|switch|on|case|off|endswitch|for|in|to|step|next|endfor|foreach|while|endwhile|do|again|return|bye|exit|break|loop|continue|call)\b"><token type="Keyword"/></rule>
<rule pattern="\b(try|catch|done|endtry)\b"><token type="Keyword"/></rule>
<rule pattern="\b(class|endclass|from|func|def|function|endfunc|endfunction|package|endpackage|private)\b"><token type="KeywordDeclaration"/></rule>
<rule pattern="\b(load|import)\b"><token type="KeywordNamespace"/></rule>
<rule pattern="\b(new|self|this|super)\b"><token type="KeywordPseudo"/></rule>
<rule pattern="\b(see|put|give|get)\b"><token type="Keyword"/></rule>
<rule pattern="\b(true|false|nl|null|tab|cr|sysargv|ccatcherror|ringoptionalfunctions)\b"><token type="NameBuiltinPseudo"/></rule>
<rule pattern="\b(and|or|not)\b"><token type="OperatorWord"/></rule>
<rule pattern="\b(acos|add|addattribute|adddays|addmethod|ascii|asin|assert|atan|atan2|attributes|binarysearch|bytes2double|bytes2float|bytes2int|callgarbagecollector|callgc|ceil|cfunctions|char|chdir|checkoverflow|classes|classname|clearerr|clock|clockspersecond|closelib|copy|cos|cosh|currentdir|date|dec|decimals|del|diffdays|dir|direxists|double2bytes|eval|exefilename|exefolder|exp|fabs|fclose|feof|ferror|fexists|fflush|fgetc|fgetpos|fgets|filename|find|float2bytes|floor|fopen|fputc|fputs|fread|freopen|fseek|fsetpos|ftell|functions|fwrite|getarch|getattribute|getchar|getfilesize|getnumber|getpathtype|getpointer|getptr|getstring|globals|hex|hex2str|importpackage|input|insert|int2bytes|intvalue|isalnum|isalpha|isandroid|isattribute|iscfunction|isclass|iscntrl|isdigit|isfreebsd|isfunction|isglobal|isgraph|islinux|islist|islocal|islower|ismacosx|ismethod|ismsdos|isnull|isnumber|isobject|ispackage|ispackageclass|ispointer|isprint|isprivateattribute|isprivatemethod|ispunct|isspace|isstring|isunix|isupper|iswindows|iswindows64|isxdigit|left|len|lines|list|list2str|loadlib|locals|log|log10|lower|max|memcpy|memorycopy|mergemethods|methods|min|murmur3hash|newlist|nofprocessors|nothing|nullpointer|nullptr|number|obj2ptr|object2pointer|objectid|optionalfunc|packageclasses|packagename|packages|parentclassname|perror|pointer2object|pointer2string|pointercompare|pow|prevfilename|print|print2str|ptr2obj|ptr2str|ptrcmp|puts|raise|random|randomize|read|ref|reference|refcount|remove|rename|reverse|rewind|right|ring_give|ring_see|ring_state_delete|ring_state_filetokens|ring_state_findvar|ring_state_init|ring_state_main|ring_state_mainfile|ring_state_new|ring_state_newvar|ring_state_resume|ring_state_runcode|ring_state_runcodeatins|ring_state_runfile|ring_state_runobjectfile|ring_state_scannererror|ring_state_setvar|ring_state_stringtokens|ringvm_callfunc|ringvm_calllist|ringvm_cfunctionslist|ringvm_classeslist|ringvm_codelist|ringvm_evalinscope|ringvm_fileslist|ringvm_functionslist|ringvm_genarray|ringvm_give|ringvm_hideerrormsg|ringvm_info|ringvm_ismempool|ringvm_memorylist|ringvm_packageslist|ringvm_passerror|ringvm_runcode|ringvm_scopescount|ringvm_see|ringvm_settrace|ringvm_tracedata|ringvm_traceevent|ringvm_tracefunc|setattribute|setpointer|setptr|shutdown|sin|sinh|sort|space|sqrt|srandom|str2hex|str2hexcstyle|str2list|strcmp|string|substr|swap|sysget|sysset|syssleep|system|sysunset|tan|tanh|tempfile|tempname|time|timelist|trim|type|ungetc|unsigned|upper|uptime|variablepointer|varptr|version|windowsnl|write)\b(?=\s*\()"><token type="NameBuiltin"/></rule>
<rule pattern="0x[a-f0-9_]+"><token type="LiteralNumberHex"/></rule>
<rule pattern="0b[01_]+"><token type="LiteralNumberBin"/></rule>
<rule pattern="0o[0-7_]+"><token type="LiteralNumberOct"/></rule>
<rule pattern="[0-9]+(?:_[0-9]+)*\.[0-9]*(?:_[0-9]+)*([eE][-+]?[0-9]+)?"><token type="LiteralNumberFloat"/></rule>
<rule pattern="[0-9]+(?:_[0-9]+)*"><token type="LiteralNumberInteger"/></rule>
<rule pattern="(\+\+|\-\-|\*\*|\^\^|!=|&lt;=|&gt;=|&lt;&lt;|&gt;&gt;|&amp;&amp;|\|\|)"><token type="Operator"/></rule>
<rule pattern="(\+=|-=|\*=|/=|%=|&lt;&lt;=|&gt;&gt;=|&amp;=|\|=|\^=)"><token type="Operator"/></rule>
<rule pattern="[-+/*%=&lt;&gt;&amp;|!~.:^?]"><token type="Operator"/></rule>
<rule pattern="[\[\](){},;]"><token type="Punctuation"/></rule>
<rule pattern="[a-zA-Z_@$][\w@$]*"><token type="Name"/></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>
<state name="string-double">
<rule pattern="[^&quot;#]+"><token type="LiteralStringDouble"/></rule>
<rule pattern="#\{"><token type="LiteralStringInterpol"/><push state="interpolation"/></rule>
<rule pattern="&quot;"><token type="LiteralStringDouble"/><pop depth="1"/></rule>
</state>
<state name="string-single">
<rule pattern="[^&#x27;#]+"><token type="LiteralStringSingle"/></rule>
<rule pattern="#\{"><token type="LiteralStringInterpol"/><push state="interpolation"/></rule>
<rule pattern="&#x27;"><token type="LiteralStringSingle"/><pop depth="1"/></rule>
</state>
<state name="string-backtick">
<rule pattern="[^`#]+"><token type="LiteralStringBacktick"/></rule>
<rule pattern="#\{"><token type="LiteralStringInterpol"/><push state="interpolation"/></rule>
<rule pattern="`"><token type="LiteralStringBacktick"/><pop depth="1"/></rule>
</state>
<state name="interpolation">
<rule pattern="\}"><token type="LiteralStringInterpol"/><pop depth="1"/></rule>
<rule><include state="root"/></rule>
</state>
</rules>
</lexer>

View File

@@ -0,0 +1,176 @@
<lexer>
<config>
<name>RPGLE</name>
<alias>SQLRPGLE</alias>
<alias>RPG IV</alias>
<filename>*.RPGLE</filename>
<filename>*.rpgle</filename>
<filename>*.SQLRPGLE</filename>
<filename>*.sqlrpgle</filename>
<mime_type>text/x-rpgle</mime_type>
<mime_type>text/x-sqlrpgle</mime_type>
<case_insensitive>true</case_insensitive>
<analyse>
<regex pattern="\*\*free" score="0.9"/>
<regex pattern="ctl-opt" score="0.9"/>
<regex pattern="dcl-(ds|s|f|proc|pr|pi)" score="0.9"/>
<regex pattern="\*in[0-9][0-9]" score="0.5"/>
</analyse>
</config>
<rules>
<state name="root">
<rule pattern="\/\/.*">
<token type="Comment"/>
</rule>
<rule pattern="^\*\*free$">
<token type="CommentSpecial"/>
</rule>
<rule pattern="\*\*((ctdata|ftrans|altseq)(\s+\w+)?)?(\r|\n|\r\n)">
<token type="CommentSpecial"/> <!-- compile-time arrays at the end of the file, introduced by ** -->
<push state="compile-time-array"/>
</rule>
<rule pattern="(\*(all(g|oc|ow|sep|thread|u|x)?|altseq|alwblanknum|ascii|astfill|aut[lo]|basic|blank(s)?|caller|cancl|cdmy(0)?|change|char|cl|cmd(y|y0)?|cnowiden|cntrld|col|comp(at)?|concurrent|constants|constructor|convert|copyright|crt(bndrpg|rpgmod)|ct(data|lbdy|lspec)|cur(lib|sym)|cvt(data)?|cwiden|cymd(0)?|data|date(time)?|day(s)?|dclcase|ddm|debugio|dec|delete|det[cl]|dft|diag|dmy|dtaara|dump|end|entry(exit)?|equate|escape|eur(0)?|exact|exclude|excp|exp(dds|include)|ext(desc|dft)?|file(s)?|first|ftrans|full|gen|getin|graph(ic)?|hex|hival|hms|hours|ignore|ilerpg|in([0-9]{2}|H[1-9]|K[A-Y]|L[1-9]|LR|O[AGV]|U[1-8])?|INFO|INHERIT|INIT|INP(UT(ONLY|PACKED)?)?|INZ(OFL|SR)|ISO(0)?|JAVA|JIS|JOB(RUN(0|MIX|_DBCS|_JAVA|_MIXED)?)?|JUL|KEEP|KEY|LANGID(SHR|UNQ)|LDA|LGL|LIB(L|RCRTAUT)|LIKE(DS)?|LIST|LOCK|LONG(JOBRUN(0)?|JUL(0)?)|LOVAL|LVL[12]|MAX(DIGITS)?|MDY(0)?|MINUTES|MIXED(ASCII|EBCDIC)|MN|MODE|MODULE|MONTH(S)?|MS(ECONDS)?|M[A-Z]{3}[0-9]{4}|NATURAL|NEW|NEXT|NO(ALLOW|CHGDSLEN|COL|CVT(DATA)?|DATETIME|DEBUGIO|EXACT|EXPDDS|EXPINCLUDE|EXT|GEN|GRAPHIC|IND|INPUTPACKED|INZOFL|KEY|PASS|RMVCOMMENT|SECLVL|SHOWCPY|SHOWSKP|SRCSTMT|UNREF|VARCHAR|VARGRAPHIC|XREF|ZONED)?|NONE|NOTIFY|NULL(IND)?|OFF|OFL|OMIT|ON(EXIT|LY)?|OPCODE|OUT(PUT)?|OWNER|PARM(S)?|PCML|PDA|PEP|PGM(BDY)?|PLACE|PROC|PROGRAM|PSSR|RECORD|REQUIRE|RESDECPOS|RETVAL|RIGHTADJ|RMVCOMMENT|ROUTINE|SECLVL|SECONDS|SELF|SERIALIZE|SHOW(CPY|SKP)|SIZE|SNGLVL|SRC(MBRTXT|STMT)?|START|STATUS|STDCHARSIZE|STGMDL|STRICTKEYS|STRING|SYS|TBL|TERASPACE|TERM|THREAD_(CONCURRENT|SERIALIZE)|TOT[CL]|TRIM|UCS2|UNIQUE|UNREF|UNSET|UPDATE|USA(0)?|USE(DECEDIT)?|USER|USR(CTL|SPC)|UTF(8|16)?|V[0-9]R[0-9]M[0-9]|V[678]|VAR(CHAR|GRAPHIC|SIZE)?|WARN|XMLSAX|XML_(ATTR_(CHARS|NAME|PREDEF_REF|UCS2_REF)|CHARS|COMMENT|DOCTYPE_DECL|ENCODING_DECL|END_(ATTR|CDATA|DOCUMENT|ELEMENT)|EXCEPTION|PI_(DATA|TARGET)|PREDEF_REF|STANDALONE_DECL|START_(CDATA|DOCUMENT|ELEMENT)|UCS2_REF|UNKNOWN_(ATTR_REF|REF)|VERSION_INFO)|XREF|YEAR(S)?|YES|YMD(0)?|ZERO(S)?|ZONED|[DHMNSY]))\b">
<token type="Literal"/> <!-- Special values -->
</rule>
<rule pattern="\bexec\s+sql\b"> <!-- embedded SQL -->
<token type="Keyword"/>
<push state="exec-sql"/>
</rule>
<rule pattern="(%(abs|addr|alloc|bitand|bitnot|bitor|bitxor|char|charcount|check|checkr|concat|concatarr|data|date|days|dec|dech|decpos|diff|div|editc|editflt|editw|elem|eof|equal|error|fields|float|found|gen|graph|handler|hival|hours|int|inth|kds|left|len|list|lookup(lt|ge|gt|le)?|loval|lower|max|maxarr|min|minutes|minarr|months|mseconds|msg|nullind|occur|omitted|open|paddr|parms|parmnum|parser|passed|proc|range|realloc|rem|replace|right|scan|scanr|scanrpl|seconds|shtdn|size|split|sqrt|status|str|subarr|subdt|subst|target|this|time|timestamp|tlookup(lt|ge|gt|le)?|trim(l|r)?|ucs2|uns|unsh|upper|xfoot|xlate|xml|years))\b">
<token type="NameFunctionMagic"/> <!-- builtin functions -->
</rule>
<rule pattern="\b(ind|int|uns|(var)?char|bindec|float|packed|zoned|time(stamp)?|date|pointer|clob|blob|(var)?graph|object|(var)?ucs2)\b">
<token type="KeywordType"/> <!-- variable types -->
</rule>
<rule pattern="\b(dcl\-(ds|pi|proc|pr|[csf])|end\-(ds|pi|proc|pr)|ctl\-opt|const|value|to|downto|not)\b">
<token type="Keyword"/> <!-- Syntax keywords -->
</rule>
<rule pattern="\b(acq|add|adddur|alloc|and(gt|lt|eq|ne|ge|le)?|begsr|bitoff|biton|cab(gt|lt|eq|ne|ge|le)?|call(b|p)?|cas(gt|lt|eq|ne|ge|le)?|cat|chain|check|checkr|clear|close|commit|comp|data-gen|data-into|dealloc|define|delete|div|do((u|w)(gt|lt|eq|ne|ge|le)?)?|dsply|dump|else(if)?|end(cs|do|for|if|mon|sl|sr)?|eval(r|-corr)?|except|exfmt|exsr|extrct|feod|for(-each)?|force|goto|if(gt|lt|eq|ne|ge|le)?|in|iter|kfld|klist|leave(sr)?|lookup|m(hh|hl|lh|ll)zo|monitor|move[al]?|mult|mvr|next|occur|on-(error|excp|exit)|open|or(gt|lt|eq|ne|ge|le)?|other|out|parm|plist|post|read(c|e|p|pe)?|realloc|rel|reset|return|rolbk|scan|select|set(gt|ll|off|on)|shtdn|snd-msg|sorta|sqrt|sub(dur|st)?|tag|test[bnz]?|time|unlock|update|when(gt|lt|eq|ne|ge|le)?|when-i[ns]|write|xfoot|slate|xml-(into|sax)|z-(add|sub))\b">
<token type="Keyword"/> <!-- Operation codes -->
</rule>
<rule pattern="\b(alloc|altseq|ccsid|copy(nest|right)|cursym|dat(edit|fmt)|debug|dec(edit|prec)|dftname|expropts|extbinint|fltdiv|formsalign|ftrans|intprec|(no)?main|openopt|thread|timfmt|actgrp|alwnull|aut|bnddir|cvtopt|dateyy|dftactgrp|enbpfrcol|fixnbr|genlvl|indent|langid|optimize|option|pgminfo|prfdta|reqprexp|strseq|stgmdl|text|truncnbr|usrprf)\b">
<token type="KeywordReserved"/> <!-- ctl-opt (former H spec) -->
</rule>
<rule pattern="\b(alias|block|commit|charcount|data|datfmt|devid|disk|ext(desc|file|ind|mbr)|form(len|ofl)|handler|ignore|include|in(dds|fds|fsr)|keyed|keyloc|likefile|maxdev|oflind|pass|pgmname|plist|prefix|printer|prtctl|qualified|rafdata|recno|rename|save(ds|ind)|seq|sfile|sln|special|static|template|timfmt|usage|usropn|workstn)\b">
<token type="KeywordReserved"/> <!-- dcl-f (former F spec) -->
</rule>
<rule pattern="\b(\*(yes|no|natural|stdcharsize|(no)?cvt|ext(desc)?|inu[1-8]|char|only|file|noind|ext|compat|input|output|update|delete))\b">
<token type="Literal"/> <!-- F spec special values-->
</rule>
<rule pattern="\b(alias|align|alt|altseq|ascend|based|ccsid|class|const|ctdata|datfmt|descend|dim|dtaara|export|ext(fld|fmt|name|pgm|proc)?|fromfile|import|inz|len|like(ds|file|rec)?|noopt|nullind|occurs|opdesc|options|overlay|overload|packeven|perrcd|pos|prefix|procptr|psds|qualified|reqproto|rtnparm|samepos|static|template|timfmt|tofile|value|varying)\b">
<token type="KeywordReserved"/> <!-- Other keywords (not operation codes nor ctl-opt/H spec) -> mostly used with variables -->
</rule>
<rule pattern="(/(copy|define|eject|else|elseif|end-exec|end-free|endif|eof|exec|free|if|include|restore|set|space|title|undefine))\b">
<token type="CommentPreproc"/> <!-- Preprocessor instructions -->
</rule>
<rule pattern="\b([0-9]+((\.[0-9]?)(e[+-][0-9]+)?)?)\b">
<token type="LiteralNumber"/>
</rule>
<rule pattern="\bx'[0-9a-fA-F]*'">
<token type="LiteralString"/> <!-- Hex string -->
</rule>
<rule pattern="'(''|[^'])*'">
<token type="LiteralString"/>
</rule>
<rule pattern="[,:;\(\)\.]+">
<token type="Punctuation"/>
</rule>
<rule pattern="((\*\*)|(&lt;&gt;)|=|([&lt;&gt;\+\-\*\/]=?))+">
<token type="Operator"/> <!-- Arithmetic operators -->
</rule>
<rule pattern="\s">
<token type="TextWhitespace"/>
</rule>
<rule pattern=".">
<token type="Text"/>
</rule>
</state>
<state name="exec-sql">
<rule pattern=';'>
<token type="Punctuation"/>
<pop depth="1"/>
</rule>
<rule pattern="\s+">
<token type="TextWhitespace"/>
</rule>
<rule pattern="--.*\n?">
<token type="CommentSingle"/>
</rule>
<rule pattern="/\*">
<token type="CommentMultiline"/>
<push state="sql-multiline-comments"/>
</rule>
<rule pattern="&#39;">
<token type="LiteralStringSingle"/>
<push state="sql-string"/>
</rule>
<rule pattern="&#34;">
<token type="LiteralStringDouble"/>
<push state="sql-double-string"/>
</rule>
<rule pattern="(DATETIME_INTERVAL_PRECISION|PARAMETER_SPECIFIC_CATALOG|PARAMATER_ORDINAL_POSITION|USER_DEFINED_TYPE_CATALOG|PARAMATER_SPECIFIC_SCHEMA|TRANSACTIONS_ROLLED_BACK|USER_DEFINED_TYPE_SCHEMA|PARAMETER_SPECIFIC_NAME|DATETIME_INTERVAL_CODE|TRANSACTIONS_COMMITTED|USER_DEFINED_TYPE_NAME|CHARACTER_SET_CATALOG|DYNAMIC_FUNCTION_CODE|COMMAND_FUNCTION_CODE|RETURNED_OCTET_LENGTH|MESSAGE_OCTET_LENGTH|CHARACTER_SET_SCHEMA|CONSTRAINT_CATALOG|TRANSACTION_ACTIVE|CHARACTER_SET_NAME|CURRENT_TIMESTAMP|CONSTRAINT_SCHEMA|COLLATION_CATALOG|RETURNED_SQLSTATE|DYNAMIC_FUNCTION|CONDITION_NUMBER|CHARACTER_LENGTH|COMMAND_FUNCTION|COLLATION_SCHEMA|CHARACTERISTICS|TRIGGER_CATALOG|CONNECTION_NAME|SUBCLASS_ORIGIN|RETURNED_LENGTH|TIMEZONE_MINUTE|CONSTRAINT_NAME|ROUTINE_CATALOG|TRIGGER_SCHEMA|ROUTINE_SCHEMA|LOCALTIMESTAMP|IMPLEMENTATION|PARAMATER_NAME|MESSAGE_LENGTH|PARAMETER_MODE|COLLATION_NAME|TIMEZONE_HOUR|SPECIFIC_NAME|DETERMINISTIC|CORRESPONTING|AUTHORIZATION|INSTANTIABLE|CURRENT_TIME|CURRENT_USER|ROUTINE_NAME|NOCREATEUSER|MESSAGE_TEXT|SQLEXCEPTION|CATALOG_NAME|SESSION_USER|CLASS_ORIGIN|CURRENT_ROLE|SPECIFICTYPE|SERIALIZABLE|CURRENT_DATE|OCTET_LENGTH|CURRENT_PATH|TRIGGER_NAME|CHAR_LENGTH|SYSTEM_USER|REFERENCING|UNENCRYPTED|COLUMN_NAME|SQLWARNINIG|DIAGNOSTICS|CURSOR_NAME|SERVER_NAME|INSENSITIVE|SCHEMA_NAME|UNCOMMITTED|TRANSACTION|CONSTRUCTOR|LANCOMPILER|CARDINALITY|CONSTRAINTS|TRANSLATION|CHECKPOINT|CONSTRAINT|CONNECTION|PRIVILEGES|COMPLETION|CONVERSION|DELIMITERS|TABLE_NAME|INDITCATOR|INITIALIZE|DESCRIPTOR|REPEATABLE|CREATEUSER|DEFERRABLE|DESTRUCTOR|PROCEDURAL|DICTIONARY|DISCONNECT|TRANSFORMS|KEY_MEMBER|BIT_LENGTH|ASYMMETRIC|ASSIGNMENT|ASENSITIVE|OVERRIDING|PARAMETERS|REFERENCES|ORDINALITY|NOCREATEDB|STATISTICS|DEALLOCATE|SAVE_POINT|RECURSIVE|STRUCTURE|SUBSTRING|IMMEDIATE|GENERATED|SYMMETRIC|STATEMENT|INCREMENT|IMMUTABLE|INCLUDING|COMMITTED|TEMPORARY|INITIALLY|TERMINATE|PRECISION|DELIMITER|TIMESTAMP|INTERSECT|ISOLATION|TRANSFORM|TRANSLATE|ROW_COUNT|ASSERTION|PARAMETER|EXCLUSIVE|LOCALTIME|VALIDATOR|AGGREGATE|EXCLUDING|SENSITIVE|EXCEPTION|ENCRYPTED|OPERATION|HIERARCHY|COLLATION|PROCEDURE|CONTINUE|ENCODING|MINVALUE|SPECIFIC|ABSOLUTE|SECURITY|WHENEVER|EXISTING|VOLATILE|MAXVALUE|EXTERNAL|NULLABLE|VARIABLE|SQLERROR|DISTINCT|DISPATCH|END-EXEC|LOCATION|ALLOCATE|OVERLAPS|UNLISTEN|ROLLBACK|TRUNCATE|DESCRIBE|SQLSTATE|BACKWARD|FUNCTION|LANGUAGE|KEY_TYPE|CASCADED|POSITION|TRAILING|DEFERRED|RELATIVE|DEFAULTS|COALSECE|PREORDER|GROUPING|MODIFIES|INHERITS|PRESERVE|DATABASE|RESTRICT|IDENTITY|TEMPLATE|NATIONAL|CONTAINS|CREATEDB|IMPLICIT|OPERATOR|CONVERT|CURRENT|CONNECT|RECHECK|PRIMARY|STORAGE|DECLARE|DEFAULT|HANDLER|COLLATE|PREPARE|REINDEX|GRANTED|CHECKED|POSTFIX|REPLACE|INSTEAD|CATALOG|RESTART|INVOKER|PLACING|PENDANT|DEFINED|ITERATE|PARTIAL|CASCADE|BREADTH|GENERAL|TRIGGER|SESSION|BETWEEN|DEFINER|LATERAL|LEADING|RETURNS|TRUSTED|UNKNOWN|FORWARD|UNNAMED|OVERLAY|FORTRAN|ANALYZE|OPTIONS|ANALYSE|FOREIGN|ROUTINE|LOCATOR|DESTROY|SUBLIST|VERBOSE|EXTRACT|NOTNULL|EXPLAIN|VERSION|SQLCODE|EXECUTE|NOTHING|DYNAMIC|WITHOUT|SIMILAR|NATURAL|COMMENT|CLUSTER|PASCAL|SOURCE|EQUALS|CALLED|ESCAPE|EXCEPT|SELECT|ISNULL|DOMAIN|SEARCH|SCROLL|SIMPLE|BITVAR|MINUTE|EXISTS|SCHEMA|ATOMIC|METHOD|NOTIFY|ACCESS|UNIQUE|ROLLUP|NULLIF|OBJECT|STABLE|COLUMN|REVOKE|OFFSET|COMMIT|MODIFY|FREEZE|DELETE|RETURN|RESULT|UNNEST|OPTION|GLOBAL|VALUES|RENAME|SYSTEM|STATIC|UPDATE|OUTPUT|LISTEN|STDOUT|STRICT|PUBLIC|IGNORE|PREFIX|SECOND|CREATE|LENGTH|BEFORE|HAVING|INSERT|VACUUM|CURSOR|ELSIF|USING|ALTER|STYPE|CYCLE|LARGE|INPUT|CROSS|INOUT|INNER|INFIX|INDEX|LEVEL|USAGE|ILIKE|VALID|OWNER|GRANT|READS|UPPER|LIMIT|OUTER|STDIN|SYSID|GROUP|ALIAS|ORDER|UNTIL|LOCAL|RESET|START|COUNT|LOWER|TABLE| TEMP|PRIOR|AFTER|STATE|ADMIN|RIGHT|COBOL|FOUND|MATCH|FORCE|ABORT|FIRST|FINAL|CLOSE|DEREF|FETCH|WHERE|FALSE|SCALE|BEGIN|CLASS|TOAST|WRITE|NCLOB|NCHAR|CHECK|CHAIN|SPACE|NAMES|EVERY|MUMPS|CACHE|UNION|UNDER|SETOF|MONTH|SHARE|SCOPE|TREAT|SHOW|SIZE|SOME|SETS|SELF|ELSE|EACH|DROP|TYPE|FROM|RULE|DESC|ROWS|ZONE|ROLE|TRUE|FREE|FULL|GOTO|TRIM|HOLD|HOST|DATA|READ|INTO|USER|JOIN|CUBE|LAST|LEFT|LESS|LIKE|LOAD|LOCK|OPEN|COPY|ONLY|OIDS|VIEW|WHEN|THAN|THEN|NULL|NONE|WITH|WORK|NEXT|YEAR|MODE|CAST|CASE|MOVE|CALL|MORE|BOTH|EXEC|CLOB|OUT|MOD|ARE|SUM|DAY|GET|AVG|NEW|SQL|ABS|MIN|ASC|END|ROW|NOT|FOR|ANY|PLI|MAX|REF|MAP|ADA|KEY|AND|ADD|ALL|OLD|OFF|PAD|SET|OR|ON|TO|IS|OF|IN|IF|GO|AS|DO|AT|NO|BY|C|G)\b">
<token type="Keyword"/>
</rule>
<rule pattern="(CHARACTER|SMALLINT|INTERVAL|DECIMAL|SERIAL8|VARYING|BOOLEAN|VARCHAR|INTEGER|NUMERIC|SERIAL|BINARY|BIGINT|NUMBER|FLOAT|ARRAY|TEXT|REAL|INT8|DATE|CHAR|BLOB|DEC|BIT|INT)\b">
<token type="NameBuiltin"/>
</rule>
<rule pattern="[+*/&lt;&gt;=~!@#%^&amp;|`?-]">
<token type="Operator"/>
</rule>
<rule pattern="[0-9]+">
<token type="LiteralNumberInteger"/>
</rule>
<rule pattern="[a-z_][\w$]*">
<token type="Name"/>
</rule>
<rule pattern="[;:()\[\],.]">
<token type="Punctuation"/>
</rule>
</state>
<state name="sql-multiline-comments">
<rule pattern="/\*">
<token type="CommentMultiline"/>
<push state="sql-multiline-comments"/>
</rule>
<rule pattern="\*/">
<token type="CommentMultiline"/>
<pop depth="1"/>
</rule>
<rule pattern="[^/*]+">
<token type="CommentMultiline"/>
</rule>
<rule pattern="[/*]">
<token type="CommentMultiline"/>
</rule>
</state>
<state name="sql-string">
<rule pattern="[^&#39;]+">
<token type="LiteralStringSingle"/>
</rule>
<rule pattern="&#39;&#39;">
<token type="LiteralStringSingle"/>
</rule>
<rule pattern="&#39;">
<token type="LiteralStringSingle"/>
<pop depth="1"/>
</rule>
</state>
<state name="sql-double-string">
<rule pattern="[^&#34;]+">
<token type="LiteralStringDouble"/>
</rule>
<rule pattern="&#34;&#34;">
<token type="LiteralStringDouble"/>
</rule>
<rule pattern="&#34;">
<token type="LiteralStringDouble"/>
<pop depth="1"/>
</rule>
</state>
<state name="compile-time-array">
<rule pattern="[^\r\n]*(\r|\n|\r\n)?">
<token type="CommentSpecial"/>
</rule>
</state>
</rules>
</lexer>

View File

@@ -0,0 +1,58 @@
<lexer>
<config>
<name>RPMSpec</name>
<alias>spec</alias>
<filename>*.spec</filename>
<mime_type>text/x-rpm-spec</mime_type>
</config>
<rules>
<state name="root">
<rule pattern="#.*$"><token type="Comment"/></rule>
<rule><include state="basic"/></rule>
</state>
<state name="description">
<rule pattern="^(%(?:package|prep|build|install|clean|check|pre[a-z]*|post[a-z]*|trigger[a-z]*|files))(.*)$"><bygroups><token type="NameDecorator"/><token type="Text"/></bygroups><pop depth="1"/></rule>
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
<rule pattern="."><token type="Text"/></rule>
</state>
<state name="changelog">
<rule pattern="\*.*$"><token type="GenericSubheading"/></rule>
<rule pattern="^(%(?:package|prep|build|install|clean|check|pre[a-z]*|post[a-z]*|trigger[a-z]*|files))(.*)$"><bygroups><token type="NameDecorator"/><token type="Text"/></bygroups><pop depth="1"/></rule>
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
<rule pattern="."><token type="Text"/></rule>
</state>
<state name="string">
<rule pattern="&quot;"><token type="LiteralStringDouble"/><pop depth="1"/></rule>
<rule pattern="\\([\\abfnrtv&quot;\&#x27;]|x[a-fA-F0-9]{2,4}|[0-7]{1,3})"><token type="LiteralStringEscape"/></rule>
<rule><include state="interpol"/></rule>
<rule pattern="."><token type="LiteralStringDouble"/></rule>
</state>
<state name="basic">
<rule><include state="macro"/></rule>
<rule pattern="(?i)^(Name|Version|Release|Epoch|Summary|Group|License|Packager|Vendor|Icon|URL|Distribution|Prefix|Patch[0-9]*|Source[0-9]*|Requires\(?[a-z]*\)?|[a-z]+Req|Obsoletes|Suggests|Provides|Conflicts|Build[a-z]+|[a-z]+Arch|Auto[a-z]+)(:)(.*)$"><bygroups><token type="GenericHeading"/><token type="Punctuation"/><usingself state="root"/></bygroups></rule>
<rule pattern="^%description"><token type="NameDecorator"/><push state="description"/></rule>
<rule pattern="^%changelog"><token type="NameDecorator"/><push state="changelog"/></rule>
<rule pattern="^(%(?:package|prep|build|install|clean|check|pre[a-z]*|post[a-z]*|trigger[a-z]*|files))(.*)$"><bygroups><token type="NameDecorator"/><token type="Text"/></bygroups></rule>
<rule pattern="%(attr|defattr|dir|doc(?:dir)?|setup|config(?:ure)?|make(?:install)|ghost|patch[0-9]+|find_lang|exclude|verify)"><token type="Keyword"/></rule>
<rule><include state="interpol"/></rule>
<rule pattern="&#x27;.*?&#x27;"><token type="LiteralStringSingle"/></rule>
<rule pattern="&quot;"><token type="LiteralStringDouble"/><push state="string"/></rule>
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
<rule pattern="."><token type="Text"/></rule>
</state>
<state name="macro">
<rule pattern="%define.*$"><token type="CommentPreproc"/></rule>
<rule pattern="%\{\!\?.*%define.*\}"><token type="CommentPreproc"/></rule>
<rule pattern="(%(?:if(?:n?arch)?|else(?:if)?|endif))(.*)$"><bygroups><token type="CommentPreproc"/><token type="Text"/></bygroups></rule>
</state>
<state name="interpol">
<rule pattern="%\{?__[a-z_]+\}?"><token type="NameFunction"/></rule>
<rule pattern="%\{?_([a-z_]+dir|[a-z_]+path|prefix)\}?"><token type="KeywordPseudo"/></rule>
<rule pattern="%\{\?\w+\}"><token type="NameVariable"/></rule>
<rule pattern="\$\{?RPM_[A-Z0-9_]+\}?"><token type="NameVariableGlobal"/></rule>
<rule pattern="%\{[a-zA-Z]\w+\}"><token type="KeywordConstant"/></rule>
</state>
</rules>
</lexer>

View File

@@ -1,3 +1,4 @@
<?xml version="1.0" ?>
<lexer>
<config>
<name>Sed</name>
@@ -10,19 +11,82 @@
</config>
<rules>
<state name="root">
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
<rule pattern="#.*$"><token type="CommentSingle"/></rule>
<rule pattern="[0-9]+"><token type="LiteralNumberInteger"/></rule>
<rule pattern="\$"><token type="Operator"/></rule>
<rule pattern="[{};,!]"><token type="Punctuation"/></rule>
<rule pattern="[dDFgGhHlnNpPqQxz=]"><token type="Keyword"/></rule>
<rule pattern="([berRtTvwW:])([^;\n]*)"><bygroups><token type="Keyword"/><token type="LiteralStringSingle"/></bygroups></rule>
<rule pattern="([aci])((?:.*?\\\n)*(?:.*?[^\\]$))"><bygroups><token type="Keyword"/><token type="LiteralStringDouble"/></bygroups></rule>
<rule pattern="([qQ])([0-9]*)"><bygroups><token type="Keyword"/><token type="LiteralNumberInteger"/></bygroups></rule>
<rule pattern="(/)((?:(?:\\[^\n]|[^\\])*?\\\n)*?(?:\\.|[^\\])*?)(/)"><bygroups><token type="Punctuation"/><token type="LiteralStringRegex"/><token type="Punctuation"/></bygroups></rule>
<rule pattern="(\\(.))((?:(?:\\[^\n]|[^\\])*?\\\n)*?(?:\\.|[^\\])*?)(\2)"><bygroups><token type="Punctuation"/>None<token type="LiteralStringRegex"/><token type="Punctuation"/></bygroups></rule>
<rule pattern="(y)(.)((?:(?:\\[^\n]|[^\\])*?\\\n)*?(?:\\.|[^\\])*?)(\2)((?:(?:\\[^\n]|[^\\])*?\\\n)*?(?:\\.|[^\\])*?)(\2)"><bygroups><token type="Keyword"/><token type="Punctuation"/><token type="LiteralStringSingle"/><token type="Punctuation"/><token type="LiteralStringSingle"/><token type="Punctuation"/></bygroups></rule>
<rule pattern="(s)(.)((?:(?:\\[^\n]|[^\\])*?\\\n)*?(?:\\.|[^\\])*?)(\2)((?:(?:\\[^\n]|[^\\])*?\\\n)*?(?:\\.|[^\\])*?)(\2)((?:[gpeIiMm]|[0-9])*)"><bygroups><token type="Keyword"/><token type="Punctuation"/><token type="LiteralStringRegex"/><token type="Punctuation"/><token type="LiteralStringSingle"/><token type="Punctuation"/><token type="Keyword"/></bygroups></rule>
<rule pattern="\s+">
<token type="TextWhitespace" />
</rule>
<rule pattern="#.*$">
<token type="CommentSingle" />
</rule>
<rule pattern="[0-9]+">
<token type="LiteralNumberInteger" />
</rule>
<rule pattern="\$">
<token type="Operator" />
</rule>
<rule pattern="[{};,!]">
<token type="Punctuation" />
</rule>
<rule pattern="[dDFgGhHlnNpPqQxz=]">
<token type="Keyword" />
</rule>
<rule pattern="([berRtTvwW:])([^;\n]*)">
<bygroups>
<token type="Keyword" />
<token type="LiteralStringSingle" />
</bygroups>
</rule>
<rule pattern="([aci])((?:.*?\\\n)*(?:.*?[^\\]$))">
<bygroups>
<token type="Keyword" />
<token type="LiteralStringDouble" />
</bygroups>
</rule>
<rule pattern="([qQ])([0-9]*)">
<bygroups>
<token type="Keyword" />
<token type="LiteralNumberInteger" />
</bygroups>
</rule>
<rule pattern="(/)((?:(?:\\[^\n]|[^\\])*?\\\n)*?(?:\\.|[^\\])*?)(/)">
<bygroups>
<token type="Punctuation" />
<token type="LiteralStringRegex" />
<token type="Punctuation" />
</bygroups>
</rule>
<rule pattern="(\\(.))((?:(?:\\[^\n]|[^\\])*?\\\n)*?(?:\\.|[^\\])*?)(\2)">
<bygroups>
<token type="Punctuation" />
<token type="Text" />
<token type="LiteralStringRegex" />
<token type="Punctuation" />
</bygroups>
</rule>
<rule
pattern="(y)(.)((?:(?:\\[^\n]|[^\\])*?\\\n)*?(?:\\.|[^\\])*?)(\2)((?:(?:\\[^\n]|[^\\])*?\\\n)*?(?:\\.|[^\\])*?)(\2)"
>
<bygroups>
<token type="Keyword" />
<token type="Punctuation" />
<token type="LiteralStringSingle" />
<token type="Punctuation" />
<token type="LiteralStringSingle" />
<token type="Punctuation" />
</bygroups>
</rule>
<rule
pattern="(s)(.)((?:(?:\\[^\n]|[^\\])*?\\\n)*?(?:\\.|[^\\])*?)(\2)((?:(?:\\[^\n]|[^\\])*?\\\n)*?(?:\\.|[^\\])*?)(\2)((?:[gpeIiMm]|[0-9])*)"
>
<bygroups>
<token type="Keyword" />
<token type="Punctuation" />
<token type="LiteralStringRegex" />
<token type="Punctuation" />
<token type="LiteralStringSingle" />
<token type="Punctuation" />
<token type="Keyword" />
</bygroups>
</rule>
</state>
</rules>
</lexer>

View File

@@ -0,0 +1,58 @@
<lexer>
<config>
<name>SNBT</name>
<alias>snbt</alias>
<filename>*.snbt</filename>
<mime_type>text/snbt</mime_type>
</config>
<rules>
<state name="root">
<rule pattern="\{"><token type="Punctuation"/><push state="compound"/></rule>
<rule pattern="[^\{]+"><token type="Text"/></rule>
</state>
<state name="whitespace">
<rule pattern="\s+"><token type="TextWhitespace"/></rule>
</state>
<state name="operators">
<rule pattern="[,:;]"><token type="Punctuation"/></rule>
</state>
<state name="literals">
<rule pattern="(true|false)"><token type="KeywordConstant"/></rule>
<rule pattern="-?\d+[eE]-?\d+"><token type="LiteralNumberFloat"/></rule>
<rule pattern="-?\d*\.\d+[fFdD]?"><token type="LiteralNumberFloat"/></rule>
<rule pattern="-?\d+[bBsSlLfFdD]?"><token type="LiteralNumberInteger"/></rule>
<rule pattern="&quot;"><token type="LiteralStringDouble"/><push state="literals.string_double"/></rule>
<rule pattern="&#x27;"><token type="LiteralStringSingle"/><push state="literals.string_single"/></rule>
</state>
<state name="literals.string_double">
<rule pattern="\\."><token type="LiteralStringEscape"/></rule>
<rule pattern="[^\\&quot;\n]+"><token type="LiteralStringDouble"/></rule>
<rule pattern="&quot;"><token type="LiteralStringDouble"/><pop depth="1"/></rule>
</state>
<state name="literals.string_single">
<rule pattern="\\."><token type="LiteralStringEscape"/></rule>
<rule pattern="[^\\&#x27;\n]+"><token type="LiteralStringSingle"/></rule>
<rule pattern="&#x27;"><token type="LiteralStringSingle"/><pop depth="1"/></rule>
</state>
<state name="compound">
<rule pattern="[A-Z_a-z]+"><token type="NameAttribute"/></rule>
<rule><include state="operators"/></rule>
<rule><include state="whitespace"/></rule>
<rule><include state="literals"/></rule>
<rule pattern="\{"><token type="Punctuation"/><push/></rule>
<rule pattern="\["><token type="Punctuation"/><push state="list"/></rule>
<rule pattern="\}"><token type="Punctuation"/><pop depth="1"/></rule>
</state>
<state name="list">
<rule pattern="[A-Z_a-z]+"><token type="NameAttribute"/></rule>
<rule><include state="literals"/></rule>
<rule><include state="operators"/></rule>
<rule><include state="whitespace"/></rule>
<rule pattern="\["><token type="Punctuation"/><push/></rule>
<rule pattern="\{"><token type="Punctuation"/><push state="compound"/></rule>
<rule pattern="\]"><token type="Punctuation"/><pop depth="1"/></rule>
</state>
</rules>
</lexer>

View File

@@ -157,8 +157,20 @@
<rule pattern="(continue|returns|storage|memory|delete|return|throw|break|catch|while|else|from|new|try|for|if|is|as|do|in|_)\b">
<token type="Keyword"/>
</rule>
<rule pattern="assembly\b">
<token type="Keyword"/>
<rule pattern="(assembly)(\s+\()(.+)(\)\s+{)">
<bygroups>
<token type="Keyword"/>
<token type="Text"/>
<token type="LiteralString"/>
<token type="Text"/>
</bygroups>
<push state="assembly"/>
</rule>
<rule pattern="(assembly)(\s+{)">
<bygroups>
<token type="Keyword"/>
<token type="Text"/>
</bygroups>
<push state="assembly"/>
</rule>
<rule pattern="(contract|interface|enum|event|struct)(\s+)([a-zA-Z_]\w*)">
@@ -235,7 +247,7 @@
<token type="Punctuation"/>
<pop depth="1"/>
</rule>
<rule pattern="[(),]">
<rule pattern="[(),.]">
<token type="Punctuation"/>
</rule>
<rule pattern=":=|=:">
@@ -276,4 +288,4 @@
</rule>
</state>
</rules>
</lexer>
</lexer>

View File

@@ -3,138 +3,147 @@
<name>Terraform</name>
<alias>terraform</alias>
<alias>tf</alias>
<alias>hcl</alias>
<filename>*.tf</filename>
<filename>*.hcl</filename>
<mime_type>application/x-tf</mime_type>
<mime_type>application/x-terraform</mime_type>
</config>
<rules>
<state name="string">
<rule pattern="&#34;">
<token type="LiteralStringDouble"/>
<pop depth="1"/>
</rule>
<rule pattern="\\\\">
<token type="LiteralStringDouble"/>
<token type="LiteralStringDouble" />
<pop depth="1" />
</rule>
<rule pattern="\\\\&#34;">
<token type="LiteralStringDouble"/>
</rule>
<rule pattern="\$\{">
<token type="LiteralStringInterpol"/>
<push state="interp-inside"/>
</rule>
<rule pattern="\$">
<token type="LiteralStringDouble"/>
<token type="LiteralStringDouble" />
</rule>
<rule pattern="[^&#34;\\\\$]+">
<token type="LiteralStringDouble"/>
<token type="LiteralStringDouble" />
</rule>
<rule pattern="[^\\\\&#34;$]+">
<token type="LiteralStringDouble" />
</rule>
<rule pattern="\$\{">
<token type="LiteralStringInterpol" />
<push state="interp-inside" />
</rule>
</state>
<state name="interp-inside">
<rule pattern="\}">
<token type="LiteralStringInterpol"/>
<pop depth="1"/>
<token type="LiteralStringInterpol" />
<pop depth="1" />
</rule>
<rule>
<include state="root"/>
<include state="root" />
</rule>
</state>
<state name="root">
<rule pattern="[\[\](),.{}]">
<token type="Punctuation"/>
</rule>
<rule pattern="-?[0-9]+">
<token type="LiteralNumber"/>
</rule>
<rule pattern="=&gt;">
<token type="Punctuation"/>
</rule>
<rule pattern="(false|true)\b">
<token type="KeywordConstant"/>
</rule>
<rule pattern="/(?s)\*(((?!\*/).)*)\*/">
<token type="CommentMultiline"/>
</rule>
<rule pattern="\s*(#|//).*\n">
<token type="CommentSingle"/>
</rule>
<rule pattern="([a-zA-Z]\w*)(\s*)(=(?!&gt;))">
<bygroups>
<token type="NameAttribute"/>
<token type="Text"/>
<token type="Text"/>
</bygroups>
</rule>
<rule pattern="^\s*(provisioner|variable|resource|provider|module|output|data)\b">
<token type="KeywordReserved"/>
</rule>
<rule pattern="(for|in)\b">
<token type="Keyword"/>
</rule>
<rule pattern="(module|count|data|each|var)">
<token type="NameBuiltin"/>
</rule>
<rule pattern="(parseint|signum|floor|ceil|log|max|min|abs|pow)\b">
<token type="NameBuiltin"/>
</rule>
<rule pattern="(trimsuffix|formatlist|trimprefix|trimspace|regexall|replace|indent|strrev|format|substr|chomp|split|title|regex|lower|upper|trim|join)\b">
<token type="NameBuiltin"/>
</rule>
<rule pattern="[^.](setintersection|coalescelist|setsubtract|setproduct|matchkeys|chunklist|transpose|contains|distinct|coalesce|setunion|reverse|flatten|element|compact|lookup|length|concat|values|zipmap|range|merge|slice|index|list|sort|keys|map)\b">
<token type="NameBuiltin"/>
</rule>
<rule pattern="[^.](base64decode|base64encode|base64gzip|jsondecode|jsonencode|yamldecode|yamlencode|csvdecode|urlencode)\b">
<token type="NameBuiltin"/>
</rule>
<rule pattern="(templatefile|filebase64|fileexists|pathexpand|basename|abspath|fileset|dirname|file)\b">
<token type="NameBuiltin"/>
</rule>
<rule pattern="(formatdate|timestamp|timeadd)\b">
<token type="NameBuiltin"/>
</rule>
<rule pattern="(filebase64sha256|filebase64sha512|base64sha512|base64sha256|filesha256|rsadecrypt|filesha512|filesha1|filemd5|uuidv5|bcrypt|sha256|sha512|sha1|uuid|md5)\b">
<token type="NameBuiltin"/>
</rule>
<rule pattern="(cidrnetmask|cidrsubnet|cidrhost)\b">
<token type="NameBuiltin"/>
</rule>
<rule pattern="(tostring|tonumber|tobool|tolist|tomap|toset|can|try)\b">
<token type="NameBuiltin"/>
</rule>
<rule pattern="=(?!&gt;)|\+|-|\*|\/|:|!|%|&gt;|&lt;(?!&lt;)|&gt;=|&lt;=|==|!=|&amp;&amp;|\||\?">
<token type="Operator"/>
</rule>
<rule pattern="\n|\s+|\\\n">
<token type="Text"/>
</rule>
<rule pattern="[a-zA-Z]\w*">
<token type="NameOther"/>
<token type="Punctuation" />
</rule>
<rule pattern="&#34;">
<token type="LiteralStringDouble"/>
<push state="string"/>
<token type="LiteralStringDouble" />
<push state="string" />
</rule>
<rule pattern="-?[0-9]+">
<token type="LiteralNumber" />
</rule>
<rule pattern="=&gt;">
<token type="Punctuation" />
</rule>
<rule pattern="(false|true)\b">
<token type="KeywordConstant" />
</rule>
<rule pattern="/(?s)\*(((?!\*/).)*)\*/">
<token type="CommentMultiline" />
</rule>
<rule pattern="\s*(#|//).*\n">
<token type="CommentSingle" />
</rule>
<rule pattern="(?!\s*)(variable)(\s*)">
<bygroups>
<token type="Name" />
<token type="Text" />
</bygroups>
</rule>
<rule pattern="^(provisioner|variable|resource|provider|module|output|data)(?!\.)\b">
<token type="KeywordReserved" />
</rule>
<rule pattern="(for|in)\b">
<token type="Keyword" />
</rule>
<rule pattern="(module|count|data|each|var)\b">
<token type="NameBuiltin" />
</rule>
<rule pattern="(parseint|signum|floor|ceil|log|max|min|abs|pow)\b">
<token type="NameBuiltin" />
</rule>
<rule
pattern="(trimsuffix|formatlist|trimprefix|trimspace|regexall|replace|indent|strrev|format|substr|chomp|split|title|regex|lower|upper|trim|join)\b"
>
<token type="NameBuiltin" />
</rule>
<rule
pattern="[^.](setintersection|coalescelist|setsubtract|setproduct|matchkeys|chunklist|transpose|contains|distinct|coalesce|setunion|reverse|flatten|element|compact|lookup|length|concat|values|zipmap|range|merge|slice|index|list|sort|keys|map)\b"
>
<token type="NameBuiltin" />
</rule>
<rule
pattern="[^.](base64decode|base64encode|base64gzip|jsondecode|jsonencode|yamldecode|yamlencode|csvdecode|urlencode)\b"
>
<token type="NameBuiltin" />
</rule>
<rule pattern="(templatefile|filebase64|fileexists|pathexpand|basename|abspath|fileset|dirname|file)\b">
<token type="NameBuiltin" />
</rule>
<rule pattern="(formatdate|timestamp|timeadd)\b">
<token type="NameBuiltin" />
</rule>
<rule
pattern="(filebase64sha256|filebase64sha512|base64sha512|base64sha256|filesha256|rsadecrypt|filesha512|filesha1|filemd5|uuidv5|bcrypt|sha256|sha512|sha1|uuid|md5)\b"
>
<token type="NameBuiltin" />
</rule>
<rule pattern="(cidrnetmask|cidrsubnet|cidrhost)\b">
<token type="NameBuiltin" />
</rule>
<rule pattern="(tostring|tonumber|tobool|tolist|tomap|toset|can|try)\b">
<token type="NameBuiltin" />
</rule>
<rule pattern="(^|[^.\w])(name|x|default|type|description|value)(_[a-zA-Z]\w*)*">
<token type="NameAttribute" />
</rule>
<rule pattern="=(?!&gt;)|\+|-|\*|\/|:|!|%|&gt;|&lt;(?!&lt;)|&gt;=|&lt;=|==|!=|&amp;&amp;|\||\?">
<token type="Operator" />
</rule>
<rule pattern="\n|\s+|\\\n">
<token type="Text" />
</rule>
<rule pattern="[a-zA-Z]\w*">
<token type="NameOther" />
</rule>
<rule pattern="(?s)(&lt;&lt;-?)(\w+)(\n\s*(?:(?!\2).)*\s*\n\s*)(\2)">
<bygroups>
<token type="Operator"/>
<token type="Operator"/>
<token type="LiteralString"/>
<token type="Operator"/>
<token type="Operator" />
<token type="Operator" />
<token type="LiteralString" />
<token type="Operator" />
</bygroups>
</rule>
</state>
<state name="declaration">
<rule pattern="(\s*)(&#34;(?:\\\\|\\&#34;|[^&#34;])*&#34;)(\s*)">
<bygroups>
<token type="Text"/>
<token type="NameVariable"/>
<token type="Text"/>
<token type="Text" />
<token type="NameAttribute" />
<token type="Text" />
</bygroups>
</rule>
<rule pattern="\{">
<token type="Punctuation"/>
<pop depth="1"/>
<token type="Punctuation" />
<pop depth="1" />
</rule>
</state>
</rules>
</lexer>
</lexer>

View File

@@ -5,6 +5,7 @@
<filename>*.toml</filename>
<filename>Pipfile</filename>
<filename>poetry.lock</filename>
<filename>uv.lock</filename>
<mime_type>text/x-toml</mime_type>
</config>
<rules>

View File

@@ -0,0 +1,162 @@
<lexer>
<config>
<name>Protocol Buffer Text Format</name>
<alias>txtpb</alias>
<filename>*.txtpb</filename>
<filename>*.textproto</filename>
<filename>*.textpb</filename>
<filename>*.pbtxt</filename>
<mime_type>application/x-protobuf-text</mime_type>
<case_insensitive>false</case_insensitive>
<dot_all>false</dot_all>
<ensure_nl>true</ensure_nl>
</config>
<rules>
<state name="double-quote">
<rule pattern="\\[abfnrtv\\\?&#39;&#34;]">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\\[0-7]{1,3}">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\\x[0-9a-fA-F]{1,2}">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\\u[0-9a-fA-F]{4}">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\\U000[0-9a-fA-F]{5}">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\\U0010[0-9a-fA-F]{4}">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="[^&#34;\\]+">
<token type="LiteralStringDouble"/>
</rule>
<rule pattern="&#34;">
<token type="LiteralStringDouble"/>
<pop depth="1"/>
</rule>
</state>
<state name="single-quote">
<rule pattern="\\[abfnrtv\\\?&#39;&#34;]">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\\[0-7]{1,3}">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\\x[0-9a-fA-F]{1,2}">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\\u[0-9a-fA-F]{4}">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\\U000[0-9a-fA-F]{5}">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\\U0010[0-9a-fA-F]{4}">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="[^&#39;\\]+">
<token type="LiteralStringSingle"/>
</rule>
<rule pattern="&#39;">
<token type="LiteralStringSingle"/>
<pop depth="1"/>
</rule>
</state>
<state name="root">
<!-- Comments -->
<rule pattern="#.*\n">
<token type="CommentSingle"/>
</rule>
<!-- Whitespace -->
<rule pattern="[ \n\t\v\f\r]+">
<token type="Text"/>
</rule>
<!-- Operators -->
<rule pattern="-">
<token type="Operator" />
</rule>
<!-- Special float literals -->
<rule pattern="(?i)(?:inf|infinity)\b">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="(?i)nan\b">
<token type="LiteralNumberFloat"/>
</rule>
<!-- Float literals with suffix (must come before decimal integers) -->
<rule pattern="(?:0|[1-9][0-9]*)[fF]">
<token type="LiteralNumberFloat"/>
</rule>
<!-- Float literals -->
<rule pattern="\.[0-9]+(?:[eE][+-]?[0-9]+)?[fF]?">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="(?:0|[1-9][0-9]*)\.[0-9]*(?:[eE][+-]?[0-9]+)?[fF]?">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="(?:0|[1-9][0-9]*)[eE][+-]?[0-9]+[fF]?">
<token type="LiteralNumberFloat"/>
</rule>
<!-- Hexadecimal integers -->
<rule pattern="0[xX][0-9a-fA-F]+">
<token type="LiteralNumberHex"/>
</rule>
<!-- Octal integers -->
<rule pattern="0[0-7]+">
<token type="LiteralNumberOct"/>
</rule>
<!-- Decimal integers -->
<rule pattern="(?:0|[1-9][0-9]*)">
<token type="LiteralNumberInteger"/>
</rule>
<!-- Boolean keywords -->
<rule pattern="\b(?:[Tt]rue|[Ff]alse|t|f)\b">
<token type="KeywordConstant"/>
</rule>
<!-- Strings -->
<rule pattern="&#34;">
<token type="LiteralStringDouble"/>
<push state="double-quote"/>
</rule>
<rule pattern="&#39;">
<token type="LiteralStringSingle"/>
<push state="single-quote"/>
</rule>
<!-- Qualified names (with dots) for field paths and type URLs -->
<rule pattern="[a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)+">
<token type="NameNamespace"/>
</rule>
<!-- Field names and identifiers (including enum values) -->
<rule pattern="[a-zA-Z_][a-zA-Z0-9_]*">
<token type="Name"/>
</rule>
<!-- URL paths in type URLs for Any expansion -->
<rule pattern="/[a-zA-Z_][a-zA-Z0-9_/.]*">
<token type="NameNamespace"/>
</rule>
<!-- Punctuation -->
<rule pattern="[:;,&lt;&gt;\[\]{}]">
<token type="Punctuation"/>
</rule>
</state>
</rules>
</lexer>

View File

@@ -15,249 +15,288 @@
<rules>
<state name="expression">
<rule pattern="{">
<token type="Punctuation"/>
<push/>
<token type="Punctuation" />
<push />
</rule>
<rule pattern="}">
<token type="Punctuation"/>
<pop depth="1"/>
<token type="Punctuation" />
<pop depth="1" />
</rule>
<rule>
<include state="root"/>
<include state="root" />
</rule>
</state>
<state name="jsx">
<rule pattern="(&lt;)(/?)(&gt;)">
<bygroups>
<token type="Punctuation"/>
<token type="Punctuation"/>
<token type="Punctuation"/>
<token type="Punctuation" />
<token type="Punctuation" />
<token type="Punctuation" />
</bygroups>
</rule>
<rule pattern="(&lt;)([\w\.]+)">
<bygroups>
<token type="Punctuation"/>
<token type="NameTag"/>
<token type="Punctuation" />
<token type="NameTag" />
</bygroups>
<push state="tag"/>
<push state="tag" />
</rule>
<rule pattern="(&lt;)(/)([\w\.]*)(&gt;)">
<bygroups>
<token type="Punctuation"/>
<token type="Punctuation"/>
<token type="NameTag"/>
<token type="Punctuation"/>
<token type="Punctuation" />
<token type="Punctuation" />
<token type="NameTag" />
<token type="Punctuation" />
</bygroups>
</rule>
</state>
<state name="tag">
<rule pattern="\s+">
<token type="Text"/>
<rule>
<include state="jsx" />
</rule>
<rule pattern="([\w]+\s*)(=)(\s*)">
<rule pattern=",">
<token type="Punctuation" />
</rule>
<rule pattern="&#34;(\\\\|\\&#34;|[^&#34;])*&#34;">
<token type="LiteralStringDouble" />
</rule>
<rule pattern="&#39;(\\\\|\\&#39;|[^&#39;])*&#39;">
<token type="LiteralStringSingle" />
</rule>
<rule pattern="`">
<token type="LiteralStringBacktick" />
<push state="interp" />
</rule>
<rule>
<include state="commentsandwhitespace" />
</rule>
<rule pattern="\s+">
<token type="Text" />
</rule>
<rule pattern="([\w-]+\s*)(=)(\s*)">
<bygroups>
<token type="NameAttribute"/>
<token type="Operator"/>
<token type="Text"/>
<token type="NameAttribute" />
<token type="Operator" />
<token type="Text" />
</bygroups>
<push state="attr"/>
<push state="attr" />
</rule>
<rule pattern="[{}]+">
<token type="Punctuation"/>
<token type="Punctuation" />
</rule>
<rule pattern="[\w\.]+">
<token type="NameAttribute"/>
<token type="NameAttribute" />
</rule>
<rule pattern="(/?)(\s*)(&gt;)">
<bygroups>
<token type="Punctuation"/>
<token type="Text"/>
<token type="Punctuation"/>
<token type="Punctuation" />
<token type="Text" />
<token type="Punctuation" />
</bygroups>
<pop depth="1"/>
<pop depth="1" />
</rule>
</state>
<state name="comment">
<rule pattern="[^-]+">
<token type="Comment" />
</rule>
<rule pattern="--&gt;">
<token type="Comment" />
<pop depth="1" />
</rule>
<rule pattern="-">
<token type="Comment" />
</rule>
</state>
<state name="commentsandwhitespace">
<rule pattern="\s+">
<token type="Text"/>
<token type="Text" />
</rule>
<rule pattern="&lt;!--">
<token type="Comment"/>
<token type="Comment" />
<push state="comment" />
</rule>
<rule pattern="//.*?\n">
<token type="CommentSingle"/>
<token type="CommentSingle" />
</rule>
<rule pattern="/\*.*?\*/">
<token type="CommentMultiline"/>
<token type="CommentMultiline" />
</rule>
</state>
<state name="badregex">
<rule pattern="\n">
<token type="Text"/>
<pop depth="1"/>
<token type="Text" />
<pop depth="1" />
</rule>
</state>
<state name="interp">
<rule pattern="`">
<token type="LiteralStringBacktick"/>
<pop depth="1"/>
<token type="LiteralStringBacktick" />
<pop depth="1" />
</rule>
<rule pattern="\\\\">
<token type="LiteralStringBacktick"/>
<token type="LiteralStringBacktick" />
</rule>
<rule pattern="\\`">
<token type="LiteralStringBacktick"/>
<token type="LiteralStringBacktick" />
</rule>
<rule pattern="\$\{">
<token type="LiteralStringInterpol"/>
<push state="interp-inside"/>
<token type="LiteralStringInterpol" />
<push state="interp-inside" />
</rule>
<rule pattern="\$">
<token type="LiteralStringBacktick"/>
<token type="LiteralStringBacktick" />
</rule>
<rule pattern="[^`\\$]+">
<token type="LiteralStringBacktick"/>
<token type="LiteralStringBacktick" />
</rule>
</state>
<state name="attr">
<rule pattern="{">
<token type="Punctuation"/>
<push state="expression"/>
<token type="Punctuation" />
<push state="expression" />
</rule>
<rule pattern="&#34;.*?&#34;">
<token type="LiteralString"/>
<pop depth="1"/>
<token type="LiteralString" />
<pop depth="1" />
</rule>
<rule pattern="&#39;.*?&#39;">
<token type="LiteralString"/>
<pop depth="1"/>
<token type="LiteralString" />
<pop depth="1" />
</rule>
<rule>
<pop depth="1"/>
<pop depth="1" />
</rule>
</state>
<state name="interp-inside">
<rule pattern="\}">
<token type="LiteralStringInterpol"/>
<pop depth="1"/>
<token type="LiteralStringInterpol" />
<pop depth="1" />
</rule>
<rule>
<include state="root"/>
<include state="root" />
</rule>
</state>
<state name="slashstartsregex">
<rule>
<include state="commentsandwhitespace"/>
<include state="commentsandwhitespace" />
</rule>
<rule pattern="/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/([gim]+\b|\B)">
<token type="LiteralStringRegex"/>
<pop depth="1"/>
<token type="LiteralStringRegex" />
<pop depth="1" />
</rule>
<rule pattern="(?=/)">
<token type="Text"/>
<push state="#pop" state="badregex"/>
<token type="Text" />
<push state="badregex" />
</rule>
<rule>
<pop depth="1"/>
<pop depth="1" />
</rule>
</state>
<state name="root">
<rule>
<include state="jsx"/>
<include state="jsx" />
</rule>
<rule pattern="^(?=\s|/|&lt;!--)">
<token type="Text"/>
<push state="slashstartsregex"/>
<token type="Text" />
<push state="slashstartsregex" />
</rule>
<rule>
<include state="commentsandwhitespace"/>
<include state="commentsandwhitespace" />
</rule>
<rule pattern="\+\+|--|~|&amp;&amp;|\?|:|\|\||\\(?=\n)|(&lt;&lt;|&gt;&gt;&gt;?|==?|!=?|[-&lt;&gt;+*%&amp;|^/])=?">
<token type="Operator"/>
<push state="slashstartsregex"/>
<token type="Operator" />
<push state="slashstartsregex" />
</rule>
<rule pattern="[{(\[;,]">
<token type="Punctuation"/>
<push state="slashstartsregex"/>
<token type="Punctuation" />
<push state="slashstartsregex" />
</rule>
<rule pattern="[})\].]">
<token type="Punctuation"/>
<token type="Punctuation" />
</rule>
<rule pattern="(for|in|of|while|do|break|return|yield|continue|switch|case|default|if|else|throw|try|catch|finally|new|delete|typeof|instanceof|keyof|asserts|is|infer|await|void|this)\b">
<token type="Keyword"/>
<push state="slashstartsregex"/>
<rule
pattern="(for|in|of|while|do|break|return|yield|continue|switch|case|default|if|else|throw|try|catch|finally|new|delete|typeof|instanceof|keyof|asserts|is|infer|await|void|this)\b"
>
<token type="Keyword" />
<push state="slashstartsregex" />
</rule>
<rule pattern="(var|let|with|function)\b">
<token type="KeywordDeclaration"/>
<push state="slashstartsregex"/>
<token type="KeywordDeclaration" />
<push state="slashstartsregex" />
</rule>
<rule pattern="(abstract|async|boolean|class|const|debugger|enum|export|extends|from|get|global|goto|implements|import|interface|namespace|package|private|protected|public|readonly|require|set|static|super|type)\b">
<token type="KeywordReserved"/>
<rule
pattern="(abstract|async|boolean|class|const|debugger|enum|export|extends|from|get|global|goto|implements|import|interface|namespace|package|private|protected|public|readonly|require|set|static|super|type)\b"
>
<token type="KeywordReserved" />
</rule>
<rule pattern="(true|false|null|NaN|Infinity|undefined)\b">
<token type="KeywordConstant"/>
<token type="KeywordConstant" />
</rule>
<rule pattern="(Array|Boolean|Date|Error|Function|Math|Number|Object|Packages|RegExp|String|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|document|this|window)\b">
<token type="NameBuiltin"/>
<rule
pattern="(Array|Boolean|Date|Error|Function|Math|Number|Object|Packages|RegExp|String|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|document|this|window)\b"
>
<token type="NameBuiltin" />
</rule>
<rule pattern="\b(module)(\s*)(\s*[\w?.$][\w?.$]*)(\s*)">
<rule pattern="\b(module)(\s+)(&quot;[\w\./@]+&quot;)(\s+)">
<bygroups>
<token type="KeywordReserved"/>
<token type="Text"/>
<token type="NameOther"/>
<token type="Text"/>
<token type="KeywordReserved" />
<token type="Text" />
<token type="NameOther" />
<token type="Text" />
</bygroups>
<push state="slashstartsregex"/>
<push state="slashstartsregex" />
</rule>
<rule pattern="\b(string|bool|number|any|never|object|symbol|unique|unknown|bigint)\b">
<token type="KeywordType"/>
<token type="KeywordType" />
</rule>
<rule pattern="\b(constructor|declare|interface|as)\b">
<token type="KeywordReserved"/>
<token type="KeywordReserved" />
</rule>
<rule pattern="(super)(\s*)(\([\w,?.$\s]+\s*\))">
<bygroups>
<token type="KeywordReserved"/>
<token type="Text"/>
<token type="KeywordReserved" />
<token type="TextWhitespace" />
<token type="Text" />
</bygroups>
<push state="slashstartsregex"/>
<push state="slashstartsregex" />
</rule>
<rule pattern="([a-zA-Z_?.$][\w?.$]*)\(\) \{">
<token type="NameOther"/>
<push state="slashstartsregex"/>
<token type="NameOther" />
<push state="slashstartsregex" />
</rule>
<rule pattern="([\w?.$][\w?.$]*)(\s*:\s*)([\w?.$][\w?.$]*)">
<bygroups>
<token type="NameOther"/>
<token type="Text"/>
<token type="KeywordType"/>
<token type="NameOther" />
<token type="Text" />
<token type="KeywordType" />
</bygroups>
</rule>
<rule pattern="[$a-zA-Z_]\w*">
<token type="NameOther"/>
<token type="NameOther" />
</rule>
<rule pattern="[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?">
<token type="LiteralNumberFloat"/>
<token type="LiteralNumberFloat" />
</rule>
<rule pattern="0x[0-9a-fA-F]+">
<token type="LiteralNumberHex"/>
<token type="LiteralNumberHex" />
</rule>
<rule pattern="[0-9]+">
<token type="LiteralNumberInteger"/>
<token type="LiteralNumberInteger" />
</rule>
<rule pattern="&#34;(\\\\|\\&#34;|[^&#34;])*&#34;">
<token type="LiteralStringDouble"/>
<token type="LiteralStringDouble" />
</rule>
<rule pattern="&#39;(\\\\|\\&#39;|[^&#39;])*&#39;">
<token type="LiteralStringSingle"/>
<token type="LiteralStringSingle" />
</rule>
<rule pattern="`">
<token type="LiteralStringBacktick"/>
<push state="interp"/>
<token type="LiteralStringBacktick" />
<push state="interp" />
</rule>
<rule pattern="@\w+">
<token type="KeywordDeclaration"/>
<token type="KeywordDeclaration" />
</rule>
</state>
</rules>
</lexer>
</lexer>

View File

@@ -0,0 +1,108 @@
<lexer>
<config>
<name>Typst</name>
<alias>typst</alias>
<filename>*.typ</filename>
<mime_type>text/x-typst</mime_type>
</config>
<rules>
<state name="root">
<rule><include state="markup"/></rule>
</state>
<state name="into_code">
<rule pattern="(\#let|\#set|\#show)\b"><token type="KeywordDeclaration"/><push state="inline_code"/></rule>
<rule pattern="(\#import|\#include)\b"><token type="KeywordNamespace"/><push state="inline_code"/></rule>
<rule pattern="(\#if|\#for|\#while|\#export)\b"><token type="KeywordReserved"/><push state="inline_code"/></rule>
<rule pattern="#\{"><token type="Punctuation"/><push state="code"/></rule>
<rule pattern="#\("><token type="Punctuation"/><push state="code"/></rule>
<rule pattern="(#[a-zA-Z_][a-zA-Z0-9_-]*)(\[)"><bygroups><token type="NameFunction"/><token type="Punctuation"/></bygroups><push state="markup"/></rule>
<rule pattern="(#[a-zA-Z_][a-zA-Z0-9_-]*)(\()"><bygroups><token type="NameFunction"/><token type="Punctuation"/></bygroups><push state="code"/></rule>
<rule pattern="(\#true|\#false|\#none|\#auto)\b"><token type="KeywordConstant"/></rule>
<rule pattern="#[a-zA-Z_][a-zA-Z0-9_]*"><token type="NameVariable"/></rule>
<rule pattern="#0x[0-9a-fA-F]+"><token type="LiteralNumberHex"/></rule>
<rule pattern="#0b[01]+"><token type="LiteralNumberBin"/></rule>
<rule pattern="#0o[0-7]+"><token type="LiteralNumberOct"/></rule>
<rule pattern="#[0-9]+[\.e][0-9]+"><token type="LiteralNumberFloat"/></rule>
<rule pattern="#[0-9]+"><token type="LiteralNumberInteger"/></rule>
</state>
<state name="markup">
<rule><include state="comment"/></rule>
<rule pattern="^\s*=+.*$"><token type="GenericHeading"/></rule>
<rule pattern="[*][^*]*[*]"><token type="GenericStrong"/></rule>
<rule pattern="_[^_]*_"><token type="GenericEmph"/></rule>
<rule pattern="\$"><token type="Punctuation"/><push state="math"/></rule>
<rule pattern="`[^`]*`"><token type="LiteralStringBacktick"/></rule>
<rule pattern="^(\s*)(-)(\s+)"><bygroups><token type="TextWhitespace"/><token type="Punctuation"/><token type="TextWhitespace"/></bygroups></rule>
<rule pattern="^(\s*)(\+)(\s+)"><bygroups><token type="TextWhitespace"/><token type="Punctuation"/><token type="TextWhitespace"/></bygroups></rule>
<rule pattern="^(\s*)([0-9]+\.)"><bygroups><token type="TextWhitespace"/><token type="Punctuation"/></bygroups></rule>
<rule pattern="^(\s*)(/)(\s+)([^:]+)(:)"><bygroups><token type="TextWhitespace"/><token type="Punctuation"/><token type="TextWhitespace"/><token type="NameVariable"/><token type="Punctuation"/></bygroups></rule>
<rule pattern="&lt;[a-zA-Z_][a-zA-Z0-9_-]*&gt;"><token type="NameLabel"/></rule>
<rule pattern="@[a-zA-Z_][a-zA-Z0-9_-]*"><token type="NameLabel"/></rule>
<rule pattern="\\#"><token type="Text"/></rule>
<rule><include state="into_code"/></rule>
<rule pattern="```(?:.|\n)*?```"><token type="LiteralStringBacktick"/></rule>
<rule pattern="https?://[0-9a-zA-Z~/%#&amp;=\&#x27;,;.+?]*"><token type="GenericEmph"/></rule>
<rule pattern="(\-\-\-|\\|\~|\-\-|\.\.\.)\B"><token type="Punctuation"/></rule>
<rule pattern="\\\["><token type="Punctuation"/></rule>
<rule pattern="\\\]"><token type="Punctuation"/></rule>
<rule pattern="\["><token type="Punctuation"/><push/></rule>
<rule pattern="\]"><token type="Punctuation"/><pop depth="1"/></rule>
<rule pattern="[ \t]+\n?|\n"><token type="TextWhitespace"/></rule>
<rule pattern="((?![*_$`&lt;@\\#\] ]|https?://).)+"><token type="Text"/></rule>
</state>
<state name="math">
<rule><include state="comment"/></rule>
<rule pattern="(\\_|\\\^|\\\&amp;)"><token type="Text"/></rule>
<rule pattern="(_|\^|\&amp;|;)"><token type="Punctuation"/></rule>
<rule pattern="(\+|/|=|\[\||\|\]|\|\||\*|:=|::=|\.\.\.|&#x27;|\-|=:|!=|&gt;&gt;|&gt;=|&gt;&gt;&gt;|&lt;&lt;|&lt;=|&lt;&lt;&lt;|\-&gt;|\|\-&gt;|=&gt;|\|=&gt;|==&gt;|\-\-&gt;|\~\~&gt;|\~&gt;|&gt;\-&gt;|\-&gt;&gt;|&lt;\-|&lt;==|&lt;\-\-|&lt;\~\~|&lt;\~|&lt;\-&lt;|&lt;&lt;\-|&lt;\-&gt;|&lt;=&gt;|&lt;==&gt;|&lt;\-\-&gt;|&gt;|&lt;|\~|:|\|)"><token type="Operator"/></rule>
<rule pattern="\\"><token type="Punctuation"/></rule>
<rule pattern="\\\$"><token type="Punctuation"/></rule>
<rule pattern="\$"><token type="Punctuation"/><pop depth="1"/></rule>
<rule><include state="into_code"/></rule>
<rule pattern="([a-zA-Z][a-zA-Z0-9-]*)(\s*)(\()"><bygroups><token type="NameFunction"/><token type="TextWhitespace"/><token type="Punctuation"/></bygroups></rule>
<rule pattern="([a-zA-Z][a-zA-Z0-9-]*)(:)"><bygroups><token type="NameVariable"/><token type="Punctuation"/></bygroups></rule>
<rule pattern="([a-zA-Z][a-zA-Z0-9-]*)"><token type="NameVariable"/></rule>
<rule pattern="[0-9]+(\.[0-9]+)?"><token type="LiteralNumber"/></rule>
<rule pattern="\.{1,3}|\(|\)|,|\{|\}"><token type="Punctuation"/></rule>
<rule pattern="&quot;[^&quot;]*&quot;"><token type="LiteralStringDouble"/></rule>
<rule pattern="[ \t\n]+"><token type="TextWhitespace"/></rule>
</state>
<state name="comment">
<rule pattern="//.*$"><token type="CommentSingle"/></rule>
<rule pattern="/[*](.|\n)*?[*]/"><token type="CommentMultiline"/></rule>
</state>
<state name="code">
<rule><include state="comment"/></rule>
<rule pattern="\["><token type="Punctuation"/><push state="markup"/></rule>
<rule pattern="\(|\{"><token type="Punctuation"/><push state="code"/></rule>
<rule pattern="\)|\}"><token type="Punctuation"/><pop depth="1"/></rule>
<rule pattern="&quot;[^&quot;]*&quot;"><token type="LiteralStringDouble"/></rule>
<rule pattern=",|\.{1,2}"><token type="Punctuation"/></rule>
<rule pattern="="><token type="Operator"/></rule>
<rule pattern="(and|or|not)\b"><token type="OperatorWord"/></rule>
<rule pattern="=&gt;|&lt;=|==|!=|&gt;|&lt;|-=|\+=|\*=|/=|\+|-|\\|\*"><token type="Operator"/></rule>
<rule pattern="([a-zA-Z_][a-zA-Z0-9_-]*)(:)"><bygroups><token type="NameVariable"/><token type="Punctuation"/></bygroups></rule>
<rule pattern="([a-zA-Z_][a-zA-Z0-9_-]*)(\()"><bygroups><token type="NameFunction"/><token type="Punctuation"/></bygroups><push state="code"/></rule>
<rule pattern="(as|break|export|continue|else|for|if|in|return|while)\b"><token type="KeywordReserved"/></rule>
<rule pattern="(import|include)\b"><token type="KeywordNamespace"/></rule>
<rule pattern="(auto|none|true|false)\b"><token type="KeywordConstant"/></rule>
<rule pattern="([0-9.]+)(mm|pt|cm|in|em|fr|%)"><bygroups><token type="LiteralNumber"/><token type="KeywordReserved"/></bygroups></rule>
<rule pattern="0x[0-9a-fA-F]+"><token type="LiteralNumberHex"/></rule>
<rule pattern="0b[01]+"><token type="LiteralNumberBin"/></rule>
<rule pattern="0o[0-7]+"><token type="LiteralNumberOct"/></rule>
<rule pattern="[0-9]+[\.e][0-9]+"><token type="LiteralNumberFloat"/></rule>
<rule pattern="[0-9]+"><token type="LiteralNumberInteger"/></rule>
<rule pattern="(let|set|show)\b"><token type="KeywordDeclaration"/></rule>
<rule pattern="([a-zA-Z_][a-zA-Z0-9_-]*)"><token type="NameVariable"/></rule>
<rule pattern="[ \t\n]+"><token type="TextWhitespace"/></rule>
<rule pattern=":"><token type="Punctuation"/></rule>
</state>
<state name="inline_code">
<rule pattern=";\b"><token type="Punctuation"/><pop depth="1"/></rule>
<rule pattern="\n"><token type="TextWhitespace"/><pop depth="1"/></rule>
<rule><include state="code"/></rule>
</state>
</rules>
</lexer>

View File

@@ -64,28 +64,17 @@
<rule pattern="(-)([\w]+)">
<token type="NameTag"/>
</rule>
<rule pattern="(@[\w]+)(=&#34;[\S]+&#34;)(&gt;)">
<rule pattern="(@[\w.]+)(=&#34;.*?&#34;)?(\/?&gt;|\s)">
<bygroups>
<token type="NameTag"/>
<token type="LiteralString"/>
<token type="Punctuation"/>
</bygroups>
</rule>
<rule pattern="(@[\w]+)(=&#34;[\S]+&#34;)">
<bygroups>
<token type="NameTag"/>
<token type="LiteralString"/>
</bygroups>
</rule>
<rule pattern="(@[\S]+)(=&#34;[\S]+&#34;)">
<bygroups>
<token type="NameTag"/>
<token type="LiteralString"/>
</bygroups>
</rule>
<rule pattern="(:[\S]+)(=&#34;[\S]+&#34;)">
<rule pattern="(:[\S]+)(=)(&#34;[\S]+&#34;)">
<bygroups>
<token type="NameTag"/>
<token type="Operator"/>
<token type="LiteralString"/>
</bygroups>
</rule>
@@ -95,30 +84,31 @@
<rule pattern="(v-b-[\S]+)">
<token type="NameTag"/>
</rule>
<rule pattern="(v-[\w]+)(=&#34;.+)([:][\w]+)(=&#34;[\w]+&#34;)(&gt;)">
<rule pattern="(v-[\w-]+)(=)(&#34;[\S ]+&#34;)(\/?&gt;|\s)">
<bygroups>
<token type="NameTag"/>
<token type="LiteralString"/>
<token type="NameTag"/>
<token type="Operator"/>
<token type="LiteralString"/>
<token type="Punctuation"/>
</bygroups>
</rule>
<rule pattern="(v-[\w]+)(=&#34;[\S]+&#34;)(&gt;)">
<rule pattern="(v-[\w-]+)(\/?&gt;|\s)">
<bygroups>
<token type="NameTag"/>
<token type="Punctuation"/>
</bygroups>
</rule>
<rule pattern="(v-[\w-]+)(=&#34;.+&#34;)(\/?&gt;|\s)">
<bygroups>
<token type="NameTag"/>
<token type="LiteralString"/>
<token type="Punctuation"/>
</bygroups>
</rule>
<rule pattern="(v-[\w]+)(&gt;)">
<rule pattern="(v-[\w-]+)(=&#34;.+)([:][\w]+)(=&#34;[\w]+&#34;)(\/?&gt;|\s)">
<bygroups>
<token type="NameTag"/>
<token type="Punctuation"/>
</bygroups>
</rule>
<rule pattern="(v-[\w]+)(=&#34;.+&#34;)(&gt;)">
<bygroups>
<token type="LiteralString"/>
<token type="NameTag"/>
<token type="LiteralString"/>
<token type="Punctuation"/>
@@ -258,14 +248,14 @@
</rule>
</state>
<state name="vue">
<rule pattern="(&lt;)([\w]+)">
<rule pattern="(&lt;)([\w-]+)">
<bygroups>
<token type="Punctuation"/>
<token type="NameTag"/>
</bygroups>
<push state="tag"/>
</rule>
<rule pattern="(&lt;)(/)([\w]+)(&gt;)">
<rule pattern="(&lt;)(/)([\w-]+)(&gt;)">
<bygroups>
<token type="Punctuation"/>
<token type="Punctuation"/>

View File

@@ -0,0 +1,149 @@
<lexer>
<config>
<name>WebAssembly Text Format</name>
<alias>wast</alias>
<alias>wat</alias>
<filename>*.wat</filename>
<filename>*.wast</filename>
</config>
<rules>
<state name="root">
<rule pattern="(module|import|func|funcref|start|param|local|type|result|export|memory|global|mut|data|table|elem|if|then|else|end|block|loop)(?=[^a-z_\.])">
<token type="Keyword"/>
</rule>
<rule pattern="(unreachable|nop|block|loop|if|else|end|br(?:_if|_table)?|return|call(?:_indirect)?|drop|select|local\.get|local\.set|local\.tee|global\.get|global\.set|i32\.load(?:(?:8|16)_(?:u|s))?|i64\.load(?:(?:8|16|32)_(?:u|s))?|f32\.load|f64\.load|i32\.store(?:8|16)?|i64\.store(:?8|16|32)?|f32\.store|f64\.store|memory\.size|memory\.grow|memory\.fill|memory\.copy|memory\.init|i32\.const|i64\.const|f32\.const|f64\.const|i32\.eqz|i32\.eq|i32\.ne|i32\.lt_s|i32\.lt_u|i32\.gt_s|i32\.gt_u|i32\.le_s|i32\.le_u|i32\.ge_s|i32\.ge_u|i64\.eqz|i64\.eq|i64\.ne|i64\.lt_s|i64\.lt_u|i64\.gt_s|i64\.gt_u|i64\.le_s|i64\.le_u|i64\.ge_s|i64\.ge_u|f32\.eq|f32\.neg?|f32\.lt|f32\.gt|f32\.le|f32\.ge|f64\.eq|f64\.neg?|f64\.lt|f64\.gt|f64\.le|f64\.ge|i32\.clz|i32\.ctz|i32\.popcnt|i32\.add|i32\.sub|i32\.mul|i32\.div_s|i32\.div_u|i32\.rem_s|i32\.rem_u|i32\.and|i32\.or|i32\.xor|i32\.shl|i32\.shr_s|i32\.shr_u|i32\.rotl|i32\.rotr|i64\.clz|i64\.ctz|i64\.popcnt|i64\.add|i64\.sub|i64\.mul|i64\.div_s|i64\.div_u|i64\.rem_s|i64\.rem_u|i64\.and|i64\.or|i64\.xor|i64\.shl|i64\.shr_s|i64\.shr_u|i64\.rotl|i64\.rotr|f32\.abs|f32\.ceil|f32\.floor|f32\.trunc|f32\.nearest|f32\.sqrt|f32\.add|f32\.sub|f32\.mul|f32\.div|f32\.min|f32\.max|f32\.copysign|f64\.abs|f64\.ceil|f64\.floor|f64\.trunc|f64\.nearest|f64\.sqrt|f64\.add|f64\.sub|f64\.mul|f64\.div|f64\.min|f64\.max|f64\.copysign|i32\.wrap_i64|i32\.trunc_f32_s|i32\.trunc_f32_u|i32\.trunc_f64_s|i32\.trunc_f64_u|i64\.extend(?:(?:8|16|32)_s|_i(?:32|64)_(?:u|s))|i32\.extend(?:8|16)_s|(?:i32|i64)\.trunc(?:_sat)?_f(?:32|64)_(?:s|u)|f32\.convert_i32_s|f32\.convert_i32_u|f32\.convert_i64_s|f32\.convert_i64_u|f32\.demote_f64|f64\.convert_i32_s|f64\.convert_i32_u|f64\.convert_i64_s|f64\.convert_i64_u|f64\.promote_f32|i32\.reinterpret_f32|i64\.reinterpret_f64|f32\.reinterpret_i32|f64\.reinterpret_i64)">
<token type="NameBuiltin"/>
<push state="arguments"/>
</rule>
<rule pattern="(i32|i64|f32|f64)">
<token type="KeywordType"/>
</rule>
<rule pattern="\$[A-Za-z0-9!#$%&amp;\&#x27;*+./:&lt;=&gt;?@\\^_`|~-]+">
<token type="NameVariable"/>
</rule>
<rule pattern=";;.*?$">
<token type="CommentSingle"/>
</rule>
<rule pattern="\(;">
<token type="CommentMultiline"/>
<push state="nesting_comment"/>
</rule>
<rule pattern="[+-]?0x[\dA-Fa-f](_?[\dA-Fa-f])*(.([\dA-Fa-f](_?[\dA-Fa-f])*)?)?([pP][+-]?[\dA-Fa-f](_?[\dA-Fa-f])*)?">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="[+-]?\d.\d(_?\d)*[eE][+-]?\d(_?\d)*">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="[+-]?\d.\d(_?\d)*">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="[+-]?\d.[eE][+-]?\d(_?\d)*">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="[+-]?(inf|nan:0x[\dA-Fa-f](_?[\dA-Fa-f])*|nan)">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="[+-]?0x[\dA-Fa-f](_?[\dA-Fa-f])*">
<token type="LiteralNumberHex"/>
</rule>
<rule pattern="[+-]?\d(_?\d)*">
<token type="LiteralNumberInteger"/>
</rule>
<rule pattern="[\(\)]">
<token type="Punctuation"/>
</rule>
<rule pattern="&quot;">
<token type="LiteralStringDouble"/>
<push state="string"/>
</rule>
<rule pattern="\s+">
<token type="Text"/>
</rule>
</state>
<state name="nesting_comment">
<rule pattern="\(;">
<token type="CommentMultiline"/>
<push/>
</rule>
<rule pattern=";\)">
<token type="CommentMultiline"/>
<pop depth="1"/>
</rule>
<rule pattern="[^;(]+">
<token type="CommentMultiline"/>
</rule>
<rule pattern="[;(]">
<token type="CommentMultiline"/>
</rule>
</state>
<state name="string">
<rule pattern="\\[\dA-Fa-f][\dA-Fa-f]">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\\t">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\\n">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\\r">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\\&quot;">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\\&#x27;">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\\u\{[\dA-Fa-f](_?[\dA-Fa-f])*\}">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\\\\">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="&quot;">
<token type="LiteralStringDouble"/>
<pop depth="1"/>
</rule>
<rule pattern="[^&quot;\\]+">
<token type="LiteralStringDouble"/>
</rule>
</state>
<state name="arguments">
<rule pattern="\s+">
<token type="Text"/>
</rule>
<rule pattern="(offset)(=)(0x[\dA-Fa-f](?:_?[\dA-Fa-f])*)">
<bygroups>
<token type="Keyword"/>
<token type="Operator"/>
<token type="LiteralNumberHex"/>
</bygroups>
</rule>
<rule pattern="(offset)(=)(\d(?:_?\d)*)">
<bygroups>
<token type="Keyword"/>
<token type="Operator"/>
<token type="LiteralNumberInteger"/>
</bygroups>
</rule>
<rule pattern="(align)(=)(0x[\dA-Fa-f](?:_?[\dA-Fa-f])*)">
<bygroups>
<token type="Keyword"/>
<token type="Operator"/>
<token type="LiteralNumberHex"/>
</bygroups>
</rule>
<rule pattern="(align)(=)(\d(?:_?\d)*)">
<bygroups>
<token type="Keyword"/>
<token type="Operator"/>
<token type="LiteralNumberInteger"/>
</bygroups>
</rule>
<rule>
<pop depth="1"/>
</rule>
</state>
</rules>
</lexer>

View File

@@ -0,0 +1,283 @@
<lexer>
<config>
<name>WebVTT</name>
<alias>vtt</alias>
<filename>*.vtt</filename>
<mime_type>text/vtt</mime_type>
</config>
<!--
The WebVTT spec refers to a WebVTT line terminator as either CRLF, CR or LF.
(https://www.w3.org/TR/webvtt1/#webvtt-line-terminator) However, with this
definition it is unclear whether CRLF is one line terminator (CRLF) or two
line terminators (CR and LF).
To work around this ambiguity, only CRLF and LF are considered as line terminators.
To my knowledge only classic Mac OS uses CR as line terminators, so the lexer should
still work for most files.
-->
<rules>
<!-- https://www.w3.org/TR/webvtt1/#webvtt-file-body -->
<state name="root">
<rule pattern="(\AWEBVTT)((?:[ \t][^\r\n]*)?(?:\r?\n){2,})">
<bygroups>
<token type="Keyword" />
<token type="Text" />
</bygroups>
</rule>
<rule pattern="(^REGION)([ \t]*$)">
<bygroups>
<token type="Keyword" />
<token type="Text" />
</bygroups>
<push state="region-settings-list" />
</rule>
<rule
pattern="(^STYLE)([ \t]*$)((?:(?!&#45;&#45;&gt;)[\s\S])*?)((?:\r?\n){2})">
<bygroups>
<token type="Keyword" />
<token type="Text" />
<using lexer="CSS" />
<token type="Text" />
</bygroups>
</rule>
<rule>
<include state="comment" />
</rule>
<rule
pattern="(?=((?![^\r\n]*&#45;&#45;&gt;)[^\r\n]*\r?\n)?(\d{2}:)?(?:[0-5][0-9]):(?:[0-5][0-9])\.\d{3}[ \t]+&#45;&#45;&gt;[ \t]+(\d{2}:)?(?:[0-5][0-9]):(?:[0-5][0-9])\.\d{3})"
>
<push state="cues" />
</rule>
</state>
<!-- https://www.w3.org/TR/webvtt1/#webvtt-region-settings-list -->
<state name="region-settings-list">
<rule pattern="(?: |\t|\r?\n(?!\r?\n))+">
<token type="Text" />
</rule>
<rule pattern="(?:\r?\n){2}">
<token type="Text" />
<pop depth="1" />
</rule>
<rule pattern="(id)(:)(?!&#45;&#45;&gt;)(\S+)">
<bygroups>
<token type="Keyword" />
<token type="Punctuation" />
<token type="Literal" />
</bygroups>
</rule>
<rule pattern="(width)(:)((?:[1-9]?\d|100)(?:\.\d+)?)(%)">
<bygroups>
<token type="Keyword" />
<token type="Punctuation" />
<token type="Literal" />
<token type="KeywordType" />
</bygroups>
</rule>
<rule pattern="(lines)(:)(\d+)">
<bygroups>
<token type="Keyword" />
<token type="Punctuation" />
<token type="Literal" />
</bygroups>
</rule>
<rule
pattern="(regionanchor|viewportanchor)(:)((?:[1-9]?\d|100)(?:\.\d+)?)(%)(,)((?:[1-9]?\d|100)(?:\.\d+)?)(%)">
<bygroups>
<token type="Keyword" />
<token type="Punctuation" />
<token type="Literal" />
<token type="KeywordType" />
<token type="Punctuation" />
<token type="Literal" />
<token type="KeywordType" />
</bygroups>
</rule>
<rule pattern="(scroll)(:)(up)">
<bygroups>
<token type="Keyword" />
<token type="Punctuation" />
<token type="KeywordConstant" />
</bygroups>
</rule>
</state>
<!-- https://www.w3.org/TR/webvtt1/#webvtt-comment-block -->
<state name="comment">
<rule
pattern="^NOTE( |\t|\r?\n)((?!&#45;&#45;&gt;)[\s\S])*?(?:(\r?\n){2}|\Z)">
<token type="Comment" />
</rule>
</state>
<!--
"Zero or more WebVTT cue blocks and WebVTT comment blocks separated from each other by one or more
WebVTT line terminators." (https://www.w3.org/TR/webvtt1/#file-structure)
-->
<state name="cues">
<rule
pattern="(?:((?!&#45;&#45;&gt;)[^\r\n]+)?(\r?\n))?((?:\d{2}:)?(?:[0-5][0-9]):(?:[0-5][0-9])\.\d{3})([ \t]+)(&#45;&#45;&gt;)([ \t]+)((?:\d{2}:)?(?:[0-5][0-9]):(?:[0-5][0-9])\.\d{3})([ \t]*)">
<bygroups>
<token type="Name" />
<token type="Text" />
<token type="LiteralDate" />
<token type="Text" />
<token type="Operator" />
<token type="Text" />
<token type="LiteralDate" />
<token type="Text" />
</bygroups>
<push state="cue-settings-list" />
</rule>
<rule>
<include state="comment" />
</rule>
</state>
<!-- https://www.w3.org/TR/webvtt1/#webvtt-cue-settings-list -->
<state name="cue-settings-list">
<rule pattern="[ \t]+">
<token type="Text" />
</rule>
<rule pattern="(vertical)(:)?(rl|lr)?">
<bygroups>
<token type="Keyword" />
<token type="Punctuation" />
<token type="KeywordConstant" />
</bygroups>
</rule>
<rule
pattern="(line)(:)?(?:(?:((?:[1-9]?\d|100)(?:\.\d+)?)(%)|(-?\d+))(?:(,)(start|center|end))?)?">
<bygroups>
<token type="Keyword" />
<token type="Punctuation" />
<token type="Literal" />
<token type="KeywordType" />
<token type="Literal" />
<token type="Punctuation" />
<token type="KeywordConstant" />
</bygroups>
</rule>
<rule
pattern="(position)(:)?(?:(?:((?:[1-9]?\d|100)(?:\.\d+)?)(%)|(-?\d+))(?:(,)(line-left|center|line-right))?)?">
<bygroups>
<token type="Keyword" />
<token type="Punctuation" />
<token type="Literal" />
<token type="KeywordType" />
<token type="Literal" />
<token type="Punctuation" />
<token type="KeywordConstant" />
</bygroups>
</rule>
<rule pattern="(size)(:)?(?:((?:[1-9]?\d|100)(?:\.\d+)?)(%))?">
<bygroups>
<token type="Keyword" />
<token type="Punctuation" />
<token type="Literal" />
<token type="KeywordType" />
</bygroups>
</rule>
<rule pattern="(align)(:)?(start|center|end|left|right)?">
<bygroups>
<token type="Keyword" />
<token type="Punctuation" />
<token type="KeywordConstant" />
</bygroups>
</rule>
<rule pattern="(region)(:)?((?![^\r\n]*&#45;&#45;&gt;(?=[ \t]+?))[^ \t\r\n]+)?">
<bygroups>
<token type="Keyword" />
<token type="Punctuation" />
<token type="Literal" />
</bygroups>
</rule>
<rule
pattern="(?=\r?\n)">
<push state="cue-payload" />
</rule>
</state>
<!-- https://www.w3.org/TR/webvtt1/#cue-payload -->
<state name="cue-payload">
<rule pattern="(\r?\n){2,}">
<token type="Text" />
<pop depth="2" />
</rule>
<rule pattern="[^&lt;&amp;]+?">
<token type="Text" />
</rule>
<rule pattern="&amp;(#\d+|#x[0-9A-Fa-f]+|[a-zA-Z0-9]+);">
<token type="Text" />
</rule>
<rule pattern="(?=&lt;)">
<token type="Text" />
<push state="cue-span-tag" />
</rule>
</state>
<state name="cue-span-tag">
<rule
pattern="&lt;(?=c|i|b|u|ruby|rt|v|lang|(?:\d{2}:)?(?:[0-5][0-9]):(?:[0-5][0-9])\.\d{3})">
<token type="Punctuation" />
<push state="cue-span-start-tag-name" />
</rule>
<rule pattern="(&lt;/)(c|i|b|u|ruby|rt|v|lang)">
<bygroups>
<token type="Punctuation" />
<token type="NameTag" />
</bygroups>
</rule>
<rule pattern="&gt;">
<token type="Punctuation" />
<pop depth="1" />
</rule>
</state>
<state name="cue-span-start-tag-name">
<rule pattern="(c|i|b|u|ruby|rt)|((?:\d{2}:)?(?:[0-5][0-9]):(?:[0-5][0-9])\.\d{3})">
<bygroups>
<token type="NameTag" />
<token type="LiteralDate" />
</bygroups>
<push state="cue-span-classes-without-annotations" />
</rule>
<rule pattern="v|lang">
<token type="NameTag" />
<push state="cue-span-classes-with-annotations" />
</rule>
</state>
<state name="cue-span-classes-without-annotations">
<rule>
<include state="cue-span-classes" />
</rule>
<rule pattern="(?=&gt;)">
<pop depth="2" />
</rule>
</state>
<state name="cue-span-classes-with-annotations">
<rule>
<include state="cue-span-classes" />
</rule>
<rule pattern="(?=[ \t])">
<push state="cue-span-start-tag-annotations" />
</rule>
</state>
<state name="cue-span-classes">
<rule pattern="(\.)([^ \t\n\r&amp;&lt;&gt;\.]+)">
<bygroups>
<token type="Punctuation" />
<token type="NameTag" />
</bygroups>
</rule>
</state>
<state name="cue-span-start-tag-annotations">
<rule
pattern="[ \t](?:[^\n\r&amp;&gt;]|&amp;(?:#\d+|#x[0-9A-Fa-f]+|[a-zA-Z0-9]+);)+">
<token type="Text" />
</rule>
<rule pattern="(?=&gt;)">
<token type="Text" />
<pop depth="3" />
</rule>
</state>
</rules>
</lexer>

View File

@@ -53,7 +53,7 @@
<bygroups>
<token type="Punctuation"/>
<token type="LiteralStringDoc"/>
<token type="TextWhitespace"/>
<token type="Ignore"/>
</bygroups>
</rule>
<rule pattern="(false|False|FALSE|true|True|TRUE|null|Off|off|yes|Yes|YES|OFF|On|ON|no|No|on|NO|n|N|Y|y)\b">

View File

@@ -3,11 +3,18 @@
<name>Zig</name>
<alias>zig</alias>
<filename>*.zig</filename>
<filename>*.zon</filename>
<mime_type>text/zig</mime_type>
</config>
<rules>
<state name="string">
<rule pattern="\\(x[a-fA-F0-9]{2}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{6}|[nr\\t\&#39;&#34;])">
<rule pattern="\\x[0-9a-fA-F]{2}">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\\u\{[0-9a-fA-F]+\}">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\\[nrt&#39;&#34;\\]">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="[^\\&#34;\n]+">
@@ -17,96 +24,164 @@
<token type="LiteralString"/>
<pop depth="1"/>
</rule>
<rule pattern="\\">
<token type="LiteralString"/>
</rule>
</state>
<state name="quoted_ident">
<rule pattern="\\x[0-9a-fA-F]{2}">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\\u\{[0-9a-fA-F]+\}">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\\[nrt&#39;&#34;\\]">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="[^\\&#34;\n]+">
<token type="Name"/>
</rule>
<rule pattern="&#34;">
<token type="Name"/>
<pop depth="1"/>
</rule>
<rule pattern="\\">
<token type="Name"/>
</rule>
</state>
<state name="root">
<!-- Whitespace -->
<rule pattern="\n">
<token type="TextWhitespace"/>
</rule>
<rule pattern="\s+">
<token type="TextWhitespace"/>
</rule>
<rule pattern="//.*?\n">
<!-- Comments -->
<rule pattern="//!.*$">
<token type="CommentSpecial"/>
</rule>
<rule pattern="///.*$">
<token type="CommentSpecial"/>
</rule>
<rule pattern="//.*$">
<token type="CommentSingle"/>
</rule>
<rule pattern="(unreachable|continue|errdefer|suspend|return|resume|cancel|break|catch|async|await|defer|asm|try)\b">
<!-- Statement keywords -->
<rule pattern="(break|return|continue|asm|defer|errdefer|unreachable|try|catch|suspend|resume|nosuspend)\b">
<token type="Keyword"/>
</rule>
<rule pattern="(threadlocal|linksection|allowzero|stdcallcc|volatile|comptime|noalias|nakedcc|inline|export|packed|extern|align|const|pub|var)\b">
<!-- Storage/reserved keywords -->
<rule pattern="(const|var|extern|packed|export|pub|noalias|inline|noinline|comptime|volatile|allowzero|align|addrspace|linksection|threadlocal|callconv)\b">
<token type="KeywordReserved"/>
</rule>
<rule pattern="(struct|union|error|enum)\b">
<!-- Structure keywords -->
<rule pattern="(struct|enum|union|error|opaque)\b">
<token type="Keyword"/>
</rule>
<!-- Repeat keywords -->
<rule pattern="(while|for)\b">
<token type="Keyword"/>
</rule>
<rule pattern="(comptime_float|comptime_int|c_longdouble|c_ulonglong|c_longlong|c_voidi8|noreturn|c_ushort|anyerror|promise|c_short|c_ulong|c_uint|c_long|isize|c_int|usize|void|f128|i128|type|bool|u128|u16|f64|f32|u64|i16|f16|i32|u32|i64|u8|i0|u0)\b">
<!-- Type keywords -->
<rule pattern="(bool|void|noreturn|type|anyerror|anyopaque|f16|f32|f64|f80|f128|i8|u8|i16|u16|i32|u32|i64|u64|i128|u128|isize|usize|comptime_int|comptime_float|c_char|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|c_longlong|c_ulonglong|c_longdouble)\b">
<token type="KeywordType"/>
</rule>
<rule pattern="(undefined|false|true|null)\b">
<!-- Constant keywords -->
<rule pattern="(true|false|null|undefined)\b">
<token type="KeywordConstant"/>
</rule>
<rule pattern="(switch|orelse|else|and|if|or)\b">
<!-- Conditional keywords -->
<rule pattern="(if|else|switch|and|or|orelse)\b">
<token type="Keyword"/>
</rule>
<rule pattern="(usingnamespace|test|fn)\b">
<!-- Other keywords -->
<rule pattern="(fn|test|anyframe|anytype)\b">
<token type="Keyword"/>
</rule>
<rule pattern="0x[0-9a-fA-F]+\.[0-9a-fA-F]+([pP][\-+]?[0-9a-fA-F]+)?">
<!-- Hex float -->
<rule pattern="0x[0-9a-fA-F][0-9a-fA-F_]*(?:\.[0-9a-fA-F][0-9a-fA-F_]*(?:[pP][-+]?[0-9][0-9_]*)?|[pP][-+]?[0-9][0-9_]*)">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="0x[0-9a-fA-F]+\.?[pP][\-+]?[0-9a-fA-F]+">
<!-- Decimal float -->
<rule pattern="[0-9][0-9_]*(?:\.[0-9][0-9_]*(?:[eE][-+]?[0-9][0-9_]*)?|[eE][-+]?[0-9][0-9_]*)">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="[0-9]+\.[0-9]+([eE][-+]?[0-9]+)?">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="[0-9]+\.?[eE][-+]?[0-9]+">
<token type="LiteralNumberFloat"/>
</rule>
<rule pattern="0b(?:_?[01])+">
<!-- Binary -->
<rule pattern="0b[01][01_]*">
<token type="LiteralNumberBin"/>
</rule>
<rule pattern="0o(?:_?[0-7])+">
<!-- Octal -->
<rule pattern="0o[0-7][0-7_]*">
<token type="LiteralNumberOct"/>
</rule>
<rule pattern="0x(?:_?[0-9a-fA-F])+">
<!-- Hex integer -->
<rule pattern="0x[0-9a-fA-F][0-9a-fA-F_]*">
<token type="LiteralNumberHex"/>
</rule>
<rule pattern="(?:_?[0-9])+">
<!-- Decimal integer -->
<rule pattern="[0-9][0-9_]*">
<token type="LiteralNumberInteger"/>
</rule>
<rule pattern="@[a-zA-Z_]\w*">
<!-- Quoted identifier -->
<rule pattern="@&#34;">
<token type="Name"/>
<push state="quoted_ident"/>
</rule>
<!-- Builtin -->
<rule pattern="@[a-zA-Z_][a-zA-Z0-9_]*">
<token type="NameBuiltin"/>
</rule>
<rule pattern="[a-zA-Z_]\w*">
<!-- Function call -->
<rule pattern="[a-zA-Z_][a-zA-Z0-9_]*(?=\s*\()">
<token type="NameFunction"/>
</rule>
<!-- Identifier -->
<rule pattern="[a-zA-Z_][a-zA-Z0-9_]*">
<token type="Name"/>
</rule>
<rule pattern="\&#39;\\\&#39;\&#39;">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\&#39;\\(|x[a-fA-F0-9]{2}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{6}|[nr\\t\&#39;&#34;])\&#39;">
<token type="LiteralStringEscape"/>
</rule>
<rule pattern="\&#39;[^\\\&#39;]\&#39;">
<token type="LiteralString"/>
<!-- Character literal -->
<rule pattern="&#39;(?:\\x[0-9a-fA-F]{2}|\\u\{[0-9a-fA-F]+\}|\\[nrt&#39;&#34;\\]|[^\\&#39;\n])&#39;">
<token type="LiteralStringChar"/>
</rule>
<!-- Multiline string -->
<rule pattern="\\\\[^\n]*">
<token type="LiteralStringHeredoc"/>
</rule>
<rule pattern="c\\\\[^\n]*">
<token type="LiteralStringHeredoc"/>
</rule>
<rule pattern="c?&#34;">
<!-- String start -->
<rule pattern="&#34;">
<token type="LiteralString"/>
<push state="string"/>
</rule>
<rule pattern="[+%=&gt;&lt;|^!?/\-*&amp;~:]">
<!-- 4-char operators -->
<rule pattern="&lt;&lt;\|=">
<token type="Operator"/>
</rule>
<rule pattern="[{}()\[\],.;]">
<!-- 3-char operators -->
<rule pattern="(?:\+%=|-%=|\*%=|\+\|=|-\|=|\*\|=|&lt;&lt;=|&gt;&gt;=|&lt;&lt;\|)">
<token type="Operator"/>
</rule>
<!-- 2-char operators -->
<rule pattern="(?:\+\+|\*\*|\|\||&lt;&lt;|&gt;&gt;|\+%|-%|\*%|\+\||-\||\*\||==|!=|&lt;=|&gt;=|\+=|-=|\*=|/=|%=|&amp;=|\|=|\^=|\.\*|\.\?|\.\.)">
<token type="Operator"/>
</rule>
<!-- 1-char operators -->
<rule pattern="[+\-*/%&amp;|^~!&lt;&gt;=]">
<token type="Operator"/>
</rule>
<!-- Punctuation -->
<rule pattern="\.\.\.">
<token type="Punctuation"/>
</rule>
<rule pattern="=&gt;">
<token type="Punctuation"/>
</rule>
<rule pattern="-&gt;">
<token type="Punctuation"/>
</rule>
<rule pattern="[{}()\[\],.;:?]">
<token type="Punctuation"/>
</rule>
</state>
</rules>
</lexer>
</lexer>

View File

@@ -0,0 +1,37 @@
package lexers
import (
. "github.com/alecthomas/chroma/v2" // nolint
)
// Gemtext lexer.
var Gemtext = Register(MustNewLexer(
&Config{
Name: "Gemtext",
Aliases: []string{"gemtext", "gmi", "gmni", "gemini"},
Filenames: []string{"*.gmi", "*.gmni", "*.gemini"},
MimeTypes: []string{"text/gemini"},
},
gemtextRules,
))
func gemtextRules() Rules {
return Rules{
"root": {
{`^(#[^#].+\r?\n)`, ByGroups(GenericHeading), nil},
{`^(#{2,3}.+\r?\n)`, ByGroups(GenericSubheading), nil},
{`^(\* )(.+\r?\n)`, ByGroups(Keyword, Text), nil},
{`^(>)(.+\r?\n)`, ByGroups(Keyword, GenericEmph), nil},
{"^(```\\r?\\n)([\\w\\W]*?)(^```)(.+\\r?\\n)?", ByGroups(String, Text, String, Comment), nil},
{
"^(```)(\\w+)(\\r?\\n)([\\w\\W]*?)(^```)(.+\\r?\\n)?",
UsingByGroup(2, 4, String, String, String, Text, String, Comment),
nil,
},
{"^(```)(.+\\r?\\n)([\\w\\W]*?)(^```)(.+\\r?\\n)?", ByGroups(String, String, Text, String, Comment), nil},
{`^(=>)(\s*)([^\s]+)(\s*)$`, ByGroups(Keyword, Text, NameAttribute, Text), nil},
{`^(=>)(\s*)([^\s]+)(\s+)(.+)$`, ByGroups(Keyword, Text, NameAttribute, Text, NameTag), nil},
{`(.|(?:\r?\n))`, ByGroups(Text), nil},
},
}
}

View File

@@ -13,7 +13,6 @@ var Go = Register(MustNewLexer(
Aliases: []string{"go", "golang"},
Filenames: []string{"*.go"},
MimeTypes: []string{"text/x-gosrc"},
EnsureNL: true,
},
goRules,
).SetAnalyser(func(text string) float32 {
@@ -29,17 +28,17 @@ var Go = Register(MustNewLexer(
func goRules() Rules {
return Rules{
"root": {
{`\n`, Text, nil},
{`\s+`, Text, nil},
{`\\\n`, Text, nil},
{`//(.*?)\n`, CommentSingle, nil},
{`\n`, TextWhitespace, nil},
{`\s+`, TextWhitespace, nil},
{`//[^\s][^\n\r]*`, CommentPreproc, nil},
{`//\s+[^\n\r]*`, CommentSingle, nil},
{`/(\\\n)?[*](.|\n)*?[*](\\\n)?/`, CommentMultiline, nil},
{`(import|package)\b`, KeywordNamespace, nil},
{`(var|func|struct|map|chan|type|interface|const)\b`, KeywordDeclaration, nil},
{Words(``, `\b`, `break`, `default`, `select`, `case`, `defer`, `go`, `else`, `goto`, `switch`, `fallthrough`, `if`, `range`, `continue`, `for`, `return`), Keyword, nil},
{`(true|false|iota|nil)\b`, KeywordConstant, nil},
{Words(``, `\b(\()`, `uint`, `uint8`, `uint16`, `uint32`, `uint64`, `int`, `int8`, `int16`, `int32`, `int64`, `float`, `float32`, `float64`, `complex64`, `complex128`, `byte`, `rune`, `string`, `bool`, `error`, `uintptr`, `print`, `println`, `panic`, `recover`, `close`, `complex`, `real`, `imag`, `len`, `cap`, `append`, `copy`, `delete`, `new`, `make`, `clear`, `min`, `max`), ByGroups(NameBuiltin, Punctuation), nil},
{Words(``, `\b`, `uint`, `uint8`, `uint16`, `uint32`, `uint64`, `int`, `int8`, `int16`, `int32`, `int64`, `float`, `float32`, `float64`, `complex64`, `complex128`, `byte`, `rune`, `string`, `bool`, `error`, `uintptr`), KeywordType, nil},
{Words(``, `\b`, `uint`, `uint8`, `uint16`, `uint32`, `uint64`, `int`, `int8`, `int16`, `int32`, `int64`, `float`, `float32`, `float64`, `complex64`, `complex128`, `byte`, `rune`, `string`, `bool`, `error`, `uintptr`, `any`), KeywordType, nil},
{`\d+i`, LiteralNumber, nil},
{`\d+\.\d*([Ee][-+]\d+)?i`, LiteralNumber, nil},
{`\.\d+([Ee][-+]\d+)?i`, LiteralNumber, nil},
@@ -55,7 +54,7 @@ func goRules() Rules {
{`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
{`(<<=|>>=|<<|>>|<=|>=|&\^=|&\^|\+=|-=|\*=|/=|%=|&=|\|=|&&|\|\||<-|\+\+|--|==|!=|:=|\.\.\.|[+\-*/%&])`, Operator, nil},
{`([a-zA-Z_]\w*)(\s*)(\()`, ByGroups(NameFunction, UsingSelf("root"), Punctuation), nil},
{`[|^<>=!()\[\]{}.,;:]`, Punctuation, nil},
{`[|^<>=!()\[\]{}.,;:~]`, Punctuation, nil},
{`[^\W\d]\w*`, NameOther, nil},
},
}

View File

@@ -29,6 +29,12 @@ func Names(withAliases bool) []string {
return GlobalLexerRegistry.Names(withAliases)
}
// Aliases of all the lexers, and skip those lexers who do not have any aliases,
// or show their name instead
func Aliases(skipWithoutAliases bool) []string {
return GlobalLexerRegistry.Aliases(skipWithoutAliases)
}
// Get a Lexer by name, alias or file extension.
//
// Note that this if there isn't an exact match on name or alias, this will

View File

@@ -5,7 +5,7 @@ import (
)
// Markdown lexer.
var Markdown = Register(DelegatingLexer(HTML, MustNewLexer(
var Markdown = Register(MustNewLexer(
&Config{
Name: "markdown",
Aliases: []string{"md", "mkd"},
@@ -13,7 +13,7 @@ var Markdown = Register(DelegatingLexer(HTML, MustNewLexer(
MimeTypes: []string{"text/x-markdown"},
},
markdownRules,
)))
))
func markdownRules() Rules {
return Rules{
@@ -40,8 +40,7 @@ func markdownRules() Rules {
{"`[^`]+`", LiteralStringBacktick, nil},
{`[@#][\w/:]+`, NameEntity, nil},
{`(!?\[)([^]]+)(\])(\()([^)]+)(\))`, ByGroups(Text, NameTag, Text, Text, NameAttribute, Text), nil},
{`[^\\\s]+`, Other, nil},
{`.|\n`, Other, nil},
{`.|\n`, Text, nil},
},
}
}

View File

@@ -0,0 +1,168 @@
package lexers
import (
. "github.com/alecthomas/chroma/v2" // nolint
)
// Markless lexer.
var Markless = Register(MustNewLexer(
&Config{
Name: "Markless",
Aliases: []string{"mess"},
Filenames: []string{"*.mess", "*.markless"},
MimeTypes: []string{"text/x-markless"},
},
marklessRules,
))
func marklessRules() Rules {
return Rules{
"root": {
Include("block"),
},
// Block directives
"block": {
Include("header"),
Include("ordered-list"),
Include("unordered-list"),
Include("code-block"),
Include("blockquote"),
Include("blockquote-header"),
Include("align"),
Include("comment"),
Include("instruction"),
Include("embed"),
Include("footnote"),
Include("horizontal-rule"),
Include("paragraph"),
},
"header": {
{`(# )(.*)$`, ByGroups(Keyword, GenericHeading), Push("inline")},
{`(##+)(.*)$`, ByGroups(Keyword, GenericSubheading), Push("inline")},
},
"ordered-list": {
{`([0-9]+\.)`, Keyword, nil},
},
"unordered-list": {
{`(- )`, Keyword, nil},
},
"code-block": {
{`(::+)( *)(\w*)([^\n]*)(\n)([\w\W]*?)(^\1$)`, UsingByGroup(3, 6, Keyword, TextWhitespace, NameFunction, String, TextWhitespace, Text, Keyword), nil},
},
"blockquote": {
{`(\| )(.*)$`, ByGroups(Keyword, GenericInserted), nil},
},
"blockquote-header": {
{`(~ )([^|\n]+)(\| )(.*?\n)`, ByGroups(Keyword, NameEntity, Keyword, GenericInserted), Push("inline-blockquote")},
{`(~ )(.*)$`, ByGroups(Keyword, NameEntity), nil},
},
"inline-blockquote": {
{`^( +)(\| )(.*$)`, ByGroups(TextWhitespace, Keyword, GenericInserted), nil},
Default(Pop(1)),
},
"align": {
{`(\|\|)|(\|<)|(\|>)|(><)`, Keyword, nil},
},
"comment": {
{`(;[; ]).*?$`, CommentSingle, nil},
},
"instruction": {
{`(! )([^ ]+)(.+?)$`, ByGroups(Keyword, NameFunction, NameVariable), nil},
},
"embed": {
{`(\[ )([^ ]+)( )([^,]+)`, ByGroups(Keyword, NameFunction, TextWhitespace, String), Push("embed-options")},
},
"embed-options": {
{`\\.`, Text, nil},
{`,`, Punctuation, nil},
{`\]?$`, Keyword, Pop(1)},
// Generic key or key/value pair
{`( *)([^, \]]+)([^,\]]+)?`, ByGroups(TextWhitespace, NameFunction, String), nil},
{`.`, Text, nil},
},
"footnote": {
{`(\[)([0-9]+)(\])`, ByGroups(Keyword, NameVariable, Keyword), Push("inline")},
},
"horizontal-rule": {
{`(==+)$`, LiteralOther, nil},
},
"paragraph": {
{` *`, TextWhitespace, Push("inline")},
},
// Inline directives
"inline": {
Include("escapes"),
Include("dashes"),
Include("newline"),
Include("italic"),
Include("underline"),
Include("bold"),
Include("strikethrough"),
Include("code"),
Include("compound"),
Include("footnote-reference"),
Include("subtext"),
Include("subtext"),
Include("url"),
{`.`, Text, nil},
{`\n`, TextWhitespace, Pop(1)},
},
"escapes": {
{`\\.`, Text, nil},
},
"dashes": {
{`-{2,3}`, TextPunctuation, nil},
},
"newline": {
{`-/-`, TextWhitespace, nil},
},
"italic": {
{`(//)(.*?)(\1)`, ByGroups(Keyword, GenericEmph, Keyword), nil},
},
"underline": {
{`(__)(.*?)(\1)`, ByGroups(Keyword, GenericUnderline, Keyword), nil},
},
"bold": {
{`(\*\*)(.*?)(\1)`, ByGroups(Keyword, GenericStrong, Keyword), nil},
},
"strikethrough": {
{`(<-)(.*?)(->)`, ByGroups(Keyword, GenericDeleted, Keyword), nil},
},
"code": {
{"(``+)(.*?)(\\1)", ByGroups(Keyword, LiteralStringBacktick, Keyword), nil},
},
"compound": {
{`(''+)(.*?)(''\()`, ByGroups(Keyword, UsingSelf("inline"), Keyword), Push("compound-options")},
},
"compound-options": {
{`\\.`, Text, nil},
{`,`, Punctuation, nil},
{`\)`, Keyword, Pop(1)},
// Hex Color
{` *#[0-9A-Fa-f]{3,6} *`, LiteralNumberHex, nil},
// Named Color
{` *(indian-red|light-coral|salmon|dark-salmon|light-salmon|crimson|red|firebrick|dark-red|pink|light-pink|hot-pink|deep-pink|medium-violet-red|pale-violet-red|coral|tomato|orange-red|dark-orange|orange|gold|yellow|light-yellow|lemon-chiffon|light-goldenrod-yellow|papayawhip|moccasin|peachpuff|pale-goldenrod|khaki|dark-khaki|lavender|thistle|plum|violet|orchid|fuchsia|magenta|medium-orchid|medium-purple|rebecca-purple|blue-violet|dark-violet|dark-orchid|dark-magenta|purple|indigo|slate-blue|dark-slate-blue|medium-slate-blue|green-yellow|chartreuse|lawn-green|lime|lime-green|pale-green|light-green|medium-spring-green|spring-green|medium-sea-green|sea-green|forest-green|green|dark-green|yellow-green|olive-drab|olive|dark-olive-green|medium-aquamarine|dark-sea-green|light-sea-green|dark-cyan|teal|aqua|cyan|light-cyan|pale-turquoise|aquamarine|turquoise|medium-turquoise|dark-turquoise|cadet-blue|steel-blue|light-steel-blue|powder-blue|light-blue|sky-blue|light-sky-blue|deep-sky-blue|dodger-blue|cornflower-blue|royal-blue|blue|medium-blue|dark-blue|navy|midnight-blue|cornsilk|blanched-almond|bisque|navajo-white|wheat|burlywood|tan|rosy-brown|sandy-brown|goldenrod|dark-goldenrod|peru|chocolate|saddle-brown|sienna|brown|maroon|white|snow|honeydew|mintcream|azure|alice-blue|ghost-white|white-smoke|seashell|beige|oldlace|floral-white|ivory|antique-white|linen|lavenderblush|mistyrose|gainsboro|light-gray|silver|dark-gray|gray|dim-gray|light-slate-gray|slate-gray|dark-slate-gray) *`, LiteralOther, nil},
// Named size
{` *(microscopic|tiny|small|normal|big|large|huge|gigantic) *`, NameTag, nil},
// Options
{` *(bold|italic|underline|strikethrough|subtext|supertext|spoiler) *`, NameBuiltin, nil},
// URL. Note the missing ) and , in the match.
{` *\w[-\w+.]*://[\w$\-_.+!*'(&/:;=?@z%#\\]+ *`, String, nil},
// Generic key or key/value pair
{`( *)([^, )]+)( [^,)]+)?`, ByGroups(TextWhitespace, NameFunction, String), nil},
{`.`, Text, nil},
},
"footnote-reference": {
{`(\[)([0-9]+)(\])`, ByGroups(Keyword, NameVariable, Keyword), nil},
},
"subtext": {
{`(v\()(.*?)(\))`, ByGroups(Keyword, UsingSelf("inline"), Keyword), nil},
},
"supertext": {
{`(\^\()(.*?)(\))`, ByGroups(Keyword, UsingSelf("inline"), Keyword), nil},
},
"url": {
{`\w[-\w+.]*://[\w\$\-_.+!*'()&,/:;=?@z%#\\]+`, String, nil},
},
}
}

View File

@@ -2,6 +2,7 @@ package lexers
import (
"regexp"
"slices"
"strings"
"unicode/utf8"
@@ -1318,21 +1319,11 @@ func indexAt(str []rune, substr []rune, pos int) int {
return idx
}
// Tells if an array of string contains a string
func contains(s []string, e string) bool {
for _, value := range s {
if value == e {
return true
}
}
return false
}
type rulePosition int
const (
topRule rulePosition = 0
bottomRule = -1
topRule rulePosition = 0 - iota
bottomRule
)
type ruleMakingConfig struct {
@@ -1625,15 +1616,15 @@ func quote(groups []string, state *LexerState) Iterator {
var tokenState string
switch {
case keyword == "qq" || contains(tokenStates, "qq"):
case keyword == "qq" || slices.Contains(tokenStates, "qq"):
tokenState = "qq"
case adverbsStr == "ww" || contains(tokenStates, "ww"):
case adverbsStr == "ww" || slices.Contains(tokenStates, "ww"):
tokenState = "ww"
case contains(tokenStates, "Q-closure") && contains(tokenStates, "Q-variable"):
case slices.Contains(tokenStates, "Q-closure") && slices.Contains(tokenStates, "Q-variable"):
tokenState = "qq"
case contains(tokenStates, "Q-closure"):
case slices.Contains(tokenStates, "Q-closure"):
tokenState = "Q-closure"
case contains(tokenStates, "Q-variable"):
case slices.Contains(tokenStates, "Q-variable"):
tokenState = "Q-variable"
default:
tokenState = "Q"