This commit is contained in:
58
vendor/github.com/alecthomas/chroma/lexers/m/make.go
generated
vendored
Normal file
58
vendor/github.com/alecthomas/chroma/lexers/m/make.go
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
package m
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
. "github.com/alecthomas/chroma/lexers/b" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Makefile lexer.
|
||||
var Makefile = internal.Register(MustNewLazyLexer(
|
||||
&Config{
|
||||
Name: "Base Makefile",
|
||||
Aliases: []string{"make", "makefile", "mf", "bsdmake"},
|
||||
Filenames: []string{"*.mak", "*.mk", "Makefile", "makefile", "Makefile.*", "GNUmakefile"},
|
||||
MimeTypes: []string{"text/x-makefile"},
|
||||
EnsureNL: true,
|
||||
},
|
||||
makefileRules,
|
||||
))
|
||||
|
||||
func makefileRules() Rules {
|
||||
return Rules{
|
||||
"root": {
|
||||
{`^(?:[\t ]+.*\n|\n)+`, Using(Bash), nil},
|
||||
{`\$[<@$+%?|*]`, Keyword, nil},
|
||||
{`\s+`, Text, nil},
|
||||
{`#.*?\n`, Comment, nil},
|
||||
{`(export)(\s+)(?=[\w${}\t -]+\n)`, ByGroups(Keyword, Text), Push("export")},
|
||||
{`export\s+`, Keyword, nil},
|
||||
{`([\w${}().-]+)(\s*)([!?:+]?=)([ \t]*)((?:.*\\\n)+|.*\n)`, ByGroups(NameVariable, Text, Operator, Text, Using(Bash)), nil},
|
||||
{`(?s)"(\\\\|\\.|[^"\\])*"`, LiteralStringDouble, nil},
|
||||
{`(?s)'(\\\\|\\.|[^'\\])*'`, LiteralStringSingle, nil},
|
||||
{`([^\n:]+)(:+)([ \t]*)`, ByGroups(NameFunction, Operator, Text), Push("block-header")},
|
||||
{`\$\(`, Keyword, Push("expansion")},
|
||||
},
|
||||
"expansion": {
|
||||
{`[^$a-zA-Z_()]+`, Text, nil},
|
||||
{`[a-zA-Z_]+`, NameVariable, nil},
|
||||
{`\$`, Keyword, nil},
|
||||
{`\(`, Keyword, Push()},
|
||||
{`\)`, Keyword, Pop(1)},
|
||||
},
|
||||
"export": {
|
||||
{`[\w${}-]+`, NameVariable, nil},
|
||||
{`\n`, Text, Pop(1)},
|
||||
{`\s+`, Text, nil},
|
||||
},
|
||||
"block-header": {
|
||||
{`[,|]`, Punctuation, nil},
|
||||
{`#.*?\n`, Comment, Pop(1)},
|
||||
{`\\\n`, Text, nil},
|
||||
{`\$\(`, Keyword, Push("expansion")},
|
||||
{`[a-zA-Z_]+`, Name, nil},
|
||||
{`\n`, Text, Pop(1)},
|
||||
{`.`, Text, nil},
|
||||
},
|
||||
}
|
||||
}
|
||||
64
vendor/github.com/alecthomas/chroma/lexers/m/mako.go
generated
vendored
Normal file
64
vendor/github.com/alecthomas/chroma/lexers/m/mako.go
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
package m
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
. "github.com/alecthomas/chroma/lexers/p" // nolint
|
||||
)
|
||||
|
||||
// Mako lexer.
|
||||
var Mako = internal.Register(MustNewLazyLexer(
|
||||
&Config{
|
||||
Name: "Mako",
|
||||
Aliases: []string{"mako"},
|
||||
Filenames: []string{"*.mao"},
|
||||
MimeTypes: []string{"application/x-mako"},
|
||||
},
|
||||
makoRules,
|
||||
))
|
||||
|
||||
func makoRules() Rules {
|
||||
return Rules{
|
||||
"root": {
|
||||
{`(\s*)(%)(\s*end(?:\w+))(\n|\Z)`, ByGroups(Text, CommentPreproc, Keyword, Other), nil},
|
||||
{`(\s*)(%)([^\n]*)(\n|\Z)`, ByGroups(Text, CommentPreproc, Using(Python), Other), nil},
|
||||
{`(\s*)(##[^\n]*)(\n|\Z)`, ByGroups(Text, CommentPreproc, Other), nil},
|
||||
{`(?s)<%doc>.*?</%doc>`, CommentPreproc, nil},
|
||||
{`(<%)([\w.:]+)`, ByGroups(CommentPreproc, NameBuiltin), Push("tag")},
|
||||
{`(</%)([\w.:]+)(>)`, ByGroups(CommentPreproc, NameBuiltin, CommentPreproc), nil},
|
||||
{`<%(?=([\w.:]+))`, CommentPreproc, Push("ondeftags")},
|
||||
{`(<%(?:!?))(.*?)(%>)(?s)`, ByGroups(CommentPreproc, Using(Python), CommentPreproc), nil},
|
||||
{`(\$\{)(.*?)(\})`, ByGroups(CommentPreproc, Using(Python), CommentPreproc), nil},
|
||||
{`(?sx)
|
||||
(.+?) # anything, followed by:
|
||||
(?:
|
||||
(?<=\n)(?=%|\#\#) | # an eval or comment line
|
||||
(?=\#\*) | # multiline comment
|
||||
(?=</?%) | # a python block
|
||||
# call start or end
|
||||
(?=\$\{) | # a substitution
|
||||
(?<=\n)(?=\s*%) |
|
||||
# - don't consume
|
||||
(\\\n) | # an escaped newline
|
||||
\Z # end of string
|
||||
)
|
||||
`, ByGroups(Other, Operator), nil},
|
||||
{`\s+`, Text, nil},
|
||||
},
|
||||
"ondeftags": {
|
||||
{`<%`, CommentPreproc, nil},
|
||||
{`(?<=<%)(include|inherit|namespace|page)`, NameBuiltin, nil},
|
||||
Include("tag"),
|
||||
},
|
||||
"tag": {
|
||||
{`((?:\w+)\s*=)(\s*)(".*?")`, ByGroups(NameAttribute, Text, LiteralString), nil},
|
||||
{`/?\s*>`, CommentPreproc, Pop(1)},
|
||||
{`\s+`, Text, nil},
|
||||
},
|
||||
"attr": {
|
||||
{`".*?"`, LiteralString, Pop(1)},
|
||||
{`'.*?'`, LiteralString, Pop(1)},
|
||||
{`[^\s>]+`, LiteralString, Pop(1)},
|
||||
},
|
||||
}
|
||||
}
|
||||
53
vendor/github.com/alecthomas/chroma/lexers/m/markdown.go
generated
vendored
Normal file
53
vendor/github.com/alecthomas/chroma/lexers/m/markdown.go
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
package m
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/h"
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Markdown lexer.
|
||||
var Markdown = internal.Register(DelegatingLexer(h.HTML, MustNewLazyLexer(
|
||||
&Config{
|
||||
Name: "markdown",
|
||||
Aliases: []string{"md", "mkd"},
|
||||
Filenames: []string{"*.md", "*.mkd", "*.markdown"},
|
||||
MimeTypes: []string{"text/x-markdown"},
|
||||
},
|
||||
markdownRules,
|
||||
)))
|
||||
|
||||
func markdownRules() Rules {
|
||||
return Rules{
|
||||
"root": {
|
||||
{`^(#[^#].+\n)`, ByGroups(GenericHeading), nil},
|
||||
{`^(#{2,6}.+\n)`, ByGroups(GenericSubheading), nil},
|
||||
{`^(\s*)([*-] )(\[[ xX]\])( .+\n)`, ByGroups(Text, Keyword, Keyword, UsingSelf("inline")), nil},
|
||||
{`^(\s*)([*-])(\s)(.+\n)`, ByGroups(Text, Keyword, Text, UsingSelf("inline")), nil},
|
||||
{`^(\s*)([0-9]+\.)( .+\n)`, ByGroups(Text, Keyword, UsingSelf("inline")), nil},
|
||||
{`^(\s*>\s)(.+\n)`, ByGroups(Keyword, GenericEmph), nil},
|
||||
{"^(```\\n)([\\w\\W]*?)(^```$)", ByGroups(String, Text, String), nil},
|
||||
{
|
||||
"^(```)(\\w+)(\\n)([\\w\\W]*?)(^```$)",
|
||||
UsingByGroup(
|
||||
internal.Get,
|
||||
2, 4,
|
||||
String, String, String, Text, String,
|
||||
),
|
||||
nil,
|
||||
},
|
||||
Include("inline"),
|
||||
},
|
||||
"inline": {
|
||||
{`\\.`, Text, nil},
|
||||
{`(\s)(\*|_)((?:(?!\2).)*)(\2)((?=\W|\n))`, ByGroups(Text, GenericEmph, GenericEmph, GenericEmph, Text), nil},
|
||||
{`(\s)((\*\*|__).*?)\3((?=\W|\n))`, ByGroups(Text, GenericStrong, GenericStrong, Text), nil},
|
||||
{`(\s)(~~[^~]+~~)((?=\W|\n))`, ByGroups(Text, GenericDeleted, Text), nil},
|
||||
{"`[^`]+`", LiteralStringBacktick, nil},
|
||||
{`[@#][\w/:]+`, NameEntity, nil},
|
||||
{`(!?\[)([^]]+)(\])(\()([^)]+)(\))`, ByGroups(Text, NameTag, Text, Text, NameAttribute, Text), nil},
|
||||
{`[^\\\s]+`, Other, nil},
|
||||
{`.|\n`, Other, nil},
|
||||
},
|
||||
}
|
||||
}
|
||||
47
vendor/github.com/alecthomas/chroma/lexers/m/mason.go
generated
vendored
Normal file
47
vendor/github.com/alecthomas/chroma/lexers/m/mason.go
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
package m
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
. "github.com/alecthomas/chroma/lexers/h" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
. "github.com/alecthomas/chroma/lexers/p" // nolint
|
||||
)
|
||||
|
||||
// Mason lexer.
|
||||
var Mason = internal.Register(MustNewLazyLexer(
|
||||
&Config{
|
||||
Name: "Mason",
|
||||
Aliases: []string{"mason"},
|
||||
Filenames: []string{"*.m", "*.mhtml", "*.mc", "*.mi", "autohandler", "dhandler"},
|
||||
MimeTypes: []string{"application/x-mason"},
|
||||
Priority: 0.1,
|
||||
},
|
||||
masonRules,
|
||||
))
|
||||
|
||||
func masonRules() Rules {
|
||||
return Rules{
|
||||
"root": {
|
||||
{`\s+`, Text, nil},
|
||||
{`(<%doc>)(.*?)(</%doc>)(?s)`, ByGroups(NameTag, CommentMultiline, NameTag), nil},
|
||||
{`(<%(?:def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)(?s)`, ByGroups(NameTag, Text, NameFunction, NameTag, UsingSelf("root"), NameTag), nil},
|
||||
{`(<%\w+)(.*?)(>)(.*?)(</%\2\s*>)(?s)`, ByGroups(NameTag, NameFunction, NameTag, Using(Perl), NameTag), nil},
|
||||
{`(<&[^|])(.*?)(,.*?)?(&>)(?s)`, ByGroups(NameTag, NameFunction, Using(Perl), NameTag), nil},
|
||||
{`(<&\|)(.*?)(,.*?)?(&>)(?s)`, ByGroups(NameTag, NameFunction, Using(Perl), NameTag), nil},
|
||||
{`</&>`, NameTag, nil},
|
||||
{`(<%!?)(.*?)(%>)(?s)`, ByGroups(NameTag, Using(Perl), NameTag), nil},
|
||||
{`(?<=^)#[^\n]*(\n|\Z)`, Comment, nil},
|
||||
{`(?<=^)(%)([^\n]*)(\n|\Z)`, ByGroups(NameTag, Using(Perl), Other), nil},
|
||||
{`(?sx)
|
||||
(.+?) # anything, followed by:
|
||||
(?:
|
||||
(?<=\n)(?=[%#]) | # an eval or comment line
|
||||
(?=</?[%&]) | # a substitution or block or
|
||||
# call start or end
|
||||
# - don't consume
|
||||
(\\\n) | # an escaped newline
|
||||
\Z # end of string
|
||||
)`, ByGroups(Using(HTML), Operator), nil},
|
||||
},
|
||||
}
|
||||
}
|
||||
36
vendor/github.com/alecthomas/chroma/lexers/m/mathematica.go
generated
vendored
Normal file
36
vendor/github.com/alecthomas/chroma/lexers/m/mathematica.go
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
package m
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Mathematica lexer.
|
||||
var Mathematica = internal.Register(MustNewLazyLexer(
|
||||
&Config{
|
||||
Name: "Mathematica",
|
||||
Aliases: []string{"mathematica", "mma", "nb"},
|
||||
Filenames: []string{"*.nb", "*.cdf", "*.nbp", "*.ma"},
|
||||
MimeTypes: []string{"application/mathematica", "application/vnd.wolfram.mathematica", "application/vnd.wolfram.mathematica.package", "application/vnd.wolfram.cdf"},
|
||||
},
|
||||
mathematicaRules,
|
||||
))
|
||||
|
||||
func mathematicaRules() Rules {
|
||||
return Rules{
|
||||
"root": {
|
||||
{`(?s)\(\*.*?\*\)`, Comment, nil},
|
||||
{"([a-zA-Z]+[A-Za-z0-9]*`)", NameNamespace, nil},
|
||||
{`([A-Za-z0-9]*_+[A-Za-z0-9]*)`, NameVariable, nil},
|
||||
{`#\d*`, NameVariable, nil},
|
||||
{`([a-zA-Z]+[a-zA-Z0-9]*)`, Name, nil},
|
||||
{`-?\d+\.\d*`, LiteralNumberFloat, nil},
|
||||
{`-?\d*\.\d+`, LiteralNumberFloat, nil},
|
||||
{`-?\d+`, LiteralNumberInteger, nil},
|
||||
{Words(``, ``, `;;`, `=`, `=.`, `!===`, `:=`, `->`, `:>`, `/.`, `+`, `-`, `*`, `/`, `^`, `&&`, `||`, `!`, `<>`, `|`, `/;`, `?`, `@`, `//`, `/@`, `@@`, `@@@`, `~~`, `===`, `&`, `<`, `>`, `<=`, `>=`), Operator, nil},
|
||||
{Words(``, ``, `,`, `;`, `(`, `)`, `[`, `]`, `{`, `}`), Punctuation, nil},
|
||||
{`".*?"`, LiteralString, nil},
|
||||
{`\s+`, TextWhitespace, nil},
|
||||
},
|
||||
}
|
||||
}
|
||||
55
vendor/github.com/alecthomas/chroma/lexers/m/matlab.go
generated
vendored
Normal file
55
vendor/github.com/alecthomas/chroma/lexers/m/matlab.go
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
package m
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Matlab lexer.
|
||||
var Matlab = internal.Register(MustNewLazyLexer(
|
||||
&Config{
|
||||
Name: "Matlab",
|
||||
Aliases: []string{"matlab"},
|
||||
Filenames: []string{"*.m"},
|
||||
MimeTypes: []string{"text/matlab"},
|
||||
},
|
||||
matlabRules,
|
||||
))
|
||||
|
||||
func matlabRules() Rules {
|
||||
return Rules{
|
||||
"root": {
|
||||
{`\n`, Text, nil},
|
||||
{`^!.*`, LiteralStringOther, nil},
|
||||
{`%\{\s*\n`, CommentMultiline, Push("blockcomment")},
|
||||
{`%.*$`, Comment, nil},
|
||||
{`^\s*function`, Keyword, Push("deffunc")},
|
||||
{Words(``, `\b`, `break`, `case`, `catch`, `classdef`, `continue`, `else`, `elseif`, `end`, `enumerated`, `events`, `for`, `function`, `global`, `if`, `methods`, `otherwise`, `parfor`, `persistent`, `properties`, `return`, `spmd`, `switch`, `try`, `while`), Keyword, nil},
|
||||
{`(sin|sind|sinh|asin|asind|asinh|cos|cosd|cosh|acos|acosd|acosh|tan|tand|tanh|atan|atand|atan2|atanh|sec|secd|sech|asec|asecd|asech|csc|cscd|csch|acsc|acscd|acsch|cot|cotd|coth|acot|acotd|acoth|hypot|exp|expm1|log|log1p|log10|log2|pow2|realpow|reallog|realsqrt|sqrt|nthroot|nextpow2|abs|angle|complex|conj|imag|real|unwrap|isreal|cplxpair|fix|floor|ceil|round|mod|rem|sign|airy|besselj|bessely|besselh|besseli|besselk|beta|betainc|betaln|ellipj|ellipke|erf|erfc|erfcx|erfinv|expint|gamma|gammainc|gammaln|psi|legendre|cross|dot|factor|isprime|primes|gcd|lcm|rat|rats|perms|nchoosek|factorial|cart2sph|cart2pol|pol2cart|sph2cart|hsv2rgb|rgb2hsv|zeros|ones|eye|repmat|rand|randn|linspace|logspace|freqspace|meshgrid|accumarray|size|length|ndims|numel|disp|isempty|isequal|isequalwithequalnans|cat|reshape|diag|blkdiag|tril|triu|fliplr|flipud|flipdim|rot90|find|end|sub2ind|ind2sub|bsxfun|ndgrid|permute|ipermute|shiftdim|circshift|squeeze|isscalar|isvector|ans|eps|realmax|realmin|pi|i|inf|nan|isnan|isinf|isfinite|j|why|compan|gallery|hadamard|hankel|hilb|invhilb|magic|pascal|rosser|toeplitz|vander|wilkinson)\b`, NameBuiltin, nil},
|
||||
{`\.\.\..*$`, Comment, nil},
|
||||
{`-|==|~=|<|>|<=|>=|&&|&|~|\|\|?`, Operator, nil},
|
||||
{`\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\`, Operator, nil},
|
||||
{`\[|\]|\(|\)|\{|\}|:|@|\.|,`, Punctuation, nil},
|
||||
{`=|:|;`, Punctuation, nil},
|
||||
{`(?<=[\w)\].])\'+`, Operator, nil},
|
||||
{`(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?`, LiteralNumberFloat, nil},
|
||||
{`\d+[eEf][+-]?[0-9]+`, LiteralNumberFloat, nil},
|
||||
{`\d+`, LiteralNumberInteger, nil},
|
||||
{`(?<![\w)\].])\'`, LiteralString, Push("string")},
|
||||
{`[a-zA-Z_]\w*`, Name, nil},
|
||||
{`.`, Text, nil},
|
||||
},
|
||||
"string": {
|
||||
{`[^\']*\'`, LiteralString, Pop(1)},
|
||||
},
|
||||
"blockcomment": {
|
||||
{`^\s*%\}`, CommentMultiline, Pop(1)},
|
||||
{`^.*\n`, CommentMultiline, nil},
|
||||
{`.`, CommentMultiline, nil},
|
||||
},
|
||||
"deffunc": {
|
||||
{`(\s*)(?:(.+)(\s*)(=)(\s*))?(.+)(\()(.*)(\))(\s*)`, ByGroups(TextWhitespace, Text, TextWhitespace, Punctuation, TextWhitespace, NameFunction, Punctuation, Text, Punctuation, TextWhitespace), Pop(1)},
|
||||
{`(\s*)([a-zA-Z_]\w*)`, ByGroups(Text, NameFunction), Pop(1)},
|
||||
},
|
||||
}
|
||||
}
|
||||
109
vendor/github.com/alecthomas/chroma/lexers/m/mcfunction.go
generated
vendored
Normal file
109
vendor/github.com/alecthomas/chroma/lexers/m/mcfunction.go
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
package m
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// mcfunction lexer.
|
||||
var MCFunction = internal.Register(MustNewLazyLexer(
|
||||
&Config{
|
||||
Name: "mcfunction",
|
||||
Aliases: []string{"mcfunction"},
|
||||
Filenames: []string{"*.mcfunction"},
|
||||
MimeTypes: []string{},
|
||||
NotMultiline: true,
|
||||
DotAll: true,
|
||||
},
|
||||
func() Rules {
|
||||
return Rules{
|
||||
"simplevalue": {
|
||||
{`(true|false)`, KeywordConstant, nil},
|
||||
{`[01]b`, LiteralNumber, nil},
|
||||
{`-?(0|[1-9]\d*)(\.\d+[eE](\+|-)?\d+|[eE](\+|-)?\d+|\.\d+)`, LiteralNumberFloat, nil},
|
||||
{`(-?\d+)(\.\.)(-?\d+)`, ByGroups(LiteralNumberInteger, Punctuation, LiteralNumberInteger), nil},
|
||||
{`-?(0|[1-9]\d*)`, LiteralNumberInteger, nil},
|
||||
{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
|
||||
{`'[^']+'`, LiteralStringSingle, nil},
|
||||
{`([!#]?)(\w+)`, ByGroups(Punctuation, Text), nil},
|
||||
},
|
||||
"nbtobjectattribute": {
|
||||
Include("nbtvalue"),
|
||||
{`:`, Punctuation, nil},
|
||||
{`,`, Punctuation, Pop(1)},
|
||||
{`\}`, Punctuation, Pop(2)},
|
||||
},
|
||||
"nbtobjectvalue": {
|
||||
{`("(\\\\|\\"|[^"])*"|[a-zA-Z0-9_]+)`, NameTag, Push("nbtobjectattribute")},
|
||||
{`\}`, Punctuation, Pop(1)},
|
||||
},
|
||||
"nbtarrayvalue": {
|
||||
Include("nbtvalue"),
|
||||
{`,`, Punctuation, nil},
|
||||
{`\]`, Punctuation, Pop(1)},
|
||||
},
|
||||
"nbtvalue": {
|
||||
Include("simplevalue"),
|
||||
{`\{`, Punctuation, Push("nbtobjectvalue")},
|
||||
{`\[`, Punctuation, Push("nbtarrayvalue")},
|
||||
},
|
||||
"argumentvalue": {
|
||||
Include("simplevalue"),
|
||||
{`,`, Punctuation, Pop(1)},
|
||||
{`[}\]]`, Punctuation, Pop(2)},
|
||||
},
|
||||
"argumentlist": {
|
||||
{`(nbt)(={)`, ByGroups(NameAttribute, Punctuation), Push("nbtobjectvalue")},
|
||||
{`([A-Za-z0-9/_!]+)(={)`, ByGroups(NameAttribute, Punctuation), Push("argumentlist")},
|
||||
{`([A-Za-z0-9/_!]+)(=)`, ByGroups(NameAttribute, Punctuation), Push("argumentvalue")},
|
||||
Include("simplevalue"),
|
||||
{`,`, Punctuation, nil},
|
||||
{`[}\]]`, Punctuation, Pop(1)},
|
||||
},
|
||||
"root": {
|
||||
{`#.*?\n`, CommentSingle, nil},
|
||||
{Words(`/?`, `\b`, `ability`, `attributes`, `advancement`,
|
||||
`ban`, `ban-ip`, `banlist`, `bossbar`,
|
||||
`camerashake`, `classroommode`, `clear`,
|
||||
`clearspawnpoint`, `clone`, `code`, `collect`,
|
||||
`createagent`, `data`, `datapack`, `debug`,
|
||||
`defaultgamemode`, `deop`, `destroy`, `detect`,
|
||||
`detectredstone`, `difficulty`, `dropall`,
|
||||
`effect`, `enchant`, `event`, `execute`,
|
||||
`experience`, `fill`, `flog`, `forceload`,
|
||||
`function`, `gamemode`, `gamerule`,
|
||||
`geteduclientinfo`, `give`, `help`, `item`,
|
||||
`immutableworld`, `kick`, `kill`, `list`,
|
||||
`locate`, `locatebiome`, `loot`, `me`, `mixer`,
|
||||
`mobevent`, `move`, `msg`, `music`, `op`,
|
||||
`pardon`, `particle`, `playanimation`,
|
||||
`playsound`, `position`, `publish`,
|
||||
`raytracefog`, `recipe`, `reload`, `remove`,
|
||||
`replaceitem`, `ride`, `save`, `save-all`,
|
||||
`save-off`, `save-on`, `say`, `schedule`,
|
||||
`scoreboard`, `seed`, `setblock`,
|
||||
`setidletimeout`, `setmaxplayers`,
|
||||
`setworldspawn`, `spawnpoint`, `spectate`,
|
||||
`spreadplayers`, `stop`, `stopsound`,
|
||||
`structure`, `summon`, `tag`, `team`, `teammsg`,
|
||||
`teleport`, `tell`, `tellraw`, `testfor`,
|
||||
`testforblock`, `testforblocks`, `tickingarea`,
|
||||
`time`, `title`, `toggledownfall`, `tp`,
|
||||
`tpagent`, `transfer`, `transferserver`,
|
||||
`trigger`, `turn`, `w`, `weather`, `whitelist`,
|
||||
`worldborder`, `worldbuilder`, `wsserver`, `xp`,
|
||||
), KeywordReserved, nil},
|
||||
{Words(``, ``, `@p`, `@r`, `@a`, `@e`, `@s`, `@c`, `@v`),
|
||||
KeywordConstant, nil},
|
||||
{`\[`, Punctuation, Push("argumentlist")},
|
||||
{`{`, Punctuation, Push("nbtobjectvalue")},
|
||||
{`~`, NameBuiltin, nil},
|
||||
{`([a-zA-Z_]+:)?[a-zA-Z_]+\b`, Text, nil},
|
||||
{`([a-z]+)(\.)([0-9]+)\b`, ByGroups(Text, Punctuation, LiteralNumber), nil},
|
||||
{`([<>=]|<=|>=)`, Punctuation, nil},
|
||||
Include("simplevalue"),
|
||||
{`\s+`, TextWhitespace, nil},
|
||||
},
|
||||
}
|
||||
},
|
||||
))
|
||||
51
vendor/github.com/alecthomas/chroma/lexers/m/meson.go
generated
vendored
Normal file
51
vendor/github.com/alecthomas/chroma/lexers/m/meson.go
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
package m
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Meson lexer.
|
||||
var Meson = internal.Register(MustNewLazyLexer(
|
||||
&Config{
|
||||
Name: "Meson",
|
||||
Aliases: []string{"meson", "meson.build"},
|
||||
Filenames: []string{"meson.build", "meson_options.txt"},
|
||||
MimeTypes: []string{"text/x-meson"},
|
||||
},
|
||||
func() Rules {
|
||||
return Rules{
|
||||
"root": {
|
||||
{`#.*?$`, Comment, nil},
|
||||
{`'''.*'''`, LiteralStringSingle, nil},
|
||||
{`[1-9][0-9]*`, LiteralNumberInteger, nil},
|
||||
{`0o[0-7]+`, LiteralNumberOct, nil},
|
||||
{`0x[a-fA-F0-9]+`, LiteralNumberHex, nil},
|
||||
Include("string"),
|
||||
Include("keywords"),
|
||||
Include("expr"),
|
||||
{`[a-zA-Z_][a-zA-Z_0-9]*`, Name, nil},
|
||||
{`\s+`, TextWhitespace, nil},
|
||||
},
|
||||
"string": {
|
||||
{`[']{3}([']{0,2}([^\\']|\\(.|\n)))*[']{3}`, LiteralString, nil},
|
||||
{`'.*?(?<!\\)(\\\\)*?'`, LiteralString, nil},
|
||||
},
|
||||
"keywords": {
|
||||
{Words(``, `\b`, `if`, `elif`, `else`, `endif`, `foreach`, `endforeach`, `break`, `continue`), Keyword, nil},
|
||||
},
|
||||
"expr": {
|
||||
{`(in|and|or|not)\b`, OperatorWord, nil},
|
||||
{`(\*=|/=|%=|\+]=|-=|==|!=|\+|-|=)`, Operator, nil},
|
||||
{`[\[\]{}:().,?]`, Punctuation, nil},
|
||||
{Words(``, `\b`, `true`, `false`), KeywordConstant, nil},
|
||||
Include("builtins"),
|
||||
{Words(``, `\b`, `meson`, `build_machine`, `host_machine`, `target_machine`), NameVariableMagic, nil},
|
||||
},
|
||||
"builtins": {
|
||||
{Words(`(?<!\.)`, `\b`, `add_global_arguments`, `add_global_link_arguments`, `add_languages`, `add_project_arguments`, `add_project_link_arguments`, `add_test_setup`, `assert`, `benchmark`, `both_libraries`, `build_target`, `configuration_data`, `configure_file`, `custom_target`, `declare_dependency`, `dependency`, `disabler`, `environment`, `error`, `executable`, `files`, `find_library`, `find_program`, `generator`, `get_option`, `get_variable`, `include_directories`, `install_data`, `install_headers`, `install_man`, `install_subdir`, `is_disabler`, `is_variable`, `jar`, `join_paths`, `library`, `message`, `project`, `range`, `run_command`, `set_variable`, `shared_library`, `shared_module`, `static_library`, `subdir`, `subdir_done`, `subproject`, `summary`, `test`, `vcs_tag`, `warning`), NameBuiltin, nil},
|
||||
{`(?<!\.)import\b`, NameNamespace, nil},
|
||||
},
|
||||
}
|
||||
},
|
||||
))
|
||||
101
vendor/github.com/alecthomas/chroma/lexers/m/metal.go
generated
vendored
Normal file
101
vendor/github.com/alecthomas/chroma/lexers/m/metal.go
generated
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
package m
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Metal lexer.
|
||||
var Metal = internal.Register(MustNewLazyLexer(
|
||||
&Config{
|
||||
Name: "Metal",
|
||||
Aliases: []string{"metal"},
|
||||
Filenames: []string{"*.metal"},
|
||||
MimeTypes: []string{"text/x-metal"},
|
||||
EnsureNL: true,
|
||||
},
|
||||
metalRules,
|
||||
))
|
||||
|
||||
func metalRules() Rules {
|
||||
return Rules{
|
||||
"statements": {
|
||||
{Words(``, `\b`, `namespace`, `operator`, `template`, `this`, `using`, `constexpr`), Keyword, nil},
|
||||
{`(enum)\b(\s+)(class)\b(\s*)`, ByGroups(Keyword, Text, Keyword, Text), Push("classname")},
|
||||
{`(class|struct|enum|union)\b(\s*)`, ByGroups(Keyword, Text), Push("classname")},
|
||||
{`\[\[.+\]\]`, NameAttribute, nil},
|
||||
{`(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*`, LiteralNumberFloat, nil},
|
||||
{`(\d+\.\d*|\.\d+|\d+[fF])[fF]?`, LiteralNumberFloat, nil},
|
||||
{`0[xX]([0-9A-Fa-f]('?[0-9A-Fa-f]+)*)[LlUu]*`, LiteralNumberHex, nil},
|
||||
{`0('?[0-7]+)+[LlUu]*`, LiteralNumberOct, nil},
|
||||
{`0[Bb][01]('?[01]+)*[LlUu]*`, LiteralNumberBin, nil},
|
||||
{`[0-9]('?[0-9]+)*[LlUu]*`, LiteralNumberInteger, nil},
|
||||
{`\*/`, Error, nil},
|
||||
{`[~!%^&*+=|?:<>/-]`, Operator, nil},
|
||||
{`[()\[\],.]`, Punctuation, nil},
|
||||
{Words(``, `\b`, `break`, `case`, `const`, `continue`, `do`, `else`, `enum`, `extern`, `for`, `if`, `return`, `sizeof`, `static`, `struct`, `switch`, `typedef`, `union`, `while`), Keyword, nil},
|
||||
{`(bool|float|half|long|ptrdiff_t|size_t|unsigned|u?char|u?int((8|16|32|64)_t)?|u?short)\b`, KeywordType, nil},
|
||||
{`(bool|float|half|u?(char|int|long|short))(2|3|4)\b`, KeywordType, nil},
|
||||
{`packed_(float|half|long|u?(char|int|short))(2|3|4)\b`, KeywordType, nil},
|
||||
{`(float|half)(2|3|4)x(2|3|4)\b`, KeywordType, nil},
|
||||
{`atomic_u?int\b`, KeywordType, nil},
|
||||
{`(rg?(8|16)(u|s)norm|rgba(8|16)(u|s)norm|srgba8unorm|rgb10a2|rg11b10f|rgb9e5)\b`, KeywordType, nil},
|
||||
{`(array|depth(2d|cube)(_array)?|depth2d_ms(_array)?|sampler|texture_buffer|texture(1|2)d(_array)?|texture2d_ms(_array)?|texture3d|texturecube(_array)?|uniform|visible_function_table)\b`, KeywordType, nil},
|
||||
{`(true|false|NULL)\b`, NameBuiltin, nil},
|
||||
{Words(``, `\b`, `device`, `constant`, `ray_data`, `thread`, `threadgroup`, `threadgroup_imageblock`), Keyword, nil},
|
||||
{`([a-zA-Z_]\w*)(\s*)(:)(?!:)`, ByGroups(NameLabel, Text, Punctuation), nil},
|
||||
{`[a-zA-Z_]\w*`, Name, nil},
|
||||
},
|
||||
"root": {
|
||||
Include("whitespace"),
|
||||
{`(fragment|kernel|vertex)?((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))([^;{]*)(\{)`, ByGroups(Keyword, UsingSelf("root"), NameFunction, UsingSelf("root"), UsingSelf("root"), Punctuation), Push("function")},
|
||||
{`(fragment|kernel|vertex)?((?:[\w*\s])+?(?:\s|[*]))([a-zA-Z_]\w*)(\s*\([^;]*?\))([^;]*)(;)`, ByGroups(Keyword, UsingSelf("root"), NameFunction, UsingSelf("root"), UsingSelf("root"), Punctuation), nil},
|
||||
Default(Push("statement")),
|
||||
},
|
||||
"classname": {
|
||||
{`(\[\[.+\]\])(\s*)`, ByGroups(NameAttribute, Text), nil},
|
||||
{`[a-zA-Z_]\w*`, NameClass, Pop(1)},
|
||||
{`\s*(?=[>{])`, Text, Pop(1)},
|
||||
},
|
||||
"whitespace": {
|
||||
{`^#if\s+0`, CommentPreproc, Push("if0")},
|
||||
{`^#`, CommentPreproc, Push("macro")},
|
||||
{`^(\s*(?:/[*].*?[*]/\s*)?)(#if\s+0)`, ByGroups(UsingSelf("root"), CommentPreproc), Push("if0")},
|
||||
{`^(\s*(?:/[*].*?[*]/\s*)?)(#)`, ByGroups(UsingSelf("root"), CommentPreproc), Push("macro")},
|
||||
{`\n`, Text, nil},
|
||||
{`\s+`, Text, nil},
|
||||
{`\\\n`, Text, nil},
|
||||
{`//(\n|[\w\W]*?[^\\]\n)`, CommentSingle, nil},
|
||||
{`/(\\\n)?[*][\w\W]*?[*](\\\n)?/`, CommentMultiline, nil},
|
||||
{`/(\\\n)?[*][\w\W]*`, CommentMultiline, nil},
|
||||
},
|
||||
"statement": {
|
||||
Include("whitespace"),
|
||||
Include("statements"),
|
||||
{`[{]`, Punctuation, Push("root")},
|
||||
{`[;}]`, Punctuation, Pop(1)},
|
||||
},
|
||||
"function": {
|
||||
Include("whitespace"),
|
||||
Include("statements"),
|
||||
{`;`, Punctuation, nil},
|
||||
{`\{`, Punctuation, Push()},
|
||||
{`\}`, Punctuation, Pop(1)},
|
||||
},
|
||||
"macro": {
|
||||
{`(include)(\s*(?:/[*].*?[*]/\s*)?)([^\n]+)`, ByGroups(CommentPreproc, Text, CommentPreprocFile), nil},
|
||||
{`[^/\n]+`, CommentPreproc, nil},
|
||||
{`/[*](.|\n)*?[*]/`, CommentMultiline, nil},
|
||||
{`//.*?\n`, CommentSingle, Pop(1)},
|
||||
{`/`, CommentPreproc, nil},
|
||||
{`(?<=\\)\n`, CommentPreproc, nil},
|
||||
{`\n`, CommentPreproc, Pop(1)},
|
||||
},
|
||||
"if0": {
|
||||
{`^\s*#if.*?(?<!\\)\n`, CommentPreproc, Push()},
|
||||
{`^\s*#el(?:se|if).*\n`, CommentPreproc, Pop(1)},
|
||||
{`^\s*#endif.*?(?<!\\)\n`, CommentPreproc, Pop(1)},
|
||||
{`.*?\n`, Comment, nil},
|
||||
},
|
||||
}
|
||||
}
|
||||
45
vendor/github.com/alecthomas/chroma/lexers/m/minizinc.go
generated
vendored
Normal file
45
vendor/github.com/alecthomas/chroma/lexers/m/minizinc.go
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
package m
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// MiniZinc lexer.
|
||||
var MZN = internal.Register(MustNewLazyLexer(
|
||||
&Config{
|
||||
Name: "MiniZinc",
|
||||
Aliases: []string{"minizinc", "MZN", "mzn"},
|
||||
Filenames: []string{"*.mzn", "*.dzn", "*.fzn"},
|
||||
MimeTypes: []string{"text/minizinc"},
|
||||
},
|
||||
mznRules,
|
||||
))
|
||||
|
||||
func mznRules() Rules {
|
||||
return Rules{
|
||||
"root": {
|
||||
{`\n`, Text, nil},
|
||||
{`\s+`, Text, nil},
|
||||
{`\\\n`, Text, nil},
|
||||
{`\%(.*?)\n`, CommentSingle, nil},
|
||||
{`/(\\\n)?[*](.|\n)*?[*](\\\n)?/`, CommentMultiline, nil},
|
||||
{`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
|
||||
{Words(`\b`, `\b`, `ann`, `annotation`, `any`, `constraint`, `function`, `include`, `list`, `of`, `op`, `output`, `minimize`, `maximize`, `par`, `predicate`, `record`, `satisfy`, `solve`, `test`, `type`, `var`), Keyword, nil},
|
||||
{Words(`\b`, `\b`, `array`, `set`, `bool`, `enum`, `float`, `int`, `string`, `tuple`), KeywordType, nil},
|
||||
{Words(`\b`, `\b`, `for`, `forall`, `if`, `then`, `else`, `endif`, `where`), Keyword, nil},
|
||||
{Words(`\b`, `\b`, `abort`, `abs`, `acosh`, `array_intersect`, `array_union`, `array1d`, `array2d`, `array3d`, `array4d`, `array5d`, `array6d`, `asin`, `assert`, `atan`, `bool2int`, `card`, `ceil`, `concat`, `cos`, `cosh`, `dom`, `dom_array`, `dom_size`, `fix`, `exp`, `floor`, `index_set`, `index_set_1of2`, `index_set_2of2`, `index_set_1of3`, `index_set_2of3`, `index_set_3of3`, `int2float`, `is_fixed`, `join`, `lb`, `lb_array`, `length`, `ln`, `log`, `log2`, `log10`, `min`, `max`, `pow`, `product`, `round`, `set2array`, `show`, `show_int`, `show_float`, `sin`, `sinh`, `sqrt`, `sum`, `tan`, `tanh`, `trace`, `ub`, `ub_array`), NameBuiltin, nil},
|
||||
{`(not|<->|->|<-|\\/|xor|/\\)`, Operator, nil},
|
||||
{`(<|>|<=|>=|==|=|!=)`, Operator, nil},
|
||||
{`(\+|-|\*|/|div|mod)`, Operator, nil},
|
||||
{Words(`\b`, `\b`, `in`, `subset`, `superset`, `union`, `diff`, `symdiff`, `intersect`), Operator, nil},
|
||||
{`(\\|\.\.|\+\+)`, Operator, nil},
|
||||
{`[|()\[\]{},:;]`, Punctuation, nil},
|
||||
{`(true|false)\b`, KeywordConstant, nil},
|
||||
{`([+-]?)\d+(\.(?!\.)\d*)?([eE][-+]?\d+)?`, LiteralNumber, nil},
|
||||
{`::\s*([^\W\d]\w*)(\s*\([^\)]*\))?`, NameDecorator, nil},
|
||||
{`\b([^\W\d]\w*)\b(\()`, ByGroups(NameFunction, Punctuation), nil},
|
||||
{`[^\W\d]\w*`, NameOther, nil},
|
||||
},
|
||||
}
|
||||
}
|
||||
47
vendor/github.com/alecthomas/chroma/lexers/m/mlir.go
generated
vendored
Normal file
47
vendor/github.com/alecthomas/chroma/lexers/m/mlir.go
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
package m
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// MLIR lexer.
|
||||
var Mlir = internal.Register(MustNewLazyLexer(
|
||||
&Config{
|
||||
Name: "MLIR",
|
||||
Aliases: []string{"mlir"},
|
||||
Filenames: []string{"*.mlir"},
|
||||
MimeTypes: []string{"text/x-mlir"},
|
||||
},
|
||||
mlirRules,
|
||||
))
|
||||
|
||||
func mlirRules() Rules {
|
||||
return Rules{
|
||||
"root": {
|
||||
Include("whitespace"),
|
||||
{`c?"[^"]*?"`, LiteralString, nil},
|
||||
{`\^([-a-zA-Z$._][\w\-$.0-9]*)\s*`, NameLabel, nil},
|
||||
{`([\w\d_$.]+)\s*=`, NameLabel, nil},
|
||||
Include("keyword"),
|
||||
{`->`, Punctuation, nil},
|
||||
{`@([\w_][\w\d_$.]*)`, NameFunction, nil},
|
||||
{`[%#][\w\d_$.]+`, NameVariable, nil},
|
||||
{`([1-9?][\d?]*\s*x)+`, LiteralNumber, nil},
|
||||
{`0[xX][a-fA-F0-9]+`, LiteralNumber, nil},
|
||||
{`-?\d+(?:[.]\d+)?(?:[eE][-+]?\d+(?:[.]\d+)?)?`, LiteralNumber, nil},
|
||||
{`[=<>{}\[\]()*.,!:]|x\b`, Punctuation, nil},
|
||||
{`[\w\d]+`, Text, nil},
|
||||
},
|
||||
"whitespace": {
|
||||
{`(\n|\s)+`, Text, nil},
|
||||
{`//.*?\n`, Comment, nil},
|
||||
},
|
||||
"keyword": {
|
||||
{Words(``, ``, `constant`, `return`), KeywordType, nil},
|
||||
{Words(``, ``, `func`, `loc`, `memref`, `tensor`, `vector`), KeywordType, nil},
|
||||
{`bf16|f16|f32|f64|index`, Keyword, nil},
|
||||
{`i[1-9]\d*`, Keyword, nil},
|
||||
},
|
||||
}
|
||||
}
|
||||
119
vendor/github.com/alecthomas/chroma/lexers/m/modula2.go
generated
vendored
Normal file
119
vendor/github.com/alecthomas/chroma/lexers/m/modula2.go
generated
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
package m
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Modula-2 lexer.
|
||||
var Modula2 = internal.Register(MustNewLazyLexer(
|
||||
&Config{
|
||||
Name: "Modula-2",
|
||||
Aliases: []string{"modula2", "m2"},
|
||||
Filenames: []string{"*.def", "*.mod"},
|
||||
MimeTypes: []string{"text/x-modula2"},
|
||||
DotAll: true,
|
||||
},
|
||||
modula2Rules,
|
||||
))
|
||||
|
||||
func modula2Rules() Rules {
|
||||
return Rules{
|
||||
"whitespace": {
|
||||
{`\n+`, Text, nil},
|
||||
{`\s+`, Text, nil},
|
||||
},
|
||||
"dialecttags": {
|
||||
{`\(\*!m2pim\*\)`, CommentSpecial, nil},
|
||||
{`\(\*!m2iso\*\)`, CommentSpecial, nil},
|
||||
{`\(\*!m2r10\*\)`, CommentSpecial, nil},
|
||||
{`\(\*!objm2\*\)`, CommentSpecial, nil},
|
||||
{`\(\*!m2iso\+aglet\*\)`, CommentSpecial, nil},
|
||||
{`\(\*!m2pim\+gm2\*\)`, CommentSpecial, nil},
|
||||
{`\(\*!m2iso\+p1\*\)`, CommentSpecial, nil},
|
||||
{`\(\*!m2iso\+xds\*\)`, CommentSpecial, nil},
|
||||
},
|
||||
"identifiers": {
|
||||
{`([a-zA-Z_$][\w$]*)`, Name, nil},
|
||||
},
|
||||
"prefixed_number_literals": {
|
||||
{`0b[01]+(\'[01]+)*`, LiteralNumberBin, nil},
|
||||
{`0[ux][0-9A-F]+(\'[0-9A-F]+)*`, LiteralNumberHex, nil},
|
||||
},
|
||||
"plain_number_literals": {
|
||||
{`[0-9]+(\'[0-9]+)*\.[0-9]+(\'[0-9]+)*[eE][+-]?[0-9]+(\'[0-9]+)*`, LiteralNumberFloat, nil},
|
||||
{`[0-9]+(\'[0-9]+)*\.[0-9]+(\'[0-9]+)*`, LiteralNumberFloat, nil},
|
||||
{`[0-9]+(\'[0-9]+)*`, LiteralNumberInteger, nil},
|
||||
},
|
||||
"suffixed_number_literals": {
|
||||
{`[0-7]+B`, LiteralNumberOct, nil},
|
||||
{`[0-7]+C`, LiteralNumberOct, nil},
|
||||
{`[0-9A-F]+H`, LiteralNumberHex, nil},
|
||||
},
|
||||
"string_literals": {
|
||||
{`'(\\\\|\\'|[^'])*'`, LiteralString, nil},
|
||||
{`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
|
||||
},
|
||||
"digraph_operators": {
|
||||
{`\*\.`, Operator, nil},
|
||||
{`\+>`, Operator, nil},
|
||||
{`<>`, Operator, nil},
|
||||
{`<=`, Operator, nil},
|
||||
{`>=`, Operator, nil},
|
||||
{`==`, Operator, nil},
|
||||
{`::`, Operator, nil},
|
||||
{`:=`, Operator, nil},
|
||||
{`\+\+`, Operator, nil},
|
||||
{`--`, Operator, nil},
|
||||
},
|
||||
"unigraph_operators": {
|
||||
{`[+-]`, Operator, nil},
|
||||
{`[*/]`, Operator, nil},
|
||||
{`\\`, Operator, nil},
|
||||
{`[=#<>]`, Operator, nil},
|
||||
{`\^`, Operator, nil},
|
||||
{`@`, Operator, nil},
|
||||
{`&`, Operator, nil},
|
||||
{`~`, Operator, nil},
|
||||
{"`", Operator, nil},
|
||||
},
|
||||
"digraph_punctuation": {
|
||||
{`\.\.`, Punctuation, nil},
|
||||
{`<<`, Punctuation, nil},
|
||||
{`>>`, Punctuation, nil},
|
||||
{`->`, Punctuation, nil},
|
||||
{`\|#`, Punctuation, nil},
|
||||
{`##`, Punctuation, nil},
|
||||
{`\|\*`, Punctuation, nil},
|
||||
},
|
||||
"unigraph_punctuation": {
|
||||
{`[()\[\]{},.:;|]`, Punctuation, nil},
|
||||
{`!`, Punctuation, nil},
|
||||
{`\?`, Punctuation, nil},
|
||||
},
|
||||
"comments": {
|
||||
{`^//.*?\n`, CommentSingle, nil},
|
||||
{`\(\*([^$].*?)\*\)`, CommentMultiline, nil},
|
||||
{`/\*(.*?)\*/`, CommentMultiline, nil},
|
||||
},
|
||||
"pragmas": {
|
||||
{`<\*.*?\*>`, CommentPreproc, nil},
|
||||
{`\(\*\$.*?\*\)`, CommentPreproc, nil},
|
||||
},
|
||||
"root": {
|
||||
Include("whitespace"),
|
||||
Include("dialecttags"),
|
||||
Include("pragmas"),
|
||||
Include("comments"),
|
||||
Include("identifiers"),
|
||||
Include("suffixed_number_literals"),
|
||||
Include("prefixed_number_literals"),
|
||||
Include("plain_number_literals"),
|
||||
Include("string_literals"),
|
||||
Include("digraph_punctuation"),
|
||||
Include("digraph_operators"),
|
||||
Include("unigraph_punctuation"),
|
||||
Include("unigraph_operators"),
|
||||
},
|
||||
}
|
||||
}
|
||||
66
vendor/github.com/alecthomas/chroma/lexers/m/monkeyc.go
generated
vendored
Normal file
66
vendor/github.com/alecthomas/chroma/lexers/m/monkeyc.go
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
package m
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
var MonkeyC = internal.Register(MustNewLazyLexer(
|
||||
&Config{
|
||||
Name: "MonkeyC",
|
||||
Aliases: []string{"monkeyc"},
|
||||
Filenames: []string{"*.mc"},
|
||||
MimeTypes: []string{"text/x-monkeyc"},
|
||||
},
|
||||
monkeyCRules,
|
||||
))
|
||||
|
||||
func monkeyCRules() Rules {
|
||||
return Rules{
|
||||
"root": {
|
||||
{`[^\S\n]+`, Text, nil},
|
||||
{`\n`, Text, nil},
|
||||
{`//(\n|[\w\W]*?[^\\]\n)`, CommentSingle, nil},
|
||||
{`/(\\\n)?[*][\w\W]*?[*](\\\n)?/`, CommentMultiline, nil},
|
||||
{`/(\\\n)?[*][\w\W]*`, CommentMultiline, nil},
|
||||
{`:[a-zA-Z_][\w_\.]*`, StringSymbol, nil},
|
||||
{`[{}\[\]\(\),;:\.]`, Punctuation, nil},
|
||||
{`[&~\|\^!+\-*\/%=?]`, Operator, nil},
|
||||
{`=>|[+-]=|&&|\|\||>>|<<|[<>]=?|[!=]=`, Operator, nil},
|
||||
{`\b(and|or|instanceof|has|extends|new)`, OperatorWord, nil},
|
||||
{Words(``, `\b`, `NaN`, `null`, `true`, `false`), KeywordConstant, nil},
|
||||
{`(using)((?:\s|\\\\s)+)`, ByGroups(KeywordNamespace, Text), Push("import")},
|
||||
{`(class)((?:\s|\\\\s)+)`, ByGroups(KeywordDeclaration, Text), Push("class")},
|
||||
{`(function)((?:\s|\\\\s)+)`, ByGroups(KeywordDeclaration, Text), Push("function")},
|
||||
{`(module)((?:\s|\\\\s)+)`, ByGroups(KeywordDeclaration, Text), Push("module")},
|
||||
{`\b(if|else|for|switch|case|while|break|continue|default|do|try|catch|finally|return|throw|extends|function)\b`, Keyword, nil},
|
||||
{`\b(const|enum|hidden|public|protected|private|static)\b`, KeywordType, nil},
|
||||
{`\bvar\b`, KeywordDeclaration, nil},
|
||||
{`\b(Activity(Monitor|Recording)?|Ant(Plus)?|Application|Attention|Background|Communications|Cryptography|FitContributor|Graphics|Gregorian|Lang|Math|Media|Persisted(Content|Locations)|Position|Properties|Sensor(History|Logging)?|Storage|StringUtil|System|Test|Time(r)?|Toybox|UserProfile|WatchUi|Rez|Drawables|Strings|Fonts|method)\b`, NameBuiltin, nil},
|
||||
{`\b(me|self|\$)\b`, NameBuiltinPseudo, nil},
|
||||
{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
|
||||
{`'(\\\\|\\'|[^''])*'`, LiteralStringSingle, nil},
|
||||
{`-?(0x[0-9a-fA-F]+l?)`, NumberHex, nil},
|
||||
{`-?([0-9]+(\.[0-9]+[df]?|[df]))\b`, NumberFloat, nil},
|
||||
{`-?([0-9]+l?)`, NumberInteger, nil},
|
||||
{`[a-zA-Z_]\w*`, Name, nil},
|
||||
},
|
||||
"import": {
|
||||
{`([a-zA-Z_][\w_\.]*)(?:(\s+)(as)(\s+)([a-zA-Z_][\w_]*))?`, ByGroups(NameNamespace, Text, KeywordNamespace, Text, NameNamespace), nil},
|
||||
Default(Pop(1)),
|
||||
},
|
||||
"class": {
|
||||
{`([a-zA-Z_][\w_\.]*)(?:(\s+)(extends)(\s+)([a-zA-Z_][\w_\.]*))?`, ByGroups(NameClass, Text, KeywordDeclaration, Text, NameClass), nil},
|
||||
Default(Pop(1)),
|
||||
},
|
||||
"function": {
|
||||
{`initialize`, NameFunctionMagic, nil},
|
||||
{`[a-zA-Z_][\w_\.]*`, NameFunction, nil},
|
||||
Default(Pop(1)),
|
||||
},
|
||||
"module": {
|
||||
{`[a-zA-Z_][\w_\.]*`, NameNamespace, nil},
|
||||
Default(Pop(1)),
|
||||
},
|
||||
}
|
||||
}
|
||||
57
vendor/github.com/alecthomas/chroma/lexers/m/mwscript.go
generated
vendored
Normal file
57
vendor/github.com/alecthomas/chroma/lexers/m/mwscript.go
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
44
vendor/github.com/alecthomas/chroma/lexers/m/myghty.go
generated
vendored
Normal file
44
vendor/github.com/alecthomas/chroma/lexers/m/myghty.go
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
package m
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
. "github.com/alecthomas/chroma/lexers/p" // nolint
|
||||
)
|
||||
|
||||
// Myghty lexer.
|
||||
var Myghty = internal.Register(MustNewLazyLexer(
|
||||
&Config{
|
||||
Name: "Myghty",
|
||||
Aliases: []string{"myghty"},
|
||||
Filenames: []string{"*.myt", "autodelegate"},
|
||||
MimeTypes: []string{"application/x-myghty"},
|
||||
},
|
||||
myghtyRules,
|
||||
))
|
||||
|
||||
func myghtyRules() Rules {
|
||||
return Rules{
|
||||
"root": {
|
||||
{`\s+`, Text, nil},
|
||||
{`(<%(?:def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)(?s)`, ByGroups(NameTag, Text, NameFunction, NameTag, UsingSelf("root"), NameTag), nil},
|
||||
{`(<%\w+)(.*?)(>)(.*?)(</%\2\s*>)(?s)`, ByGroups(NameTag, NameFunction, NameTag, Using(Python2), NameTag), nil},
|
||||
{`(<&[^|])(.*?)(,.*?)?(&>)`, ByGroups(NameTag, NameFunction, Using(Python2), NameTag), nil},
|
||||
{`(<&\|)(.*?)(,.*?)?(&>)(?s)`, ByGroups(NameTag, NameFunction, Using(Python2), NameTag), nil},
|
||||
{`</&>`, NameTag, nil},
|
||||
{`(<%!?)(.*?)(%>)(?s)`, ByGroups(NameTag, Using(Python2), NameTag), nil},
|
||||
{`(?<=^)#[^\n]*(\n|\Z)`, Comment, nil},
|
||||
{`(?<=^)(%)([^\n]*)(\n|\Z)`, ByGroups(NameTag, Using(Python2), Other), nil},
|
||||
{`(?sx)
|
||||
(.+?) # anything, followed by:
|
||||
(?:
|
||||
(?<=\n)(?=[%#]) | # an eval or comment line
|
||||
(?=</?[%&]) | # a substitution or block or
|
||||
# call start or end
|
||||
# - don't consume
|
||||
(\\\n) | # an escaped newline
|
||||
\Z # end of string
|
||||
)`, ByGroups(Other, Operator), nil},
|
||||
},
|
||||
}
|
||||
}
|
||||
83
vendor/github.com/alecthomas/chroma/lexers/m/mysql.go
generated
vendored
Normal file
83
vendor/github.com/alecthomas/chroma/lexers/m/mysql.go
generated
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
package m
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
var (
|
||||
mysqlAnalyserNameBetweenBacktickRe = regexp.MustCompile("`[a-zA-Z_]\\w*`")
|
||||
mysqlAnalyserNameBetweenBracketRe = regexp.MustCompile(`\[[a-zA-Z_]\w*\]`)
|
||||
)
|
||||
|
||||
// MySQL lexer.
|
||||
var MySQL = internal.Register(MustNewLazyLexer(
|
||||
&Config{
|
||||
Name: "MySQL",
|
||||
Aliases: []string{"mysql"},
|
||||
Filenames: []string{"*.sql"},
|
||||
MimeTypes: []string{"text/x-mysql"},
|
||||
NotMultiline: true,
|
||||
CaseInsensitive: true,
|
||||
},
|
||||
mySQLRules,
|
||||
).SetAnalyser(func(text string) float32 {
|
||||
nameBetweenBacktickCount := len(mysqlAnalyserNameBetweenBacktickRe.FindAllString(text, -1))
|
||||
nameBetweenBracketCount := len(mysqlAnalyserNameBetweenBracketRe.FindAllString(text, -1))
|
||||
|
||||
var result float32
|
||||
|
||||
// Same logic as above in the TSQL analysis.
|
||||
dialectNameCount := nameBetweenBacktickCount + nameBetweenBracketCount
|
||||
if dialectNameCount >= 1 && nameBetweenBacktickCount >= (2*nameBetweenBracketCount) {
|
||||
// Found at least twice as many `name` as [name].
|
||||
result += 0.5
|
||||
} else if nameBetweenBacktickCount > nameBetweenBracketCount {
|
||||
result += 0.2
|
||||
} else if nameBetweenBacktickCount > 0 {
|
||||
result += 0.1
|
||||
}
|
||||
|
||||
return result
|
||||
}))
|
||||
|
||||
func mySQLRules() Rules {
|
||||
return Rules{
|
||||
"root": {
|
||||
{`\s+`, TextWhitespace, nil},
|
||||
{`(#|--\s+).*\n?`, CommentSingle, nil},
|
||||
{`/\*`, CommentMultiline, Push("multiline-comments")},
|
||||
{`[0-9]+`, LiteralNumberInteger, nil},
|
||||
{`[0-9]*\.[0-9]+(e[+-][0-9]+)`, LiteralNumberFloat, nil},
|
||||
{`((?:_[a-z0-9]+)?)(')`, ByGroups(LiteralStringAffix, LiteralStringSingle), Push("string")},
|
||||
{`((?:_[a-z0-9]+)?)(")`, ByGroups(LiteralStringAffix, LiteralStringDouble), Push("double-string")},
|
||||
{"[+*/<>=~!@#%^&|`?-]", Operator, nil},
|
||||
{`\b(tinyint|smallint|mediumint|int|integer|bigint|date|datetime|time|bit|bool|tinytext|mediumtext|longtext|text|tinyblob|mediumblob|longblob|blob|float|double|double\s+precision|real|numeric|dec|decimal|timestamp|year|char|varchar|varbinary|varcharacter|enum|set)(\b\s*)(\()?`, ByGroups(KeywordType, TextWhitespace, Punctuation), nil},
|
||||
{`\b(add|all|alter|analyze|and|as|asc|asensitive|before|between|bigint|binary|blob|both|by|call|cascade|case|change|char|character|check|collate|column|condition|constraint|continue|convert|create|cross|current_date|current_time|current_timestamp|current_user|cursor|database|databases|day_hour|day_microsecond|day_minute|day_second|dec|decimal|declare|default|delayed|delete|desc|describe|deterministic|distinct|distinctrow|div|double|drop|dual|each|else|elseif|enclosed|escaped|exists|exit|explain|fetch|flush|float|float4|float8|for|force|foreign|from|fulltext|grant|group|having|high_priority|hour_microsecond|hour_minute|hour_second|identified|if|ignore|in|index|infile|inner|inout|insensitive|insert|int|int1|int2|int3|int4|int8|integer|interval|into|is|iterate|join|key|keys|kill|leading|leave|left|like|limit|lines|load|localtime|localtimestamp|lock|long|loop|low_priority|match|minute_microsecond|minute_second|mod|modifies|natural|no_write_to_binlog|not|numeric|on|optimize|option|optionally|or|order|out|outer|outfile|precision|primary|privileges|procedure|purge|raid0|read|reads|real|references|regexp|release|rename|repeat|replace|require|restrict|return|revoke|right|rlike|schema|schemas|second_microsecond|select|sensitive|separator|set|show|smallint|soname|spatial|specific|sql|sql_big_result|sql_calc_found_rows|sql_small_result|sqlexception|sqlstate|sqlwarning|ssl|starting|straight_join|table|terminated|then|to|trailing|trigger|undo|union|unique|unlock|unsigned|update|usage|use|user|using|utc_date|utc_time|utc_timestamp|values|varying|when|where|while|with|write|x509|xor|year_month|zerofill)\b`, Keyword, nil},
|
||||
{`\b(auto_increment|engine|charset|tables)\b`, KeywordPseudo, nil},
|
||||
{`(true|false|null)`, NameConstant, nil},
|
||||
{`([a-z_]\w*)(\s*)(\()`, ByGroups(NameFunction, TextWhitespace, Punctuation), nil},
|
||||
{`[a-z_]\w*`, Name, nil},
|
||||
{`@[a-z0-9]*[._]*[a-z0-9]*`, NameVariable, nil},
|
||||
{`[;:()\[\],.]`, Punctuation, nil},
|
||||
},
|
||||
"multiline-comments": {
|
||||
{`/\*`, CommentMultiline, Push("multiline-comments")},
|
||||
{`\*/`, CommentMultiline, Pop(1)},
|
||||
{`[^/*]+`, CommentMultiline, nil},
|
||||
{`[/*]`, CommentMultiline, nil},
|
||||
},
|
||||
"string": {
|
||||
{`[^']+`, LiteralStringSingle, nil},
|
||||
{`''`, LiteralStringSingle, nil},
|
||||
{`'`, LiteralStringSingle, Pop(1)},
|
||||
},
|
||||
"double-string": {
|
||||
{`[^"]+`, LiteralStringDouble, nil},
|
||||
{`""`, LiteralStringDouble, nil},
|
||||
{`"`, LiteralStringDouble, Pop(1)},
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user