mirror of https://github.com/cheat/cheat.git
chore(dependencies): update dependencies
Run `make vendor-update`.
This commit is contained in:
parent
08fb9e11a9
commit
367673d5d9
6
go.mod
6
go.mod
|
@ -3,7 +3,7 @@ module github.com/cheat/cheat
|
||||||
go 1.14
|
go 1.14
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/alecthomas/chroma v0.8.1
|
github.com/alecthomas/chroma v0.8.2
|
||||||
github.com/davecgh/go-spew v1.1.1
|
github.com/davecgh/go-spew v1.1.1
|
||||||
github.com/dlclark/regexp2 v1.4.0 // indirect
|
github.com/dlclark/regexp2 v1.4.0 // indirect
|
||||||
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
|
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
|
||||||
|
@ -12,8 +12,8 @@ require (
|
||||||
github.com/mitchellh/go-homedir v1.1.0
|
github.com/mitchellh/go-homedir v1.1.0
|
||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
|
||||||
github.com/sergi/go-diff v1.1.0 // indirect
|
github.com/sergi/go-diff v1.1.0 // indirect
|
||||||
golang.org/x/sys v0.0.0-20201101102859-da207088b7d1 // indirect
|
golang.org/x/sys v0.0.0-20201126233918-771906719818 // indirect
|
||||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
|
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
|
||||||
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0
|
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0
|
||||||
gopkg.in/yaml.v2 v2.3.0
|
gopkg.in/yaml.v2 v2.4.0
|
||||||
)
|
)
|
||||||
|
|
12
go.sum
12
go.sum
|
@ -1,7 +1,7 @@
|
||||||
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U=
|
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U=
|
||||||
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI=
|
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI=
|
||||||
github.com/alecthomas/chroma v0.8.1 h1:ym20sbvyC6RXz45u4qDglcgr8E313oPROshcuCHqiEE=
|
github.com/alecthomas/chroma v0.8.2 h1:x3zkuE2lUk/RIekyAJ3XRqSCP4zwWDfcw/YJCuCAACg=
|
||||||
github.com/alecthomas/chroma v0.8.1/go.mod h1:sko8vR34/90zvl5QdcUdvzL3J8NKjAUx9va9jPuFNoM=
|
github.com/alecthomas/chroma v0.8.2/go.mod h1:sko8vR34/90zvl5QdcUdvzL3J8NKjAUx9va9jPuFNoM=
|
||||||
github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 h1:JHZL0hZKJ1VENNfmXvHbgYlbUOvpzYzvy2aZU5gXVeo=
|
github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 h1:JHZL0hZKJ1VENNfmXvHbgYlbUOvpzYzvy2aZU5gXVeo=
|
||||||
github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0=
|
github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0=
|
||||||
github.com/alecthomas/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE=
|
github.com/alecthomas/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE=
|
||||||
|
@ -53,8 +53,8 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4 h1:opSr2sbRXk5X5/givKrrKj9HXxFpW2sdCiP8MJSKLQY=
|
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4 h1:opSr2sbRXk5X5/givKrrKj9HXxFpW2sdCiP8MJSKLQY=
|
||||||
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20201101102859-da207088b7d1 h1:a/mKvvZr9Jcc8oKfcmgzyp7OwF73JPWsQLvH1z2Kxck=
|
golang.org/x/sys v0.0.0-20201126233918-771906719818 h1:f1CIuDlJhwANEC2MM87MBEVMr3jl5bifgsfj90XAF9c=
|
||||||
golang.org/x/sys v0.0.0-20201101102859-da207088b7d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201126233918-771906719818/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
@ -64,5 +64,5 @@ gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0 h1:POO/ycCATvegFmVuPpQzZFJ+p
|
||||||
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg=
|
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg=
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||||
|
|
|
@ -6,6 +6,8 @@ release:
|
||||||
brews:
|
brews:
|
||||||
-
|
-
|
||||||
install: bin.install "chroma"
|
install: bin.install "chroma"
|
||||||
|
env:
|
||||||
|
- CGO_ENABLED=0
|
||||||
builds:
|
builds:
|
||||||
- goos:
|
- goos:
|
||||||
- linux
|
- linux
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
sudo: false
|
|
||||||
language: go
|
|
||||||
go:
|
|
||||||
- "1.13.x"
|
|
||||||
script:
|
|
||||||
- go test -v ./...
|
|
||||||
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s v1.26.0
|
|
||||||
- ./bin/golangci-lint run
|
|
||||||
- git clean -fdx .
|
|
||||||
after_success:
|
|
||||||
curl -sL https://git.io/goreleaser | bash && goreleaser
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Chroma — A general purpose syntax highlighter in pure Go [![Golang Documentation](https://godoc.org/github.com/alecthomas/chroma?status.svg)](https://godoc.org/github.com/alecthomas/chroma) [![Build Status](https://travis-ci.org/alecthomas/chroma.svg)](https://travis-ci.org/alecthomas/chroma) [![Gitter chat](https://badges.gitter.im/alecthomas.svg)](https://gitter.im/alecthomas/Lobby)
|
# Chroma — A general purpose syntax highlighter in pure Go [![Golang Documentation](https://godoc.org/github.com/alecthomas/chroma?status.svg)](https://godoc.org/github.com/alecthomas/chroma) [![CircleCI](https://img.shields.io/circleci/project/github/alecthomas/chroma.svg)](https://circleci.com/gh/alecthomas/chroma) [![Go Report Card](https://goreportcard.com/badge/github.com/alecthomas/chroma)](https://goreportcard.com/report/github.com/alecthomas/chroma) [![Slack chat](https://img.shields.io/static/v1?logo=slack&style=flat&label=slack&color=green&message=gophers)](https://gophers.slack.com/messages/CN9DS8YF3)
|
||||||
|
|
||||||
> **NOTE:** As Chroma has just been released, its API is still in flux. That said, the high-level interface should not change significantly.
|
> **NOTE:** As Chroma has just been released, its API is still in flux. That said, the high-level interface should not change significantly.
|
||||||
|
|
||||||
|
@ -36,29 +36,30 @@ translators for Pygments lexers and styles.
|
||||||
Prefix | Language
|
Prefix | Language
|
||||||
:----: | --------
|
:----: | --------
|
||||||
A | ABAP, ABNF, ActionScript, ActionScript 3, Ada, Angular2, ANTLR, ApacheConf, APL, AppleScript, Arduino, Awk
|
A | ABAP, ABNF, ActionScript, ActionScript 3, Ada, Angular2, ANTLR, ApacheConf, APL, AppleScript, Arduino, Awk
|
||||||
B | Ballerina, Base Makefile, Bash, Batchfile, BlitzBasic, BNF, Brainfuck
|
B | Ballerina, Base Makefile, Bash, Batchfile, BibTeX, BlitzBasic, BNF, Brainfuck
|
||||||
C | C, C#, C++, Cap'n Proto, Cassandra CQL, Ceylon, CFEngine3, cfstatement, ChaiScript, Cheetah, Clojure, CMake, COBOL, CoffeeScript, Common Lisp, Coq, Crystal, CSS, Cython
|
C | C, C#, C++, Caddyfile, Caddyfile Directives, Cap'n Proto, Cassandra CQL, Ceylon, CFEngine3, cfstatement, ChaiScript, Cheetah, Clojure, CMake, COBOL, CoffeeScript, Common Lisp, Coq, Crystal, CSS, Cython
|
||||||
D | D, Dart, Diff, Django/Jinja, Docker, DTD
|
D | D, Dart, Diff, Django/Jinja, Docker, DTD
|
||||||
E | EBNF, Elixir, Elm, EmacsLisp, Erlang
|
E | EBNF, Elixir, Elm, EmacsLisp, Erlang
|
||||||
F | Factor, Fish, Forth, Fortran, FSharp
|
F | Factor, Fish, Forth, Fortran, FSharp
|
||||||
G | GAS, GDScript, Genshi, Genshi HTML, Genshi Text, GLSL, Gnuplot, Go, Go HTML Template, Go Text Template, GraphQL, Groovy
|
G | GAS, GDScript, Genshi, Genshi HTML, Genshi Text, Gherkin, GLSL, Gnuplot, Go, Go HTML Template, Go Text Template, GraphQL, Groovy
|
||||||
H | Handlebars, Haskell, Haxe, HCL, Hexdump, HTML, HTTP, Hy
|
H | Handlebars, Haskell, Haxe, HCL, Hexdump, HLB, HTML, HTTP, Hy
|
||||||
I | Idris, INI, Io
|
I | Idris, Igor, INI, Io
|
||||||
J | J, Java, JavaScript, JSON, Julia, Jungle
|
J | J, Java, JavaScript, JSON, Julia, Jungle
|
||||||
K | Kotlin
|
K | Kotlin
|
||||||
L | Lighttpd configuration file, LLVM, Lua
|
L | Lighttpd configuration file, LLVM, Lua
|
||||||
M | Mako, markdown, Mason, Mathematica, Matlab, MiniZinc, MLIR, Modula-2, MonkeyC, MorrowindScript, Myghty, MySQL
|
M | Mako, markdown, Mason, Mathematica, Matlab, MiniZinc, MLIR, Modula-2, MonkeyC, MorrowindScript, Myghty, MySQL
|
||||||
N | NASM, Newspeak, Nginx configuration file, Nim, Nix
|
N | NASM, Newspeak, Nginx configuration file, Nim, Nix
|
||||||
O | Objective-C, OCaml, Octave, OpenSCAD, Org Mode
|
O | Objective-C, OCaml, Octave, OpenSCAD, Org Mode
|
||||||
P | PacmanConf, Perl, PHP, Pig, PkgConfig, PL/pgSQL, plaintext, PostgreSQL SQL dialect, PostScript, POVRay, PowerShell, Prolog, Protocol Buffer, Puppet, Python, Python 3
|
P | PacmanConf, Perl, PHP, PHTML, Pig, PkgConfig, PL/pgSQL, plaintext, Pony, PostgreSQL SQL dialect, PostScript, POVRay, PowerShell, Prolog, PromQL, Protocol Buffer, Puppet, Python, Python 3
|
||||||
Q | QBasic
|
Q | QBasic
|
||||||
R | R, Racket, Ragel, react, reg, reStructuredText, Rexx, Ruby, Rust
|
R | R, Racket, Ragel, react, ReasonML, reg, reStructuredText, Rexx, Ruby, Rust
|
||||||
S | Sass, Scala, Scheme, Scilab, SCSS, Smalltalk, Smarty, SML, Snobol, Solidity, SPARQL, SQL, SquidConf, Swift, SYSTEMD, systemverilog
|
S | SAS, Sass, Scala, Scheme, Scilab, SCSS, Smalltalk, Smarty, Snobol, Solidity, SPARQL, SQL, SquidConf, Standard ML, Stylus, Swift, SYSTEMD, systemverilog
|
||||||
T | TableGen, TASM, Tcl, Tcsh, Termcap, Terminfo, Terraform, TeX, Thrift, TOML, TradingView, Transact-SQL, Turing, Turtle, Twig, TypeScript, TypoScript, TypoScriptCssData, TypoScriptHtmlData
|
T | TableGen, TASM, Tcl, Tcsh, Termcap, Terminfo, Terraform, TeX, Thrift, TOML, TradingView, Transact-SQL, Turing, Turtle, Twig, TypeScript, TypoScript, TypoScriptCssData, TypoScriptHtmlData
|
||||||
V | VB.net, verilog, VHDL, VimL, vue
|
V | VB.net, verilog, VHDL, VimL, vue
|
||||||
W | WDTE
|
W | WDTE
|
||||||
X | XML, Xorg
|
X | XML, Xorg
|
||||||
Y | YAML
|
Y | YAML, YANG
|
||||||
|
Z | Zig
|
||||||
|
|
||||||
|
|
||||||
_I will attempt to keep this section up to date, but an authoritative list can be
|
_I will attempt to keep this section up to date, but an authoritative list can be
|
||||||
|
@ -183,7 +184,7 @@ following constructor options:
|
||||||
- `ClassPrefix(prefix)` - prefix each generated CSS class.
|
- `ClassPrefix(prefix)` - prefix each generated CSS class.
|
||||||
- `TabWidth(width)` - Set the rendered tab width, in characters.
|
- `TabWidth(width)` - Set the rendered tab width, in characters.
|
||||||
- `WithLineNumbers()` - Render line numbers (style with `LineNumbers`).
|
- `WithLineNumbers()` - Render line numbers (style with `LineNumbers`).
|
||||||
- `LinkableLineNumbers()` - Make the line numbers linkable.
|
- `LinkableLineNumbers()` - Make the line numbers linkable and be a link to themselves.
|
||||||
- `HighlightLines(ranges)` - Highlight lines in these ranges (style with `LineHighlight`).
|
- `HighlightLines(ranges)` - Highlight lines in these ranges (style with `LineHighlight`).
|
||||||
- `LineNumbersInTable()` - Use a table for formatting line numbers and code, rather than spans.
|
- `LineNumbersInTable()` - Use a table for formatting line numbers and code, rather than spans.
|
||||||
|
|
||||||
|
|
|
@ -211,7 +211,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%s>%*d\n</span>", f.styleAttr(css, chroma.LineNumbersTable), f.lineIDAttribute(line), lineDigits, line)
|
fmt.Fprintf(w, "<span%s%s>%s\n</span>", f.styleAttr(css, chroma.LineNumbersTable), f.lineIDAttribute(line), f.lineTitleWithLinkIfNeeded(lineDigits, line))
|
||||||
|
|
||||||
if highlight {
|
if highlight {
|
||||||
fmt.Fprintf(w, "</span>")
|
fmt.Fprintf(w, "</span>")
|
||||||
|
@ -237,7 +237,7 @@ func (f *Formatter) writeHTML(w io.Writer, style *chroma.Style, tokens []chroma.
|
||||||
}
|
}
|
||||||
|
|
||||||
if f.lineNumbers && !wrapInTable {
|
if f.lineNumbers && !wrapInTable {
|
||||||
fmt.Fprintf(w, "<span%s%s>%*d</span>", f.styleAttr(css, chroma.LineNumbers), f.lineIDAttribute(line), lineDigits, line)
|
fmt.Fprintf(w, "<span%s%s>%s</span>", f.styleAttr(css, chroma.LineNumbers), f.lineIDAttribute(line), f.lineTitleWithLinkIfNeeded(lineDigits, line))
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, token := range tokens {
|
for _, token := range tokens {
|
||||||
|
@ -272,7 +272,19 @@ func (f *Formatter) lineIDAttribute(line int) string {
|
||||||
if !f.linkableLineNumbers {
|
if !f.linkableLineNumbers {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
return fmt.Sprintf(" id=\"%s%d\"", f.lineNumbersIDPrefix, line)
|
return fmt.Sprintf(" id=\"%s\"", f.lineID(line))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *Formatter) lineTitleWithLinkIfNeeded(lineDigits, line int) string {
|
||||||
|
title := fmt.Sprintf("%*d", lineDigits, line)
|
||||||
|
if !f.linkableLineNumbers {
|
||||||
|
return title
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("<a style=\"outline: none; text-decoration:none; color:inherit\" href=\"#%s\">%s</a>", f.lineID(line), title)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f *Formatter) lineID(line int) string {
|
||||||
|
return fmt.Sprintf("%s%d", f.lineNumbersIDPrefix, line)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *Formatter) shouldHighlight(highlightIndex, line int) (bool, bool) {
|
func (f *Formatter) shouldHighlight(highlightIndex, line int) (bool, bool) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ 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"},
|
||||||
Filenames: []string{"*.sh", "*.ksh", "*.bash", "*.ebuild", "*.eclass", "*.exheres-0", "*.exlib", "*.zsh", "*.zshrc", ".bashrc", "bashrc", ".bash_*", "bash_*", "zshrc", ".zshrc", "PKGBUILD"},
|
Filenames: []string{"*.sh", "*.ksh", "*.bash", "*.ebuild", "*.eclass", ".env", "*.env", "*.exheres-0", "*.exlib", "*.zsh", "*.zshrc", ".bashrc", "bashrc", ".bash_*", "bash_*", "zshrc", ".zshrc", "PKGBUILD"},
|
||||||
MimeTypes: []string{"application/x-sh", "application/x-shellscript"},
|
MimeTypes: []string{"application/x-sh", "application/x-shellscript"},
|
||||||
},
|
},
|
||||||
Rules{
|
Rules{
|
||||||
|
|
|
@ -60,13 +60,13 @@ var Go = internal.Register(MustNewLexer(
|
||||||
|
|
||||||
var goTemplateRules = Rules{
|
var goTemplateRules = Rules{
|
||||||
"root": {
|
"root": {
|
||||||
|
{`{{(- )?/\*(.|\n)*?\*/( -)?}}`, CommentMultiline, nil},
|
||||||
{`{{[-]?`, CommentPreproc, Push("template")},
|
{`{{[-]?`, CommentPreproc, Push("template")},
|
||||||
{`[^{]+`, Other, nil},
|
{`[^{]+`, Other, nil},
|
||||||
{`{`, Other, nil},
|
{`{`, Other, nil},
|
||||||
},
|
},
|
||||||
"template": {
|
"template": {
|
||||||
{`[-]?}}`, CommentPreproc, Pop(1)},
|
{`[-]?}}`, CommentPreproc, Pop(1)},
|
||||||
{`/\*.*?\*/`, Comment, nil},
|
|
||||||
{`(?=}})`, CommentPreproc, Pop(1)}, // Terminate the pipeline
|
{`(?=}})`, CommentPreproc, Pop(1)}, // Terminate the pipeline
|
||||||
{`\(`, Operator, Push("subexpression")},
|
{`\(`, Operator, Push("subexpression")},
|
||||||
{`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
|
{`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
|
||||||
|
@ -80,19 +80,19 @@ var goTemplateRules = Rules{
|
||||||
{`\s+`, Whitespace, nil},
|
{`\s+`, Whitespace, nil},
|
||||||
{`\(`, Operator, Push("subexpression")},
|
{`\(`, Operator, Push("subexpression")},
|
||||||
{`(range|if|else|while|with|template|end|true|false|nil|and|call|html|index|js|len|not|or|print|printf|println|urlquery|eq|ne|lt|le|gt|ge)\b`, Keyword, nil},
|
{`(range|if|else|while|with|template|end|true|false|nil|and|call|html|index|js|len|not|or|print|printf|println|urlquery|eq|ne|lt|le|gt|ge)\b`, Keyword, nil},
|
||||||
{`\||:=`, Operator, nil},
|
{`\||:?=|,`, Operator, nil},
|
||||||
{`[$]?[^\W\d]\w*`, NameOther, nil},
|
{`[$]?[^\W\d]\w*`, NameOther, nil},
|
||||||
{`[$]?\.(?:[^\W\d]\w*)?`, NameAttribute, nil},
|
{`[$]?\.(?:[^\W\d]\w*)?`, NameAttribute, nil},
|
||||||
{`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
|
{`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
|
||||||
{`\d+i`, LiteralNumber, nil},
|
{`-?\d+i`, LiteralNumber, nil},
|
||||||
{`\d+\.\d*([Ee][-+]\d+)?i`, LiteralNumber, nil},
|
{`-?\d+\.\d*([Ee][-+]\d+)?i`, LiteralNumber, nil},
|
||||||
{`\.\d+([Ee][-+]\d+)?i`, LiteralNumber, nil},
|
{`\.\d+([Ee][-+]\d+)?i`, LiteralNumber, nil},
|
||||||
{`\d+[Ee][-+]\d+i`, LiteralNumber, nil},
|
{`-?\d+[Ee][-+]\d+i`, LiteralNumber, nil},
|
||||||
{`\d+(\.\d+[eE][+\-]?\d+|\.\d*|[eE][+\-]?\d+)`, LiteralNumberFloat, nil},
|
{`-?\d+(\.\d+[eE][+\-]?\d+|\.\d*|[eE][+\-]?\d+)`, LiteralNumberFloat, nil},
|
||||||
{`\.\d+([eE][+\-]?\d+)?`, LiteralNumberFloat, nil},
|
{`-?\.\d+([eE][+\-]?\d+)?`, LiteralNumberFloat, nil},
|
||||||
{`0[0-7]+`, LiteralNumberOct, nil},
|
{`-?0[0-7]+`, LiteralNumberOct, nil},
|
||||||
{`0[xX][0-9a-fA-F]+`, LiteralNumberHex, nil},
|
{`-?0[xX][0-9a-fA-F]+`, LiteralNumberHex, nil},
|
||||||
{`(0|[1-9][0-9]*)`, LiteralNumberInteger, nil},
|
{`-?(0|[1-9][0-9]*)`, LiteralNumberInteger, nil},
|
||||||
{`'(\\['"\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|[^\\])'`, LiteralStringChar, nil},
|
{`'(\\['"\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|[^\\])'`, LiteralStringChar, nil},
|
||||||
{"`[^`]*`", LiteralString, nil},
|
{"`[^`]*`", LiteralString, nil},
|
||||||
},
|
},
|
||||||
|
|
|
@ -49,6 +49,7 @@ var JavascriptRules = Rules{
|
||||||
{"`", LiteralStringBacktick, Pop(1)},
|
{"`", LiteralStringBacktick, Pop(1)},
|
||||||
{`\\\\`, LiteralStringBacktick, nil},
|
{`\\\\`, LiteralStringBacktick, nil},
|
||||||
{"\\\\`", LiteralStringBacktick, nil},
|
{"\\\\`", LiteralStringBacktick, nil},
|
||||||
|
{"\\\\[^`\\\\]", LiteralStringBacktick, nil},
|
||||||
{`\$\{`, LiteralStringInterpol, Push("interp-inside")},
|
{`\$\{`, LiteralStringInterpol, Push("interp-inside")},
|
||||||
{`\$`, LiteralStringBacktick, nil},
|
{`\$`, LiteralStringBacktick, nil},
|
||||||
{"[^`\\\\$]+", LiteralStringBacktick, nil},
|
{"[^`\\\\$]+", LiteralStringBacktick, nil},
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
package p
|
||||||
|
|
||||||
|
import (
|
||||||
|
. "github.com/alecthomas/chroma" // nolint
|
||||||
|
"github.com/alecthomas/chroma/lexers/internal"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Promql lexer.
|
||||||
|
var Promql = internal.Register(MustNewLexer(
|
||||||
|
&Config{
|
||||||
|
Name: "PromQL",
|
||||||
|
Aliases: []string{"promql"},
|
||||||
|
Filenames: []string{"*.promql"},
|
||||||
|
MimeTypes: []string{},
|
||||||
|
},
|
||||||
|
Rules{
|
||||||
|
"root": {
|
||||||
|
{`\n`, TextWhitespace, nil},
|
||||||
|
{`\s+`, TextWhitespace, nil},
|
||||||
|
{`,`, Punctuation, nil},
|
||||||
|
{Words(``, `\b`, `bool`, `by`, `group_left`, `group_right`, `ignoring`, `offset`, `on`, `without`), Keyword, nil},
|
||||||
|
{Words(``, `\b`, `sum`, `min`, `max`, `avg`, `group`, `stddev`, `stdvar`, `count`, `count_values`, `bottomk`, `topk`, `quantile`), Keyword, nil},
|
||||||
|
{Words(``, `\b`, `abs`, `absent`, `absent_over_time`, `avg_over_time`, `ceil`, `changes`, `clamp_max`, `clamp_min`, `count_over_time`, `day_of_month`, `day_of_week`, `days_in_month`, `delta`, `deriv`, `exp`, `floor`, `histogram_quantile`, `holt_winters`, `hour`, `idelta`, `increase`, `irate`, `label_join`, `label_replace`, `ln`, `log10`, `log2`, `max_over_time`, `min_over_time`, `minute`, `month`, `predict_linear`, `quantile_over_time`, `rate`, `resets`, `round`, `scalar`, `sort`, `sort_desc`, `sqrt`, `stddev_over_time`, `stdvar_over_time`, `sum_over_time`, `time`, `timestamp`, `vector`, `year`), KeywordReserved, nil},
|
||||||
|
{`[1-9][0-9]*[smhdwy]`, LiteralString, nil},
|
||||||
|
{`-?[0-9]+\.[0-9]+`, LiteralNumberFloat, nil},
|
||||||
|
{`-?[0-9]+`, LiteralNumberInteger, nil},
|
||||||
|
{`#.*?$`, CommentSingle, nil},
|
||||||
|
{`(\+|\-|\*|\/|\%|\^)`, Operator, nil},
|
||||||
|
{`==|!=|>=|<=|<|>`, Operator, nil},
|
||||||
|
{`and|or|unless`, OperatorWord, nil},
|
||||||
|
{`[_a-zA-Z][a-zA-Z0-9_]+`, NameVariable, nil},
|
||||||
|
{`(["\'])(.*?)(["\'])`, ByGroups(Punctuation, LiteralString, Punctuation), nil},
|
||||||
|
{`\(`, Operator, Push("function")},
|
||||||
|
{`\)`, Operator, nil},
|
||||||
|
{`\{`, Punctuation, Push("labels")},
|
||||||
|
{`\[`, Punctuation, Push("range")},
|
||||||
|
},
|
||||||
|
"labels": {
|
||||||
|
{`\}`, Punctuation, Pop(1)},
|
||||||
|
{`\n`, TextWhitespace, nil},
|
||||||
|
{`\s+`, TextWhitespace, nil},
|
||||||
|
{`,`, Punctuation, nil},
|
||||||
|
{`([_a-zA-Z][a-zA-Z0-9_]*?)(\s*?)(=~|!=|=|~!)(\s*?)(")(.*?)(")`, ByGroups(NameLabel, TextWhitespace, Operator, TextWhitespace, Punctuation, LiteralString, Punctuation), nil},
|
||||||
|
},
|
||||||
|
"range": {
|
||||||
|
{`\]`, Punctuation, Pop(1)},
|
||||||
|
{`[1-9][0-9]*[smhdwy]`, LiteralString, nil},
|
||||||
|
},
|
||||||
|
"function": {
|
||||||
|
{`\)`, Operator, Pop(1)},
|
||||||
|
{`\(`, Operator, Push()},
|
||||||
|
Default(Pop(1)),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
))
|
|
@ -0,0 +1,54 @@
|
||||||
|
package lexers
|
||||||
|
|
||||||
|
import (
|
||||||
|
. "github.com/alecthomas/chroma" // nolint
|
||||||
|
"github.com/alecthomas/chroma/lexers/internal"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Qml lexer.
|
||||||
|
var Qml = internal.Register(MustNewLexer(
|
||||||
|
&Config{
|
||||||
|
Name: "QML",
|
||||||
|
Aliases: []string{"qml", "qbs"},
|
||||||
|
Filenames: []string{"*.qml", "*.qbs"},
|
||||||
|
MimeTypes: []string{"application/x-qml", "application/x-qt.qbs+qml"},
|
||||||
|
DotAll: true,
|
||||||
|
},
|
||||||
|
Rules{
|
||||||
|
"commentsandwhitespace": {
|
||||||
|
{`\s+`, Text, nil},
|
||||||
|
{`<!--`, Comment, nil},
|
||||||
|
{`//.*?\n`, CommentSingle, nil},
|
||||||
|
{`/\*.*?\*/`, CommentMultiline, nil},
|
||||||
|
},
|
||||||
|
"slashstartsregex": {
|
||||||
|
Include("commentsandwhitespace"),
|
||||||
|
{`/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/([gim]+\b|\B)`, LiteralStringRegex, Pop(1)},
|
||||||
|
{`(?=/)`, Text, Push("#pop", "badregex")},
|
||||||
|
Default(Pop(1)),
|
||||||
|
},
|
||||||
|
"badregex": {
|
||||||
|
{`\n`, Text, Pop(1)},
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
{`^(?=\s|/|<!--)`, Text, Push("slashstartsregex")},
|
||||||
|
Include("commentsandwhitespace"),
|
||||||
|
{`\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?`, Operator, Push("slashstartsregex")},
|
||||||
|
{`[{(\[;,]`, Punctuation, Push("slashstartsregex")},
|
||||||
|
{`[})\].]`, Punctuation, nil},
|
||||||
|
{`\bid\s*:\s*[A-Za-z][\w.]*`, KeywordDeclaration, Push("slashstartsregex")},
|
||||||
|
{`\b[A-Za-z][\w.]*\s*:`, Keyword, Push("slashstartsregex")},
|
||||||
|
{`(for|in|while|do|break|return|continue|switch|case|default|if|else|throw|try|catch|finally|new|delete|typeof|instanceof|void|this)\b`, Keyword, Push("slashstartsregex")},
|
||||||
|
{`(var|let|with|function)\b`, KeywordDeclaration, Push("slashstartsregex")},
|
||||||
|
{`(abstract|boolean|byte|char|class|const|debugger|double|enum|export|extends|final|float|goto|implements|import|int|interface|long|native|package|private|protected|public|short|static|super|synchronized|throws|transient|volatile)\b`, KeywordReserved, nil},
|
||||||
|
{`(true|false|null|NaN|Infinity|undefined)\b`, KeywordConstant, nil},
|
||||||
|
{`(Array|Boolean|Date|Error|Function|Math|netscape|Number|Object|Packages|RegExp|String|sun|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|Error|eval|isFinite|isNaN|parseFloat|parseInt|document|this|window)\b`, NameBuiltin, nil},
|
||||||
|
{`[$a-zA-Z_]\w*`, NameOther, nil},
|
||||||
|
{`[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?`, LiteralNumberFloat, nil},
|
||||||
|
{`0x[0-9a-fA-F]+`, LiteralNumberHex, nil},
|
||||||
|
{`[0-9]+`, LiteralNumberInteger, nil},
|
||||||
|
{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
|
||||||
|
{`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
))
|
|
@ -28,18 +28,18 @@ var Rust = internal.Register(MustNewLexer(
|
||||||
{`/\*\*(\n|[^/*])`, LiteralStringDoc, Push("doccomment")},
|
{`/\*\*(\n|[^/*])`, LiteralStringDoc, Push("doccomment")},
|
||||||
{`/\*!`, LiteralStringDoc, Push("doccomment")},
|
{`/\*!`, LiteralStringDoc, Push("doccomment")},
|
||||||
{`/\*`, CommentMultiline, Push("comment")},
|
{`/\*`, CommentMultiline, Push("comment")},
|
||||||
{`r#*"(?:\\.|[^\\\r\n;])*"#*`, LiteralString, nil},
|
{`r#*"(?:\\.|[^\\;])*"#*`, LiteralString, nil},
|
||||||
{`"(?:\\.|[^\\\r\n"])*"`, LiteralString, nil},
|
{`"(?:\\.|[^\\"])*"`, LiteralString, nil},
|
||||||
{`\$([a-zA-Z_]\w*|\(,?|\),?|,?)`, CommentPreproc, nil},
|
{`\$([a-zA-Z_]\w*|\(,?|\),?|,?)`, CommentPreproc, nil},
|
||||||
{Words(``, `\b`, `as`, `box`, `const`, `crate`, `else`, `extern`, `for`, `if`, `impl`, `in`, `loop`, `match`, `move`, `mut`, `pub`, `ref`, `return`, `static`, `super`, `trait`, `unsafe`, `use`, `where`, `while`), Keyword, nil},
|
{Words(``, `\b`, `as`, `async`, `await`, `const`, `crate`, `else`, `extern`, `for`, `if`, `impl`, `in`, `loop`, `match`, `move`, `mut`, `pub`, `ref`, `return`, `static`, `super`, `trait`, `unsafe`, `use`, `where`, `while`), Keyword, nil},
|
||||||
{Words(``, `\b`, `abstract`, `alignof`, `become`, `do`, `final`, `macro`, `offsetof`, `override`, `priv`, `proc`, `pure`, `sizeof`, `typeof`, `unsized`, `virtual`, `yield`), KeywordReserved, nil},
|
{Words(``, `\b`, `abstract`, `become`, `box`, `do`, `final`, `macro`, `override`, `priv`, `try`, `typeof`, `unsized`, `virtual`, `yield`), KeywordReserved, nil},
|
||||||
{`(true|false)\b`, KeywordConstant, nil},
|
{`(true|false)\b`, KeywordConstant, nil},
|
||||||
{`mod\b`, Keyword, Push("modname")},
|
{`mod\b`, Keyword, Push("modname")},
|
||||||
{`let\b`, KeywordDeclaration, nil},
|
{`let\b`, KeywordDeclaration, nil},
|
||||||
{`fn\b`, Keyword, Push("funcname")},
|
{`fn\b`, Keyword, Push("funcname")},
|
||||||
{`(struct|enum|type|union)\b`, Keyword, Push("typename")},
|
{`(struct|enum|type|union)\b`, Keyword, Push("typename")},
|
||||||
{`(default)(\s+)(type|fn)\b`, ByGroups(Keyword, Text, Keyword), nil},
|
{`(default)(\s+)(type|fn)\b`, ByGroups(Keyword, Text, Keyword), nil},
|
||||||
{Words(``, `\b`, `u8`, `u16`, `u32`, `u64`, `i8`, `i16`, `i32`, `i64`, `usize`, `isize`, `f32`, `f64`, `str`, `bool`), KeywordType, nil},
|
{Words(``, `\b`, `u8`, `u16`, `u32`, `u64`, `u128`, `i8`, `i16`, `i32`, `i64`, `i128`, `usize`, `isize`, `f32`, `f64`, `str`, `bool`), KeywordType, nil},
|
||||||
{`self\b`, NameBuiltinPseudo, nil},
|
{`self\b`, NameBuiltinPseudo, nil},
|
||||||
{Words(``, `\b`, `Copy`, `Send`, `Sized`, `Sync`, `Drop`, `Fn`, `FnMut`, `FnOnce`, `Box`, `ToOwned`, `Clone`, `PartialEq`, `PartialOrd`, `Eq`, `Ord`, `AsRef`, `AsMut`, `Into`, `From`, `Default`, `Iterator`, `Extend`, `IntoIterator`, `DoubleEndedIterator`, `ExactSizeIterator`, `Option`, `Some`, `None`, `Result`, `Ok`, `Err`, `SliceConcatExt`, `String`, `ToString`, `Vec`), NameBuiltin, nil},
|
{Words(``, `\b`, `Copy`, `Send`, `Sized`, `Sync`, `Drop`, `Fn`, `FnMut`, `FnOnce`, `Box`, `ToOwned`, `Clone`, `PartialEq`, `PartialOrd`, `Eq`, `Ord`, `AsRef`, `AsMut`, `Into`, `From`, `Default`, `Iterator`, `Extend`, `IntoIterator`, `DoubleEndedIterator`, `ExactSizeIterator`, `Option`, `Some`, `None`, `Result`, `Ok`, `Err`, `SliceConcatExt`, `String`, `ToString`, `Vec`), NameBuiltin, nil},
|
||||||
{`::\b`, Text, nil},
|
{`::\b`, Text, nil},
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -30,10 +30,10 @@ var Zig = internal.Register(MustNewLexer(
|
||||||
{`0x[0-9a-fA-F]+\.?[pP][\-+]?[0-9a-fA-F]+`, LiteralNumberFloat, nil},
|
{`0x[0-9a-fA-F]+\.?[pP][\-+]?[0-9a-fA-F]+`, LiteralNumberFloat, nil},
|
||||||
{`[0-9]+\.[0-9]+([eE][-+]?[0-9]+)?`, LiteralNumberFloat, nil},
|
{`[0-9]+\.[0-9]+([eE][-+]?[0-9]+)?`, LiteralNumberFloat, nil},
|
||||||
{`[0-9]+\.?[eE][-+]?[0-9]+`, LiteralNumberFloat, nil},
|
{`[0-9]+\.?[eE][-+]?[0-9]+`, LiteralNumberFloat, nil},
|
||||||
{`0b[01]+`, LiteralNumberBin, nil},
|
{`0b(?:_?[01])+`, LiteralNumberBin, nil},
|
||||||
{`0o[0-7]+`, LiteralNumberOct, nil},
|
{`0o(?:_?[0-7])+`, LiteralNumberOct, nil},
|
||||||
{`0x[0-9a-fA-F]+`, LiteralNumberHex, nil},
|
{`0x(?:_?[0-9a-fA-F])+`, LiteralNumberHex, nil},
|
||||||
{`[0-9]+`, LiteralNumberInteger, nil},
|
{`(?:_?[0-9])+`, LiteralNumberInteger, nil},
|
||||||
{`@[a-zA-Z_]\w*`, NameBuiltin, nil},
|
{`@[a-zA-Z_]\w*`, NameBuiltin, nil},
|
||||||
{`[a-zA-Z_]\w*`, Name, nil},
|
{`[a-zA-Z_]\w*`, Name, nil},
|
||||||
{`\'\\\'\'`, LiteralStringEscape, nil},
|
{`\'\\\'\'`, LiteralStringEscape, nil},
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
package styles
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/alecthomas/chroma"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Base16Snazzy style
|
||||||
|
var Base16Snazzy = Register(chroma.MustNewStyle("base16-snazzy", chroma.StyleEntries{
|
||||||
|
chroma.Comment: "#78787e",
|
||||||
|
chroma.CommentHashbang: "#78787e",
|
||||||
|
chroma.CommentMultiline: "#78787e",
|
||||||
|
chroma.CommentPreproc: "#78787e",
|
||||||
|
chroma.CommentSingle: "#78787e",
|
||||||
|
chroma.CommentSpecial: "#78787e",
|
||||||
|
chroma.Generic: "#e2e4e5",
|
||||||
|
chroma.GenericDeleted: "#ff5c57",
|
||||||
|
chroma.GenericEmph: "#e2e4e5 underline",
|
||||||
|
chroma.GenericError: "#ff5c57",
|
||||||
|
chroma.GenericHeading: "#e2e4e5 bold",
|
||||||
|
chroma.GenericInserted: "#e2e4e5 bold",
|
||||||
|
chroma.GenericOutput: "#43454f",
|
||||||
|
chroma.GenericPrompt: "#e2e4e5",
|
||||||
|
chroma.GenericStrong: "#e2e4e5 italic",
|
||||||
|
chroma.GenericSubheading: "#e2e4e5 bold",
|
||||||
|
chroma.GenericTraceback: "#e2e4e5",
|
||||||
|
chroma.GenericUnderline: "underline",
|
||||||
|
chroma.Error: "#ff5c57",
|
||||||
|
chroma.Keyword: "#ff6ac1",
|
||||||
|
chroma.KeywordConstant: "#ff6ac1",
|
||||||
|
chroma.KeywordDeclaration: "#ff5c57",
|
||||||
|
chroma.KeywordNamespace: "#ff6ac1",
|
||||||
|
chroma.KeywordPseudo: "#ff6ac1",
|
||||||
|
chroma.KeywordReserved: "#ff6ac1",
|
||||||
|
chroma.KeywordType: "#9aedfe",
|
||||||
|
chroma.Literal: "#e2e4e5",
|
||||||
|
chroma.LiteralDate: "#e2e4e5",
|
||||||
|
chroma.Name: "#e2e4e5",
|
||||||
|
chroma.NameAttribute: "#57c7ff",
|
||||||
|
chroma.NameBuiltin: "#ff5c57",
|
||||||
|
chroma.NameBuiltinPseudo: "#e2e4e5",
|
||||||
|
chroma.NameClass: "#f3f99d",
|
||||||
|
chroma.NameConstant: "#ff9f43",
|
||||||
|
chroma.NameDecorator: "#ff9f43",
|
||||||
|
chroma.NameEntity: "#e2e4e5",
|
||||||
|
chroma.NameException: "#e2e4e5",
|
||||||
|
chroma.NameFunction: "#57c7ff",
|
||||||
|
chroma.NameLabel: "#ff5c57",
|
||||||
|
chroma.NameNamespace: "#e2e4e5",
|
||||||
|
chroma.NameOther: "#e2e4e5",
|
||||||
|
chroma.NameTag: "#ff6ac1",
|
||||||
|
chroma.NameVariable: "#ff5c57",
|
||||||
|
chroma.NameVariableClass: "#ff5c57",
|
||||||
|
chroma.NameVariableGlobal: "#ff5c57",
|
||||||
|
chroma.NameVariableInstance: "#ff5c57",
|
||||||
|
chroma.LiteralNumber: "#ff9f43",
|
||||||
|
chroma.LiteralNumberBin: "#ff9f43",
|
||||||
|
chroma.LiteralNumberFloat: "#ff9f43",
|
||||||
|
chroma.LiteralNumberHex: "#ff9f43",
|
||||||
|
chroma.LiteralNumberInteger: "#ff9f43",
|
||||||
|
chroma.LiteralNumberIntegerLong: "#ff9f43",
|
||||||
|
chroma.LiteralNumberOct: "#ff9f43",
|
||||||
|
chroma.Operator: "#ff6ac1",
|
||||||
|
chroma.OperatorWord: "#ff6ac1",
|
||||||
|
chroma.Other: "#e2e4e5",
|
||||||
|
chroma.Punctuation: "#e2e4e5",
|
||||||
|
chroma.LiteralString: "#5af78e",
|
||||||
|
chroma.LiteralStringBacktick: "#5af78e",
|
||||||
|
chroma.LiteralStringChar: "#5af78e",
|
||||||
|
chroma.LiteralStringDoc: "#5af78e",
|
||||||
|
chroma.LiteralStringDouble: "#5af78e",
|
||||||
|
chroma.LiteralStringEscape: "#5af78e",
|
||||||
|
chroma.LiteralStringHeredoc: "#5af78e",
|
||||||
|
chroma.LiteralStringInterpol: "#5af78e",
|
||||||
|
chroma.LiteralStringOther: "#5af78e",
|
||||||
|
chroma.LiteralStringRegex: "#5af78e",
|
||||||
|
chroma.LiteralStringSingle: "#5af78e",
|
||||||
|
chroma.LiteralStringSymbol: "#5af78e",
|
||||||
|
chroma.Text: "#e2e4e5",
|
||||||
|
chroma.TextWhitespace: "#e2e4e5",
|
||||||
|
chroma.Background: " bg:#282a36",
|
||||||
|
}))
|
|
@ -1,8 +1,12 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
import re
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from subprocess import check_output
|
from subprocess import check_output
|
||||||
|
|
||||||
lines = check_output(["go", "run", "./cmd/chroma/main.go", "--list"]).decode('utf-8').splitlines()
|
README_FILE = "README.md"
|
||||||
|
|
||||||
|
|
||||||
|
lines = check_output(["go", "run", "./cmd/chroma/main.go", "--list"]).decode("utf-8").splitlines()
|
||||||
lines = [line.strip() for line in lines if line.startswith(" ") and not line.startswith(" ")]
|
lines = [line.strip() for line in lines if line.startswith(" ") and not line.startswith(" ")]
|
||||||
lines = sorted(lines, key=lambda l: l.lower())
|
lines = sorted(lines, key=lambda l: l.lower())
|
||||||
|
|
||||||
|
@ -11,5 +15,18 @@ table = defaultdict(list)
|
||||||
for line in lines:
|
for line in lines:
|
||||||
table[line[0].upper()].append(line)
|
table[line[0].upper()].append(line)
|
||||||
|
|
||||||
|
rows = []
|
||||||
for key, value in table.items():
|
for key, value in table.items():
|
||||||
print("{} | {}".format(key, ', '.join(value)))
|
rows.append("{} | {}".format(key, ", ".join(value)))
|
||||||
|
tbody = "\n".join(rows)
|
||||||
|
|
||||||
|
with open(README_FILE, "r") as f:
|
||||||
|
content = f.read()
|
||||||
|
|
||||||
|
with open(README_FILE, "w") as f:
|
||||||
|
marker = re.compile(r"(?P<start>:----: \\| --------\n).*?(?P<end>\n\n)", re.DOTALL)
|
||||||
|
replacement = r"\g<start>%s\g<end>" % tbody
|
||||||
|
updated_content = marker.sub(replacement, content)
|
||||||
|
f.write(updated_content)
|
||||||
|
|
||||||
|
print(tbody)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
// +build arm,darwin
|
// +build arm,darwin
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
// +build arm64,darwin
|
// +build arm64,darwin
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// +build linux
|
// +build linux
|
||||||
// +build arm64
|
// +build arm64
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// +build linux
|
// +build linux
|
||||||
// +build mips64 mips64le
|
// +build mips64 mips64le
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// +build linux
|
// +build linux
|
||||||
// +build mips mipsle
|
// +build mips mipsle
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// +build linux
|
// +build linux
|
||||||
// +build ppc64 ppc64le
|
// +build ppc64 ppc64le
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build riscv64,!gccgo
|
// +build riscv64,gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// +build s390x
|
// +build s390x
|
||||||
// +build linux
|
// +build linux
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
//
|
//
|
||||||
// +build ppc64 s390x mips mips64
|
// +build armbe arm64be m68k mips mips64 mips64p32 ppc ppc64 s390 s390x shbe sparc sparc64
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
//
|
//
|
||||||
// +build 386 amd64 amd64p32 arm arm64 ppc64le mipsle mips64le riscv64
|
// +build 386 amd64 amd64p32 alpha arm arm64 mipsle mips64le mips64p32le nios2 ppc64le riscv riscv64 sh
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
|
|
@ -225,6 +225,7 @@ struct ltchars {
|
||||||
#include <linux/kexec.h>
|
#include <linux/kexec.h>
|
||||||
#include <linux/keyctl.h>
|
#include <linux/keyctl.h>
|
||||||
#include <linux/loop.h>
|
#include <linux/loop.h>
|
||||||
|
#include <linux/lwtunnel.h>
|
||||||
#include <linux/magic.h>
|
#include <linux/magic.h>
|
||||||
#include <linux/memfd.h>
|
#include <linux/memfd.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
@ -561,6 +562,7 @@ ccflags="$@"
|
||||||
$2 ~ /^CRYPTO_/ ||
|
$2 ~ /^CRYPTO_/ ||
|
||||||
$2 ~ /^TIPC_/ ||
|
$2 ~ /^TIPC_/ ||
|
||||||
$2 ~ /^DEVLINK_/ ||
|
$2 ~ /^DEVLINK_/ ||
|
||||||
|
$2 ~ /^LWTUNNEL_IP/ ||
|
||||||
$2 !~ "WMESGLEN" &&
|
$2 !~ "WMESGLEN" &&
|
||||||
$2 ~ /^W[A-Z0-9]+$/ ||
|
$2 ~ /^W[A-Z0-9]+$/ ||
|
||||||
$2 ~/^PPPIOC/ ||
|
$2 ~/^PPPIOC/ ||
|
||||||
|
|
|
@ -105,6 +105,19 @@ func Pipe(p []int) (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//sysnb pipe2(p *[2]_C_int, flags int) (err error)
|
||||||
|
|
||||||
|
func Pipe2(p []int, flags int) error {
|
||||||
|
if len(p) != 2 {
|
||||||
|
return EINVAL
|
||||||
|
}
|
||||||
|
var pp [2]_C_int
|
||||||
|
err := pipe2(&pp, flags)
|
||||||
|
p[0] = int(pp[0])
|
||||||
|
p[1] = int(pp[1])
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
//sys extpread(fd int, p []byte, flags int, offset int64) (n int, err error)
|
//sys extpread(fd int, p []byte, flags int, offset int64) (n int, err error)
|
||||||
func Pread(fd int, p []byte, offset int64) (n int, err error) {
|
func Pread(fd int, p []byte, offset int64) (n int, err error) {
|
||||||
return extpread(fd, p, 0, offset)
|
return extpread(fd, p, 0, offset)
|
||||||
|
|
|
@ -641,6 +641,36 @@ func (sa *SockaddrCAN) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrCAN, nil
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrCAN, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SockaddrCANJ1939 implements the Sockaddr interface for AF_CAN using J1939
|
||||||
|
// protocol (https://en.wikipedia.org/wiki/SAE_J1939). For more information
|
||||||
|
// on the purposes of the fields, check the official linux kernel documentation
|
||||||
|
// available here: https://www.kernel.org/doc/Documentation/networking/j1939.rst
|
||||||
|
type SockaddrCANJ1939 struct {
|
||||||
|
Ifindex int
|
||||||
|
Name uint64
|
||||||
|
PGN uint32
|
||||||
|
Addr uint8
|
||||||
|
raw RawSockaddrCAN
|
||||||
|
}
|
||||||
|
|
||||||
|
func (sa *SockaddrCANJ1939) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||||
|
if sa.Ifindex < 0 || sa.Ifindex > 0x7fffffff {
|
||||||
|
return nil, 0, EINVAL
|
||||||
|
}
|
||||||
|
sa.raw.Family = AF_CAN
|
||||||
|
sa.raw.Ifindex = int32(sa.Ifindex)
|
||||||
|
n := (*[8]byte)(unsafe.Pointer(&sa.Name))
|
||||||
|
for i := 0; i < 8; i++ {
|
||||||
|
sa.raw.Addr[i] = n[i]
|
||||||
|
}
|
||||||
|
p := (*[4]byte)(unsafe.Pointer(&sa.PGN))
|
||||||
|
for i := 0; i < 4; i++ {
|
||||||
|
sa.raw.Addr[i+8] = p[i]
|
||||||
|
}
|
||||||
|
sa.raw.Addr[12] = sa.Addr
|
||||||
|
return unsafe.Pointer(&sa.raw), SizeofSockaddrCAN, nil
|
||||||
|
}
|
||||||
|
|
||||||
// SockaddrALG implements the Sockaddr interface for AF_ALG type sockets.
|
// SockaddrALG implements the Sockaddr interface for AF_ALG type sockets.
|
||||||
// SockaddrALG enables userspace access to the Linux kernel's cryptography
|
// SockaddrALG enables userspace access to the Linux kernel's cryptography
|
||||||
// subsystem. The Type and Name fields specify which type of hash or cipher
|
// subsystem. The Type and Name fields specify which type of hash or cipher
|
||||||
|
@ -1150,20 +1180,43 @@ func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||||
return sa, nil
|
return sa, nil
|
||||||
|
|
||||||
case AF_CAN:
|
case AF_CAN:
|
||||||
pp := (*RawSockaddrCAN)(unsafe.Pointer(rsa))
|
proto, err := GetsockoptInt(fd, SOL_SOCKET, SO_PROTOCOL)
|
||||||
sa := &SockaddrCAN{
|
if err != nil {
|
||||||
Ifindex: int(pp.Ifindex),
|
return nil, err
|
||||||
}
|
}
|
||||||
rx := (*[4]byte)(unsafe.Pointer(&sa.RxID))
|
|
||||||
for i := 0; i < 4; i++ {
|
|
||||||
rx[i] = pp.Addr[i]
|
|
||||||
}
|
|
||||||
tx := (*[4]byte)(unsafe.Pointer(&sa.TxID))
|
|
||||||
for i := 0; i < 4; i++ {
|
|
||||||
tx[i] = pp.Addr[i+4]
|
|
||||||
}
|
|
||||||
return sa, nil
|
|
||||||
|
|
||||||
|
pp := (*RawSockaddrCAN)(unsafe.Pointer(rsa))
|
||||||
|
|
||||||
|
switch proto {
|
||||||
|
case CAN_J1939:
|
||||||
|
sa := &SockaddrCANJ1939{
|
||||||
|
Ifindex: int(pp.Ifindex),
|
||||||
|
}
|
||||||
|
name := (*[8]byte)(unsafe.Pointer(&sa.Name))
|
||||||
|
for i := 0; i < 8; i++ {
|
||||||
|
name[i] = pp.Addr[i]
|
||||||
|
}
|
||||||
|
pgn := (*[4]byte)(unsafe.Pointer(&sa.PGN))
|
||||||
|
for i := 0; i < 4; i++ {
|
||||||
|
pgn[i] = pp.Addr[i+8]
|
||||||
|
}
|
||||||
|
addr := (*[1]byte)(unsafe.Pointer(&sa.Addr))
|
||||||
|
addr[0] = pp.Addr[12]
|
||||||
|
return sa, nil
|
||||||
|
default:
|
||||||
|
sa := &SockaddrCAN{
|
||||||
|
Ifindex: int(pp.Ifindex),
|
||||||
|
}
|
||||||
|
rx := (*[4]byte)(unsafe.Pointer(&sa.RxID))
|
||||||
|
for i := 0; i < 4; i++ {
|
||||||
|
rx[i] = pp.Addr[i]
|
||||||
|
}
|
||||||
|
tx := (*[4]byte)(unsafe.Pointer(&sa.TxID))
|
||||||
|
for i := 0; i < 4; i++ {
|
||||||
|
tx[i] = pp.Addr[i+4]
|
||||||
|
}
|
||||||
|
return sa, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil, EAFNOSUPPORT
|
return nil, EAFNOSUPPORT
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build amd64,linux
|
// +build amd64,linux
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build linux,!gccgo
|
// +build linux,gc
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build linux,!gccgo,386
|
// +build linux,gc,386
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build arm,!gccgo,linux
|
// +build arm,gc,linux
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
// +build !gccgo,!ppc64le,!ppc64
|
// +build gc,!ppc64le,!ppc64
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// +build linux
|
// +build linux
|
||||||
// +build ppc64le ppc64
|
// +build ppc64le ppc64
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
|
|
@ -1217,6 +1217,12 @@ const (
|
||||||
LOOP_SET_STATUS_SETTABLE_FLAGS = 0xc
|
LOOP_SET_STATUS_SETTABLE_FLAGS = 0xc
|
||||||
LO_KEY_SIZE = 0x20
|
LO_KEY_SIZE = 0x20
|
||||||
LO_NAME_SIZE = 0x40
|
LO_NAME_SIZE = 0x40
|
||||||
|
LWTUNNEL_IP6_MAX = 0x8
|
||||||
|
LWTUNNEL_IP_MAX = 0x8
|
||||||
|
LWTUNNEL_IP_OPTS_MAX = 0x3
|
||||||
|
LWTUNNEL_IP_OPT_ERSPAN_MAX = 0x4
|
||||||
|
LWTUNNEL_IP_OPT_GENEVE_MAX = 0x3
|
||||||
|
LWTUNNEL_IP_OPT_VXLAN_MAX = 0x1
|
||||||
MADV_COLD = 0x14
|
MADV_COLD = 0x14
|
||||||
MADV_DODUMP = 0x11
|
MADV_DODUMP = 0x11
|
||||||
MADV_DOFORK = 0xb
|
MADV_DOFORK = 0xb
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Code generated by the command above; see README.md. DO NOT EDIT.
|
// Code generated by the command above; see README.md. DO NOT EDIT.
|
||||||
|
|
||||||
// +build aix,ppc64
|
// +build aix,ppc64
|
||||||
// +build !gccgo
|
// +build gc
|
||||||
|
|
||||||
package unix
|
package unix
|
||||||
|
|
||||||
|
|
|
@ -362,6 +362,16 @@ func pipe() (r int, w int, err error) {
|
||||||
|
|
||||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
|
func pipe2(p *[2]_C_int, flags int) (err error) {
|
||||||
|
_, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0)
|
||||||
|
if e1 != 0 {
|
||||||
|
err = errnoErr(e1)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||||
|
|
||||||
func extpread(fd int, p []byte, flags int, offset int64) (n int, err error) {
|
func extpread(fd int, p []byte, flags int, offset int64) (n int, err error) {
|
||||||
var _p0 unsafe.Pointer
|
var _p0 unsafe.Pointer
|
||||||
if len(p) > 0 {
|
if len(p) > 0 {
|
||||||
|
|
|
@ -2981,3 +2981,21 @@ type PPSKTime struct {
|
||||||
Nsec int32
|
Nsec int32
|
||||||
Flags uint32
|
Flags uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
LWTUNNEL_ENCAP_NONE = 0x0
|
||||||
|
LWTUNNEL_ENCAP_MPLS = 0x1
|
||||||
|
LWTUNNEL_ENCAP_IP = 0x2
|
||||||
|
LWTUNNEL_ENCAP_ILA = 0x3
|
||||||
|
LWTUNNEL_ENCAP_IP6 = 0x4
|
||||||
|
LWTUNNEL_ENCAP_SEG6 = 0x5
|
||||||
|
LWTUNNEL_ENCAP_BPF = 0x6
|
||||||
|
LWTUNNEL_ENCAP_SEG6_LOCAL = 0x7
|
||||||
|
LWTUNNEL_ENCAP_RPL = 0x8
|
||||||
|
LWTUNNEL_ENCAP_MAX = 0x8
|
||||||
|
|
||||||
|
MPLS_IPTUNNEL_UNSPEC = 0x0
|
||||||
|
MPLS_IPTUNNEL_DST = 0x1
|
||||||
|
MPLS_IPTUNNEL_TTL = 0x2
|
||||||
|
MPLS_IPTUNNEL_MAX = 0x2
|
||||||
|
)
|
||||||
|
|
|
@ -11,6 +11,7 @@ go:
|
||||||
- "1.11.x"
|
- "1.11.x"
|
||||||
- "1.12.x"
|
- "1.12.x"
|
||||||
- "1.13.x"
|
- "1.13.x"
|
||||||
|
- "1.14.x"
|
||||||
- "tip"
|
- "tip"
|
||||||
|
|
||||||
go_import_path: gopkg.in/yaml.v2
|
go_import_path: gopkg.in/yaml.v2
|
||||||
|
|
|
@ -79,6 +79,8 @@ func yaml_parser_set_encoding(parser *yaml_parser_t, encoding yaml_encoding_t) {
|
||||||
parser.encoding = encoding
|
parser.encoding = encoding
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var disableLineWrapping = false
|
||||||
|
|
||||||
// Create a new emitter object.
|
// Create a new emitter object.
|
||||||
func yaml_emitter_initialize(emitter *yaml_emitter_t) {
|
func yaml_emitter_initialize(emitter *yaml_emitter_t) {
|
||||||
*emitter = yaml_emitter_t{
|
*emitter = yaml_emitter_t{
|
||||||
|
@ -86,7 +88,9 @@ func yaml_emitter_initialize(emitter *yaml_emitter_t) {
|
||||||
raw_buffer: make([]byte, 0, output_raw_buffer_size),
|
raw_buffer: make([]byte, 0, output_raw_buffer_size),
|
||||||
states: make([]yaml_emitter_state_t, 0, initial_stack_size),
|
states: make([]yaml_emitter_state_t, 0, initial_stack_size),
|
||||||
events: make([]yaml_event_t, 0, initial_queue_size),
|
events: make([]yaml_event_t, 0, initial_queue_size),
|
||||||
best_width: -1,
|
}
|
||||||
|
if disableLineWrapping {
|
||||||
|
emitter.best_width = -1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
module "gopkg.in/yaml.v2"
|
module gopkg.in/yaml.v2
|
||||||
|
|
||||||
require (
|
go 1.15
|
||||||
"gopkg.in/check.v1" v0.0.0-20161208181325-20d25e280405
|
|
||||||
)
|
require gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
|
||||||
|
|
|
@ -175,7 +175,7 @@ func unmarshal(in []byte, out interface{}, strict bool) (err error) {
|
||||||
// Zero valued structs will be omitted if all their public
|
// Zero valued structs will be omitted if all their public
|
||||||
// fields are zero, unless they implement an IsZero
|
// fields are zero, unless they implement an IsZero
|
||||||
// method (see the IsZeroer interface type), in which
|
// method (see the IsZeroer interface type), in which
|
||||||
// case the field will be included if that method returns true.
|
// case the field will be excluded if IsZero returns true.
|
||||||
//
|
//
|
||||||
// flow Marshal using a flow style (useful for structs,
|
// flow Marshal using a flow style (useful for structs,
|
||||||
// sequences and maps).
|
// sequences and maps).
|
||||||
|
@ -464,3 +464,15 @@ func isZero(v reflect.Value) bool {
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FutureLineWrap globally disables line wrapping when encoding long strings.
|
||||||
|
// This is a temporary and thus deprecated method introduced to faciliate
|
||||||
|
// migration towards v3, which offers more control of line lengths on
|
||||||
|
// individual encodings, and has a default matching the behavior introduced
|
||||||
|
// by this function.
|
||||||
|
//
|
||||||
|
// The default formatting of v2 was erroneously changed in v2.3.0 and reverted
|
||||||
|
// in v2.4.0, at which point this function was introduced to help migration.
|
||||||
|
func FutureLineWrap() {
|
||||||
|
disableLineWrapping = true
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# github.com/alecthomas/chroma v0.8.1
|
# github.com/alecthomas/chroma v0.8.2
|
||||||
## explicit
|
## explicit
|
||||||
github.com/alecthomas/chroma
|
github.com/alecthomas/chroma
|
||||||
github.com/alecthomas/chroma/formatters
|
github.com/alecthomas/chroma/formatters
|
||||||
|
@ -58,7 +58,7 @@ github.com/mitchellh/go-homedir
|
||||||
## explicit
|
## explicit
|
||||||
# github.com/sergi/go-diff v1.1.0
|
# github.com/sergi/go-diff v1.1.0
|
||||||
## explicit
|
## explicit
|
||||||
# golang.org/x/sys v0.0.0-20201101102859-da207088b7d1
|
# golang.org/x/sys v0.0.0-20201126233918-771906719818
|
||||||
## explicit
|
## explicit
|
||||||
golang.org/x/sys/internal/unsafeheader
|
golang.org/x/sys/internal/unsafeheader
|
||||||
golang.org/x/sys/unix
|
golang.org/x/sys/unix
|
||||||
|
@ -67,6 +67,6 @@ golang.org/x/sys/unix
|
||||||
# gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0
|
# gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0
|
||||||
## explicit
|
## explicit
|
||||||
gopkg.in/yaml.v1
|
gopkg.in/yaml.v1
|
||||||
# gopkg.in/yaml.v2 v2.3.0
|
# gopkg.in/yaml.v2 v2.4.0
|
||||||
## explicit
|
## explicit
|
||||||
gopkg.in/yaml.v2
|
gopkg.in/yaml.v2
|
||||||
|
|
Loading…
Reference in New Issue