mirror of
https://github.com/cheat/cheat.git
synced 2025-09-02 01:58:29 +02:00
Add vendor files for go build
This commit is contained in:
55
vendor/github.com/alecthomas/chroma/lexers/g/gas.go
generated
vendored
Normal file
55
vendor/github.com/alecthomas/chroma/lexers/g/gas.go
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
package g
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Gas lexer.
|
||||
var Gas = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "GAS",
|
||||
Aliases: []string{"gas", "asm"},
|
||||
Filenames: []string{"*.s", "*.S"},
|
||||
MimeTypes: []string{"text/x-gas"},
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
Include("whitespace"),
|
||||
{`(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+):`, NameLabel, nil},
|
||||
{`\.(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+)`, NameAttribute, Push("directive-args")},
|
||||
{`lock|rep(n?z)?|data\d+`, NameAttribute, nil},
|
||||
{`(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+)`, NameFunction, Push("instruction-args")},
|
||||
{`[\r\n]+`, Text, nil},
|
||||
},
|
||||
"directive-args": {
|
||||
{`(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+)`, NameConstant, nil},
|
||||
{`"(\\"|[^"])*"`, LiteralString, nil},
|
||||
{`@(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+)`, NameAttribute, nil},
|
||||
{`(?:0[xX][a-zA-Z0-9]+|\d+)`, LiteralNumberInteger, nil},
|
||||
{`[\r\n]+`, Text, Pop(1)},
|
||||
Include("punctuation"),
|
||||
Include("whitespace"),
|
||||
},
|
||||
"instruction-args": {
|
||||
{`([a-z0-9]+)( )(<)((?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+))(>)`, ByGroups(LiteralNumberHex, Text, Punctuation, NameConstant, Punctuation), nil},
|
||||
{`([a-z0-9]+)( )(<)((?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+))([-+])((?:0[xX][a-zA-Z0-9]+|\d+))(>)`, ByGroups(LiteralNumberHex, Text, Punctuation, NameConstant, Punctuation, LiteralNumberInteger, Punctuation), nil},
|
||||
{`(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+)`, NameConstant, nil},
|
||||
{`(?:0[xX][a-zA-Z0-9]+|\d+)`, LiteralNumberInteger, nil},
|
||||
{`%(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+)`, NameVariable, nil},
|
||||
{`$(?:0[xX][a-zA-Z0-9]+|\d+)`, LiteralNumberInteger, nil},
|
||||
{`$'(.|\\')'`, LiteralStringChar, nil},
|
||||
{`[\r\n]+`, Text, Pop(1)},
|
||||
Include("punctuation"),
|
||||
Include("whitespace"),
|
||||
},
|
||||
"whitespace": {
|
||||
{`\n`, Text, nil},
|
||||
{`\s+`, Text, nil},
|
||||
{`[;#].*?\n`, Comment, nil},
|
||||
},
|
||||
"punctuation": {
|
||||
{`[-*,.()\[\]!:]+`, Punctuation, nil},
|
||||
},
|
||||
},
|
||||
))
|
124
vendor/github.com/alecthomas/chroma/lexers/g/gdscript.go
generated
vendored
Normal file
124
vendor/github.com/alecthomas/chroma/lexers/g/gdscript.go
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
114
vendor/github.com/alecthomas/chroma/lexers/g/genshi.go
generated
vendored
Normal file
114
vendor/github.com/alecthomas/chroma/lexers/g/genshi.go
generated
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
package g
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
. "github.com/alecthomas/chroma/lexers/p"
|
||||
)
|
||||
|
||||
// Genshi Text lexer.
|
||||
var GenshiText = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "Genshi Text",
|
||||
Aliases: []string{"genshitext"},
|
||||
Filenames: []string{},
|
||||
MimeTypes: []string{"application/x-genshi-text", "text/x-genshi"},
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
{`[^#$\s]+`, Other, nil},
|
||||
{`^(\s*)(##.*)$`, ByGroups(Text, Comment), nil},
|
||||
{`^(\s*)(#)`, ByGroups(Text, CommentPreproc), Push("directive")},
|
||||
Include("variable"),
|
||||
{`[#$\s]`, Other, nil},
|
||||
},
|
||||
"directive": {
|
||||
{`\n`, Text, Pop(1)},
|
||||
{`(?:def|for|if)\s+.*`, Using(Python), Pop(1)},
|
||||
{`(choose|when|with)([^\S\n]+)(.*)`, ByGroups(Keyword, Text, Using(Python)), Pop(1)},
|
||||
{`(choose|otherwise)\b`, Keyword, Pop(1)},
|
||||
{`(end\w*)([^\S\n]*)(.*)`, ByGroups(Keyword, Text, Comment), Pop(1)},
|
||||
},
|
||||
"variable": {
|
||||
{`(?<!\$)(\$\{)(.+?)(\})`, ByGroups(CommentPreproc, Using(Python), CommentPreproc), nil},
|
||||
{`(?<!\$)(\$)([a-zA-Z_][\w.]*)`, NameVariable, nil},
|
||||
},
|
||||
},
|
||||
))
|
||||
|
||||
// Html+Genshi lexer.
|
||||
var GenshiHTMLTemplate = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "Genshi HTML",
|
||||
Aliases: []string{"html+genshi", "html+kid"},
|
||||
Filenames: []string{},
|
||||
MimeTypes: []string{"text/html+genshi"},
|
||||
NotMultiline: true,
|
||||
DotAll: true,
|
||||
},
|
||||
genshiMarkupRules,
|
||||
))
|
||||
|
||||
// Genshi lexer.
|
||||
var Genshi = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "Genshi",
|
||||
Aliases: []string{"genshi", "kid", "xml+genshi", "xml+kid"},
|
||||
Filenames: []string{"*.kid"},
|
||||
MimeTypes: []string{"application/x-genshi", "application/x-kid"},
|
||||
NotMultiline: true,
|
||||
DotAll: true,
|
||||
},
|
||||
genshiMarkupRules,
|
||||
))
|
||||
|
||||
var genshiMarkupRules = Rules{
|
||||
"root": {
|
||||
{`[^<$]+`, Other, nil},
|
||||
{`(<\?python)(.*?)(\?>)`, ByGroups(CommentPreproc, Using(Python), CommentPreproc), nil},
|
||||
{`<\s*(script|style)\s*.*?>.*?<\s*/\1\s*>`, Other, nil},
|
||||
{`<\s*py:[a-zA-Z0-9]+`, NameTag, Push("pytag")},
|
||||
{`<\s*[a-zA-Z0-9:.]+`, NameTag, Push("tag")},
|
||||
Include("variable"),
|
||||
{`[<$]`, Other, nil},
|
||||
},
|
||||
"pytag": {
|
||||
{`\s+`, Text, nil},
|
||||
{`[\w:-]+\s*=`, NameAttribute, Push("pyattr")},
|
||||
{`/?\s*>`, NameTag, Pop(1)},
|
||||
},
|
||||
"pyattr": {
|
||||
{`(")(.*?)(")`, ByGroups(LiteralString, Using(Python), LiteralString), Pop(1)},
|
||||
{`(')(.*?)(')`, ByGroups(LiteralString, Using(Python), LiteralString), Pop(1)},
|
||||
{`[^\s>]+`, LiteralString, Pop(1)},
|
||||
},
|
||||
"tag": {
|
||||
{`\s+`, Text, nil},
|
||||
{`py:[\w-]+\s*=`, NameAttribute, Push("pyattr")},
|
||||
{`[\w:-]+\s*=`, NameAttribute, Push("attr")},
|
||||
{`/?\s*>`, NameTag, Pop(1)},
|
||||
},
|
||||
"attr": {
|
||||
{`"`, LiteralString, Push("attr-dstring")},
|
||||
{`'`, LiteralString, Push("attr-sstring")},
|
||||
{`[^\s>]*`, LiteralString, Pop(1)},
|
||||
},
|
||||
"attr-dstring": {
|
||||
{`"`, LiteralString, Pop(1)},
|
||||
Include("strings"),
|
||||
{`'`, LiteralString, nil},
|
||||
},
|
||||
"attr-sstring": {
|
||||
{`'`, LiteralString, Pop(1)},
|
||||
Include("strings"),
|
||||
{`'`, LiteralString, nil},
|
||||
},
|
||||
"strings": {
|
||||
{`[^"'$]+`, LiteralString, nil},
|
||||
Include("variable"),
|
||||
},
|
||||
"variable": {
|
||||
{`(?<!\$)(\$\{)(.+?)(\})`, ByGroups(CommentPreproc, Using(Python), CommentPreproc), nil},
|
||||
{`(?<!\$)(\$)([a-zA-Z_][\w\.]*)`, NameVariable, nil},
|
||||
},
|
||||
}
|
37
vendor/github.com/alecthomas/chroma/lexers/g/glsl.go
generated
vendored
Normal file
37
vendor/github.com/alecthomas/chroma/lexers/g/glsl.go
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
package g
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// GLSL lexer.
|
||||
var GLSL = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "GLSL",
|
||||
Aliases: []string{"glsl"},
|
||||
Filenames: []string{"*.vert", "*.frag", "*.geo"},
|
||||
MimeTypes: []string{"text/x-glslsrc"},
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
{`^#.*`, CommentPreproc, nil},
|
||||
{`//.*`, CommentSingle, nil},
|
||||
{`/(\\\n)?[*](.|\n)*?[*](\\\n)?/`, CommentMultiline, nil},
|
||||
{`\+|-|~|!=?|\*|/|%|<<|>>|<=?|>=?|==?|&&?|\^|\|\|?`, Operator, nil},
|
||||
{`[?:]`, Operator, nil},
|
||||
{`\bdefined\b`, Operator, nil},
|
||||
{`[;{}(),\[\]]`, Punctuation, nil},
|
||||
{`[+-]?\d*\.\d+([eE][-+]?\d+)?`, LiteralNumberFloat, nil},
|
||||
{`[+-]?\d+\.\d*([eE][-+]?\d+)?`, LiteralNumberFloat, nil},
|
||||
{`0[xX][0-9a-fA-F]*`, LiteralNumberHex, nil},
|
||||
{`0[0-7]*`, LiteralNumberOct, nil},
|
||||
{`[1-9][0-9]*`, LiteralNumberInteger, nil},
|
||||
{Words(`\b`, `\b`, `attribute`, `const`, `uniform`, `varying`, `centroid`, `break`, `continue`, `do`, `for`, `while`, `if`, `else`, `in`, `out`, `inout`, `float`, `int`, `void`, `bool`, `true`, `false`, `invariant`, `discard`, `return`, `mat2`, `mat3mat4`, `mat2x2`, `mat3x2`, `mat4x2`, `mat2x3`, `mat3x3`, `mat4x3`, `mat2x4`, `mat3x4`, `mat4x4`, `vec2`, `vec3`, `vec4`, `ivec2`, `ivec3`, `ivec4`, `bvec2`, `bvec3`, `bvec4`, `sampler1D`, `sampler2D`, `sampler3DsamplerCube`, `sampler1DShadow`, `sampler2DShadow`, `struct`), Keyword, nil},
|
||||
{Words(`\b`, `\b`, `asm`, `class`, `union`, `enum`, `typedef`, `template`, `this`, `packed`, `goto`, `switch`, `default`, `inline`, `noinline`, `volatile`, `public`, `static`, `extern`, `external`, `interface`, `long`, `short`, `double`, `half`, `fixed`, `unsigned`, `lowp`, `mediump`, `highp`, `precision`, `input`, `output`, `hvec2`, `hvec3`, `hvec4`, `dvec2`, `dvec3`, `dvec4`, `fvec2`, `fvec3`, `fvec4`, `sampler2DRect`, `sampler3DRect`, `sampler2DRectShadow`, `sizeof`, `cast`, `namespace`, `using`), Keyword, nil},
|
||||
{`[a-zA-Z_]\w*`, Name, nil},
|
||||
{`\.`, Punctuation, nil},
|
||||
{`\s+`, Text, nil},
|
||||
},
|
||||
},
|
||||
))
|
117
vendor/github.com/alecthomas/chroma/lexers/g/gnuplot.go
generated
vendored
Normal file
117
vendor/github.com/alecthomas/chroma/lexers/g/gnuplot.go
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
114
vendor/github.com/alecthomas/chroma/lexers/g/go.go
generated
vendored
Normal file
114
vendor/github.com/alecthomas/chroma/lexers/g/go.go
generated
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
package g
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/h"
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Go lexer.
|
||||
var Go = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "Go",
|
||||
Aliases: []string{"go", "golang"},
|
||||
Filenames: []string{"*.go"},
|
||||
MimeTypes: []string{"text/x-gosrc"},
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
{`\n`, Text, nil},
|
||||
{`\s+`, Text, nil},
|
||||
{`\\\n`, Text, nil},
|
||||
{`//(.*?)\n`, CommentSingle, nil},
|
||||
{`/(\\\n)?[*](.|\n)*?[*](\\\n)?/`, CommentMultiline, nil},
|
||||
{`(import|package)\b`, KeywordNamespace, nil},
|
||||
{`(var|func|struct|map|chan|type|interface|const)\b`, KeywordDeclaration, nil},
|
||||
{Words(``, `\b`, `break`, `default`, `select`, `case`, `defer`, `go`, `else`, `goto`, `switch`, `fallthrough`, `if`, `range`, `continue`, `for`, `return`), Keyword, nil},
|
||||
{`(true|false|iota|nil)\b`, KeywordConstant, nil},
|
||||
{Words(``, `\b(\()`, `uint`, `uint8`, `uint16`, `uint32`, `uint64`, `int`, `int8`, `int16`, `int32`, `int64`, `float`, `float32`, `float64`, `complex64`, `complex128`, `byte`, `rune`, `string`, `bool`, `error`, `uintptr`, `print`, `println`, `panic`, `recover`, `close`, `complex`, `real`, `imag`, `len`, `cap`, `append`, `copy`, `delete`, `new`, `make`), ByGroups(NameBuiltin, Punctuation), nil},
|
||||
{Words(``, `\b`, `uint`, `uint8`, `uint16`, `uint32`, `uint64`, `int`, `int8`, `int16`, `int32`, `int64`, `float`, `float32`, `float64`, `complex64`, `complex128`, `byte`, `rune`, `string`, `bool`, `error`, `uintptr`), KeywordType, nil},
|
||||
{`\d+i`, LiteralNumber, nil},
|
||||
{`\d+\.\d*([Ee][-+]\d+)?i`, LiteralNumber, nil},
|
||||
{`\.\d+([Ee][-+]\d+)?i`, LiteralNumber, nil},
|
||||
{`\d+[Ee][-+]\d+i`, LiteralNumber, nil},
|
||||
{`\d+(\.\d+[eE][+\-]?\d+|\.\d*|[eE][+\-]?\d+)`, LiteralNumberFloat, nil},
|
||||
{`\.\d+([eE][+\-]?\d+)?`, LiteralNumberFloat, nil},
|
||||
{`0[0-7]+`, LiteralNumberOct, nil},
|
||||
{`0[xX][0-9a-fA-F]+`, LiteralNumberHex, nil},
|
||||
{`(0|[1-9][0-9]*)`, LiteralNumberInteger, nil},
|
||||
{`'(\\['"\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|[^\\])'`, LiteralStringChar, nil},
|
||||
{"(`)([^`]*)(`)", ByGroups(LiteralString, Using(TypeRemappingLexer(GoTextTemplate, TypeMapping{{Other, LiteralString, nil}})), LiteralString), nil},
|
||||
{`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
|
||||
{`(<<=|>>=|<<|>>|<=|>=|&\^=|&\^|\+=|-=|\*=|/=|%=|&=|\|=|&&|\|\||<-|\+\+|--|==|!=|:=|\.\.\.|[+\-*/%&])`, Operator, nil},
|
||||
{`([a-zA-Z_]\w*)(\s*)(\()`, ByGroups(NameFunction, UsingSelf("root"), Punctuation), nil},
|
||||
{`[|^<>=!()\[\]{}.,;:]`, Punctuation, nil},
|
||||
{`[^\W\d]\w*`, NameOther, nil},
|
||||
},
|
||||
},
|
||||
).SetAnalyser(func(text string) float32 {
|
||||
if strings.Contains(text, "fmt.") && strings.Contains(text, "package ") {
|
||||
return 0.5
|
||||
}
|
||||
if strings.Contains(text, "package ") {
|
||||
return 0.1
|
||||
}
|
||||
return 0.0
|
||||
}))
|
||||
|
||||
var goTemplateRules = Rules{
|
||||
"root": {
|
||||
{`{{[-]?`, CommentPreproc, Push("template")},
|
||||
{`[^{]+`, Other, nil},
|
||||
{`{`, Other, nil},
|
||||
},
|
||||
"template": {
|
||||
{`[-]?}}`, CommentPreproc, Pop(1)},
|
||||
{`/\*.*?\*/`, Comment, nil},
|
||||
{`(?=}})`, CommentPreproc, Pop(1)}, // Terminate the pipeline
|
||||
{`\(`, Operator, Push("subexpression")},
|
||||
{`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
|
||||
Include("expression"),
|
||||
},
|
||||
"subexpression": {
|
||||
{`\)`, Operator, Pop(1)},
|
||||
Include("expression"),
|
||||
},
|
||||
"expression": {
|
||||
{`\s+`, Whitespace, nil},
|
||||
{`\(`, Operator, Push("subexpression")},
|
||||
{`(range|if|else|while|with|template|end|true|false|nil|and|call|html|index|js|len|not|or|print|printf|println|urlquery|eq|ne|lt|le|gt|ge)\b`, Keyword, nil},
|
||||
{`\||:=`, Operator, nil},
|
||||
{`[$]?[^\W\d]\w*`, NameOther, nil},
|
||||
{`[$]?\.(?:[^\W\d]\w*)?`, NameAttribute, nil},
|
||||
{`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
|
||||
{`\d+i`, LiteralNumber, nil},
|
||||
{`\d+\.\d*([Ee][-+]\d+)?i`, LiteralNumber, nil},
|
||||
{`\.\d+([Ee][-+]\d+)?i`, LiteralNumber, nil},
|
||||
{`\d+[Ee][-+]\d+i`, LiteralNumber, nil},
|
||||
{`\d+(\.\d+[eE][+\-]?\d+|\.\d*|[eE][+\-]?\d+)`, LiteralNumberFloat, nil},
|
||||
{`\.\d+([eE][+\-]?\d+)?`, LiteralNumberFloat, nil},
|
||||
{`0[0-7]+`, LiteralNumberOct, nil},
|
||||
{`0[xX][0-9a-fA-F]+`, LiteralNumberHex, nil},
|
||||
{`(0|[1-9][0-9]*)`, LiteralNumberInteger, nil},
|
||||
{`'(\\['"\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|[^\\])'`, LiteralStringChar, nil},
|
||||
{"`[^`]*`", LiteralString, nil},
|
||||
},
|
||||
}
|
||||
|
||||
var GoHTMLTemplate = internal.Register(DelegatingLexer(h.HTML, MustNewLexer(
|
||||
&Config{
|
||||
Name: "Go HTML Template",
|
||||
Aliases: []string{"go-html-template"},
|
||||
},
|
||||
goTemplateRules,
|
||||
)))
|
||||
|
||||
var GoTextTemplate = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "Go Text Template",
|
||||
Aliases: []string{"go-text-template"},
|
||||
},
|
||||
goTemplateRules,
|
||||
))
|
45
vendor/github.com/alecthomas/chroma/lexers/g/graphql.go
generated
vendored
Normal file
45
vendor/github.com/alecthomas/chroma/lexers/g/graphql.go
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
package g
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Go lexer.
|
||||
var Graphql = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "GraphQL",
|
||||
Aliases: []string{"graphql", "graphqls", "gql"},
|
||||
Filenames: []string{"*.graphql", "*.graphqls"},
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
{`(query|mutation|subscription|fragment|scalar|implements|interface|union|enum|input|type)`, KeywordDeclaration, Push("type")},
|
||||
{`(on|extend|schema|directive|\.\.\.)`, KeywordDeclaration, nil},
|
||||
{`(QUERY|MUTATION|SUBSCRIPTION|FIELD|FRAGMENT_DEFINITION|FRAGMENT_SPREAD|INLINE_FRAGMENT|SCHEMA|SCALAR|OBJECT|FIELD_DEFINITION|ARGUMENT_DEFINITION|INTERFACE|UNION|ENUM|ENUM_VALUE|INPUT_OBJECT|INPUT_FIELD_DEFINITION)\b`, KeywordConstant, nil},
|
||||
{`[^\W\d]\w*`, NameProperty, nil},
|
||||
{`\@\w+`, NameDecorator, nil},
|
||||
{`:`, Punctuation, Push("type")},
|
||||
{`[\(\)\{\}\[\],!\|=]`, Punctuation, nil},
|
||||
{`\$\w+`, NameVariable, nil},
|
||||
{`\d+i`, LiteralNumber, nil},
|
||||
{`\d+\.\d*([Ee][-+]\d+)?i`, LiteralNumber, nil},
|
||||
{`\.\d+([Ee][-+]\d+)?i`, LiteralNumber, nil},
|
||||
{`\d+[Ee][-+]\d+i`, LiteralNumber, nil},
|
||||
{`\d+(\.\d+[eE][+\-]?\d+|\.\d*|[eE][+\-]?\d+)`, LiteralNumberFloat, nil},
|
||||
{`\.\d+([eE][+\-]?\d+)?`, LiteralNumberFloat, nil},
|
||||
{`(0|[1-9][0-9]*)`, LiteralNumberInteger, nil},
|
||||
{`"""[\x00-\x7F]*?"""`, LiteralString, nil},
|
||||
{`"(\\["\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|[^\\])"`, LiteralStringChar, nil},
|
||||
{`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
|
||||
{`"(true|false|null)*"`, Literal, nil},
|
||||
{`[\r\n\s]+`, Whitespace, nil},
|
||||
{`#[^\r\n]*`, Comment, nil},
|
||||
},
|
||||
// Treats the next word as a class, default rules it would be a property
|
||||
"type": {
|
||||
{`[^\W\d]\w*`, NameClass, Pop(1)},
|
||||
Include("root"),
|
||||
},
|
||||
},
|
||||
))
|
58
vendor/github.com/alecthomas/chroma/lexers/g/groovy.go
generated
vendored
Normal file
58
vendor/github.com/alecthomas/chroma/lexers/g/groovy.go
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
package g
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Groovy lexer.
|
||||
var Groovy = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "Groovy",
|
||||
Aliases: []string{"groovy"},
|
||||
Filenames: []string{"*.groovy", "*.gradle"},
|
||||
MimeTypes: []string{"text/x-groovy"},
|
||||
DotAll: true,
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
{`#!(.*?)$`, CommentPreproc, Push("base")},
|
||||
Default(Push("base")),
|
||||
},
|
||||
"base": {
|
||||
{`^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)([a-zA-Z_]\w*)(\s*)(\()`, ByGroups(UsingSelf("root"), NameFunction, Text, Operator), nil},
|
||||
{`[^\S\n]+`, Text, nil},
|
||||
{`//.*?\n`, CommentSingle, nil},
|
||||
{`/\*.*?\*/`, CommentMultiline, nil},
|
||||
{`@[a-zA-Z_][\w.]*`, NameDecorator, nil},
|
||||
{`(as|assert|break|case|catch|continue|default|do|else|finally|for|if|in|goto|instanceof|new|return|switch|this|throw|try|while|in|as)\b`, Keyword, nil},
|
||||
{`(abstract|const|enum|extends|final|implements|native|private|protected|public|static|strictfp|super|synchronized|throws|transient|volatile)\b`, KeywordDeclaration, nil},
|
||||
{`(def|boolean|byte|char|double|float|int|long|short|void)\b`, KeywordType, nil},
|
||||
{`(package)(\s+)`, ByGroups(KeywordNamespace, Text), nil},
|
||||
{`(true|false|null)\b`, KeywordConstant, nil},
|
||||
{`(class|interface)(\s+)`, ByGroups(KeywordDeclaration, Text), Push("class")},
|
||||
{`(import)(\s+)`, ByGroups(KeywordNamespace, Text), Push("import")},
|
||||
{`""".*?"""`, LiteralStringDouble, nil},
|
||||
{`'''.*?'''`, LiteralStringSingle, nil},
|
||||
{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
|
||||
{`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil},
|
||||
{`\$/((?!/\$).)*/\$`, LiteralString, nil},
|
||||
{`/(\\\\|\\"|[^/])*/`, LiteralString, nil},
|
||||
{`'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'`, LiteralStringChar, nil},
|
||||
{`(\.)([a-zA-Z_]\w*)`, ByGroups(Operator, NameAttribute), nil},
|
||||
{`[a-zA-Z_]\w*:`, NameLabel, nil},
|
||||
{`[a-zA-Z_$]\w*`, Name, nil},
|
||||
{`[~^*!%&\[\](){}<>|+=:;,./?-]`, Operator, nil},
|
||||
{`[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?`, LiteralNumberFloat, nil},
|
||||
{`0x[0-9a-fA-F]+`, LiteralNumberHex, nil},
|
||||
{`[0-9]+L?`, LiteralNumberInteger, nil},
|
||||
{`\n`, Text, nil},
|
||||
},
|
||||
"class": {
|
||||
{`[a-zA-Z_]\w*`, NameClass, Pop(1)},
|
||||
},
|
||||
"import": {
|
||||
{`[\w.]+\*?`, NameNamespace, Pop(1)},
|
||||
},
|
||||
},
|
||||
))
|
Reference in New Issue
Block a user