mirror of
https://github.com/cheat/cheat.git
synced 2024-12-23 13:09:44 +01:00
55b18b4897
commit 95479c8ad744db48386a5c78e54ef8da80e9120b Author: Chris Lane <chris@chris-allen-lane.com> Date: Wed Apr 28 12:26:32 2021 -0400 chore(version): bump version to 4.2.1 commit6956f51cae
Author: Chris Lane <chris@chris-allen-lane.com> Date: Wed Apr 28 12:24:21 2021 -0400 fix(Makefile): `vendor-update` Update the `vendor-update` build target to run `go mod vendor` after updating dependencies. commit0aca411279
Author: Chris Lane <chris@chris-allen-lane.com> Date: Wed Apr 28 12:23:24 2021 -0400 chore(deps): update dependencies commite847956b02
Author: Chris Lane <chris@chris-allen-lane.com> Date: Wed Apr 28 08:26:51 2021 -0400 chore(deps): build updates - Upgrade `go` to `1.16.3` - Attempt to fix build errors regarding dependencies
108 lines
3.8 KiB
Go
108 lines
3.8 KiB
Go
package m
|
|
|
|
import (
|
|
. "github.com/alecthomas/chroma" // nolint
|
|
"github.com/alecthomas/chroma/lexers/internal"
|
|
)
|
|
|
|
// mcfunction lexer.
|
|
var MCFunction = internal.Register(MustNewLexer(
|
|
&Config{
|
|
Name: "mcfunction",
|
|
Aliases: []string{"mcfunction"},
|
|
Filenames: []string{"*.mcfunction"},
|
|
MimeTypes: []string{},
|
|
NotMultiline: true,
|
|
DotAll: true,
|
|
},
|
|
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},
|
|
},
|
|
},
|
|
))
|