Fastfix for previous two commits (sorry) and chroma update.
Well, doing "git add ." not from repository's root is a bad idea. Updated chroma dependency, added more languages to syntax highlighting.
This commit is contained in:
34
vendor/github.com/alecthomas/chroma/lexers/m/markdown.go
generated
vendored
34
vendor/github.com/alecthomas/chroma/lexers/m/markdown.go
generated
vendored
@@ -21,8 +21,15 @@ var Markdown = internal.Register(MustNewLexer(
|
||||
{`^(\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(LiteralString, Text, LiteralString), nil},
|
||||
{"^(```)(\\w+)(\\n)([\\w\\W]*?)(^```$)", EmitterFunc(markdownCodeBlock), 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": {
|
||||
@@ -38,26 +45,3 @@ var Markdown = internal.Register(MustNewLexer(
|
||||
},
|
||||
},
|
||||
))
|
||||
|
||||
func markdownCodeBlock(groups []string, lexer Lexer) Iterator {
|
||||
iterators := []Iterator{}
|
||||
tokens := []*Token{
|
||||
{String, groups[1]},
|
||||
{String, groups[2]},
|
||||
{Text, groups[3]},
|
||||
}
|
||||
code := groups[4]
|
||||
lexer = internal.Get(groups[2])
|
||||
if lexer == nil {
|
||||
tokens = append(tokens, &Token{String, code})
|
||||
iterators = append(iterators, Literator(tokens...))
|
||||
} else {
|
||||
sub, err := lexer.Tokenise(nil, code)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
iterators = append(iterators, Literator(tokens...), sub)
|
||||
}
|
||||
iterators = append(iterators, Literator(&Token{String, groups[5]}))
|
||||
return Concaterator(iterators...)
|
||||
}
|
||||
|
62
vendor/github.com/alecthomas/chroma/lexers/m/monkeyc.go
generated
vendored
Normal file
62
vendor/github.com/alecthomas/chroma/lexers/m/monkeyc.go
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
package m
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
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)),
|
||||
},
|
||||
},
|
||||
))
|
Reference in New Issue
Block a user