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:
61
vendor/github.com/alecthomas/chroma/lexers/t/tasm.go
generated
vendored
Normal file
61
vendor/github.com/alecthomas/chroma/lexers/t/tasm.go
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
package t
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Tasm lexer.
|
||||
var Tasm = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "TASM",
|
||||
Aliases: []string{"tasm"},
|
||||
Filenames: []string{"*.asm", "*.ASM", "*.tasm"},
|
||||
MimeTypes: []string{"text/x-tasm"},
|
||||
CaseInsensitive: true,
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
{`^\s*%`, CommentPreproc, Push("preproc")},
|
||||
Include("whitespace"),
|
||||
{`[@a-z$._?][\w$.?#@~]*:`, NameLabel, nil},
|
||||
{`BITS|USE16|USE32|SECTION|SEGMENT|ABSOLUTE|EXTERN|GLOBAL|ORG|ALIGN|STRUC|ENDSTRUC|ENDS|COMMON|CPU|GROUP|UPPERCASE|INCLUDE|EXPORT|LIBRARY|MODULE|PROC|ENDP|USES|ARG|DATASEG|UDATASEG|END|IDEAL|P386|MODEL|ASSUME|CODESEG|SIZE`, Keyword, Push("instruction-args")},
|
||||
{`([@a-z$._?][\w$.?#@~]*)(\s+)(db|dd|dw|T[A-Z][a-z]+)`, ByGroups(NameConstant, KeywordDeclaration, KeywordDeclaration), Push("instruction-args")},
|
||||
{`(?:res|d)[bwdqt]|times`, KeywordDeclaration, Push("instruction-args")},
|
||||
{`[@a-z$._?][\w$.?#@~]*`, NameFunction, Push("instruction-args")},
|
||||
{`[\r\n]+`, Text, nil},
|
||||
},
|
||||
"instruction-args": {
|
||||
{"\"(\\\\\"|[^\"\\n])*\"|'(\\\\'|[^'\\n])*'|`(\\\\`|[^`\\n])*`", LiteralString, nil},
|
||||
{`(?:0x[0-9a-f]+|$0[0-9a-f]*|[0-9]+[0-9a-f]*h)`, LiteralNumberHex, nil},
|
||||
{`[0-7]+q`, LiteralNumberOct, nil},
|
||||
{`[01]+b`, LiteralNumberBin, nil},
|
||||
{`[0-9]+\.e?[0-9]+`, LiteralNumberFloat, nil},
|
||||
{`[0-9]+`, LiteralNumberInteger, nil},
|
||||
Include("punctuation"),
|
||||
{`r[0-9][0-5]?[bwd]|[a-d][lh]|[er]?[a-d]x|[er]?[sb]p|[er]?[sd]i|[c-gs]s|st[0-7]|mm[0-7]|cr[0-4]|dr[0-367]|tr[3-7]`, NameBuiltin, nil},
|
||||
{`[@a-z$._?][\w$.?#@~]*`, NameVariable, nil},
|
||||
{`(\\\s*)(;.*)([\r\n])`, ByGroups(Text, CommentSingle, Text), nil},
|
||||
{`[\r\n]+`, Text, Pop(1)},
|
||||
Include("whitespace"),
|
||||
},
|
||||
"preproc": {
|
||||
{`[^;\n]+`, CommentPreproc, nil},
|
||||
{`;.*?\n`, CommentSingle, Pop(1)},
|
||||
{`\n`, CommentPreproc, Pop(1)},
|
||||
},
|
||||
"whitespace": {
|
||||
{`[\n\r]`, Text, nil},
|
||||
{`\\[\n\r]`, Text, nil},
|
||||
{`[ \t]+`, Text, nil},
|
||||
{`;.*`, CommentSingle, nil},
|
||||
},
|
||||
"punctuation": {
|
||||
{`[,():\[\]]+`, Punctuation, nil},
|
||||
{`[&|^<>+*=/%~-]+`, Operator, nil},
|
||||
{`[$]+`, KeywordConstant, nil},
|
||||
{`seg|wrt|strict`, OperatorWord, nil},
|
||||
{`byte|[dq]?word`, KeywordType, nil},
|
||||
},
|
||||
},
|
||||
))
|
116
vendor/github.com/alecthomas/chroma/lexers/t/tcl.go
generated
vendored
Normal file
116
vendor/github.com/alecthomas/chroma/lexers/t/tcl.go
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
package t
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Tcl lexer.
|
||||
var Tcl = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "Tcl",
|
||||
Aliases: []string{"tcl"},
|
||||
Filenames: []string{"*.tcl", "*.rvt"},
|
||||
MimeTypes: []string{"text/x-tcl", "text/x-script.tcl", "application/x-tcl"},
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
Include("command"),
|
||||
Include("basic"),
|
||||
Include("data"),
|
||||
{`\}`, Keyword, nil},
|
||||
},
|
||||
"command": {
|
||||
{Words(`\b`, `\b`, `after`, `apply`, `array`, `break`, `catch`, `continue`, `elseif`, `else`, `error`, `eval`, `expr`, `for`, `foreach`, `global`, `if`, `namespace`, `proc`, `rename`, `return`, `set`, `switch`, `then`, `trace`, `unset`, `update`, `uplevel`, `upvar`, `variable`, `vwait`, `while`), Keyword, Push("params")},
|
||||
{Words(`\b`, `\b`, `append`, `bgerror`, `binary`, `cd`, `chan`, `clock`, `close`, `concat`, `dde`, `dict`, `encoding`, `eof`, `exec`, `exit`, `fblocked`, `fconfigure`, `fcopy`, `file`, `fileevent`, `flush`, `format`, `gets`, `glob`, `history`, `http`, `incr`, `info`, `interp`, `join`, `lappend`, `lassign`, `lindex`, `linsert`, `list`, `llength`, `load`, `loadTk`, `lrange`, `lrepeat`, `lreplace`, `lreverse`, `lsearch`, `lset`, `lsort`, `mathfunc`, `mathop`, `memory`, `msgcat`, `open`, `package`, `pid`, `pkg::create`, `pkg_mkIndex`, `platform`, `platform::shell`, `puts`, `pwd`, `re_syntax`, `read`, `refchan`, `regexp`, `registry`, `regsub`, `scan`, `seek`, `socket`, `source`, `split`, `string`, `subst`, `tell`, `time`, `tm`, `unknown`, `unload`), NameBuiltin, Push("params")},
|
||||
{`([\w.-]+)`, NameVariable, Push("params")},
|
||||
{`#`, Comment, Push("comment")},
|
||||
},
|
||||
"command-in-brace": {
|
||||
{Words(`\b`, `\b`, `after`, `apply`, `array`, `break`, `catch`, `continue`, `elseif`, `else`, `error`, `eval`, `expr`, `for`, `foreach`, `global`, `if`, `namespace`, `proc`, `rename`, `return`, `set`, `switch`, `then`, `trace`, `unset`, `update`, `uplevel`, `upvar`, `variable`, `vwait`, `while`), Keyword, Push("params-in-brace")},
|
||||
{Words(`\b`, `\b`, `append`, `bgerror`, `binary`, `cd`, `chan`, `clock`, `close`, `concat`, `dde`, `dict`, `encoding`, `eof`, `exec`, `exit`, `fblocked`, `fconfigure`, `fcopy`, `file`, `fileevent`, `flush`, `format`, `gets`, `glob`, `history`, `http`, `incr`, `info`, `interp`, `join`, `lappend`, `lassign`, `lindex`, `linsert`, `list`, `llength`, `load`, `loadTk`, `lrange`, `lrepeat`, `lreplace`, `lreverse`, `lsearch`, `lset`, `lsort`, `mathfunc`, `mathop`, `memory`, `msgcat`, `open`, `package`, `pid`, `pkg::create`, `pkg_mkIndex`, `platform`, `platform::shell`, `puts`, `pwd`, `re_syntax`, `read`, `refchan`, `regexp`, `registry`, `regsub`, `scan`, `seek`, `socket`, `source`, `split`, `string`, `subst`, `tell`, `time`, `tm`, `unknown`, `unload`), NameBuiltin, Push("params-in-brace")},
|
||||
{`([\w.-]+)`, NameVariable, Push("params-in-brace")},
|
||||
{`#`, Comment, Push("comment")},
|
||||
},
|
||||
"command-in-bracket": {
|
||||
{Words(`\b`, `\b`, `after`, `apply`, `array`, `break`, `catch`, `continue`, `elseif`, `else`, `error`, `eval`, `expr`, `for`, `foreach`, `global`, `if`, `namespace`, `proc`, `rename`, `return`, `set`, `switch`, `then`, `trace`, `unset`, `update`, `uplevel`, `upvar`, `variable`, `vwait`, `while`), Keyword, Push("params-in-bracket")},
|
||||
{Words(`\b`, `\b`, `append`, `bgerror`, `binary`, `cd`, `chan`, `clock`, `close`, `concat`, `dde`, `dict`, `encoding`, `eof`, `exec`, `exit`, `fblocked`, `fconfigure`, `fcopy`, `file`, `fileevent`, `flush`, `format`, `gets`, `glob`, `history`, `http`, `incr`, `info`, `interp`, `join`, `lappend`, `lassign`, `lindex`, `linsert`, `list`, `llength`, `load`, `loadTk`, `lrange`, `lrepeat`, `lreplace`, `lreverse`, `lsearch`, `lset`, `lsort`, `mathfunc`, `mathop`, `memory`, `msgcat`, `open`, `package`, `pid`, `pkg::create`, `pkg_mkIndex`, `platform`, `platform::shell`, `puts`, `pwd`, `re_syntax`, `read`, `refchan`, `regexp`, `registry`, `regsub`, `scan`, `seek`, `socket`, `source`, `split`, `string`, `subst`, `tell`, `time`, `tm`, `unknown`, `unload`), NameBuiltin, Push("params-in-bracket")},
|
||||
{`([\w.-]+)`, NameVariable, Push("params-in-bracket")},
|
||||
{`#`, Comment, Push("comment")},
|
||||
},
|
||||
"command-in-paren": {
|
||||
{Words(`\b`, `\b`, `after`, `apply`, `array`, `break`, `catch`, `continue`, `elseif`, `else`, `error`, `eval`, `expr`, `for`, `foreach`, `global`, `if`, `namespace`, `proc`, `rename`, `return`, `set`, `switch`, `then`, `trace`, `unset`, `update`, `uplevel`, `upvar`, `variable`, `vwait`, `while`), Keyword, Push("params-in-paren")},
|
||||
{Words(`\b`, `\b`, `append`, `bgerror`, `binary`, `cd`, `chan`, `clock`, `close`, `concat`, `dde`, `dict`, `encoding`, `eof`, `exec`, `exit`, `fblocked`, `fconfigure`, `fcopy`, `file`, `fileevent`, `flush`, `format`, `gets`, `glob`, `history`, `http`, `incr`, `info`, `interp`, `join`, `lappend`, `lassign`, `lindex`, `linsert`, `list`, `llength`, `load`, `loadTk`, `lrange`, `lrepeat`, `lreplace`, `lreverse`, `lsearch`, `lset`, `lsort`, `mathfunc`, `mathop`, `memory`, `msgcat`, `open`, `package`, `pid`, `pkg::create`, `pkg_mkIndex`, `platform`, `platform::shell`, `puts`, `pwd`, `re_syntax`, `read`, `refchan`, `regexp`, `registry`, `regsub`, `scan`, `seek`, `socket`, `source`, `split`, `string`, `subst`, `tell`, `time`, `tm`, `unknown`, `unload`), NameBuiltin, Push("params-in-paren")},
|
||||
{`([\w.-]+)`, NameVariable, Push("params-in-paren")},
|
||||
{`#`, Comment, Push("comment")},
|
||||
},
|
||||
"basic": {
|
||||
{`\(`, Keyword, Push("paren")},
|
||||
{`\[`, Keyword, Push("bracket")},
|
||||
{`\{`, Keyword, Push("brace")},
|
||||
{`"`, LiteralStringDouble, Push("string")},
|
||||
{`(eq|ne|in|ni)\b`, OperatorWord, nil},
|
||||
{`!=|==|<<|>>|<=|>=|&&|\|\||\*\*|[-+~!*/%<>&^|?:]`, Operator, nil},
|
||||
},
|
||||
"data": {
|
||||
{`\s+`, Text, nil},
|
||||
{`0x[a-fA-F0-9]+`, LiteralNumberHex, nil},
|
||||
{`0[0-7]+`, LiteralNumberOct, nil},
|
||||
{`\d+\.\d+`, LiteralNumberFloat, nil},
|
||||
{`\d+`, LiteralNumberInteger, nil},
|
||||
{`\$([\w.:-]+)`, NameVariable, nil},
|
||||
{`([\w.:-]+)`, Text, nil},
|
||||
},
|
||||
"params": {
|
||||
{`;`, Keyword, Pop(1)},
|
||||
{`\n`, Text, Pop(1)},
|
||||
{`(else|elseif|then)\b`, Keyword, nil},
|
||||
Include("basic"),
|
||||
Include("data"),
|
||||
},
|
||||
"params-in-brace": {
|
||||
{`\}`, Keyword, Push("#pop", "#pop")},
|
||||
Include("params"),
|
||||
},
|
||||
"params-in-paren": {
|
||||
{`\)`, Keyword, Push("#pop", "#pop")},
|
||||
Include("params"),
|
||||
},
|
||||
"params-in-bracket": {
|
||||
{`\]`, Keyword, Push("#pop", "#pop")},
|
||||
Include("params"),
|
||||
},
|
||||
"string": {
|
||||
{`\[`, LiteralStringDouble, Push("string-square")},
|
||||
{`(?s)(\\\\|\\[0-7]+|\\.|[^"\\])`, LiteralStringDouble, nil},
|
||||
{`"`, LiteralStringDouble, Pop(1)},
|
||||
},
|
||||
"string-square": {
|
||||
{`\[`, LiteralStringDouble, Push("string-square")},
|
||||
{`(?s)(\\\\|\\[0-7]+|\\.|\\\n|[^\]\\])`, LiteralStringDouble, nil},
|
||||
{`\]`, LiteralStringDouble, Pop(1)},
|
||||
},
|
||||
"brace": {
|
||||
{`\}`, Keyword, Pop(1)},
|
||||
Include("command-in-brace"),
|
||||
Include("basic"),
|
||||
Include("data"),
|
||||
},
|
||||
"paren": {
|
||||
{`\)`, Keyword, Pop(1)},
|
||||
Include("command-in-paren"),
|
||||
Include("basic"),
|
||||
Include("data"),
|
||||
},
|
||||
"bracket": {
|
||||
{`\]`, Keyword, Pop(1)},
|
||||
Include("command-in-bracket"),
|
||||
Include("basic"),
|
||||
Include("data"),
|
||||
},
|
||||
"comment": {
|
||||
{`.*[^\\]\n`, Comment, Pop(1)},
|
||||
{`.*\\\n`, Comment, nil},
|
||||
},
|
||||
},
|
||||
))
|
59
vendor/github.com/alecthomas/chroma/lexers/t/tcsh.go
generated
vendored
Normal file
59
vendor/github.com/alecthomas/chroma/lexers/t/tcsh.go
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
package t
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Tcsh lexer.
|
||||
var Tcsh = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "Tcsh",
|
||||
Aliases: []string{"tcsh", "csh"},
|
||||
Filenames: []string{"*.tcsh", "*.csh"},
|
||||
MimeTypes: []string{"application/x-csh"},
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
Include("basic"),
|
||||
{`\$\(`, Keyword, Push("paren")},
|
||||
{`\$\{#?`, Keyword, Push("curly")},
|
||||
{"`", LiteralStringBacktick, Push("backticks")},
|
||||
Include("data"),
|
||||
},
|
||||
"basic": {
|
||||
{`\b(if|endif|else|while|then|foreach|case|default|continue|goto|breaksw|end|switch|endsw)\s*\b`, Keyword, nil},
|
||||
{`\b(alias|alloc|bg|bindkey|break|builtins|bye|caller|cd|chdir|complete|dirs|echo|echotc|eval|exec|exit|fg|filetest|getxvers|glob|getspath|hashstat|history|hup|inlib|jobs|kill|limit|log|login|logout|ls-F|migrate|newgrp|nice|nohup|notify|onintr|popd|printenv|pushd|rehash|repeat|rootnode|popd|pushd|set|shift|sched|setenv|setpath|settc|setty|setxvers|shift|source|stop|suspend|source|suspend|telltc|time|umask|unalias|uncomplete|unhash|universe|unlimit|unset|unsetenv|ver|wait|warp|watchlog|where|which)\s*\b`, NameBuiltin, nil},
|
||||
{`#.*`, Comment, nil},
|
||||
{`\\[\w\W]`, LiteralStringEscape, nil},
|
||||
{`(\b\w+)(\s*)(=)`, ByGroups(NameVariable, Text, Operator), nil},
|
||||
{`[\[\]{}()=]+`, Operator, nil},
|
||||
{`<<\s*(\'?)\\?(\w+)[\w\W]+?\2`, LiteralString, nil},
|
||||
{`;`, Punctuation, nil},
|
||||
},
|
||||
"data": {
|
||||
{`(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"`, LiteralStringDouble, nil},
|
||||
{`(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'`, LiteralStringSingle, nil},
|
||||
{`\s+`, Text, nil},
|
||||
{"[^=\\s\\[\\]{}()$\"\\'`\\\\;#]+", Text, nil},
|
||||
{`\d+(?= |\Z)`, LiteralNumber, nil},
|
||||
{`\$#?(\w+|.)`, NameVariable, nil},
|
||||
},
|
||||
"curly": {
|
||||
{`\}`, Keyword, Pop(1)},
|
||||
{`:-`, Keyword, nil},
|
||||
{`\w+`, NameVariable, nil},
|
||||
{"[^}:\"\\'`$]+", Punctuation, nil},
|
||||
{`:`, Punctuation, nil},
|
||||
Include("root"),
|
||||
},
|
||||
"paren": {
|
||||
{`\)`, Keyword, Pop(1)},
|
||||
Include("root"),
|
||||
},
|
||||
"backticks": {
|
||||
{"`", LiteralStringBacktick, Pop(1)},
|
||||
Include("root"),
|
||||
},
|
||||
},
|
||||
))
|
42
vendor/github.com/alecthomas/chroma/lexers/t/termcap.go
generated
vendored
Normal file
42
vendor/github.com/alecthomas/chroma/lexers/t/termcap.go
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
package t
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Termcap lexer.
|
||||
var Termcap = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "Termcap",
|
||||
Aliases: []string{"termcap"},
|
||||
Filenames: []string{"termcap", "termcap.src"},
|
||||
MimeTypes: []string{},
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
{`^#.*$`, Comment, nil},
|
||||
{`^[^\s#:|]+`, NameTag, Push("names")},
|
||||
},
|
||||
"names": {
|
||||
{`\n`, Text, Pop(1)},
|
||||
{`:`, Punctuation, Push("defs")},
|
||||
{`\|`, Punctuation, nil},
|
||||
{`[^:|]+`, NameAttribute, nil},
|
||||
},
|
||||
"defs": {
|
||||
{`\\\n[ \t]*`, Text, nil},
|
||||
{`\n[ \t]*`, Text, Pop(2)},
|
||||
{`(#)([0-9]+)`, ByGroups(Operator, LiteralNumber), nil},
|
||||
{`=`, Operator, Push("data")},
|
||||
{`:`, Punctuation, nil},
|
||||
{`[^\s:=#]+`, NameClass, nil},
|
||||
},
|
||||
"data": {
|
||||
{`\\072`, Literal, nil},
|
||||
{`:`, Punctuation, Pop(1)},
|
||||
{`[^:\\]+`, Literal, nil},
|
||||
{`.`, Literal, nil},
|
||||
},
|
||||
},
|
||||
))
|
42
vendor/github.com/alecthomas/chroma/lexers/t/terminfo.go
generated
vendored
Normal file
42
vendor/github.com/alecthomas/chroma/lexers/t/terminfo.go
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
package t
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Terminfo lexer.
|
||||
var Terminfo = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "Terminfo",
|
||||
Aliases: []string{"terminfo"},
|
||||
Filenames: []string{"terminfo", "terminfo.src"},
|
||||
MimeTypes: []string{},
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
{`^#.*$`, Comment, nil},
|
||||
{`^[^\s#,|]+`, NameTag, Push("names")},
|
||||
},
|
||||
"names": {
|
||||
{`\n`, Text, Pop(1)},
|
||||
{`(,)([ \t]*)`, ByGroups(Punctuation, Text), Push("defs")},
|
||||
{`\|`, Punctuation, nil},
|
||||
{`[^,|]+`, NameAttribute, nil},
|
||||
},
|
||||
"defs": {
|
||||
{`\n[ \t]+`, Text, nil},
|
||||
{`\n`, Text, Pop(2)},
|
||||
{`(#)([0-9]+)`, ByGroups(Operator, LiteralNumber), nil},
|
||||
{`=`, Operator, Push("data")},
|
||||
{`(,)([ \t]*)`, ByGroups(Punctuation, Text), nil},
|
||||
{`[^\s,=#]+`, NameClass, nil},
|
||||
},
|
||||
"data": {
|
||||
{`\\[,\\]`, Literal, nil},
|
||||
{`(,)([ \t]*)`, ByGroups(Punctuation, Text), Pop(1)},
|
||||
{`[^\\,]+`, Literal, nil},
|
||||
{`.`, Literal, nil},
|
||||
},
|
||||
},
|
||||
))
|
69
vendor/github.com/alecthomas/chroma/lexers/t/terraform.go
generated
vendored
Normal file
69
vendor/github.com/alecthomas/chroma/lexers/t/terraform.go
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
package t
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Terraform lexer.
|
||||
var Terraform = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "Terraform",
|
||||
Aliases: []string{"terraform", "tf"},
|
||||
Filenames: []string{"*.tf"},
|
||||
MimeTypes: []string{"application/x-tf", "application/x-terraform"},
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
Include("string"),
|
||||
Include("punctuation"),
|
||||
Include("curly"),
|
||||
Include("basic"),
|
||||
Include("whitespace"),
|
||||
{`[0-9]+`, LiteralNumber, nil},
|
||||
},
|
||||
"basic": {
|
||||
{Words(`\b`, `\b`, `true`, `false`), KeywordType, nil},
|
||||
{`\s*/\*`, CommentMultiline, Push("comment")},
|
||||
{`\s*#.*\n`, CommentSingle, nil},
|
||||
{`(.*?)(\s*)(=)`, ByGroups(NameAttribute, Text, Operator), nil},
|
||||
{Words(`\b`, `\b`, `variable`, `resource`, `provider`, `provisioner`, `module`), KeywordReserved, Push("function")},
|
||||
{Words(`\b`, `\b`, `ingress`, `egress`, `listener`, `default`, `connection`, `alias`), KeywordDeclaration, nil},
|
||||
{`\$\{`, LiteralStringInterpol, Push("var_builtin")},
|
||||
},
|
||||
"function": {
|
||||
{`(\s+)(".*")(\s+)`, ByGroups(Text, LiteralString, Text), nil},
|
||||
Include("punctuation"),
|
||||
Include("curly"),
|
||||
},
|
||||
"var_builtin": {
|
||||
{`\$\{`, LiteralStringInterpol, Push()},
|
||||
{Words(`\b`, `\b`, `concat`, `file`, `join`, `lookup`, `element`), NameBuiltin, nil},
|
||||
Include("string"),
|
||||
Include("punctuation"),
|
||||
{`\s+`, Text, nil},
|
||||
{`\}`, LiteralStringInterpol, Pop(1)},
|
||||
},
|
||||
"string": {
|
||||
{`(".*")`, ByGroups(LiteralStringDouble), nil},
|
||||
},
|
||||
"punctuation": {
|
||||
{`[\[\](),.]`, Punctuation, nil},
|
||||
},
|
||||
"curly": {
|
||||
{`\{`, TextPunctuation, nil},
|
||||
{`\}`, TextPunctuation, nil},
|
||||
},
|
||||
"comment": {
|
||||
{`[^*/]`, CommentMultiline, nil},
|
||||
{`/\*`, CommentMultiline, Push()},
|
||||
{`\*/`, CommentMultiline, Pop(1)},
|
||||
{`[*/]`, CommentMultiline, nil},
|
||||
},
|
||||
"whitespace": {
|
||||
{`\n`, Text, nil},
|
||||
{`\s+`, Text, nil},
|
||||
{`\\\n`, Text, nil},
|
||||
},
|
||||
},
|
||||
))
|
56
vendor/github.com/alecthomas/chroma/lexers/t/tex.go
generated
vendored
Normal file
56
vendor/github.com/alecthomas/chroma/lexers/t/tex.go
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
package t
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Tex lexer.
|
||||
var TeX = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "TeX",
|
||||
Aliases: []string{"tex", "latex"},
|
||||
Filenames: []string{"*.tex", "*.aux", "*.toc"},
|
||||
MimeTypes: []string{"text/x-tex", "text/x-latex"},
|
||||
},
|
||||
Rules{
|
||||
"general": {
|
||||
{`%.*?\n`, Comment, nil},
|
||||
{`[{}]`, NameBuiltin, nil},
|
||||
{`[&_^]`, NameBuiltin, nil},
|
||||
},
|
||||
"root": {
|
||||
{`\\\[`, LiteralStringBacktick, Push("displaymath")},
|
||||
{`\\\(`, LiteralString, Push("inlinemath")},
|
||||
{`\$\$`, LiteralStringBacktick, Push("displaymath")},
|
||||
{`\$`, LiteralString, Push("inlinemath")},
|
||||
{`\\([a-zA-Z]+|.)`, Keyword, Push("command")},
|
||||
{`\\$`, Keyword, nil},
|
||||
Include("general"),
|
||||
{`[^\\$%&_^{}]+`, Text, nil},
|
||||
},
|
||||
"math": {
|
||||
{`\\([a-zA-Z]+|.)`, NameVariable, nil},
|
||||
Include("general"),
|
||||
{`[0-9]+`, LiteralNumber, nil},
|
||||
{`[-=!+*/()\[\]]`, Operator, nil},
|
||||
{`[^=!+*/()\[\]\\$%&_^{}0-9-]+`, NameBuiltin, nil},
|
||||
},
|
||||
"inlinemath": {
|
||||
{`\\\)`, LiteralString, Pop(1)},
|
||||
{`\$`, LiteralString, Pop(1)},
|
||||
Include("math"),
|
||||
},
|
||||
"displaymath": {
|
||||
{`\\\]`, LiteralString, Pop(1)},
|
||||
{`\$\$`, LiteralString, Pop(1)},
|
||||
{`\$`, NameBuiltin, nil},
|
||||
Include("math"),
|
||||
},
|
||||
"command": {
|
||||
{`\[.*?\]`, NameAttribute, nil},
|
||||
{`\*`, Keyword, nil},
|
||||
Default(Pop(1)),
|
||||
},
|
||||
},
|
||||
))
|
73
vendor/github.com/alecthomas/chroma/lexers/t/thrift.go
generated
vendored
Normal file
73
vendor/github.com/alecthomas/chroma/lexers/t/thrift.go
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
package t
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Thrift lexer.
|
||||
var Thrift = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "Thrift",
|
||||
Aliases: []string{"thrift"},
|
||||
Filenames: []string{"*.thrift"},
|
||||
MimeTypes: []string{"application/x-thrift"},
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
Include("whitespace"),
|
||||
Include("comments"),
|
||||
{`"`, LiteralStringDouble, Combined("stringescape", "dqs")},
|
||||
{`\'`, LiteralStringSingle, Combined("stringescape", "sqs")},
|
||||
{`(namespace)(\s+)`, ByGroups(KeywordNamespace, TextWhitespace), Push("namespace")},
|
||||
{`(enum|union|struct|service|exception)(\s+)`, ByGroups(KeywordDeclaration, TextWhitespace), Push("class")},
|
||||
{`((?:(?:[^\W\d]|\$)[\w.\[\]$<>]*\s+)+?)((?:[^\W\d]|\$)[\w$]*)(\s*)(\()`, ByGroups(UsingSelf("root"), NameFunction, Text, Operator), nil},
|
||||
Include("keywords"),
|
||||
Include("numbers"),
|
||||
{`[&=]`, Operator, nil},
|
||||
{`[:;,{}()<>\[\]]`, Punctuation, nil},
|
||||
{`[a-zA-Z_](\.\w|\w)*`, Name, nil},
|
||||
},
|
||||
"whitespace": {
|
||||
{`\n`, TextWhitespace, nil},
|
||||
{`\s+`, TextWhitespace, nil},
|
||||
},
|
||||
"comments": {
|
||||
{`#.*$`, Comment, nil},
|
||||
{`//.*?\n`, Comment, nil},
|
||||
{`/\*[\w\W]*?\*/`, CommentMultiline, nil},
|
||||
},
|
||||
"stringescape": {
|
||||
{`\\([\\nrt"\'])`, LiteralStringEscape, nil},
|
||||
},
|
||||
"dqs": {
|
||||
{`"`, LiteralStringDouble, Pop(1)},
|
||||
{`[^\\"\n]+`, LiteralStringDouble, nil},
|
||||
},
|
||||
"sqs": {
|
||||
{`'`, LiteralStringSingle, Pop(1)},
|
||||
{`[^\\\'\n]+`, LiteralStringSingle, nil},
|
||||
},
|
||||
"namespace": {
|
||||
{`[a-z*](\.\w|\w)*`, NameNamespace, Pop(1)},
|
||||
Default(Pop(1)),
|
||||
},
|
||||
"class": {
|
||||
{`[a-zA-Z_]\w*`, NameClass, Pop(1)},
|
||||
Default(Pop(1)),
|
||||
},
|
||||
"keywords": {
|
||||
{`(async|oneway|extends|throws|required|optional)\b`, Keyword, nil},
|
||||
{`(true|false)\b`, KeywordConstant, nil},
|
||||
{`(const|typedef)\b`, KeywordDeclaration, nil},
|
||||
{Words(``, `\b`, `cpp_namespace`, `cpp_include`, `cpp_type`, `java_package`, `cocoa_prefix`, `csharp_namespace`, `delphi_namespace`, `php_namespace`, `py_module`, `perl_package`, `ruby_namespace`, `smalltalk_category`, `smalltalk_prefix`, `xsd_all`, `xsd_optional`, `xsd_nillable`, `xsd_namespace`, `xsd_attrs`, `include`), KeywordNamespace, nil},
|
||||
{Words(``, `\b`, `void`, `bool`, `byte`, `i16`, `i32`, `i64`, `double`, `string`, `binary`, `map`, `list`, `set`, `slist`, `senum`), KeywordType, nil},
|
||||
{Words(`\b`, `\b`, `BEGIN`, `END`, `__CLASS__`, `__DIR__`, `__FILE__`, `__FUNCTION__`, `__LINE__`, `__METHOD__`, `__NAMESPACE__`, `abstract`, `alias`, `and`, `args`, `as`, `assert`, `begin`, `break`, `case`, `catch`, `class`, `clone`, `continue`, `declare`, `def`, `default`, `del`, `delete`, `do`, `dynamic`, `elif`, `else`, `elseif`, `elsif`, `end`, `enddeclare`, `endfor`, `endforeach`, `endif`, `endswitch`, `endwhile`, `ensure`, `except`, `exec`, `finally`, `float`, `for`, `foreach`, `function`, `global`, `goto`, `if`, `implements`, `import`, `in`, `inline`, `instanceof`, `interface`, `is`, `lambda`, `module`, `native`, `new`, `next`, `nil`, `not`, `or`, `pass`, `public`, `print`, `private`, `protected`, `raise`, `redo`, `rescue`, `retry`, `register`, `return`, `self`, `sizeof`, `static`, `super`, `switch`, `synchronized`, `then`, `this`, `throw`, `transient`, `try`, `undef`, `unless`, `unsigned`, `until`, `use`, `var`, `virtual`, `volatile`, `when`, `while`, `with`, `xor`, `yield`), KeywordReserved, nil},
|
||||
},
|
||||
"numbers": {
|
||||
{`[+-]?(\d+\.\d+([eE][+-]?\d+)?|\.?\d+[eE][+-]?\d+)`, LiteralNumberFloat, nil},
|
||||
{`[+-]?0x[0-9A-Fa-f]+`, LiteralNumberHex, nil},
|
||||
{`[+-]?[0-9]+`, LiteralNumberInteger, nil},
|
||||
},
|
||||
},
|
||||
))
|
29
vendor/github.com/alecthomas/chroma/lexers/t/toml.go
generated
vendored
Normal file
29
vendor/github.com/alecthomas/chroma/lexers/t/toml.go
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
package t
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
var TOML = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "TOML",
|
||||
Aliases: []string{"toml"},
|
||||
Filenames: []string{"*.toml"},
|
||||
MimeTypes: []string{"text/x-toml"},
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
{`\s+`, Text, nil},
|
||||
{`#.*`, Comment, nil},
|
||||
{Words(``, `\b`, `true`, `false`), KeywordConstant, nil},
|
||||
{`\d\d\d\d-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d\+)?(Z|[+-]\d{2}:\d{2})`, LiteralDate, nil},
|
||||
{`[+-]?[0-9](_?\d)*\.\d+`, LiteralNumberFloat, nil},
|
||||
{`[+-]?[0-9](_?\d)*`, LiteralNumberInteger, nil},
|
||||
{`"(\\\\|\\"|[^"])*"`, StringDouble, nil},
|
||||
{`'(\\\\|\\'|[^'])*'`, StringSingle, nil},
|
||||
{`[.,=\[\]]`, Punctuation, nil},
|
||||
{`[^\W\d]\w*`, NameOther, nil},
|
||||
},
|
||||
},
|
||||
))
|
60
vendor/github.com/alecthomas/chroma/lexers/t/transactsql.go
generated
vendored
Normal file
60
vendor/github.com/alecthomas/chroma/lexers/t/transactsql.go
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
67
vendor/github.com/alecthomas/chroma/lexers/t/turtle.go
generated
vendored
Normal file
67
vendor/github.com/alecthomas/chroma/lexers/t/turtle.go
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
package t
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Turtle lexer.
|
||||
var Turtle = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "Turtle",
|
||||
Aliases: []string{"turtle"},
|
||||
Filenames: []string{"*.ttl"},
|
||||
MimeTypes: []string{"text/turtle", "application/x-turtle"},
|
||||
NotMultiline: true,
|
||||
CaseInsensitive: true,
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
{`\s+`, TextWhitespace, nil},
|
||||
{"(@base|BASE)(\\s+)(<[^<>\"{}|^`\\\\\\x00-\\x20]*>)(\\s*)(\\.?)", ByGroups(Keyword, TextWhitespace, NameVariable, TextWhitespace, Punctuation), nil},
|
||||
{"(@prefix|PREFIX)(\\s+)((?:[a-z][\\w-]*)?\\:)(\\s+)(<[^<>\"{}|^`\\\\\\x00-\\x20]*>)(\\s*)(\\.?)", ByGroups(Keyword, TextWhitespace, NameNamespace, TextWhitespace, NameVariable, TextWhitespace, Punctuation), nil},
|
||||
{`(?<=\s)a(?=\s)`, KeywordType, nil},
|
||||
{"(<[^<>\"{}|^`\\\\\\x00-\\x20]*>)", NameVariable, nil},
|
||||
{`((?:[a-z][\w-]*)?\:)([a-z][\w-]*)`, ByGroups(NameNamespace, NameTag), nil},
|
||||
{`#[^\n]+`, Comment, nil},
|
||||
{`\b(true|false)\b`, Literal, nil},
|
||||
{`[+\-]?\d*\.\d+`, LiteralNumberFloat, nil},
|
||||
{`[+\-]?\d*(:?\.\d+)?E[+\-]?\d+`, LiteralNumberFloat, nil},
|
||||
{`[+\-]?\d+`, LiteralNumberInteger, nil},
|
||||
{`[\[\](){}.;,:^]`, Punctuation, nil},
|
||||
{`"""`, LiteralString, Push("triple-double-quoted-string")},
|
||||
{`"`, LiteralString, Push("single-double-quoted-string")},
|
||||
{`'''`, LiteralString, Push("triple-single-quoted-string")},
|
||||
{`'`, LiteralString, Push("single-single-quoted-string")},
|
||||
},
|
||||
"triple-double-quoted-string": {
|
||||
{`"""`, LiteralString, Push("end-of-string")},
|
||||
{`[^\\]+`, LiteralString, nil},
|
||||
{`\\`, LiteralString, Push("string-escape")},
|
||||
},
|
||||
"single-double-quoted-string": {
|
||||
{`"`, LiteralString, Push("end-of-string")},
|
||||
{`[^"\\\n]+`, LiteralString, nil},
|
||||
{`\\`, LiteralString, Push("string-escape")},
|
||||
},
|
||||
"triple-single-quoted-string": {
|
||||
{`'''`, LiteralString, Push("end-of-string")},
|
||||
{`[^\\]+`, LiteralString, nil},
|
||||
{`\\`, LiteralString, Push("string-escape")},
|
||||
},
|
||||
"single-single-quoted-string": {
|
||||
{`'`, LiteralString, Push("end-of-string")},
|
||||
{`[^'\\\n]+`, LiteralString, nil},
|
||||
{`\\`, LiteralString, Push("string-escape")},
|
||||
},
|
||||
"string-escape": {
|
||||
{`.`, LiteralString, Pop(1)},
|
||||
},
|
||||
"end-of-string": {
|
||||
{`(@)([a-z]+(:?-[a-z0-9]+)*)`, ByGroups(Operator, GenericEmph, GenericEmph), Pop(2)},
|
||||
{"(\\^\\^)(<[^<>\"{}|^`\\\\\\x00-\\x20]*>)", ByGroups(Operator, GenericEmph), Pop(2)},
|
||||
{`(\^\^)((?:[a-z][\w-]*)?\:)([a-z][\w-]*)`, ByGroups(Operator, GenericEmph, GenericEmph), Pop(2)},
|
||||
Default(Pop(2)),
|
||||
},
|
||||
},
|
||||
))
|
54
vendor/github.com/alecthomas/chroma/lexers/t/twig.go
generated
vendored
Normal file
54
vendor/github.com/alecthomas/chroma/lexers/t/twig.go
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
package t
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Twig lexer.
|
||||
var Twig = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "Twig",
|
||||
Aliases: []string{"twig"},
|
||||
Filenames: []string{},
|
||||
MimeTypes: []string{"application/x-twig"},
|
||||
DotAll: true,
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
{`[^{]+`, Other, nil},
|
||||
{`\{\{`, CommentPreproc, Push("var")},
|
||||
{`\{\#.*?\#\}`, Comment, nil},
|
||||
{`(\{%)(-?\s*)(raw)(\s*-?)(%\})(.*?)(\{%)(-?\s*)(endraw)(\s*-?)(%\})`, ByGroups(CommentPreproc, Text, Keyword, Text, CommentPreproc, Other, CommentPreproc, Text, Keyword, Text, CommentPreproc), nil},
|
||||
{`(\{%)(-?\s*)(verbatim)(\s*-?)(%\})(.*?)(\{%)(-?\s*)(endverbatim)(\s*-?)(%\})`, ByGroups(CommentPreproc, Text, Keyword, Text, CommentPreproc, Other, CommentPreproc, Text, Keyword, Text, CommentPreproc), nil},
|
||||
{`(\{%)(-?\s*)(filter)(\s+)((?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w-]|[^\x00-\x7f])*)`, ByGroups(CommentPreproc, Text, Keyword, Text, NameFunction), Push("tag")},
|
||||
{`(\{%)(-?\s*)([a-zA-Z_]\w*)`, ByGroups(CommentPreproc, Text, Keyword), Push("tag")},
|
||||
{`\{`, Other, nil},
|
||||
},
|
||||
"varnames": {
|
||||
{`(\|)(\s*)((?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w-]|[^\x00-\x7f])*)`, ByGroups(Operator, Text, NameFunction), nil},
|
||||
{`(is)(\s+)(not)?(\s*)((?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w-]|[^\x00-\x7f])*)`, ByGroups(Keyword, Text, Keyword, Text, NameFunction), nil},
|
||||
{`(?i)(true|false|none|null)\b`, KeywordPseudo, nil},
|
||||
{`(in|not|and|b-and|or|b-or|b-xor|isif|elseif|else|importconstant|defined|divisibleby|empty|even|iterable|odd|sameasmatches|starts\s+with|ends\s+with)\b`, Keyword, nil},
|
||||
{`(loop|block|parent)\b`, NameBuiltin, nil},
|
||||
{`(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w-]|[^\x00-\x7f])*`, NameVariable, nil},
|
||||
{`\.(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w-]|[^\x00-\x7f])*`, NameVariable, nil},
|
||||
{`\.[0-9]+`, LiteralNumber, 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"),
|
||||
},
|
||||
"tag": {
|
||||
{`\s+`, Text, nil},
|
||||
{`(-?)(%\})`, ByGroups(Text, CommentPreproc), Pop(1)},
|
||||
Include("varnames"),
|
||||
{`.`, Punctuation, nil},
|
||||
},
|
||||
},
|
||||
))
|
72
vendor/github.com/alecthomas/chroma/lexers/t/typescript.go
generated
vendored
Normal file
72
vendor/github.com/alecthomas/chroma/lexers/t/typescript.go
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
package t
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// TypeScript lexer.
|
||||
var TypeScript = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "TypeScript",
|
||||
Aliases: []string{"ts", "typescript"},
|
||||
Filenames: []string{"*.ts", "*.tsx"},
|
||||
MimeTypes: []string{"text/x-typescript"},
|
||||
DotAll: true,
|
||||
},
|
||||
Rules{
|
||||
"commentsandwhitespace": {
|
||||
{`\s+`, Text, nil},
|
||||
{`<!--`, Comment, nil},
|
||||
{`//.*?\n`, CommentSingle, nil},
|
||||
{`/\*.*?\*/`, CommentMultiline, nil},
|
||||
},
|
||||
"slashstartsregex": {
|
||||
Include("commentsandwhitespace"),
|
||||
{`/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/([gim]+\b|\B)`, LiteralStringRegex, Pop(1)},
|
||||
{`(?=/)`, Text, Push("#pop", "badregex")},
|
||||
Default(Pop(1)),
|
||||
},
|
||||
"badregex": {
|
||||
{`\n`, Text, Pop(1)},
|
||||
},
|
||||
"root": {
|
||||
{`^(?=\s|/|<!--)`, Text, Push("slashstartsregex")},
|
||||
Include("commentsandwhitespace"),
|
||||
{`\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?`, Operator, Push("slashstartsregex")},
|
||||
{`[{(\[;,]`, Punctuation, Push("slashstartsregex")},
|
||||
{`[})\].]`, Punctuation, nil},
|
||||
{`(for|in|while|do|break|return|continue|switch|case|default|if|else|throw|try|catch|finally|new|delete|typeof|instanceof|void|this)\b`, Keyword, Push("slashstartsregex")},
|
||||
{`(var|let|with|function)\b`, KeywordDeclaration, Push("slashstartsregex")},
|
||||
{`(abstract|boolean|byte|char|class|const|debugger|double|enum|export|extends|final|float|goto|implements|import|int|interface|long|native|package|private|protected|public|short|static|super|synchronized|throws|transient|volatile)\b`, KeywordReserved, nil},
|
||||
{`(true|false|null|NaN|Infinity|undefined)\b`, KeywordConstant, nil},
|
||||
{`(Array|Boolean|Date|Error|Function|Math|netscape|Number|Object|Packages|RegExp|String|sun|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|Error|eval|isFinite|isNaN|parseFloat|parseInt|document|this|window)\b`, NameBuiltin, nil},
|
||||
{`\b(module)(\s*)(\s*[\w?.$][\w?.$]*)(\s*)`, ByGroups(KeywordReserved, Text, NameOther, Text), Push("slashstartsregex")},
|
||||
{`\b(string|bool|number)\b`, KeywordType, nil},
|
||||
{`\b(constructor|declare|interface|as|AS)\b`, KeywordReserved, nil},
|
||||
{`(super)(\s*)(\([\w,?.$\s]+\s*\))`, ByGroups(KeywordReserved, Text), Push("slashstartsregex")},
|
||||
{`([a-zA-Z_?.$][\w?.$]*)\(\) \{`, NameOther, Push("slashstartsregex")},
|
||||
{`([\w?.$][\w?.$]*)(\s*:\s*)([\w?.$][\w?.$]*)`, ByGroups(NameOther, Text, KeywordType), nil},
|
||||
{`[$a-zA-Z_]\w*`, NameOther, nil},
|
||||
{`[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?`, LiteralNumberFloat, nil},
|
||||
{`0x[0-9a-fA-F]+`, LiteralNumberHex, nil},
|
||||
{`[0-9]+`, LiteralNumberInteger, nil},
|
||||
{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
|
||||
{`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil},
|
||||
{"`", LiteralStringBacktick, Push("interp")},
|
||||
{`@\w+`, KeywordDeclaration, nil},
|
||||
},
|
||||
"interp": {
|
||||
{"`", LiteralStringBacktick, Pop(1)},
|
||||
{`\\\\`, LiteralStringBacktick, nil},
|
||||
{"\\\\`", LiteralStringBacktick, nil},
|
||||
{`\$\{`, LiteralStringInterpol, Push("interp-inside")},
|
||||
{`\$`, LiteralStringBacktick, nil},
|
||||
{"[^`\\\\$]+", LiteralStringBacktick, nil},
|
||||
},
|
||||
"interp-inside": {
|
||||
{`\}`, LiteralStringInterpol, Pop(1)},
|
||||
Include("root"),
|
||||
},
|
||||
},
|
||||
))
|
125
vendor/github.com/alecthomas/chroma/lexers/t/typoscript.go
generated
vendored
Normal file
125
vendor/github.com/alecthomas/chroma/lexers/t/typoscript.go
generated
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
package t
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Typoscript lexer.
|
||||
var Typoscript = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "TypoScript",
|
||||
Aliases: []string{"typoscript"},
|
||||
Filenames: []string{"*.ts", "*.txt"},
|
||||
MimeTypes: []string{"text/x-typoscript"},
|
||||
DotAll: true,
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
Include("comment"),
|
||||
Include("constant"),
|
||||
Include("html"),
|
||||
Include("label"),
|
||||
Include("whitespace"),
|
||||
Include("keywords"),
|
||||
Include("punctuation"),
|
||||
Include("operator"),
|
||||
Include("structure"),
|
||||
Include("literal"),
|
||||
Include("other"),
|
||||
},
|
||||
"keywords": {
|
||||
{`(\[)(?i)(browser|compatVersion|dayofmonth|dayofweek|dayofyear|device|ELSE|END|GLOBAL|globalString|globalVar|hostname|hour|IP|language|loginUser|loginuser|minute|month|page|PIDinRootline|PIDupinRootline|system|treeLevel|useragent|userFunc|usergroup|version)([^\]]*)(\])`, ByGroups(LiteralStringSymbol, NameConstant, Text, LiteralStringSymbol), nil},
|
||||
{`(?=[\w\-])(HTMLparser|HTMLparser_tags|addParams|cache|encapsLines|filelink|if|imageLinkWrap|imgResource|makelinks|numRows|numberFormat|parseFunc|replacement|round|select|split|stdWrap|strPad|tableStyle|tags|textStyle|typolink)(?![\w\-])`, NameFunction, nil},
|
||||
{`(?:(=?\s*<?\s+|^\s*))(cObj|field|config|content|constants|FEData|file|frameset|includeLibs|lib|page|plugin|register|resources|sitemap|sitetitle|styles|temp|tt_[^:.\s]*|types|xmlnews|INCLUDE_TYPOSCRIPT|_CSS_DEFAULT_STYLE|_DEFAULT_PI_VARS|_LOCAL_LANG)(?![\w\-])`, ByGroups(Operator, NameBuiltin), nil},
|
||||
{`(?=[\w\-])(CASE|CLEARGIF|COA|COA_INT|COBJ_ARRAY|COLUMNS|CONTENT|CTABLE|EDITPANEL|FILE|FILES|FLUIDTEMPLATE|FORM|HMENU|HRULER|HTML|IMAGE|IMGTEXT|IMG_RESOURCE|LOAD_REGISTER|MEDIA|MULTIMEDIA|OTABLE|PAGE|QTOBJECT|RECORDS|RESTORE_REGISTER|SEARCHRESULT|SVG|SWFOBJECT|TEMPLATE|TEXT|USER|USER_INT)(?![\w\-])`, NameClass, nil},
|
||||
{`(?=[\w\-])(ACTIFSUBRO|ACTIFSUB|ACTRO|ACT|CURIFSUBRO|CURIFSUB|CURRO|CUR|IFSUBRO|IFSUB|NO|SPC|USERDEF1RO|USERDEF1|USERDEF2RO|USERDEF2|USRRO|USR)`, NameClass, nil},
|
||||
{`(?=[\w\-])(GMENU_FOLDOUT|GMENU_LAYERS|GMENU|IMGMENUITEM|IMGMENU|JSMENUITEM|JSMENU|TMENUITEM|TMENU_LAYERS|TMENU)`, NameClass, nil},
|
||||
{`(?=[\w\-])(PHP_SCRIPT(_EXT|_INT)?)`, NameClass, nil},
|
||||
{`(?=[\w\-])(userFunc)(?![\w\-])`, NameFunction, nil},
|
||||
},
|
||||
"whitespace": {
|
||||
{`\s+`, Text, nil},
|
||||
},
|
||||
"html": {
|
||||
{`<\S[^\n>]*>`, Using(TypoScriptHTMLData), nil},
|
||||
{`&[^;\n]*;`, LiteralString, nil},
|
||||
{`(_CSS_DEFAULT_STYLE)(\s*)(\()(?s)(.*(?=\n\)))`, ByGroups(NameClass, Text, LiteralStringSymbol, Using(TypoScriptCSSData)), nil},
|
||||
},
|
||||
"literal": {
|
||||
{`0x[0-9A-Fa-f]+t?`, LiteralNumberHex, nil},
|
||||
{`[0-9]+`, LiteralNumberInteger, nil},
|
||||
{`(###\w+###)`, NameConstant, nil},
|
||||
},
|
||||
"label": {
|
||||
{`(EXT|FILE|LLL):[^}\n"]*`, LiteralString, nil},
|
||||
{`(?![^\w\-])([\w\-]+(?:/[\w\-]+)+/?)(\S*\n)`, ByGroups(LiteralString, LiteralString), nil},
|
||||
},
|
||||
"punctuation": {
|
||||
{`[,.]`, Punctuation, nil},
|
||||
},
|
||||
"operator": {
|
||||
{`[<>,:=.*%+|]`, Operator, nil},
|
||||
},
|
||||
"structure": {
|
||||
{`[{}()\[\]\\]`, LiteralStringSymbol, nil},
|
||||
},
|
||||
"constant": {
|
||||
{`(\{)(\$)((?:[\w\-]+\.)*)([\w\-]+)(\})`, ByGroups(LiteralStringSymbol, Operator, NameConstant, NameConstant, LiteralStringSymbol), nil},
|
||||
{`(\{)([\w\-]+)(\s*:\s*)([\w\-]+)(\})`, ByGroups(LiteralStringSymbol, NameConstant, Operator, NameConstant, LiteralStringSymbol), nil},
|
||||
{`(#[a-fA-F0-9]{6}\b|#[a-fA-F0-9]{3}\b)`, LiteralStringChar, nil},
|
||||
},
|
||||
"comment": {
|
||||
{`(?<!(#|\'|"))(?:#(?!(?:[a-fA-F0-9]{6}|[a-fA-F0-9]{3}))[^\n#]+|//[^\n]*)`, Comment, nil},
|
||||
{`/\*(?:(?!\*/).)*\*/`, Comment, nil},
|
||||
{`(\s*#\s*\n)`, Comment, nil},
|
||||
},
|
||||
"other": {
|
||||
{`[\w"\-!/&;]+`, Text, nil},
|
||||
},
|
||||
},
|
||||
))
|
||||
|
||||
// TypoScriptCSSData lexer.
|
||||
var TypoScriptCSSData = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "TypoScriptCssData",
|
||||
Aliases: []string{"typoscriptcssdata"},
|
||||
Filenames: []string{},
|
||||
MimeTypes: []string{},
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
{`(.*)(###\w+###)(.*)`, ByGroups(LiteralString, NameConstant, LiteralString), nil},
|
||||
{`(\{)(\$)((?:[\w\-]+\.)*)([\w\-]+)(\})`, ByGroups(LiteralStringSymbol, Operator, NameConstant, NameConstant, LiteralStringSymbol), nil},
|
||||
{`(.*)(\{)([\w\-]+)(\s*:\s*)([\w\-]+)(\})(.*)`, ByGroups(LiteralString, LiteralStringSymbol, NameConstant, Operator, NameConstant, LiteralStringSymbol, LiteralString), nil},
|
||||
{`\s+`, Text, nil},
|
||||
{`/\*(?:(?!\*/).)*\*/`, Comment, nil},
|
||||
{`(?<!(#|\'|"))(?:#(?!(?:[a-fA-F0-9]{6}|[a-fA-F0-9]{3}))[^\n#]+|//[^\n]*)`, Comment, nil},
|
||||
{`[<>,:=.*%+|]`, LiteralString, nil},
|
||||
{`[\w"\-!/&;(){}]+`, LiteralString, nil},
|
||||
},
|
||||
},
|
||||
))
|
||||
|
||||
// TypoScriptHTMLData lexer.
|
||||
var TypoScriptHTMLData = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "TypoScriptHtmlData",
|
||||
Aliases: []string{"typoscripthtmldata"},
|
||||
Filenames: []string{},
|
||||
MimeTypes: []string{},
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
{`(INCLUDE_TYPOSCRIPT)`, NameClass, nil},
|
||||
{`(EXT|FILE|LLL):[^}\n"]*`, LiteralString, nil},
|
||||
{`(.*)(###\w+###)(.*)`, ByGroups(LiteralString, NameConstant, LiteralString), nil},
|
||||
{`(\{)(\$)((?:[\w\-]+\.)*)([\w\-]+)(\})`, ByGroups(LiteralStringSymbol, Operator, NameConstant, NameConstant, LiteralStringSymbol), nil},
|
||||
{`(.*)(\{)([\w\-]+)(\s*:\s*)([\w\-]+)(\})(.*)`, ByGroups(LiteralString, LiteralStringSymbol, NameConstant, Operator, NameConstant, LiteralStringSymbol, LiteralString), nil},
|
||||
{`\s+`, Text, nil},
|
||||
{`[<>,:=.*%+|]`, LiteralString, nil},
|
||||
{`[\w"\-!/&;(){}#]+`, LiteralString, nil},
|
||||
},
|
||||
},
|
||||
))
|
Reference in New Issue
Block a user