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", "formatters/html",
"lexers", "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" "styles"
] ]
revision = "v0.2.1" revision = "v0.4.0"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -26,9 +51,15 @@
revision = "487489b64fb796de2e55f4e8a4ad1e145f80e957" revision = "487489b64fb796de2e55f4e8a4ad1e145f80e957"
version = "v1.1.6" version = "v1.1.6"
[[projects]]
branch = "master"
name = "golang.org/x/sys"
packages = ["unix"]
revision = "d8e400bc7db4870d786864138af681469693d18c"
[solve-meta] [solve-meta]
analyzer-name = "dep" analyzer-name = "dep"
analyzer-version = 1 analyzer-version = 1
inputs-digest = "d000af53c3e4361e32b9cefa257a3a9e965a5b2a08fab400e6b4825e78da5919" inputs-digest = "5c4b057af89d03566fba2045c8432d4c9b1957cc3148828d596d91ce8fa7adc4"
solver-name = "gps-cdcl" solver-name = "gps-cdcl"
solver-version = 1 solver-version = 1

View File

@ -4,4 +4,8 @@
[[constraint]] [[constraint]]
name = "github.com/alecthomas/chroma" 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, "<table%s><tr>", f.styleAttr(css, chroma.LineTable))
fmt.Fprintf(w, "<td%s>\n", f.styleAttr(css, chroma.LineTableTD)) fmt.Fprintf(w, "<td%s>\n", f.styleAttr(css, chroma.LineTableTD))
fmt.Fprintf(w, "<pre%s>", f.styleAttr(css, chroma.Background)) fmt.Fprintf(w, "<pre%s>", f.styleAttr(css, chroma.Background))
for index, _ := range lines { for index := range lines {
line := f.baseLineNumber + index line := f.baseLineNumber + index
highlight, next := f.shouldHighlight(highlightIndex, line) highlight, next := f.shouldHighlight(highlightIndex, line)
if next { 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>", 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 { if highlight {
fmt.Fprintf(w, "</span>") 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 { func (f *Formatter) class(t chroma.TokenType) string {
for t != 0 { for t != 0 {
cls, ok := chroma.StandardTypes[t] if cls, ok := chroma.StandardTypes[t]; ok {
if ok { if cls != "" {
return cls return f.prefix + cls
}
return ""
} }
t = t.Parent() 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 { 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 { 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 { func (f *Formatter) WriteCSS(w io.Writer, style *chroma.Style) error {
css := f.styleToCSS(style) css := f.styleToCSS(style)
// Special-case background as it is mapped to the outer ".chroma" class. // 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 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{} tts := []int{}
for tt := range css { for tt := range css {
tts = append(tts, int(tt)) tts = append(tts, int(tt))
@ -295,7 +307,7 @@ func (f *Formatter) WriteCSS(w io.Writer, style *chroma.Style) error {
continue continue
} }
styles := css[tt] 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 return err
} }
} }
@ -318,13 +330,12 @@ func (f *Formatter) styleToCSS(style *chroma.Style) map[chroma.TokenType]string
} }
classes[chroma.Background] += f.tabWidthStyle() classes[chroma.Background] += f.tabWidthStyle()
lineNumbersStyle := "margin-right: 0.4em; padding: 0 0.4em 0 0.4em;" 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.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.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] classes[chroma.LineTableTD] = "vertical-align: top; padding: 0; margin: 0; border: 0;" + classes[chroma.LineTableTD]
return classes return classes
} }
@ -348,10 +359,11 @@ func StyleEntryToCSS(e chroma.StyleEntry) string {
// Compress CSS attributes - remove spaces, transform 6-digit colours to 3. // Compress CSS attributes - remove spaces, transform 6-digit colours to 3.
func compressStyle(s string) string { func compressStyle(s string) string {
s = strings.Replace(s, " ", "", -1)
parts := strings.Split(s, ";") parts := strings.Split(s, ";")
out := []string{} out := []string{}
for _, p := range parts { for _, p := range parts {
p = strings.Join(strings.Fields(p), " ")
p = strings.Replace(p, ": ", ":", 1)
if strings.Contains(p, "#") { if strings.Contains(p, "#") {
c := p[len(p)-6:] c := p[len(p)-6:]
if c[0] == c[1] && c[2] == c[3] && c[4] == c[5] { 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 { type TokeniseOptions struct {
// State to start tokenisation in. Defaults to "root". // State to start tokenisation in. Defaults to "root".
State string State string
// Nested tokenisation.
Nested bool
} }
// A Lexer for tokenising source code. // A Lexer for tokenising source code.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,11 +1,12 @@
package lexers package c
import ( import (
. "github.com/alecthomas/chroma" // nolint . "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
) )
// CSharp lexer. // CSharp lexer.
var CSharp = Register(MustNewLexer( var CSharp = internal.Register(MustNewLexer(
&Config{ &Config{
Name: "C#", Name: "C#",
Aliases: []string{"csharp", "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 ( import (
. "github.com/alecthomas/chroma" // nolint . "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
) )
// Cython lexer. // Cython lexer.
var Cython = Register(MustNewLexer( var Cython = internal.Register(MustNewLexer(
&Config{ &Config{
Name: "Cython", Name: "Cython",
Aliases: []string{"cython", "pyx", "pyrex"}, Aliases: []string{"cython", "pyx", "pyrex"},

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,11 +1,14 @@
package lexers package h
import ( 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. // HTML lexer.
var HTML = Register(MustNewLexer( var HTML = internal.Register(MustNewLexer(
&Config{ &Config{
Name: "HTML", Name: "HTML",
Aliases: []string{"html"}, Aliases: []string{"html"},
@ -41,11 +44,11 @@ var HTML = Register(MustNewLexer(
}, },
"script-content": { "script-content": {
{`(<)(\s*)(/)(\s*)(script)(\s*)(>)`, ByGroups(Punctuation, Text, Punctuation, Text, NameTag, Text, Punctuation), Pop(1)}, {`(<)(\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": { "style-content": {
{`(<)(\s*)(/)(\s*)(style)(\s*)(>)`, ByGroups(Punctuation, Text, Punctuation, Text, NameTag, Text, Punctuation), Pop(1)}, {`(<)(\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": { "attr": {
{`".*?"`, LiteralString, Pop(1)}, {`".*?"`, LiteralString, Pop(1)},

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,11 +1,12 @@
package lexers package j
import ( import (
. "github.com/alecthomas/chroma" // nolint . "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
) )
// Java lexer. // Java lexer.
var Java = Register(MustNewLexer( var Java = internal.Register(MustNewLexer(
&Config{ &Config{
Name: "Java", Name: "Java",
Aliases: []string{"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 ( import (
. "github.com/alecthomas/chroma" // nolint . "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
) )
// Json lexer. // Json lexer.
var Json = Register(MustNewLexer( var Json = internal.Register(MustNewLexer(
&Config{ &Config{
Name: "JSON", Name: "JSON",
Aliases: []string{"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 ( import (
. "github.com/alecthomas/chroma" // nolint . "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
) )
// Julia lexer. // Julia lexer.
var Julia = Register(MustNewLexer( var Julia = internal.Register(MustNewLexer(
&Config{ &Config{
Name: "Julia", Name: "Julia",
Aliases: []string{"julia", "jl"}, 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 ( import (
. "github.com/alecthomas/chroma" // nolint . "github.com/alecthomas/chroma" // nolint
"github.com/alecthomas/chroma/lexers/internal"
) )
// Lighttpd Configuration File lexer. // Lighttpd Configuration File lexer.
var Lighttpd = Register(MustNewLexer( var Lighttpd = internal.Register(MustNewLexer(
&Config{ &Config{
Name: "Lighttpd configuration file", Name: "Lighttpd configuration file",
Aliases: []string{"lighty", "lighttpd"}, Aliases: []string{"lighty", "lighttpd"},

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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