m

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2021 License: MIT Imports: 6 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

View Source
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},
			},
		}
	},
))

mcfunction lexer.

View Source
var MZN = internal.Register(MustNewLazyLexer(
	&Config{
		Name:      "MiniZinc",
		Aliases:   []string{"minizinc", "MZN", "mzn"},
		Filenames: []string{"*.mzn", "*.dzn", "*.fzn"},
		MimeTypes: []string{"text/minizinc"},
	},
	mznRules,
))

MiniZinc lexer.

View Source
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,
))

Makefile lexer.

View Source
var Mako = internal.Register(MustNewLazyLexer(
	&Config{
		Name:      "Mako",
		Aliases:   []string{"mako"},
		Filenames: []string{"*.mao"},
		MimeTypes: []string{"application/x-mako"},
	},
	makoRules,
))

Mako lexer.

View Source
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,
)))

Markdown lexer.

View Source
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,
))

Mason lexer.

View Source
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,
))

Mathematica lexer.

View Source
var Matlab = internal.Register(MustNewLazyLexer(
	&Config{
		Name:      "Matlab",
		Aliases:   []string{"matlab"},
		Filenames: []string{"*.m"},
		MimeTypes: []string{"text/matlab"},
	},
	matlabRules,
))

Matlab lexer.

View Source
var Metal = internal.Register(MustNewLazyLexer(
	&Config{
		Name:      "Metal",
		Aliases:   []string{"metal"},
		Filenames: []string{"*.metal"},
		MimeTypes: []string{"text/x-metal"},
		EnsureNL:  true,
	},
	metalRules,
))

Metal lexer.

View Source
var Mlir = internal.Register(MustNewLazyLexer(
	&Config{
		Name:      "MLIR",
		Aliases:   []string{"mlir"},
		Filenames: []string{"*.mlir"},
		MimeTypes: []string{"text/x-mlir"},
	},
	mlirRules,
))

MLIR lexer.

View Source
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,
))

Modula-2 lexer.

View Source
var MonkeyC = internal.Register(MustNewLazyLexer(
	&Config{
		Name:      "MonkeyC",
		Aliases:   []string{"monkeyc"},
		Filenames: []string{"*.mc"},
		MimeTypes: []string{"text/x-monkeyc"},
	},
	monkeyCRules,
))
View Source
var MorrowindScript = internal.Register(MustNewLazyLexer(
	&Config{
		Name:      "MorrowindScript",
		Aliases:   []string{"morrowind", "mwscript"},
		Filenames: []string{},
		MimeTypes: []string{},
	},
	morrowindScriptRules,
))

MorrowindScript lexer.

View Source
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

	dialectNameCount := nameBetweenBacktickCount + nameBetweenBracketCount
	if dialectNameCount >= 1 && nameBetweenBacktickCount >= (2*nameBetweenBracketCount) {

		result += 0.5
	} else if nameBetweenBacktickCount > nameBetweenBracketCount {
		result += 0.2
	} else if nameBetweenBacktickCount > 0 {
		result += 0.1
	}

	return result
}))

MySQL lexer.

View Source
var Myghty = internal.Register(MustNewLazyLexer(
	&Config{
		Name:      "Myghty",
		Aliases:   []string{"myghty"},
		Filenames: []string{"*.myt", "autodelegate"},
		MimeTypes: []string{"application/x-myghty"},
	},
	myghtyRules,
))

Myghty lexer.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL