Add and update dependencies

Add golang.org/x/sys/unix dependency

Update alecthomas/chroma to version 0.4.0
This commit is contained in:
Kevin Burke 2018-03-19 09:08:44 -07:00
parent e86e26c4bc
commit d9708da184
No known key found for this signature in database
GPG Key ID: 24B0EF06511BA263
390 changed files with 146678 additions and 735 deletions

35
Gopkg.lock generated
View File

@ -7,9 +7,34 @@
".",
"formatters/html",
"lexers",
"lexers/a",
"lexers/b",
"lexers/c",
"lexers/d",
"lexers/e",
"lexers/f",
"lexers/g",
"lexers/h",
"lexers/i",
"lexers/internal",
"lexers/j",
"lexers/k",
"lexers/l",
"lexers/m",
"lexers/n",
"lexers/o",
"lexers/p",
"lexers/q",
"lexers/r",
"lexers/s",
"lexers/t",
"lexers/v",
"lexers/w",
"lexers/x",
"lexers/y",
"styles"
]
revision = "v0.2.1"
revision = "v0.4.0"
[[projects]]
branch = "master"
@ -26,9 +51,15 @@
revision = "487489b64fb796de2e55f4e8a4ad1e145f80e957"
version = "v1.1.6"
[[projects]]
branch = "master"
name = "golang.org/x/sys"
packages = ["unix"]
revision = "d8e400bc7db4870d786864138af681469693d18c"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "d000af53c3e4361e32b9cefa257a3a9e965a5b2a08fab400e6b4825e78da5919"
inputs-digest = "5c4b057af89d03566fba2045c8432d4c9b1957cc3148828d596d91ce8fa7adc4"
solver-name = "gps-cdcl"
solver-version = 1

View File

@ -4,4 +4,8 @@
[[constraint]]
name = "github.com/alecthomas/chroma"
revision = "v0.2.1"
revision = "v0.4.0"
[[constraint]]
name = "golang.org/x/sys"
branch = "master"

View File

@ -159,7 +159,7 @@ func (f *Formatter) writeHTML(w io.Writer, style *chroma.Style, tokens []*chroma
fmt.Fprintf(w, "<table%s><tr>", f.styleAttr(css, chroma.LineTable))
fmt.Fprintf(w, "<td%s>\n", f.styleAttr(css, chroma.LineTableTD))
fmt.Fprintf(w, "<pre%s>", f.styleAttr(css, chroma.Background))
for index, _ := range lines {
for index := range lines {
line := f.baseLineNumber + index
highlight, next := f.shouldHighlight(highlightIndex, line)
if next {
@ -169,7 +169,7 @@ func (f *Formatter) writeHTML(w io.Writer, style *chroma.Style, tokens []*chroma
fmt.Fprintf(w, "<span%s>", f.styleAttr(css, chroma.LineHighlight))
}
fmt.Fprintf(w, "<span%s>%*d</span>", f.styleAttr(css, chroma.LineNumbersTable), lineDigits, line)
fmt.Fprintf(w, "<span%s>%*d\n</span>", f.styleAttr(css, chroma.LineNumbersTable), lineDigits, line)
if highlight {
fmt.Fprintf(w, "</span>")
@ -241,13 +241,18 @@ func (f *Formatter) shouldHighlight(highlightIndex, line int) (bool, bool) {
func (f *Formatter) class(t chroma.TokenType) string {
for t != 0 {
cls, ok := chroma.StandardTypes[t]
if ok {
return cls
if cls, ok := chroma.StandardTypes[t]; ok {
if cls != "" {
return f.prefix + cls
}
return ""
}
t = t.Parent()
}
return chroma.StandardTypes[t]
if cls := chroma.StandardTypes[t]; cls != "" {
return f.prefix + cls
}
return ""
}
func (f *Formatter) styleAttr(styles map[chroma.TokenType]string, tt chroma.TokenType) string {
@ -267,7 +272,7 @@ func (f *Formatter) styleAttr(styles map[chroma.TokenType]string, tt chroma.Toke
}
}
}
return string(fmt.Sprintf(` style="%s"`, styles[tt]))
return fmt.Sprintf(` style="%s"`, styles[tt])
}
func (f *Formatter) tabWidthStyle() string {
@ -281,9 +286,16 @@ func (f *Formatter) tabWidthStyle() string {
func (f *Formatter) WriteCSS(w io.Writer, style *chroma.Style) error {
css := f.styleToCSS(style)
// Special-case background as it is mapped to the outer ".chroma" class.
if _, err := fmt.Fprintf(w, "/* %s */ .chroma { %s }\n", chroma.Background, css[chroma.Background]); err != nil {
if _, err := fmt.Fprintf(w, "/* %s */ .%schroma { %s }\n", chroma.Background, f.prefix, css[chroma.Background]); err != nil {
return err
}
// Special-case code column of table to expand width.
if f.lineNumbers && f.lineNumbersInTable {
if _, err := fmt.Fprintf(w, "/* %s */ .%schroma .%s:last-child { width: 100%%; }",
chroma.LineTableTD, f.prefix, f.class(chroma.LineTableTD)); err != nil {
return err
}
}
tts := []int{}
for tt := range css {
tts = append(tts, int(tt))
@ -295,7 +307,7 @@ func (f *Formatter) WriteCSS(w io.Writer, style *chroma.Style) error {
continue
}
styles := css[tt]
if _, err := fmt.Fprintf(w, "/* %s */ .chroma .%s { %s }\n", tt, f.class(tt), styles); err != nil {
if _, err := fmt.Fprintf(w, "/* %s */ .%schroma .%s { %s }\n", tt, f.prefix, f.class(tt), styles); err != nil {
return err
}
}
@ -318,13 +330,12 @@ func (f *Formatter) styleToCSS(style *chroma.Style) map[chroma.TokenType]string
}
classes[chroma.Background] += f.tabWidthStyle()
lineNumbersStyle := "margin-right: 0.4em; padding: 0 0.4em 0 0.4em;"
// all rules begin with default rules followed by user provided rules
// All rules begin with default rules followed by user provided rules
classes[chroma.LineNumbers] = lineNumbersStyle + classes[chroma.LineNumbers]
classes[chroma.LineNumbersTable] = lineNumbersStyle + " display: block;" + classes[chroma.LineNumbersTable]
classes[chroma.LineNumbersTable] = lineNumbersStyle + classes[chroma.LineNumbersTable]
classes[chroma.LineHighlight] = "display: block; width: 100%;" + classes[chroma.LineHighlight]
classes[chroma.LineTable] = "border-spacing: 0; padding: 0; margin: 0; border: 0; width: 100%; overflow: auto; display: block;" + classes[chroma.LineTable]
classes[chroma.LineTable] = "border-spacing: 0; padding: 0; margin: 0; border: 0; width: auto; overflow: auto; display: block;" + classes[chroma.LineTable]
classes[chroma.LineTableTD] = "vertical-align: top; padding: 0; margin: 0; border: 0;" + classes[chroma.LineTableTD]
return classes
}
@ -348,10 +359,11 @@ func StyleEntryToCSS(e chroma.StyleEntry) string {
// Compress CSS attributes - remove spaces, transform 6-digit colours to 3.
func compressStyle(s string) string {
s = strings.Replace(s, " ", "", -1)
parts := strings.Split(s, ";")
out := []string{}
for _, p := range parts {
p = strings.Join(strings.Fields(p), " ")
p = strings.Replace(p, ": ", ":", 1)
if strings.Contains(p, "#") {
c := p[len(p)-6:]
if c[0] == c[1] && c[2] == c[3] && c[4] == c[5] {

View File

@ -75,6 +75,8 @@ func (t *Token) Clone() *Token {
type TokeniseOptions struct {
// State to start tokenisation in. Defaults to "root".
State string
// Nested tokenisation.
Nested bool
}
// A Lexer for tokenising source code.

View File

@ -1,11 +1,12 @@
package lexers
package a
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Abnf lexer.
var Abnf = Register(MustNewLexer(
var Abnf = internal.Register(MustNewLexer(
&Config{
Name: "ABNF",
Aliases: []string{"abnf"},

View File

@ -1,11 +1,12 @@
package lexers
package a
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Actionscript lexer.
var Actionscript = Register(MustNewLexer(
var Actionscript = internal.Register(MustNewLexer(
&Config{
Name: "ActionScript",
Aliases: []string{"as", "actionscript"},

View File

@ -1,11 +1,12 @@
package lexers
package a
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Actionscript 3 lexer.
var Actionscript3 = Register(MustNewLexer(
var Actionscript3 = internal.Register(MustNewLexer(
&Config{
Name: "ActionScript 3",
Aliases: []string{"as3", "actionscript3"},

View File

@ -1,11 +1,12 @@
package lexers
package a
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Ada lexer.
var Ada = Register(MustNewLexer(
var Ada = internal.Register(MustNewLexer(
&Config{
Name: "Ada",
Aliases: []string{"ada", "ada95", "ada2005"},

View File

@ -1,11 +1,12 @@
package lexers
package a
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Angular2 lexer.
var Angular2 = Register(MustNewLexer(
var Angular2 = internal.Register(MustNewLexer(
&Config{
Name: "Angular2",
Aliases: []string{"ng2"},

View File

@ -1,11 +1,12 @@
package lexers
package a
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// ANTLR lexer.
var ANTLR = Register(MustNewLexer(
var ANTLR = internal.Register(MustNewLexer(
&Config{
Name: "ANTLR",
Aliases: []string{"antlr"},

View File

@ -1,11 +1,12 @@
package lexers
package a
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Apacheconf lexer.
var Apacheconf = Register(MustNewLexer(
var Apacheconf = internal.Register(MustNewLexer(
&Config{
Name: "ApacheConf",
Aliases: []string{"apacheconf", "aconf", "apache"},

View File

@ -1,11 +1,12 @@
package lexers
package a
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Apl lexer.
var Apl = Register(MustNewLexer(
var Apl = internal.Register(MustNewLexer(
&Config{
Name: "APL",
Aliases: []string{"apl"},

View File

@ -1,11 +1,12 @@
package lexers
package a
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Applescript lexer.
var Applescript = Register(MustNewLexer(
var Applescript = internal.Register(MustNewLexer(
&Config{
Name: "AppleScript",
Aliases: []string{"applescript"},

View File

@ -1,11 +1,12 @@
package lexers
package a
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Awk lexer.
var Awk = Register(MustNewLexer(
var Awk = internal.Register(MustNewLexer(
&Config{
Name: "Awk",
Aliases: []string{"awk", "gawk", "mawk", "nawk"},

View File

@ -1,15 +1,16 @@
package lexers
package b
import (
"regexp"
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
var bashAnalyserRe = regexp.MustCompile(`(?m)^#!.*/bin/(?:env |)(?:bash|zsh|sh|ksh)`)
// Bash lexer.
var Bash = Register(MustNewLexer(
var Bash = internal.Register(MustNewLexer(
&Config{
Name: "Bash",
Aliases: []string{"bash", "sh", "ksh", "zsh", "shell"},

View File

@ -1,11 +1,12 @@
package lexers
package b
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Batchfile lexer.
var Batchfile = Register(MustNewLexer(
var Batchfile = internal.Register(MustNewLexer(
&Config{
Name: "Batchfile",
Aliases: []string{"bat", "batch", "dosbatch", "winbatch"},

View File

@ -1,11 +1,12 @@
package lexers
package b
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Blitzbasic lexer.
var Blitzbasic = Register(MustNewLexer(
var Blitzbasic = internal.Register(MustNewLexer(
&Config{
Name: "BlitzBasic",
Aliases: []string{"blitzbasic", "b3d", "bplus"},

View File

@ -1,11 +1,12 @@
package lexers
package b
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Bnf lexer.
var Bnf = Register(MustNewLexer(
var Bnf = internal.Register(MustNewLexer(
&Config{
Name: "BNF",
Aliases: []string{"bnf"},

View File

@ -1,11 +1,12 @@
package lexers
package b
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Brainfuck lexer.
var Brainfuck = Register(MustNewLexer(
var Brainfuck = internal.Register(MustNewLexer(
&Config{
Name: "Brainfuck",
Aliases: []string{"brainfuck", "bf"},

View File

@ -1,11 +1,12 @@
package lexers
package c
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// C lexer.
var C = Register(MustNewLexer(
var C = internal.Register(MustNewLexer(
&Config{
Name: "C",
Aliases: []string{"c"},

View File

@ -1,11 +1,12 @@
package lexers
package c
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Cap'N'Proto Proto lexer.
var CapNProto = Register(MustNewLexer(
var CapNProto = internal.Register(MustNewLexer(
&Config{
Name: "Cap'n Proto",
Aliases: []string{"capnp"},

View File

@ -1,11 +1,12 @@
package lexers
package c
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Ceylon lexer.
var Ceylon = Register(MustNewLexer(
var Ceylon = internal.Register(MustNewLexer(
&Config{
Name: "Ceylon",
Aliases: []string{"ceylon"},

View File

@ -1,11 +1,12 @@
package lexers
package c
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Cfengine3 lexer.
var Cfengine3 = Register(MustNewLexer(
var Cfengine3 = internal.Register(MustNewLexer(
&Config{
Name: "CFEngine3",
Aliases: []string{"cfengine3", "cf3"},

View File

@ -1,11 +1,12 @@
package lexers
package c
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Chaiscript lexer.
var Chaiscript = Register(MustNewLexer(
var Chaiscript = internal.Register(MustNewLexer(
&Config{
Name: "ChaiScript",
Aliases: []string{"chai", "chaiscript"},

View File

@ -1,11 +1,13 @@
package lexers
package c
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
. "github.com/alecthomas/chroma/lexers/p" // nolint
)
// Cheetah lexer.
var Cheetah = Register(MustNewLexer(
var Cheetah = internal.Register(MustNewLexer(
&Config{
Name: "Cheetah",
Aliases: []string{"cheetah", "spitfire"},
@ -18,9 +20,9 @@ var Cheetah = Register(MustNewLexer(
{`#[*](.|\n)*?[*]#`, Comment, nil},
{`#end[^#\n]*(?:#|$)`, CommentPreproc, nil},
{`#slurp$`, CommentPreproc, nil},
{`(#[a-zA-Z]+)([^#\n]*)(#|$)`, ByGroups(CommentPreproc, Using(Python, nil), CommentPreproc), nil},
{`(\$)([a-zA-Z_][\w.]*\w)`, ByGroups(CommentPreproc, Using(Python, nil)), nil},
{`(\$\{!?)(.*?)(\})(?s)`, ByGroups(CommentPreproc, Using(Python, nil), CommentPreproc), nil},
{`(#[a-zA-Z]+)([^#\n]*)(#|$)`, ByGroups(CommentPreproc, Using(Python), CommentPreproc), nil},
{`(\$)([a-zA-Z_][\w.]*\w)`, ByGroups(CommentPreproc, Using(Python)), nil},
{`(\$\{!?)(.*?)(\})(?s)`, ByGroups(CommentPreproc, Using(Python), CommentPreproc), nil},
{`(?sx)
(.+?) # anything, followed by:
(?:

View File

@ -1,11 +1,12 @@
package lexers
package c
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Common Lisp lexer.
var CommonLisp = Register(MustNewLexer(
var CommonLisp = internal.Register(MustNewLexer(
&Config{
Name: "Common Lisp",
Aliases: []string{"common-lisp", "cl", "lisp"},

View File

@ -1,11 +1,12 @@
package lexers
package c
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Clojure lexer.
var Clojure = Register(MustNewLexer(
var Clojure = internal.Register(MustNewLexer(
&Config{
Name: "Clojure",
Aliases: []string{"clojure", "clj"},

View File

@ -1,11 +1,12 @@
package lexers
package c
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Cmake lexer.
var Cmake = Register(MustNewLexer(
var Cmake = internal.Register(MustNewLexer(
&Config{
Name: "CMake",
Aliases: []string{"cmake"},

View File

@ -1,11 +1,12 @@
package lexers
package c
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Cobol lexer.
var Cobol = Register(MustNewLexer(
var Cobol = internal.Register(MustNewLexer(
&Config{
Name: "COBOL",
Aliases: []string{"cobol"},

View File

@ -1,11 +1,12 @@
package lexers
package c
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Coffeescript lexer.
var Coffeescript = Register(MustNewLexer(
var Coffeescript = internal.Register(MustNewLexer(
&Config{
Name: "CoffeeScript",
Aliases: []string{"coffee-script", "coffeescript", "coffee"},

View File

@ -1,11 +1,12 @@
package lexers
package c
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Cfstatement lexer.
var Cfstatement = Register(MustNewLexer(
var Cfstatement = internal.Register(MustNewLexer(
&Config{
Name: "cfstatement",
Aliases: []string{"cfs"},

View File

@ -1,11 +1,12 @@
package lexers
package c
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Coq lexer.
var Coq = Register(MustNewLexer(
var Coq = internal.Register(MustNewLexer(
&Config{
Name: "Coq",
Aliases: []string{"coq"},

View File

@ -1,16 +1,18 @@
package lexers
package c
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// CPP lexer.
var CPP = Register(MustNewLexer(
var CPP = internal.Register(MustNewLexer(
&Config{
Name: "C++",
Aliases: []string{"cpp", "c++"},
Filenames: []string{"*.cpp", "*.hpp", "*.c++", "*.h++", "*.cc", "*.hh", "*.cxx", "*.hxx", "*.C", "*.H", "*.cp", "*.CPP"},
MimeTypes: []string{"text/x-c++hdr", "text/x-c++src"},
EnsureNL: true,
},
Rules{
"statements": {

View File

@ -1,11 +1,12 @@
package lexers
package c
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Crystal lexer.
var Crystal = Register(MustNewLexer(
var Crystal = internal.Register(MustNewLexer(
&Config{
Name: "Crystal",
Aliases: []string{"cr", "crystal"},

View File

@ -1,11 +1,12 @@
package lexers
package c
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// CSharp lexer.
var CSharp = Register(MustNewLexer(
var CSharp = internal.Register(MustNewLexer(
&Config{
Name: "C#",
Aliases: []string{"csharp", "c#"},

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,12 @@
package lexers
package c
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Cython lexer.
var Cython = Register(MustNewLexer(
var Cython = internal.Register(MustNewLexer(
&Config{
Name: "Cython",
Aliases: []string{"cython", "pyx", "pyrex"},

View File

@ -1,11 +1,12 @@
package lexers
package d
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Dart lexer.
var Dart = Register(MustNewLexer(
var Dart = internal.Register(MustNewLexer(
&Config{
Name: "Dart",
Aliases: []string{"dart"},

View File

@ -1,11 +1,12 @@
package lexers
package d
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Diff lexer.
var Diff = Register(MustNewLexer(
var Diff = internal.Register(MustNewLexer(
&Config{
Name: "Diff",
Aliases: []string{"diff", "udiff"},

View File

@ -1,11 +1,12 @@
package lexers
package d
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Django/Jinja lexer.
var DjangoJinja = Register(MustNewLexer(
var DjangoJinja = internal.Register(MustNewLexer(
&Config{
Name: "Django/Jinja",
Aliases: []string{"django", "jinja"},

View File

@ -1,11 +1,13 @@
package lexers
package d
import (
. "github.com/alecthomas/chroma" // nolint
. "github.com/alecthomas/chroma/lexers/b"
"github.com/alecthomas/chroma/lexers/internal"
)
// Docker lexer.
var Docker = Register(MustNewLexer(
var Docker = internal.Register(MustNewLexer(
&Config{
Name: "Docker",
Aliases: []string{"docker", "dockerfile"},
@ -19,7 +21,7 @@ var Docker = Register(MustNewLexer(
{`^((?:FROM|MAINTAINER|CMD|EXPOSE|ENV|ADD|ENTRYPOINT|VOLUME|WORKDIR))\b(.*)`, ByGroups(Keyword, LiteralString), nil},
{`#.*`, Comment, nil},
{`RUN`, Keyword, nil},
{`(.*\\\n)*.+`, Using(Bash, nil), nil},
{`(.*\\\n)*.+`, Using(Bash), nil},
},
},
))

View File

@ -1,11 +1,12 @@
package lexers
package d
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Dtd lexer.
var Dtd = Register(MustNewLexer(
var Dtd = internal.Register(MustNewLexer(
&Config{
Name: "DTD",
Aliases: []string{"dtd"},

View File

@ -1,11 +1,12 @@
package lexers
package e
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Ebnf lexer.
var Ebnf = Register(MustNewLexer(
var Ebnf = internal.Register(MustNewLexer(
&Config{
Name: "EBNF",
Aliases: []string{"ebnf"},

View File

@ -1,11 +1,12 @@
package lexers
package e
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Elixir lexer.
var Elixir = Register(MustNewLexer(
var Elixir = internal.Register(MustNewLexer(
&Config{
Name: "Elixir",
Aliases: []string{"elixir", "ex", "exs"},

View File

@ -1,11 +1,12 @@
package lexers
package e
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Elm lexer.
var Elm = Register(MustNewLexer(
var Elm = internal.Register(MustNewLexer(
&Config{
Name: "Elm",
Aliases: []string{"elm"},

View File

@ -1,7 +1,8 @@
package lexers
package e
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
var (
@ -521,7 +522,7 @@ var (
)
// EmacsLisp lexer.
var EmacsLisp = Register(TypeRemappingLexer(MustNewLexer(
var EmacsLisp = internal.Register(TypeRemappingLexer(MustNewLexer(
&Config{
Name: "EmacsLisp",
Aliases: []string{"emacs", "elisp", "emacs-lisp"},

View File

@ -1,11 +1,12 @@
package lexers
package e
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Erlang lexer.
var Erlang = Register(MustNewLexer(
var Erlang = internal.Register(MustNewLexer(
&Config{
Name: "Erlang",
Aliases: []string{"erlang"},

View File

@ -1,11 +1,12 @@
package lexers
package f
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Factor lexer.
var Factor = Register(MustNewLexer(
var Factor = internal.Register(MustNewLexer(
&Config{
Name: "Factor",
Aliases: []string{"factor"},

View File

@ -1,11 +1,12 @@
package lexers
package f
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Fish lexer.
var Fish = Register(MustNewLexer(
var Fish = internal.Register(MustNewLexer(
&Config{
Name: "Fish",
Aliases: []string{"fish", "fishshell"},

View File

@ -1,11 +1,12 @@
package lexers
package f
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Forth lexer.
var Forth = Register(MustNewLexer(
var Forth = internal.Register(MustNewLexer(
&Config{
Name: "Forth",
Aliases: []string{"forth"},

View File

@ -1,11 +1,12 @@
package lexers
package f
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Fortran lexer.
var Fortran = Register(MustNewLexer(
var Fortran = internal.Register(MustNewLexer(
&Config{
Name: "Fortran",
Aliases: []string{"fortran"},

View File

@ -1,11 +1,12 @@
package lexers
package f
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Fsharp lexer.
var Fsharp = Register(MustNewLexer(
var Fsharp = internal.Register(MustNewLexer(
&Config{
Name: "FSharp",
Aliases: []string{"fsharp"},

View File

@ -1,11 +1,12 @@
package lexers
package g
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Gas lexer.
var Gas = Register(MustNewLexer(
var Gas = internal.Register(MustNewLexer(
&Config{
Name: "GAS",
Aliases: []string{"gas", "asm"},

View File

@ -1,11 +1,12 @@
package lexers
package g
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// GDScript lexer.
var GDScript = Register(MustNewLexer(
var GDScript = internal.Register(MustNewLexer(
&Config{
Name: "GDScript",
Aliases: []string{"gdscript", "gd"},

View File

@ -1,11 +1,13 @@
package lexers
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 = Register(MustNewLexer(
var GenshiText = internal.Register(MustNewLexer(
&Config{
Name: "Genshi Text",
Aliases: []string{"genshitext"},
@ -22,20 +24,20 @@ var GenshiText = Register(MustNewLexer(
},
"directive": {
{`\n`, Text, Pop(1)},
{`(?:def|for|if)\s+.*`, Using(Python, nil), Pop(1)},
{`(choose|when|with)([^\S\n]+)(.*)`, ByGroups(Keyword, Text, Using(Python, nil)), 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, nil), CommentPreproc), nil},
{`(?<!\$)(\$\{)(.+?)(\})`, ByGroups(CommentPreproc, Using(Python), CommentPreproc), nil},
{`(?<!\$)(\$)([a-zA-Z_][\w.]*)`, NameVariable, nil},
},
},
))
// Html+Genshi lexer.
var GenshiHTMLTemplate = Register(MustNewLexer(
var GenshiHTMLTemplate = internal.Register(MustNewLexer(
&Config{
Name: "Genshi HTML",
Aliases: []string{"html+genshi", "html+kid"},
@ -48,7 +50,7 @@ var GenshiHTMLTemplate = Register(MustNewLexer(
))
// Genshi lexer.
var Genshi = Register(MustNewLexer(
var Genshi = internal.Register(MustNewLexer(
&Config{
Name: "Genshi",
Aliases: []string{"genshi", "kid", "xml+genshi", "xml+kid"},
@ -63,7 +65,7 @@ var Genshi = Register(MustNewLexer(
var genshiMarkupRules = Rules{
"root": {
{`[^<$]+`, Other, nil},
{`(<\?python)(.*?)(\?>)`, ByGroups(CommentPreproc, Using(Python, nil), CommentPreproc), 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")},
@ -76,8 +78,8 @@ var genshiMarkupRules = Rules{
{`/?\s*>`, NameTag, Pop(1)},
},
"pyattr": {
{`(")(.*?)(")`, ByGroups(LiteralString, Using(Python, nil), LiteralString), Pop(1)},
{`(')(.*?)(')`, ByGroups(LiteralString, Using(Python, nil), LiteralString), Pop(1)},
{`(")(.*?)(")`, ByGroups(LiteralString, Using(Python), LiteralString), Pop(1)},
{`(')(.*?)(')`, ByGroups(LiteralString, Using(Python), LiteralString), Pop(1)},
{`[^\s>]+`, LiteralString, Pop(1)},
},
"tag": {
@ -106,7 +108,7 @@ var genshiMarkupRules = Rules{
Include("variable"),
},
"variable": {
{`(?<!\$)(\$\{)(.+?)(\})`, ByGroups(CommentPreproc, Using(Python, nil), CommentPreproc), nil},
{`(?<!\$)(\$\{)(.+?)(\})`, ByGroups(CommentPreproc, Using(Python), CommentPreproc), nil},
{`(?<!\$)(\$)([a-zA-Z_][\w\.]*)`, NameVariable, nil},
},
}

View File

@ -1,11 +1,12 @@
package lexers
package g
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// GLSL lexer.
var GLSL = Register(MustNewLexer(
var GLSL = internal.Register(MustNewLexer(
&Config{
Name: "GLSL",
Aliases: []string{"glsl"},

View File

@ -1,11 +1,12 @@
package lexers
package g
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Gnuplot lexer.
var Gnuplot = Register(MustNewLexer(
var Gnuplot = internal.Register(MustNewLexer(
&Config{
Name: "Gnuplot",
Aliases: []string{"gnuplot"},

View File

@ -1,13 +1,14 @@
package lexers
package g
import (
"strings"
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Go lexer.
var Go = Register(MustNewLexer(
var Go = internal.Register(MustNewLexer(
&Config{
Name: "Go",
Aliases: []string{"go", "golang"},

View File

@ -1,11 +1,12 @@
package lexers
package g
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Groovy lexer.
var Groovy = Register(MustNewLexer(
var Groovy = internal.Register(MustNewLexer(
&Config{
Name: "Groovy",
Aliases: []string{"groovy"},

View File

@ -1,11 +1,12 @@
package lexers
package h
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Handlebars lexer.
var Handlebars = Register(MustNewLexer(
var Handlebars = internal.Register(MustNewLexer(
&Config{
Name: "Handlebars",
Aliases: []string{"handlebars"},

View File

@ -1,11 +1,12 @@
package lexers
package h
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Haskell lexer.
var Haskell = Register(MustNewLexer(
var Haskell = internal.Register(MustNewLexer(
&Config{
Name: "Haskell",
Aliases: []string{"haskell", "hs"},

View File

@ -1,11 +1,12 @@
package lexers
package h
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Haxe lexer.
var Haxe = Register(MustNewLexer(
var Haxe = internal.Register(MustNewLexer(
&Config{
Name: "Haxe",
Aliases: []string{"hx", "haxe", "hxsl"},

View File

@ -1,11 +1,12 @@
package lexers
package h
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Hexdump lexer.
var Hexdump = Register(MustNewLexer(
var Hexdump = internal.Register(MustNewLexer(
&Config{
Name: "Hexdump",
Aliases: []string{"hexdump"},

View File

@ -1,11 +1,14 @@
package lexers
package h
import (
. "github.com/alecthomas/chroma" // nolint
. "github.com/alecthomas/chroma" // nolint
. "github.com/alecthomas/chroma/lexers/c" // nolint
"github.com/alecthomas/chroma/lexers/internal"
. "github.com/alecthomas/chroma/lexers/j" // nolint
)
// HTML lexer.
var HTML = Register(MustNewLexer(
var HTML = internal.Register(MustNewLexer(
&Config{
Name: "HTML",
Aliases: []string{"html"},
@ -41,11 +44,11 @@ var HTML = Register(MustNewLexer(
},
"script-content": {
{`(<)(\s*)(/)(\s*)(script)(\s*)(>)`, ByGroups(Punctuation, Text, Punctuation, Text, NameTag, Text, Punctuation), Pop(1)},
{`.+?(?=<\s*/\s*script\s*>)`, Using(Javascript, nil), nil},
{`.+?(?=<\s*/\s*script\s*>)`, Using(Javascript), nil},
},
"style-content": {
{`(<)(\s*)(/)(\s*)(style)(\s*)(>)`, ByGroups(Punctuation, Text, Punctuation, Text, NameTag, Text, Punctuation), Pop(1)},
{`.+?(?=<\s*/\s*style\s*>)`, Using(CSS, nil), nil},
{`.+?(?=<\s*/\s*style\s*>)`, Using(CSS), nil},
},
"attr": {
{`".*?"`, LiteralString, Pop(1)},

View File

@ -1,12 +1,14 @@
package lexers
package h
import (
. "github.com/alecthomas/chroma" // nolint
"strings"
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// HTTP lexer.
var HTTP = Register(httpBodyContentTypeLexer(MustNewLexer(
var HTTP = internal.Register(httpBodyContentTypeLexer(MustNewLexer(
&Config{
Name: "HTTP",
Aliases: []string{"http"},
@ -17,7 +19,7 @@ var HTTP = Register(httpBodyContentTypeLexer(MustNewLexer(
},
Rules{
"root": {
{`(GET|POST|PUT|DELETE|HEAD|OPTIONS|TRACE|PATCH)( +)([^ ]+)( +)(HTTP)(/)(1\.[01])(\r?\n|\Z)`, ByGroups(NameFunction, Text, NameNamespace, Text, KeywordReserved, Operator, LiteralNumber, Text), Push("headers")},
{`(GET|POST|PUT|DELETE|HEAD|OPTIONS|TRACE|PATCH|CONNECT)( +)([^ ]+)( +)(HTTP)(/)(1\.[01])(\r?\n|\Z)`, ByGroups(NameFunction, Text, NameNamespace, Text, KeywordReserved, Operator, LiteralNumber, Text), Push("headers")},
{`(HTTP)(/)(1\.[01])( +)(\d{3})( +)([^\r\n]+)(\r?\n|\Z)`, ByGroups(KeywordReserved, Operator, LiteralNumber, Text, LiteralNumber, Text, NameException, Text), Push("headers")},
},
"headers": {
@ -91,7 +93,7 @@ func (d *httpBodyContentTyper) Tokenise(options *TokeniseOptions, text string) (
}
case token.Type == Generic && contentType != "":
{
lexer := MatchMimeType(contentType)
lexer := internal.MatchMimeType(contentType)
// application/calendar+xml can be treated as application/xml
// if there's not a better match.
@ -99,7 +101,7 @@ func (d *httpBodyContentTyper) Tokenise(options *TokeniseOptions, text string) (
slashPos := strings.Index(contentType, "/")
plusPos := strings.LastIndex(contentType, "+")
contentType = contentType[:slashPos+1] + contentType[plusPos+1:]
lexer = MatchMimeType(contentType)
lexer = internal.MatchMimeType(contentType)
}
if lexer == nil {

View File

@ -1,11 +1,12 @@
package lexers
package h
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Hy lexer.
var Hy = Register(MustNewLexer(
var Hy = internal.Register(MustNewLexer(
&Config{
Name: "Hy",
Aliases: []string{"hylang"},

View File

@ -1,11 +1,12 @@
package lexers
package i
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Idris lexer.
var Idris = Register(MustNewLexer(
var Idris = internal.Register(MustNewLexer(
&Config{
Name: "Idris",
Aliases: []string{"idris", "idr"},

View File

@ -1,11 +1,12 @@
package lexers
package i
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Ini lexer.
var Ini = Register(MustNewLexer(
var Ini = internal.Register(MustNewLexer(
&Config{
Name: "INI",
Aliases: []string{"ini", "cfg", "dosini"},

View File

@ -1,11 +1,12 @@
package lexers
package i
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Io lexer.
var Io = Register(MustNewLexer(
var Io = internal.Register(MustNewLexer(
&Config{
Name: "Io",
Aliases: []string{"io"},

View File

@ -1,4 +1,4 @@
package lexers
package internal
import (
"path/filepath"

View File

@ -1,11 +1,12 @@
package lexers
package j
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Java lexer.
var Java = Register(MustNewLexer(
var Java = internal.Register(MustNewLexer(
&Config{
Name: "Java",
Aliases: []string{"java"},

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,12 @@
package lexers
package j
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Json lexer.
var Json = Register(MustNewLexer(
var Json = internal.Register(MustNewLexer(
&Config{
Name: "JSON",
Aliases: []string{"json"},

42
vendor/github.com/alecthomas/chroma/lexers/j/jsx.go generated vendored Normal file
View File

@ -0,0 +1,42 @@
package j
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
var JSXRules = func() Rules {
rules := JavascriptRules.Clone()
rules["jsx"] = []Rule{
{`(<)([\w_\-]+)`, ByGroups(Punctuation, NameTag), Push("tag")},
{`(<)(/)(\s*)([\w_\-]+)(\s*)(>)`, ByGroups(Punctuation, Punctuation, Text, NameTag, Text, Punctuation), nil},
}
rules["tag"] = []Rule{
{`\s+`, Text, nil},
{`([\w]+\s*)(=)(\s*)`, ByGroups(NameAttribute, Operator, Text), Push("attr")},
{`[{}]+`, Punctuation, nil},
{`[\w\.]+`, NameAttribute, nil},
{`(/?)(\s*)(>)`, ByGroups(Punctuation, Text, Punctuation), Pop(1)},
}
rules["attr"] = []Rule{
{`\s+`, Text, nil},
{`".*?"`, String, Pop(1)},
{`'.*?'`, String, Pop(1)},
{`[^\s>]+`, String, Pop(1)},
}
rules["root"] = append([]Rule{Include("jsx")}, rules["root"]...)
return rules
}()
// JSX lexer.
var JSX = internal.Register(MustNewLexer(
&Config{
Name: "JSX",
Aliases: []string{"react"},
Filenames: []string{"*.jsx", "*.react"},
MimeTypes: []string{"text/jsx", "text/typescript-jsx"},
DotAll: true,
},
JSXRules,
))

View File

@ -1,11 +1,12 @@
package lexers
package j
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Julia lexer.
var Julia = Register(MustNewLexer(
var Julia = internal.Register(MustNewLexer(
&Config{
Name: "Julia",
Aliases: []string{"julia", "jl"},

File diff suppressed because one or more lines are too long

55
vendor/github.com/alecthomas/chroma/lexers/k/kotlin.go generated vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,12 @@
package lexers
package l
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Lighttpd Configuration File lexer.
var Lighttpd = Register(MustNewLexer(
var Lighttpd = internal.Register(MustNewLexer(
&Config{
Name: "Lighttpd configuration file",
Aliases: []string{"lighty", "lighttpd"},

View File

@ -1,11 +1,12 @@
package lexers
package l
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Llvm lexer.
var Llvm = Register(MustNewLexer(
var Llvm = internal.Register(MustNewLexer(
&Config{
Name: "LLVM",
Aliases: []string{"llvm"},

View File

@ -1,11 +1,12 @@
package lexers
package l
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Lua lexer.
var Lua = Register(MustNewLexer(
var Lua = internal.Register(MustNewLexer(
&Config{
Name: "Lua",
Aliases: []string{"lua"},

58
vendor/github.com/alecthomas/chroma/lexers/lexers.go generated vendored Normal file
View File

@ -0,0 +1,58 @@
// Package lexers contains the registry of all lexers.
//
// Sub-packages contain lexer implementations.
package lexers
// nolint: golint
import (
"github.com/alecthomas/chroma"
_ "github.com/alecthomas/chroma/lexers/a"
_ "github.com/alecthomas/chroma/lexers/b"
_ "github.com/alecthomas/chroma/lexers/c"
_ "github.com/alecthomas/chroma/lexers/d"
_ "github.com/alecthomas/chroma/lexers/e"
_ "github.com/alecthomas/chroma/lexers/f"
_ "github.com/alecthomas/chroma/lexers/g"
_ "github.com/alecthomas/chroma/lexers/h"
_ "github.com/alecthomas/chroma/lexers/i"
"github.com/alecthomas/chroma/lexers/internal"
_ "github.com/alecthomas/chroma/lexers/j"
_ "github.com/alecthomas/chroma/lexers/k"
_ "github.com/alecthomas/chroma/lexers/l"
_ "github.com/alecthomas/chroma/lexers/m"
_ "github.com/alecthomas/chroma/lexers/n"
_ "github.com/alecthomas/chroma/lexers/o"
_ "github.com/alecthomas/chroma/lexers/p"
_ "github.com/alecthomas/chroma/lexers/q"
_ "github.com/alecthomas/chroma/lexers/r"
_ "github.com/alecthomas/chroma/lexers/s"
_ "github.com/alecthomas/chroma/lexers/t"
_ "github.com/alecthomas/chroma/lexers/v"
_ "github.com/alecthomas/chroma/lexers/w"
_ "github.com/alecthomas/chroma/lexers/x"
_ "github.com/alecthomas/chroma/lexers/y"
)
// Registry of Lexers.
var Registry = internal.Registry
// Names of all lexers, optionally including aliases.
func Names(withAliases bool) []string { return internal.Names(withAliases) }
// Get a Lexer by name, alias or file extension.
func Get(name string) chroma.Lexer { return internal.Get(name) }
// MatchMimeType attempts to find a lexer for the given MIME type.
func MatchMimeType(mimeType string) chroma.Lexer { return internal.MatchMimeType(mimeType) }
// Match returns the first lexer matching filename.
func Match(filename string) chroma.Lexer { return internal.Match(filename) }
// Analyse text content and return the "best" lexer..
func Analyse(text string) chroma.Lexer { return internal.Analyse(text) }
// Register a Lexer with the global registry.
func Register(lexer chroma.Lexer) chroma.Lexer { return internal.Register(lexer) }
// Fallback lexer if no other is found.
var Fallback = internal.Fallback

View File

@ -1,11 +1,13 @@
package lexers
package m
import (
. "github.com/alecthomas/chroma" // nolint
. "github.com/alecthomas/chroma" // nolint
. "github.com/alecthomas/chroma/lexers/b" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Makefile lexer.
var Makefile = Register(MustNewLexer(
var Makefile = internal.Register(MustNewLexer(
&Config{
Name: "Base Makefile",
Aliases: []string{"make", "makefile", "mf", "bsdmake"},
@ -15,13 +17,13 @@ var Makefile = Register(MustNewLexer(
},
Rules{
"root": {
{`^(?:[\t ]+.*\n|\n)+`, Using(Bash, nil), nil},
{`^(?:[\t ]+.*\n|\n)+`, Using(Bash), nil},
{`\$[<@$+%?|*]`, Keyword, nil},
{`\s+`, Text, nil},
{`#.*?\n`, Comment, nil},
{`(export)(\s+)(?=[\w${}\t -]+\n)`, ByGroups(Keyword, Text), Push("export")},
{`export\s+`, Keyword, nil},
{`([\w${}().-]+)(\s*)([!?:+]?=)([ \t]*)((?:.*\\\n)+|.*\n)`, ByGroups(NameVariable, Text, Operator, Text, Using(Bash, nil)), nil},
{`([\w${}().-]+)(\s*)([!?:+]?=)([ \t]*)((?:.*\\\n)+|.*\n)`, ByGroups(NameVariable, Text, Operator, Text, Using(Bash)), nil},
{`(?s)"(\\\\|\\.|[^"\\])*"`, LiteralStringDouble, nil},
{`(?s)'(\\\\|\\.|[^'\\])*'`, LiteralStringSingle, nil},
{`([^\n:]+)(:+)([ \t]*)`, ByGroups(NameFunction, Operator, Text), Push("block-header")},

View File

@ -1,11 +1,13 @@
package lexers
package m
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
. "github.com/alecthomas/chroma/lexers/p" // nolint
)
// Mako lexer.
var Mako = Register(MustNewLexer(
var Mako = internal.Register(MustNewLexer(
&Config{
Name: "Mako",
Aliases: []string{"mako"},
@ -15,14 +17,14 @@ var Mako = Register(MustNewLexer(
Rules{
"root": {
{`(\s*)(%)(\s*end(?:\w+))(\n|\Z)`, ByGroups(Text, CommentPreproc, Keyword, Other), nil},
{`(\s*)(%)([^\n]*)(\n|\Z)`, ByGroups(Text, CommentPreproc, Using(Python, nil), Other), nil},
{`(\s*)(%)([^\n]*)(\n|\Z)`, ByGroups(Text, CommentPreproc, Using(Python), Other), nil},
{`(\s*)(##[^\n]*)(\n|\Z)`, ByGroups(Text, CommentPreproc, Other), nil},
{`(?s)<%doc>.*?</%doc>`, CommentPreproc, nil},
{`(<%)([\w.:]+)`, ByGroups(CommentPreproc, NameBuiltin), Push("tag")},
{`(</%)([\w.:]+)(>)`, ByGroups(CommentPreproc, NameBuiltin, CommentPreproc), nil},
{`<%(?=([\w.:]+))`, CommentPreproc, Push("ondeftags")},
{`(<%(?:!?))(.*?)(%>)(?s)`, ByGroups(CommentPreproc, Using(Python, nil), CommentPreproc), nil},
{`(\$\{)(.*?)(\})`, ByGroups(CommentPreproc, Using(Python, nil), CommentPreproc), nil},
{`(<%(?:!?))(.*?)(%>)(?s)`, ByGroups(CommentPreproc, Using(Python), CommentPreproc), nil},
{`(\$\{)(.*?)(\})`, ByGroups(CommentPreproc, Using(Python), CommentPreproc), nil},
{`(?sx)
(.+?) # anything, followed by:
(?:

View File

@ -1,11 +1,12 @@
package lexers
package m
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Markdown lexer.
var Markdown = Register(MustNewLexer(
var Markdown = internal.Register(MustNewLexer(
&Config{
Name: "markdown",
Aliases: []string{"md", "mkd"},
@ -46,7 +47,7 @@ func markdownCodeBlock(groups []string, lexer Lexer) Iterator {
{Text, groups[3]},
}
code := groups[4]
lexer = Get(groups[2])
lexer = internal.Get(groups[2])
if lexer == nil {
tokens = append(tokens, &Token{String, code})
iterators = append(iterators, Literator(tokens...))

View File

@ -1,11 +1,14 @@
package lexers
package m
import (
. "github.com/alecthomas/chroma" // nolint
. "github.com/alecthomas/chroma" // nolint
. "github.com/alecthomas/chroma/lexers/h" // nolint
"github.com/alecthomas/chroma/lexers/internal"
. "github.com/alecthomas/chroma/lexers/p" // nolint
)
// Mason lexer.
var Mason = Register(MustNewLexer(
var Mason = internal.Register(MustNewLexer(
&Config{
Name: "Mason",
Aliases: []string{"mason"},
@ -18,13 +21,13 @@ var Mason = Register(MustNewLexer(
{`\s+`, Text, nil},
{`(<%doc>)(.*?)(</%doc>)(?s)`, ByGroups(NameTag, CommentMultiline, NameTag), nil},
{`(<%(?:def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)(?s)`, ByGroups(NameTag, Text, NameFunction, NameTag, UsingSelf("root"), NameTag), nil},
{`(<%\w+)(.*?)(>)(.*?)(</%\2\s*>)(?s)`, ByGroups(NameTag, NameFunction, NameTag, Using(Perl, nil), NameTag), nil},
{`(<&[^|])(.*?)(,.*?)?(&>)(?s)`, ByGroups(NameTag, NameFunction, Using(Perl, nil), NameTag), nil},
{`(<&\|)(.*?)(,.*?)?(&>)(?s)`, ByGroups(NameTag, NameFunction, Using(Perl, nil), NameTag), nil},
{`(<%\w+)(.*?)(>)(.*?)(</%\2\s*>)(?s)`, ByGroups(NameTag, NameFunction, NameTag, Using(Perl), NameTag), nil},
{`(<&[^|])(.*?)(,.*?)?(&>)(?s)`, ByGroups(NameTag, NameFunction, Using(Perl), NameTag), nil},
{`(<&\|)(.*?)(,.*?)?(&>)(?s)`, ByGroups(NameTag, NameFunction, Using(Perl), NameTag), nil},
{`</&>`, NameTag, nil},
{`(<%!?)(.*?)(%>)(?s)`, ByGroups(NameTag, Using(Perl, nil), NameTag), nil},
{`(<%!?)(.*?)(%>)(?s)`, ByGroups(NameTag, Using(Perl), NameTag), nil},
{`(?<=^)#[^\n]*(\n|\Z)`, Comment, nil},
{`(?<=^)(%)([^\n]*)(\n|\Z)`, ByGroups(NameTag, Using(Perl, nil), Other), nil},
{`(?<=^)(%)([^\n]*)(\n|\Z)`, ByGroups(NameTag, Using(Perl), Other), nil},
{`(?sx)
(.+?) # anything, followed by:
(?:
@ -34,7 +37,7 @@ var Mason = Register(MustNewLexer(
# - don't consume
(\\\n) | # an escaped newline
\Z # end of string
)`, ByGroups(Using(HTML, nil), Operator), nil},
)`, ByGroups(Using(HTML), Operator), nil},
},
},
))

View File

@ -1,11 +1,12 @@
package lexers
package m
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Mathematica lexer.
var Mathematica = Register(MustNewLexer(
var Mathematica = internal.Register(MustNewLexer(
&Config{
Name: "Mathematica",
Aliases: []string{"mathematica", "mma", "nb"},

View File

@ -1,11 +1,12 @@
package lexers
package m
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// MiniZinc lexer.
var MZN = Register(MustNewLexer(
var MZN = internal.Register(MustNewLexer(
&Config{
Name: "MiniZinc",
Aliases: []string{"minizinc", "MZN", "mzn"},

View File

@ -1,11 +1,12 @@
package lexers
package m
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Modula-2 lexer.
var Modula2 = Register(MustNewLexer(
var Modula2 = internal.Register(MustNewLexer(
&Config{
Name: "Modula-2",
Aliases: []string{"modula2", "m2"},

View File

@ -1,11 +1,12 @@
package lexers
package m
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// MorrowindScript lexer.
var MorrowindScript = Register(MustNewLexer(
var MorrowindScript = internal.Register(MustNewLexer(
&Config{
Name: "MorrowindScript",
Aliases: []string{"morrowind", "mwscript"},

View File

@ -1,11 +1,13 @@
package lexers
package m
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
. "github.com/alecthomas/chroma/lexers/p" // nolint
)
// Myghty lexer.
var Myghty = Register(MustNewLexer(
var Myghty = internal.Register(MustNewLexer(
&Config{
Name: "Myghty",
Aliases: []string{"myghty"},
@ -16,13 +18,13 @@ var Myghty = Register(MustNewLexer(
"root": {
{`\s+`, Text, nil},
{`(<%(?:def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)(?s)`, ByGroups(NameTag, Text, NameFunction, NameTag, UsingSelf("root"), NameTag), nil},
{`(<%\w+)(.*?)(>)(.*?)(</%\2\s*>)(?s)`, ByGroups(NameTag, NameFunction, NameTag, Using(Python, nil), NameTag), nil},
{`(<&[^|])(.*?)(,.*?)?(&>)`, ByGroups(NameTag, NameFunction, Using(Python, nil), NameTag), nil},
{`(<&\|)(.*?)(,.*?)?(&>)(?s)`, ByGroups(NameTag, NameFunction, Using(Python, nil), NameTag), nil},
{`(<%\w+)(.*?)(>)(.*?)(</%\2\s*>)(?s)`, ByGroups(NameTag, NameFunction, NameTag, Using(Python), NameTag), nil},
{`(<&[^|])(.*?)(,.*?)?(&>)`, ByGroups(NameTag, NameFunction, Using(Python), NameTag), nil},
{`(<&\|)(.*?)(,.*?)?(&>)(?s)`, ByGroups(NameTag, NameFunction, Using(Python), NameTag), nil},
{`</&>`, NameTag, nil},
{`(<%!?)(.*?)(%>)(?s)`, ByGroups(NameTag, Using(Python, nil), NameTag), nil},
{`(<%!?)(.*?)(%>)(?s)`, ByGroups(NameTag, Using(Python), NameTag), nil},
{`(?<=^)#[^\n]*(\n|\Z)`, Comment, nil},
{`(?<=^)(%)([^\n]*)(\n|\Z)`, ByGroups(NameTag, Using(Python, nil), Other), nil},
{`(?<=^)(%)([^\n]*)(\n|\Z)`, ByGroups(NameTag, Using(Python), Other), nil},
{`(?sx)
(.+?) # anything, followed by:
(?:

View File

@ -1,11 +1,12 @@
package lexers
package m
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// MySQL lexer.
var MySQL = Register(MustNewLexer(
var MySQL = internal.Register(MustNewLexer(
&Config{
Name: "MySQL",
Aliases: []string{"mysql"},

View File

@ -1,11 +1,12 @@
package lexers
package n
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Nasm lexer.
var Nasm = Register(MustNewLexer(
var Nasm = internal.Register(MustNewLexer(
&Config{
Name: "NASM",
Aliases: []string{"nasm"},

View File

@ -1,11 +1,12 @@
package lexers
package n
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Newspeak lexer.
var Newspeak = Register(MustNewLexer(
var Newspeak = internal.Register(MustNewLexer(
&Config{
Name: "Newspeak",
Aliases: []string{"newspeak"},

View File

@ -1,11 +1,12 @@
package lexers
package n
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Nginx Configuration File lexer.
var Nginx = Register(MustNewLexer(
var Nginx = internal.Register(MustNewLexer(
&Config{
Name: "Nginx configuration file",
Aliases: []string{"nginx"},

View File

@ -1,11 +1,12 @@
package lexers
package n
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Nim lexer.
var Nim = Register(MustNewLexer(
var Nim = internal.Register(MustNewLexer(
&Config{
Name: "Nim",
Aliases: []string{"nim", "nimrod"},

View File

@ -1,16 +1,17 @@
package lexers
package n
import (
"strings"
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// nixb matches right boundary of a nix word. Use it instead of \b.
const nixb = `(?![a-zA-Z0-9_'-])`
// Nix lexer.
var Nix = Register(MustNewLexer(
var Nix = internal.Register(MustNewLexer(
&Config{
Name: "Nix",
Aliases: []string{"nixos", "nix"},

View File

@ -1,11 +1,12 @@
package lexers
package o
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Objective-C lexer.
var ObjectiveC = Register(MustNewLexer(
var ObjectiveC = internal.Register(MustNewLexer(
&Config{
Name: "Objective-C",
Aliases: []string{"objective-c", "objectivec", "obj-c", "objc"},

View File

@ -1,11 +1,12 @@
package lexers
package o
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Ocaml lexer.
var Ocaml = Register(MustNewLexer(
var Ocaml = internal.Register(MustNewLexer(
&Config{
Name: "OCaml",
Aliases: []string{"ocaml"},

View File

@ -1,11 +1,12 @@
package lexers
package o
import (
. "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
)
// Octave lexer.
var Octave = Register(MustNewLexer(
var Octave = internal.Register(MustNewLexer(
&Config{
Name: "Octave",
Aliases: []string{"octave"},

Some files were not shown because too many files have changed in this diff Show More