package m

import "github.com/alecthomas/chroma/lexers/m"

Index

Variables

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.

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.

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},
			{"" /* 606 byte string literal not displayed */,

				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.

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.

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},
			{"" /* 461 byte string literal not displayed */,

				ByGroups(Using(HTML), Operator), nil},
		},
	},
))

Mason lexer.

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.

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},
			{"" /* 1112 byte string literal not displayed */, 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.

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.

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},
			{"" /* 334 byte string literal not displayed */, 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)),
		},
	},
))
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": {
			{"" /* 6138 byte string literal not displayed */, NameBuiltin, nil},
			{"" /* 2895 byte string literal not displayed */, NameBuiltin, nil},
		},
		"types": {
			{`(?i)(short|long|float)\b`, KeywordType, nil},
		},
		"punct": {
			{`[()]`, Punctuation, nil},
		},
		"operators": {
			{`[#=,./%+\-?]`, Operator, nil},
			{`(==|<=|<|>=|>|!=)`, Operator, nil},
		},
	},
))

MorrowindScript lexer.

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},
			{"" /* 276 byte string literal not displayed */, ByGroups(KeywordType, Text, Punctuation), nil},
			{"" /* 1589 byte string literal not displayed */, 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.

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},
			{"" /* 461 byte string literal not displayed */,

				ByGroups(Other, Operator), nil},
		},
	},
))

Myghty lexer.

Source Files

make.go mako.go markdown.go mason.go mathematica.go matlab.go minizinc.go modula2.go monkeyc.go mwscript.go myghty.go mysql.go

Version
v0.6.6
Published
Jul 20, 2019
Platform
js/wasm
Imports
5 packages
Last checked
16 minutes ago

Tools for package owners.