Pagination, readable error messages to user, syntax highlighting started.
Pagination now works. Temporary hardcoded 10 pastes per page, will be put in configuration later. Maybe. From now user will receive readable error message if error occured. Started to work on syntax highlighting, tried to make lexers detection work but apparently to no avail.
This commit is contained in:
91
vendor/github.com/alecthomas/chroma/lexers/d/dart.go
generated
vendored
Normal file
91
vendor/github.com/alecthomas/chroma/lexers/d/dart.go
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
package d
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Dart lexer.
|
||||
var Dart = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "Dart",
|
||||
Aliases: []string{"dart"},
|
||||
Filenames: []string{"*.dart"},
|
||||
MimeTypes: []string{"text/x-dart"},
|
||||
DotAll: true,
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
Include("string_literal"),
|
||||
{`#!(.*?)$`, CommentPreproc, nil},
|
||||
{`\b(import|export)\b`, Keyword, Push("import_decl")},
|
||||
{`\b(library|source|part of|part)\b`, Keyword, nil},
|
||||
{`[^\S\n]+`, Text, nil},
|
||||
{`//.*?\n`, CommentSingle, nil},
|
||||
{`/\*.*?\*/`, CommentMultiline, nil},
|
||||
{`\b(class)\b(\s+)`, ByGroups(KeywordDeclaration, Text), Push("class")},
|
||||
{`\b(assert|break|case|catch|continue|default|do|else|finally|for|if|in|is|new|return|super|switch|this|throw|try|while)\b`, Keyword, nil},
|
||||
{`\b(abstract|async|await|const|extends|factory|final|get|implements|native|operator|set|static|sync|typedef|var|with|yield)\b`, KeywordDeclaration, nil},
|
||||
{`\b(bool|double|dynamic|int|num|Object|String|void)\b`, KeywordType, nil},
|
||||
{`\b(false|null|true)\b`, KeywordConstant, nil},
|
||||
{`[~!%^&*+=|?:<>/-]|as\b`, Operator, nil},
|
||||
{`[a-zA-Z_$]\w*:`, NameLabel, nil},
|
||||
{`[a-zA-Z_$]\w*`, Name, nil},
|
||||
{`[(){}\[\],.;]`, Punctuation, nil},
|
||||
{`0[xX][0-9a-fA-F]+`, LiteralNumberHex, nil},
|
||||
{`\d+(\.\d*)?([eE][+-]?\d+)?`, LiteralNumber, nil},
|
||||
{`\.\d+([eE][+-]?\d+)?`, LiteralNumber, nil},
|
||||
{`\n`, Text, nil},
|
||||
},
|
||||
"class": {
|
||||
{`[a-zA-Z_$]\w*`, NameClass, Pop(1)},
|
||||
},
|
||||
"import_decl": {
|
||||
Include("string_literal"),
|
||||
{`\s+`, Text, nil},
|
||||
{`\b(as|show|hide)\b`, Keyword, nil},
|
||||
{`[a-zA-Z_$]\w*`, Name, nil},
|
||||
{`\,`, Punctuation, nil},
|
||||
{`\;`, Punctuation, Pop(1)},
|
||||
},
|
||||
"string_literal": {
|
||||
{`r"""([\w\W]*?)"""`, LiteralStringDouble, nil},
|
||||
{`r'''([\w\W]*?)'''`, LiteralStringSingle, nil},
|
||||
{`r"(.*?)"`, LiteralStringDouble, nil},
|
||||
{`r'(.*?)'`, LiteralStringSingle, nil},
|
||||
{`"""`, LiteralStringDouble, Push("string_double_multiline")},
|
||||
{`'''`, LiteralStringSingle, Push("string_single_multiline")},
|
||||
{`"`, LiteralStringDouble, Push("string_double")},
|
||||
{`'`, LiteralStringSingle, Push("string_single")},
|
||||
},
|
||||
"string_common": {
|
||||
{`\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|u\{[0-9A-Fa-f]*\}|[a-z'\"$\\])`, LiteralStringEscape, nil},
|
||||
{`(\$)([a-zA-Z_]\w*)`, ByGroups(LiteralStringInterpol, Name), nil},
|
||||
{`(\$\{)(.*?)(\})`, ByGroups(LiteralStringInterpol, UsingSelf("root"), LiteralStringInterpol), nil},
|
||||
},
|
||||
"string_double": {
|
||||
{`"`, LiteralStringDouble, Pop(1)},
|
||||
{`[^"$\\\n]+`, LiteralStringDouble, nil},
|
||||
Include("string_common"),
|
||||
{`\$+`, LiteralStringDouble, nil},
|
||||
},
|
||||
"string_double_multiline": {
|
||||
{`"""`, LiteralStringDouble, Pop(1)},
|
||||
{`[^"$\\]+`, LiteralStringDouble, nil},
|
||||
Include("string_common"),
|
||||
{`(\$|\")+`, LiteralStringDouble, nil},
|
||||
},
|
||||
"string_single": {
|
||||
{`'`, LiteralStringSingle, Pop(1)},
|
||||
{`[^'$\\\n]+`, LiteralStringSingle, nil},
|
||||
Include("string_common"),
|
||||
{`\$+`, LiteralStringSingle, nil},
|
||||
},
|
||||
"string_single_multiline": {
|
||||
{`'''`, LiteralStringSingle, Pop(1)},
|
||||
{`[^\'$\\]+`, LiteralStringSingle, nil},
|
||||
Include("string_common"),
|
||||
{`(\$|\')+`, LiteralStringSingle, nil},
|
||||
},
|
||||
},
|
||||
))
|
29
vendor/github.com/alecthomas/chroma/lexers/d/diff.go
generated
vendored
Normal file
29
vendor/github.com/alecthomas/chroma/lexers/d/diff.go
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
package d
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Diff lexer.
|
||||
var Diff = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "Diff",
|
||||
Aliases: []string{"diff", "udiff"},
|
||||
EnsureNL: true,
|
||||
Filenames: []string{"*.diff", "*.patch"},
|
||||
MimeTypes: []string{"text/x-diff", "text/x-patch"},
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
{` .*\n`, Text, nil},
|
||||
{`\+.*\n`, GenericInserted, nil},
|
||||
{`-.*\n`, GenericDeleted, nil},
|
||||
{`!.*\n`, GenericStrong, nil},
|
||||
{`@.*\n`, GenericSubheading, nil},
|
||||
{`([Ii]ndex|diff).*\n`, GenericHeading, nil},
|
||||
{`=.*\n`, GenericHeading, nil},
|
||||
{`.*\n`, Text, nil},
|
||||
},
|
||||
},
|
||||
))
|
53
vendor/github.com/alecthomas/chroma/lexers/d/django.go
generated
vendored
Normal file
53
vendor/github.com/alecthomas/chroma/lexers/d/django.go
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
package d
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Django/Jinja lexer.
|
||||
var DjangoJinja = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "Django/Jinja",
|
||||
Aliases: []string{"django", "jinja"},
|
||||
Filenames: []string{},
|
||||
MimeTypes: []string{"application/x-django-templating", "application/x-jinja"},
|
||||
DotAll: true,
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
{`[^{]+`, Other, nil},
|
||||
{`\{\{`, CommentPreproc, Push("var")},
|
||||
{`\{[*#].*?[*#]\}`, Comment, nil},
|
||||
{`(\{%)(-?\s*)(comment)(\s*-?)(%\})(.*?)(\{%)(-?\s*)(endcomment)(\s*-?)(%\})`, ByGroups(CommentPreproc, Text, Keyword, Text, CommentPreproc, Comment, CommentPreproc, Text, Keyword, Text, CommentPreproc), nil},
|
||||
{`(\{%)(-?\s*)(raw)(\s*-?)(%\})(.*?)(\{%)(-?\s*)(endraw)(\s*-?)(%\})`, ByGroups(CommentPreproc, Text, Keyword, Text, CommentPreproc, Text, CommentPreproc, Text, Keyword, Text, CommentPreproc), nil},
|
||||
{`(\{%)(-?\s*)(filter)(\s+)([a-zA-Z_]\w*)`, ByGroups(CommentPreproc, Text, Keyword, Text, NameFunction), Push("block")},
|
||||
{`(\{%)(-?\s*)([a-zA-Z_]\w*)`, ByGroups(CommentPreproc, Text, Keyword), Push("block")},
|
||||
{`\{`, Other, nil},
|
||||
},
|
||||
"varnames": {
|
||||
{`(\|)(\s*)([a-zA-Z_]\w*)`, ByGroups(Operator, Text, NameFunction), nil},
|
||||
{`(is)(\s+)(not)?(\s+)?([a-zA-Z_]\w*)`, ByGroups(Keyword, Text, Keyword, Text, NameFunction), nil},
|
||||
{`(_|true|false|none|True|False|None)\b`, KeywordPseudo, nil},
|
||||
{`(in|as|reversed|recursive|not|and|or|is|if|else|import|with(?:(?:out)?\s*context)?|scoped|ignore\s+missing)\b`, Keyword, nil},
|
||||
{`(loop|block|super|forloop)\b`, NameBuiltin, nil},
|
||||
{`[a-zA-Z_][\w-]*`, NameVariable, nil},
|
||||
{`\.\w+`, NameVariable, nil},
|
||||
{`:?"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
|
||||
{`:?'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil},
|
||||
{`([{}()\[\]+\-*/,:~]|[><=]=?)`, Operator, nil},
|
||||
{`[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?`, LiteralNumber, nil},
|
||||
},
|
||||
"var": {
|
||||
{`\s+`, Text, nil},
|
||||
{`(-?)(\}\})`, ByGroups(Text, CommentPreproc), Pop(1)},
|
||||
Include("varnames"),
|
||||
},
|
||||
"block": {
|
||||
{`\s+`, Text, nil},
|
||||
{`(-?)(%\})`, ByGroups(Text, CommentPreproc), Pop(1)},
|
||||
Include("varnames"),
|
||||
{`.`, Punctuation, nil},
|
||||
},
|
||||
},
|
||||
))
|
27
vendor/github.com/alecthomas/chroma/lexers/d/docker.go
generated
vendored
Normal file
27
vendor/github.com/alecthomas/chroma/lexers/d/docker.go
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
package d
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
. "github.com/alecthomas/chroma/lexers/b"
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Docker lexer.
|
||||
var Docker = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "Docker",
|
||||
Aliases: []string{"docker", "dockerfile"},
|
||||
Filenames: []string{"Dockerfile", "*.docker"},
|
||||
MimeTypes: []string{"text/x-dockerfile-config"},
|
||||
CaseInsensitive: true,
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
{`^(ONBUILD)(\s+)((?:FROM|MAINTAINER|CMD|EXPOSE|ENV|ADD|ENTRYPOINT|VOLUME|WORKDIR))\b`, ByGroups(NameKeyword, TextWhitespace, Keyword), nil},
|
||||
{`^((?:FROM|MAINTAINER|CMD|EXPOSE|ENV|ADD|ENTRYPOINT|VOLUME|WORKDIR))\b(.*)`, ByGroups(Keyword, LiteralString), nil},
|
||||
{`#.*`, Comment, nil},
|
||||
{`RUN`, Keyword, nil},
|
||||
{`(.*\\\n)*.+`, Using(Bash), nil},
|
||||
},
|
||||
},
|
||||
))
|
69
vendor/github.com/alecthomas/chroma/lexers/d/dtd.go
generated
vendored
Normal file
69
vendor/github.com/alecthomas/chroma/lexers/d/dtd.go
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
package d
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Dtd lexer.
|
||||
var Dtd = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "DTD",
|
||||
Aliases: []string{"dtd"},
|
||||
Filenames: []string{"*.dtd"},
|
||||
MimeTypes: []string{"application/xml-dtd"},
|
||||
DotAll: true,
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
Include("common"),
|
||||
{`(<!ELEMENT)(\s+)(\S+)`, ByGroups(Keyword, Text, NameTag), Push("element")},
|
||||
{`(<!ATTLIST)(\s+)(\S+)`, ByGroups(Keyword, Text, NameTag), Push("attlist")},
|
||||
{`(<!ENTITY)(\s+)(\S+)`, ByGroups(Keyword, Text, NameEntity), Push("entity")},
|
||||
{`(<!NOTATION)(\s+)(\S+)`, ByGroups(Keyword, Text, NameTag), Push("notation")},
|
||||
{`(<!\[)([^\[\s]+)(\s*)(\[)`, ByGroups(Keyword, NameEntity, Text, Keyword), nil},
|
||||
{`(<!DOCTYPE)(\s+)([^>\s]+)`, ByGroups(Keyword, Text, NameTag), nil},
|
||||
{`PUBLIC|SYSTEM`, KeywordConstant, nil},
|
||||
{`[\[\]>]`, Keyword, nil},
|
||||
},
|
||||
"common": {
|
||||
{`\s+`, Text, nil},
|
||||
{`(%|&)[^;]*;`, NameEntity, nil},
|
||||
{`<!--`, Comment, Push("comment")},
|
||||
{`[(|)*,?+]`, Operator, nil},
|
||||
{`"[^"]*"`, LiteralStringDouble, nil},
|
||||
{`\'[^\']*\'`, LiteralStringSingle, nil},
|
||||
},
|
||||
"comment": {
|
||||
{`[^-]+`, Comment, nil},
|
||||
{`-->`, Comment, Pop(1)},
|
||||
{`-`, Comment, nil},
|
||||
},
|
||||
"element": {
|
||||
Include("common"),
|
||||
{`EMPTY|ANY|#PCDATA`, KeywordConstant, nil},
|
||||
{`[^>\s|()?+*,]+`, NameTag, nil},
|
||||
{`>`, Keyword, Pop(1)},
|
||||
},
|
||||
"attlist": {
|
||||
Include("common"),
|
||||
{`CDATA|IDREFS|IDREF|ID|NMTOKENS|NMTOKEN|ENTITIES|ENTITY|NOTATION`, KeywordConstant, nil},
|
||||
{`#REQUIRED|#IMPLIED|#FIXED`, KeywordConstant, nil},
|
||||
{`xml:space|xml:lang`, KeywordReserved, nil},
|
||||
{`[^>\s|()?+*,]+`, NameAttribute, nil},
|
||||
{`>`, Keyword, Pop(1)},
|
||||
},
|
||||
"entity": {
|
||||
Include("common"),
|
||||
{`SYSTEM|PUBLIC|NDATA`, KeywordConstant, nil},
|
||||
{`[^>\s|()?+*,]+`, NameEntity, nil},
|
||||
{`>`, Keyword, Pop(1)},
|
||||
},
|
||||
"notation": {
|
||||
Include("common"),
|
||||
{`SYSTEM|PUBLIC`, KeywordConstant, nil},
|
||||
{`[^>\s|()?+*,]+`, NameAttribute, nil},
|
||||
{`>`, Keyword, Pop(1)},
|
||||
},
|
||||
},
|
||||
))
|
Reference in New Issue
Block a user