Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var MZN = internal.Register(MustNewLexer( &Config{ Name: "MiniZinc", Aliases: []string{"minizinc", "MZN", "mzn"}, Filenames: []string{"*.mzn", "*.dzn", "*.fzn"}, MimeTypes: []string{"text/minizinc"}, }, 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}, }, }, ))
MiniZinc lexer.
View Source
var Makefile = internal.Register(MustNewLexer( &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, }, 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}, }, }, ))
Makefile lexer.
View Source
var Mako = internal.Register(MustNewLexer( &Config{ Name: "Mako", Aliases: []string{"mako"}, Filenames: []string{"*.mao"}, MimeTypes: []string{"application/x-mako"}, }, 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)}, }, }, ))
Mako lexer.
View Source
var Markdown = internal.Register(MustNewLexer( &Config{ Name: "markdown", Aliases: []string{"md", "mkd"}, Filenames: []string{"*.md", "*.mkd", "*.markdown"}, MimeTypes: []string{"text/x-markdown"}, }, 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)([*_][^*_]+[*_])(\W|\n)`, ByGroups(Text, 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]+`, Text, nil}, {`.|\n`, Text, nil}, }, }, ))
Markdown lexer.
View Source
var Mason = internal.Register(MustNewLexer( &Config{ Name: "Mason", Aliases: []string{"mason"}, Filenames: []string{"*.m", "*.mhtml", "*.mc", "*.mi", "autohandler", "dhandler"}, MimeTypes: []string{"application/x-mason"}, Priority: 0.1, }, 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}, }, }, ))
Mason lexer.
View Source
var Mathematica = internal.Register(MustNewLexer( &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"}, }, 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}, }, }, ))
Mathematica lexer.
View Source
var Matlab = internal.Register(MustNewLexer( &Config{ Name: "Matlab", Aliases: []string{"matlab"}, Filenames: []string{"*.m"}, MimeTypes: []string{"text/matlab"}, }, 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)}, }, }, ))
Matlab lexer.
View Source
var Mlir = internal.Register(MustNewLexer( &Config{ Name: "MLIR", Aliases: []string{"mlir"}, Filenames: []string{"*.mlir"}, MimeTypes: []string{"text/x-mlir"}, }, 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}, }, }, ))
MLIR lexer.
View Source
var Modula2 = internal.Register(MustNewLexer( &Config{ Name: "Modula-2", Aliases: []string{"modula2", "m2"}, Filenames: []string{"*.def", "*.mod"}, MimeTypes: []string{"text/x-modula2"}, DotAll: true, }, 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"), }, }, ))
Modula-2 lexer.
View Source
var MonkeyC = internal.Register(MustNewLexer( &Config{ Name: "MonkeyC", Aliases: []string{"monkeyc"}, Filenames: []string{"*.mc"}, MimeTypes: []string{"text/x-monkeyc"}, }, 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)), }, }, ))
View Source
var MorrowindScript = internal.Register(MustNewLexer( &Config{ Name: "MorrowindScript", Aliases: []string{"morrowind", "mwscript"}, Filenames: []string{}, MimeTypes: []string{}, }, Rules{ "root": { {`\s+`, Text, nil}, {`;.*$`, Comment, nil}, {`(["'])(?:(?=(\\?))\2.)*?\1`, LiteralString, nil}, {`[0-9]+`, LiteralNumberInteger, nil}, {`[0-9]+\.[0-9]*(?!\.)`, LiteralNumberFloat, nil}, Include("keywords"), Include("types"), Include("builtins"), Include("punct"), Include("operators"), {`\n`, Text, nil}, {`\S+\s+`, Text, nil}, {`[a-zA-Z0-9_]\w*`, Name, nil}, }, "keywords": { {`(?i)(begin|if|else|elseif|endif|while|endwhile|return|to)\b`, Keyword, nil}, {`(?i)(end)\b`, Keyword, nil}, {`(?i)(end)\w+.*$`, Text, nil}, {`[\w+]->[\w+]`, Operator, nil}, }, "builtins": { {`(?i)(Activate|AddItem|AddSoulGem|AddSpell|AddToLevCreature|AddToLevItem|AddTopic|AIActivate|AIEscort|AIEscortCell|AIFollow|AiFollowCell|AITravel|AIWander|BecomeWerewolf|Cast|ChangeWeather|Choice|ClearForceJump|ClearForceMoveJump|ClearForceRun|ClearForceSneak|ClearInfoActor|Disable|DisableLevitation|DisablePlayerControls|DisablePlayerFighting|DisablePlayerJumping|DisablePlayerLooking|DisablePlayerMagic|DisablePlayerViewSwitch|DisableTeleporting|DisableVanityMode|DontSaveObject|Drop|Enable|EnableBirthMenu|EnableClassMenu|EnableInventoryMenu|EnableLevelUpMenu|EnableLevitation|EnableMagicMenu|EnableMapMenu|EnableNameMenu|EnablePlayerControls|EnablePlayerFighting|EnablePlayerJumping|EnablePlayerLooking|EnablePlayerMagic|EnablePlayerViewSwitch|EnableRaceMenu|EnableRest|EnableStatsMenu|EnableTeleporting|EnableVanityMode|Equip|ExplodeSpell|Face|FadeIn|FadeOut|FadeTo|Fall|ForceGreeting|ForceJump|ForceRun|ForceSneak|Flee|GotoJail|HurtCollidingActor|HurtStandingActor|Journal|Lock|LoopGroup|LowerRank|MenuTest|MessageBox|ModAcrobatics|ModAgility|ModAlarm|ModAlchemy|ModAlteration|ModArmorBonus|ModArmorer|ModAthletics|ModAttackBonus|ModAxe|ModBlock|ModBluntWeapon|ModCastPenalty|ModChameleon|ModConjuration|ModCurrentFatigue|ModCurrentHealth|ModCurrentMagicka|ModDefendBonus|ModDestruction|ModDisposition|ModEnchant|ModEndurance|ModFactionReaction|ModFatigue|ModFight|ModFlee|ModFlying|ModHandToHand|ModHealth|ModHeavyArmor|ModIllusion|ModIntelligence|ModInvisible|ModLightArmor|ModLongBlade|ModLuck|ModMagicka|ModMarksman|ModMediumArmor|ModMercantile|ModMysticism|ModParalysis|ModPCCrimeLevel|ModPCFacRep|ModPersonality|ModRegion|ModReputation|ModResistBlight|ModResistCorprus|ModResistDisease|ModResistFire|ModResistFrost|ModResistMagicka|ModResistNormalWeapons|ModResistParalysis|ModResistPoison|ModResistShock|ModRestoration|ModScale|ModSecurity|ModShortBlade|ModSilence|ModSneak|ModSpear|ModSpeechcraft|ModSpeed|ModStrength|ModSuperJump|ModSwimSpeed|ModUnarmored|ModWaterBreathing|ModWaterLevel|ModWaterWalking|ModWillpower|Move|MoveWorld|PayFine|PayFineThief|PCClearExpelled|PCExpell|PCForce1stPerson|PCForce3rdPerson|PCJoinFaction|PCLowerRank|PCRaiseRank|PlaceAtMe|PlaceAtPC|PlaceItem|PlaceItemCell|PlayBink|PlayGroup|PlayLoopSound3D|PlayLoopSound3DVP|PlaySound|PlaySound3D|PlaySound3DVP|PlaySoundVP|Position|PositionCell|RaiseRank|RemoveEffects|RemoveFromLevCreature|RemoveFromLevItem|RemoveItem|RemoveSoulgem|RemoveSpell|RemoveSpellEffects|ResetActors|Resurrect|Rotate|RotateWorld|Say|StartScript|[S|s]et|SetAcrobatics|SetAgility|SetAlarm|SetAlchemy|SetAlteration|SetAngle|SetArmorBonus|SetArmorer|SetAthletics|SetAtStart|SetAttackBonus|SetAxe|SetBlock|SetBluntWeapon|SetCastPenalty|SetChameleon|SetConjuration|SetDelete|SetDefendBonus|SetDestruction|SetDisposition|SetEnchant|SetEndurance|SetFactionReaction|SetFatigue|SetFight|SetFlee|SetFlying|SetHandToHand|SetHealth|SetHeavyArmor|SetIllusion|SetIntelligence|SetInvisible|SetJournalIndex|SetLightArmor|SetLevel|SetLongBlade|SetLuck|SetMagicka|SetMarksman|SetMediumArmor|SetMercantile|SetMysticism|SetParalysis|SetPCCCrimeLevel|SetPCFacRep|SetPersonality|SetPos|SetReputation|SetResistBlight|SetResistCorprus|SetResistDisease|SetResistFire|SetResistFrost|SetResistMagicka|SetResistNormalWeapons|SetResistParalysis|SetResistPoison|SetResistShock|SetRestoration|SetScale|SetSecurity|SetShortBlade|SetSilence|SetSneak|SetSpear|SetSpeechcraft|SetSpeed|SetStrength|SetSuperJump|SetSwimSpeed|SetUnarmored|SetWaterBreathing|SetWaterlevel|SetWaterWalking|SetWerewolfAcrobatics|SetWillpower|ShowMap|ShowRestMenu|SkipAnim|StartCombat|StopCombat|StopScript|StopSound|StreamMusic|TurnMoonRed|TurnMoonWhite|UndoWerewolf|Unlock|WakeUpPC|CenterOnCell|CenterOnExterior|FillMap|FixMe|ToggleAI|ToggleCollision|ToggleFogOfWar|ToggleGodMode|ToggleMenus|ToggleSky|ToggleWorld|ToggleVanityMode|CellChanged|GetAcrobatics|GetAgility|GetAIPackageDone|GetAlarm|GetAlchemy|GetAlteration|GetAngle|GetArmorBonus|GetArmorer|GetAthletics|GetAttackBonus|GetAttacked|GetArmorType,|GetAxe|GetBlightDisease|GetBlock|GetBluntWeapon|GetButtonPressed|GetCastPenalty|GetChameleon|GetCollidingActor|GetCollidingPC|GetCommonDisease|GetConjuration|GetCurrentAIPackage|GetCurrentTime|GetCurrentWeather|GetDeadCount|GetDefendBonus|GetDestruction|GetDetected|GetDisabled|GetDisposition|GetDistance|GetEffect|GetEnchant|GetEndurance|GetFatigue|GetFight|GetFlee|GetFlying|GetForceJump|GetForceRun|GetForceSneak|GetHandToHand|GetHealth|GetHealthGetRatio|GetHeavyArmor|GetIllusion|GetIntelligence|GetInterior|GetInvisible|GetItemCount|GetJournalIndex|GetLightArmor|GetLineOfSight|GetLOS|GetLevel|GetLocked|GetLongBlade|GetLuck|GetMagicka|GetMarksman|GetMasserPhase|GetSecundaPhase|GetMediumArmor|GetMercantile|GetMysticism|GetParalysis|GetPCCell|GetPCCrimeLevel|GetPCinJail|GetPCJumping|GetPCRank|GetPCRunning|GetPCSleep|GetPCSneaking|GetPCTraveling|GetPersonality|GetPlayerControlsDisabled|GetPlayerFightingDisabled|GetPlayerJumpingDisabled|GetPlayerLookingDisabled|GetPlayerMagicDisabled|GetPos|GetRace|GetReputation|GetResistBlight|GetResistCorprus|GetResistDisease|GetResistFire|GetResistFrost|GetResistMagicka|GetResistNormalWeapons|GetResistParalysis|GetResistPoison|GetResistShock|GetRestoration|GetScale|GetSecondsPassed|GetSecurity|GetShortBlade|GetSilence|GetSneak|GetSoundPlaying|GetSpear|GetSpeechcraft|GetSpeed|GetSpell|GetSpellEffects|GetSpellReadied|GetSquareRoot|GetStandingActor|GetStandingPC|GetStrength|GetSuperJump|GetSwimSpeed|GetTarget|GetUnarmored|GetVanityModeDisabled|GetWaterBreathing|GetWaterLevel|GetWaterWalking|GetWeaponDrawn|GetWeaponType|GetWerewolfKills|GetWillpower|GetWindSpeed|HasItemEquipped|HasSoulgem|HitAttemptOnMe|HitOnMe|IsWerewolf|MenuMode|OnActivate|OnDeath|OnKnockout|OnMurder|PCExpelled|PCGet3rdPerson|PCKnownWerewolf|Random|RepairedOnMe|SameFaction|SayDone|ScriptRunning|AllowWereWolfForceGreeting|Companion|MinimumProfit|NoFlee|NoHello|NoIdle|NoLore|OnPCAdd|OnPCDrop|OnPCEquip|OnPCHitMe|OnPCRepair|PCSkipEquip|OnPCSoulGemUse|StayOutside|CrimeGoldDiscount|CrimeGoldTurnIn|Day|DaysPassed|GameHour|Month|NPCVoiceDistance|PCRace|PCWerewolf|PCVampire|TimeScale|VampClan|Year)\b`, NameBuiltin, nil}, {`(?i)(sEffectWaterBreathing|sEffectSwiftSwim|sEffectWaterWalking|sEffectShield|sEffectFireShield|sEffectLightningShield|sEffectFrostShield|sEffectBurden|sEffectFeather|sEffectJump|sEffectLevitate|sEffectSlowFall|sEffectLock|sEffectOpen|sEffectFireDamage|sEffectShockDamage|sEffectFrostDamage|sEffectDrainAttribute|sEffectDrainHealth|sEffectDrainSpellpoints|sEffectDrainFatigue|sEffectDrainSkill|sEffectDamageAttribute|sEffectDamageHealth|sEffectDamageMagicka|sEffectDamageFatigue|sEffectDamageSkill|sEffectPoison|sEffectWeaknessToFire|sEffectWeaknessToFrost|sEffectWeaknessToShock|sEffectWeaknessToMagicka|sEffectWeaknessToCommonDisease|sEffectWeaknessToBlightDisease|sEffectWeaknessToCorprusDisease|sEffectWeaknessToPoison|sEffectWeaknessToNormalWeapons|sEffectDisintegrateWeapon|sEffectDisintegrateArmor|sEffectInvisibility|sEffectChameleon|sEffectLight|sEffectSanctuary|sEffectNightEye|sEffectCharm|sEffectParalyze|sEffectSilence|sEffectBlind|sEffectSound|sEffectCalmHumanoid|sEffectCalmCreature|sEffectFrenzyHumanoid|sEffectFrenzyCreature|sEffectDemoralizeHumanoid|sEffectDemoralizeCreature|sEffectRallyHumanoid|sEffectRallyCreature|sEffectDispel|sEffectSoultrap|sEffectTelekinesis|sEffectMark|sEffectRecall|sEffectDivineIntervention|sEffectAlmsiviIntervention|sEffectDetectAnimal|sEffectDetectEnchantment|sEffectDetectKey|sEffectSpellAbsorption|sEffectReflect|sEffectCureCommonDisease|sEffectCureBlightDisease|sEffectCureCorprusDisease|sEffectCurePoison|sEffectCureParalyzation|sEffectRestoreAttribute|sEffectRestoreHealth|sEffectRestoreSpellPoints|sEffectRestoreFatigue|sEffectRestoreSkill|sEffectFortifyAttribute|sEffectFortifyHealth|sEffectFortifySpellpoints|sEffectFortifyFatigue|sEffectFortifySkill|sEffectFortifyMagickaMultiplier|sEffectAbsorbAttribute|sEffectAbsorbHealth|sEffectAbsorbSpellPoints|sEffectAbsorbFatigue|sEffectAbsorbSkill|sEffectResistFire|sEffectResistFrost|sEffectResistShock|sEffectResistMagicka|sEffectResistCommonDisease|sEffectResistBlightDisease|sEffectResistCorprusDisease|sEffectResistPoison|sEffectResistNormalWeapons|sEffectResistParalysis|sEffectRemoveCurse|sEffectTurnUndead|sEffectSummonScamp|sEffectSummonClannfear|sEffectSummonDaedroth|sEffectSummonDremora|sEffectSummonAncestralGhost|sEffectSummonSkeletalMinion|sEffectSummonLeastBonewalker|sEffectSummonGreaterBonewalker|sEffectSummonBonelord|sEffectSummonWingedTwilight|sEffectSummonHunger|sEffectSummonGoldensaint|sEffectSummonFlameAtronach|sEffectSummonFrostAtronach|sEffectSummonStormAtronach|sEffectFortifyAttackBonus|sEffectCommandCreatures|sEffectCommandHumanoids|sEffectBoundDagger|sEffectBoundLongsword|sEffectBoundMace|sEffectBoundBattleAxe|sEffectBoundSpear|sEffectBoundLongbow|sEffectExtraSpell|sEffectBoundCuirass|sEffectBoundHelm|sEffectBoundBoots|sEffectBoundShield|sEffectBoundGloves|sEffectCorpus|sEffectVampirism|sEffectSummonCenturionSphere|sEffectSunDamage|sEffectStuntedMagicka)`, NameBuiltin, nil}, }, "types": { {`(?i)(short|long|float)\b`, KeywordType, nil}, }, "punct": { {`[()]`, Punctuation, nil}, }, "operators": { {`[#=,./%+\-?]`, Operator, nil}, {`(==|<=|<|>=|>|!=)`, Operator, nil}, }, }, ))
MorrowindScript lexer.
View Source
var MySQL = internal.Register(MustNewLexer( &Config{ Name: "MySQL", Aliases: []string{"mysql"}, Filenames: []string{"*.sql"}, MimeTypes: []string{"text/x-mysql"}, NotMultiline: true, CaseInsensitive: true, }, Rules{ "root": { {`\s+`, Text, 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, Text, 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, Text, 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)}, }, }, ))
MySQL lexer.
View Source
var Myghty = internal.Register(MustNewLexer( &Config{ Name: "Myghty", Aliases: []string{"myghty"}, Filenames: []string{"*.myt", "autodelegate"}, MimeTypes: []string{"application/x-myghty"}, }, 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(Python), NameTag), nil}, {`(<&[^|])(.*?)(,.*?)?(&>)`, ByGroups(NameTag, NameFunction, Using(Python), NameTag), nil}, {`(<&\|)(.*?)(,.*?)?(&>)(?s)`, ByGroups(NameTag, NameFunction, Using(Python), NameTag), nil}, {`</&>`, NameTag, nil}, {`(<%!?)(.*?)(%>)(?s)`, ByGroups(NameTag, Using(Python), NameTag), nil}, {`(?<=^)#[^\n]*(\n|\Z)`, Comment, nil}, {`(?<=^)(%)([^\n]*)(\n|\Z)`, ByGroups(NameTag, Using(Python), 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}, }, }, ))
Myghty lexer.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.