mirror of
https://github.com/cheat/cheat.git
synced 2024-12-21 12:15:06 +01:00
v3.3.0 (#525)
* feat: directory-scoped cheatpaths `cheat` now searches for a `.cheat` directory in the current working directory. If found, that directory is (temporarily) appended to the slice of cheatpaths. * makefile wip * fix: appeases linter Appeases linter (`go vet`) by adding quotation marks to YAML struct tags. * chore: modifies .gitignore Adds `tag` to `.gitignore` * feat: adds Makefile Adds a `Makefile` for managing build-related tasks. * chore: documents directory-local paths Adds documentation regarding the new directory-local cheatpath functionality. * chore: updates dependencies * chore: bumps version to 3.3.0 * chore: updates bin scripts - Removes `build_release.sh` - Places deprecation notice in `build_devel.sh`, as its purpose has been superceded by the `Makefile`.
This commit is contained in:
parent
815e714fb4
commit
91f0d02de2
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
dist
|
||||
tags
|
||||
|
133
Makefile
Normal file
133
Makefile
Normal file
@ -0,0 +1,133 @@
|
||||
# paths
|
||||
makefile := $(realpath $(lastword $(MAKEFILE_LIST)))
|
||||
root_dir := $(shell dirname $(makefile))
|
||||
cmd_dir := $(root_dir)/cmd/cheat
|
||||
dist_dir := $(root_dir)/dist
|
||||
|
||||
# executables
|
||||
CAT := cat
|
||||
COLUMN := column
|
||||
CTAGS := ctags
|
||||
GO := go
|
||||
GREP := grep
|
||||
LINT := revive
|
||||
MKDIR := mkdir -p
|
||||
RM := rm
|
||||
SCC := scc
|
||||
SED := sed
|
||||
SORT := sort
|
||||
|
||||
# build flags
|
||||
BUILD_FLAGS := -ldflags="-s -w" -mod vendor
|
||||
GOBIN :=
|
||||
|
||||
# NB: this is a kludge to specify the desired build targets. This information
|
||||
# would "naturally" be best structured as an array of structs, but lacking that
|
||||
# capability, we're condensing that information into strings which we will
|
||||
# later split.
|
||||
#
|
||||
# Format: <architecture>/<os>/<arm-version>/<executable-name>
|
||||
.PHONY: $(RELEASES)
|
||||
RELEASES := \
|
||||
amd64/darwin/0/cheat-darwin-amd64 \
|
||||
amd64/linux/0/cheat-linux-amd64 \
|
||||
amd64/windows/0/cheat-windows-amd64.exe \
|
||||
arm/linux/5/cheat-linux-arm5 \
|
||||
arm/linux/6/cheat-linux-arm6 \
|
||||
arm/linux/7/cheat-linux-arm7
|
||||
|
||||
# macros to unpack the above
|
||||
parts = $(subst /, ,$@)
|
||||
arch = $(word 1, $(parts))
|
||||
os = $(word 2, $(parts))
|
||||
arm = $(word 3, $(parts))
|
||||
bin = $(word 4, $(parts))
|
||||
|
||||
|
||||
## build: builds an executable for your architecture
|
||||
.PHONY: build
|
||||
build: clean generate
|
||||
$(GO) build $(BUILD_FLAGS) -o $(dist_dir)/cheat $(cmd_dir)
|
||||
|
||||
## build-release: builds release executables
|
||||
.PHONY: build-release
|
||||
build-release: $(RELEASES)
|
||||
|
||||
.PHONY: generate
|
||||
generate:
|
||||
$(GO) generate $(cmd_dir)
|
||||
|
||||
.PHONY: $(RELEASES)
|
||||
$(RELEASES): clean generate check
|
||||
ifeq ($(arch),arm)
|
||||
GOARCH=$(arch) GOOS=$(os) GOARM=$(arm) $(GO) build $(BUILD_FLAGS) -o $(dist_dir)/$(bin) $(cmd_dir)
|
||||
else
|
||||
GOARCH=$(arch) GOOS=$(os) $(GO) build $(BUILD_FLAGS) -o $(dist_dir)/$(bin) $(cmd_dir)
|
||||
endif
|
||||
|
||||
## install: builds and installs cheat on your PATH
|
||||
.PHONY: install
|
||||
install:
|
||||
$(GO) install $(BUILD_FLAGS) $(GOBIN) $(cmd_dir)
|
||||
|
||||
$(dist_dir):
|
||||
$(MKDIR) $(dist_dir)
|
||||
|
||||
## clean: removes compiled executables
|
||||
.PHONY: clean
|
||||
clean: $(dist_dir)
|
||||
$(RM) -f $(dist_dir)/*
|
||||
|
||||
## distclean: removes the tags file
|
||||
.PHONY: distclean
|
||||
distclean:
|
||||
$(RM) $(root_dir)/tags
|
||||
|
||||
## setup: installs revive (linter) and scc (sloc tool)
|
||||
.PHONY: setup
|
||||
setup:
|
||||
GO111MODULE=off $(GO) get -u github.com/boyter/scc github.com/mgechev/revive
|
||||
|
||||
## sloc: counts "semantic lines of code"
|
||||
.PHONY: sloc
|
||||
sloc:
|
||||
$(SCC) --exclude-dir=vendor
|
||||
|
||||
## tags: builds a tags file
|
||||
.PHONY: tags
|
||||
tags:
|
||||
$(CTAGS) -R $(root_dir) --exclude=$(root_dir)/vendor
|
||||
|
||||
## vendor: downloads, tidies, and verifies dependencies
|
||||
.PHONY: vendor
|
||||
vendor: lint # kludge: revive appears to complain if the vendor directory disappears while a lint is running
|
||||
$(GO) mod vendor && $(GO) mod tidy && $(GO) mod verify
|
||||
|
||||
## fmt: runs go fmt
|
||||
.PHONY: fmt
|
||||
fmt:
|
||||
$(GO) fmt $(root_dir)/...
|
||||
|
||||
## lint: lints go source files
|
||||
.PHONY: lint
|
||||
lint:
|
||||
$(LINT) -exclude $(root_dir)/vendor/... $(root_dir)/...
|
||||
$(GO) vet $(root_dir)/...
|
||||
|
||||
## test: runs unit-tests
|
||||
.PHONY: test
|
||||
test:
|
||||
$(GO) test $(root_dir)/...
|
||||
|
||||
## check: formats, lints, vendors, and run unit-tests
|
||||
.PHONY: check
|
||||
check: fmt lint vendor test
|
||||
|
||||
## help: displays this help text
|
||||
.PHONY: help
|
||||
help:
|
||||
@$(CAT) $(makefile) | \
|
||||
$(SORT) | \
|
||||
$(GREP) "^##" | \
|
||||
$(SED) 's/## //g' | \
|
||||
$(COLUMN) -t -s ':'
|
@ -125,6 +125,11 @@ If a user attempts to edit a cheatsheet on a read-only cheatpath, `cheat` will
|
||||
transparently copy that sheet to a writeable directory before opening it for
|
||||
editing.
|
||||
|
||||
### Directory-scoped Cheatpaths ###
|
||||
At times, it can be useful to closely associate cheatsheets with a directory on
|
||||
your filesystem. `cheat` facilitates this by searching for a `.cheat` folder in
|
||||
the current working directory. If found, the `.cheat` directory will
|
||||
(temporarily) be added to the cheatpaths.
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
@ -1,16 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
# TODO: this script has been made obsolete by the Makefile, yet downstream
|
||||
# package managers plausibly rely on it for compiling locally. Remove this file
|
||||
# after downstream maintainers have had time to modify their packages to simply
|
||||
# invoke `make` in the project root.
|
||||
|
||||
# locate the cheat project root
|
||||
BINDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
APPDIR=$(readlink -f "$BINDIR/..")
|
||||
|
||||
# update the vendored dependencies
|
||||
go mod vendor && go mod tidy
|
||||
|
||||
# compile the executable
|
||||
cd "$APPDIR/cmd/cheat"
|
||||
go clean && go generate && go build -mod vendor
|
||||
mv "$APPDIR/cmd/cheat/cheat" "$APPDIR/dist/cheat"
|
||||
cd $APPDIR
|
||||
|
||||
# display a build checksum
|
||||
md5sum "$APPDIR/dist/cheat"
|
||||
make
|
||||
|
@ -1,36 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# locate the cheat project root
|
||||
BINDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
APPDIR=$(readlink -f "$BINDIR/..")
|
||||
|
||||
# update the vendored dependencies
|
||||
go mod vendor && go mod tidy
|
||||
|
||||
# build embeds
|
||||
cd "$APPDIR/cmd/cheat"
|
||||
go clean && go generate
|
||||
|
||||
# amd64/darwin
|
||||
env GOOS=darwin GOARCH=amd64 go build -mod vendor -o \
|
||||
"$APPDIR/dist/cheat-darwin-amd64" "$APPDIR/cmd/cheat"
|
||||
|
||||
# amd64/linux
|
||||
env GOOS=linux GOARCH=amd64 go build -mod vendor -o \
|
||||
"$APPDIR/dist/cheat-linux-amd64" "$APPDIR/cmd/cheat"
|
||||
|
||||
# amd64/windows
|
||||
env GOOS=windows GOARCH=amd64 go build -mod vendor -o \
|
||||
"$APPDIR/dist/cheat-win-amd64.exe" "$APPDIR/cmd/cheat"
|
||||
|
||||
# arm7/linux
|
||||
env GOOS=linux GOARCH=arm GOARM=7 go build -mod vendor -o \
|
||||
"$APPDIR/dist/cheat-linux-arm7" "$APPDIR/cmd/cheat"
|
||||
|
||||
# arm6/linux
|
||||
env GOOS=linux GOARCH=arm GOARM=6 go build -mod vendor -o \
|
||||
"$APPDIR/dist/cheat-linux-arm6" "$APPDIR/cmd/cheat"
|
||||
|
||||
# arm5/linux
|
||||
env GOOS=linux GOARCH=arm GOARM=5 go build -mod vendor -o \
|
||||
"$APPDIR/dist/cheat-linux-arm5" "$APPDIR/cmd/cheat"
|
@ -13,7 +13,7 @@ import (
|
||||
"github.com/cheat/cheat/internal/config"
|
||||
)
|
||||
|
||||
const version = "3.2.2"
|
||||
const version = "3.3.0"
|
||||
|
||||
func main() {
|
||||
|
||||
|
@ -61,5 +61,15 @@ cheatpaths:
|
||||
path: ~/.dotfiles/cheat/personal
|
||||
tags: [ personal ]
|
||||
readonly: false
|
||||
|
||||
# While it requires no specific configuration here, it's also worth noting
|
||||
# that 'cheat' will automatically append directories named '.cheat' within
|
||||
# the current working directory to the 'cheatpath'. This can be very useful
|
||||
# if you'd like to closely associate cheatsheets with, for example, a
|
||||
# directory containing source code.
|
||||
#
|
||||
# Such "directory-scoped" cheatsheets will be treated as the most "local"
|
||||
# cheatsheets, and will override less "local" cheatsheets. Likewise,
|
||||
# directory-scoped cheatsheets will always be editable ('readonly: false').
|
||||
`)
|
||||
}
|
||||
|
@ -52,3 +52,13 @@ cheatpaths:
|
||||
path: ~/.dotfiles/cheat/personal
|
||||
tags: [ personal ]
|
||||
readonly: false
|
||||
|
||||
# While it requires no specific configuration here, it's also worth noting
|
||||
# that 'cheat' will automatically append directories named '.cheat' within
|
||||
# the current working directory to the 'cheatpath'. This can be very useful
|
||||
# if you'd like to closely associate cheatsheets with, for example, a
|
||||
# directory containing source code.
|
||||
#
|
||||
# Such "directory-scoped" cheatsheets will be treated as the most "local"
|
||||
# cheatsheets, and will override less "local" cheatsheets. Likewise,
|
||||
# directory-scoped cheatsheets will always be editable ('readonly: false').
|
||||
|
18
go.sum
18
go.sum
@ -1,20 +1,12 @@
|
||||
github.com/GeertJohan/go.incremental v1.0.0/go.mod h1:6fAjUhbVuX1KcMD3c8TEgVUqmo4seqhv0i0kdATSkM0=
|
||||
github.com/GeertJohan/go.rice v1.0.0/go.mod h1:eH6gbSOAUv07dQuZVnBmoDP8mgsM1rtixis4Tib9if0=
|
||||
github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
|
||||
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/chroma v0.7.0 h1:z+0HgTUmkpRDRz0SRSdMaqOLfJV4F+N1FPDZUZIDUzw=
|
||||
github.com/alecthomas/chroma v0.7.0/go.mod h1:1U/PfCsTALWWYHDnsIQkxEBM0+6LLe0v8+RSVMOwxeY=
|
||||
github.com/alecthomas/chroma v0.7.1 h1:G1i02OhUbRi2nJxcNkwJaY/J1gHXj9tt72qN6ZouLFQ=
|
||||
github.com/alecthomas/chroma v0.7.1/go.mod h1:gHw09mkX1Qp80JlYbmN9L3+4R5o6DJJ3GRShh+AICNc=
|
||||
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/kong v0.1.17-0.20190424132513-439c674f7ae0/go.mod h1:+inYUSluD+p4L8KdviBSgzcqEjUQOfC5fQDRFuc36lI=
|
||||
github.com/alecthomas/kong v0.2.1-0.20190708041108-0548c6b1afae/go.mod h1:+inYUSluD+p4L8KdviBSgzcqEjUQOfC5fQDRFuc36lI=
|
||||
github.com/alecthomas/kong-hcl v0.1.8-0.20190615233001-b21fea9723c8/go.mod h1:MRgZdU3vrFd05IQ89AxUZ0aYdF39BYoNFa324SodPCA=
|
||||
github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 h1:p9Sln00KOTlrYkxI1zYWl1QLnEqAqEARBEYa8FQnQcY=
|
||||
github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ=
|
||||
github.com/daaku/go.zipexe v1.0.0/go.mod h1:z8IiR6TsVLEYKwXAoE/I+8ys/sDkgTzSL0CLnGVd57E=
|
||||
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ=
|
||||
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
@ -24,12 +16,6 @@ github.com/dlclark/regexp2 v1.1.6 h1:CqB4MjHw0MFCDj+PHHjiESmHX+N7t0tJzKvC6M97BRg
|
||||
github.com/dlclark/regexp2 v1.1.6/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
|
||||
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 h1:bWDMxwH3px2JBh6AyO7hdCn/PkvCZXii8TGj7sbtEbQ=
|
||||
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
|
||||
github.com/gorilla/csrf v1.6.0/go.mod h1:7tSf8kmjNYr7IWDCYhd3U8Ck34iQ/Yw5CJu7bAkHEGI=
|
||||
github.com/gorilla/handlers v1.4.1/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
|
||||
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||
github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=
|
||||
@ -41,8 +27,6 @@ github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyex
|
||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229/go.mod h1:0aYXnNPJ8l7uZxf45rWW1a/uME32OF0rhiYGNQ2oF2E=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
@ -52,8 +36,6 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
|
||||
golang.org/x/sys v0.0.0-20181128092732-4ed8d59d0b35 h1:YAFjXN64LMvktoUZH9zgY4lGc/msGN7HQfoSuKCgaDU=
|
||||
golang.org/x/sys v0.0.0-20181128092732-4ed8d59d0b35/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
|
||||
|
@ -2,8 +2,8 @@ package cheatpath
|
||||
|
||||
// Cheatpath encapsulates cheatsheet path information
|
||||
type Cheatpath struct {
|
||||
Name string `yaml:name`
|
||||
Path string `yaml:path`
|
||||
ReadOnly bool `yaml:readonly`
|
||||
Tags []string `yaml:tags`
|
||||
Name string `yaml:"name"`
|
||||
Path string `yaml:"path"`
|
||||
ReadOnly bool `yaml:"readonly"`
|
||||
Tags []string `yaml:"tags"`
|
||||
}
|
||||
|
@ -14,11 +14,11 @@ import (
|
||||
|
||||
// Config encapsulates configuration parameters
|
||||
type Config struct {
|
||||
Colorize bool `yaml:colorize`
|
||||
Editor string `yaml:editor`
|
||||
Cheatpaths []cp.Cheatpath `yaml:cheatpaths`
|
||||
Style string `yaml:style`
|
||||
Formatter string `yaml:formatter`
|
||||
Colorize bool `yaml:"colorize"`
|
||||
Editor string `yaml:"editor"`
|
||||
Cheatpaths []cp.Cheatpath `yaml:"cheatpaths"`
|
||||
Style string `yaml:"style"`
|
||||
Formatter string `yaml:"formatter"`
|
||||
}
|
||||
|
||||
// New returns a new Config struct
|
||||
@ -39,6 +39,24 @@ func New(opts map[string]interface{}, confPath string, resolve bool) (Config, er
|
||||
return Config{}, fmt.Errorf("could not unmarshal yaml: %v", err)
|
||||
}
|
||||
|
||||
// if a .cheat directory exists locally, append it to the cheatpaths
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return Config{}, fmt.Errorf("failed to get cwd: %v", err)
|
||||
}
|
||||
|
||||
local := filepath.Join(cwd, ".cheat")
|
||||
if _, err := os.Stat(local); err == nil {
|
||||
path := cp.Cheatpath{
|
||||
Name: "cwd",
|
||||
Path: local,
|
||||
ReadOnly: false,
|
||||
Tags: []string{},
|
||||
}
|
||||
|
||||
conf.Cheatpaths = append(conf.Cheatpaths, path)
|
||||
}
|
||||
|
||||
// process cheatpaths
|
||||
for i, cheatpath := range conf.Cheatpaths {
|
||||
|
||||
|
4
vendor/github.com/alecthomas/chroma/.golangci.yml
generated
vendored
4
vendor/github.com/alecthomas/chroma/.golangci.yml
generated
vendored
@ -18,6 +18,8 @@ linters:
|
||||
- funlen
|
||||
- godox
|
||||
- wsl
|
||||
- gomnd
|
||||
- gocognit
|
||||
|
||||
linters-settings:
|
||||
govet:
|
||||
@ -49,3 +51,5 @@ issues:
|
||||
- 'at least one file in a package should have a package comment'
|
||||
- 'string literal contains the Unicode'
|
||||
- 'methods on the same type should have the same receiver name'
|
||||
- '_TokenType_name should be _TokenTypeName'
|
||||
- '`_TokenType_map` should be `_TokenTypeMap`'
|
||||
|
4
vendor/github.com/alecthomas/chroma/.travis.yml
generated
vendored
4
vendor/github.com/alecthomas/chroma/.travis.yml
generated
vendored
@ -1,8 +1,10 @@
|
||||
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.20.0
|
||||
- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s v1.22.2
|
||||
- ./bin/golangci-lint run
|
||||
- git clean -fdx .
|
||||
after_success:
|
||||
|
19
vendor/github.com/alecthomas/chroma/Makefile
generated
vendored
Normal file
19
vendor/github.com/alecthomas/chroma/Makefile
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
.PHONY: chromad upload all
|
||||
|
||||
all: README.md tokentype_string.go
|
||||
|
||||
README.md: lexers/*/*.go
|
||||
./table.py
|
||||
|
||||
tokentype_string.go: types.go
|
||||
go generate
|
||||
|
||||
chromad:
|
||||
(cd ./cmd/chromad && go get github.com/GeertJohan/go.rice/rice@master && go install github.com/GeertJohan/go.rice/rice)
|
||||
rm -f chromad
|
||||
(export CGOENABLED=0 GOOS=linux ; cd ./cmd/chromad && go build -o ../../chromad .)
|
||||
rice append -i ./cmd/chromad --exec=./chromad
|
||||
|
||||
upload: chromad
|
||||
scp chromad root@swapoff.org: && \
|
||||
ssh root@swapoff.org 'install -m755 ./chromad /srv/http/swapoff.org/bin && service chromad restart'
|
7
vendor/github.com/alecthomas/chroma/README.md
generated
vendored
7
vendor/github.com/alecthomas/chroma/README.md
generated
vendored
@ -47,14 +47,14 @@ I | Idris, INI, Io
|
||||
J | J, Java, JavaScript, JSON, Julia, Jungle
|
||||
K | Kotlin
|
||||
L | Lighttpd configuration file, LLVM, Lua
|
||||
M | Mako, markdown, Mason, Mathematica, Matlab, MiniZinc, 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
|
||||
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
|
||||
Q | QBasic
|
||||
R | R, Racket, Ragel, react, reg, reStructuredText, Rexx, Ruby, Rust
|
||||
S | Sass, Scala, Scheme, Scilab, SCSS, Smalltalk, Smarty, Snobol, Solidity, SPARQL, SQL, SquidConf, Swift, SYSTEMD, systemverilog
|
||||
T | TASM, Tcl, Tcsh, Termcap, Terminfo, Terraform, TeX, Thrift, TOML, TradingView, Transact-SQL, Turing, Turtle, Twig, TypeScript, TypoScript, TypoScriptCssData, TypoScriptHtmlData
|
||||
S | Sass, Scala, Scheme, Scilab, SCSS, Smalltalk, Smarty, SML, Snobol, Solidity, SPARQL, SQL, SquidConf, Swift, SYSTEMD, systemverilog
|
||||
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
|
||||
W | WDTE
|
||||
X | XML, Xorg
|
||||
@ -183,6 +183,7 @@ following constructor options:
|
||||
- `ClassPrefix(prefix)` - prefix each generated CSS class.
|
||||
- `TabWidth(width)` - Set the rendered tab width, in characters.
|
||||
- `WithLineNumbers()` - Render line numbers (style with `LineNumbers`).
|
||||
- `LinkableLineNumbers()` - Make the line numbers linkable.
|
||||
- `HighlightLines(ranges)` - Highlight lines in these ranges (style with `LineHighlight`).
|
||||
- `LineNumbersInTable()` - Use a table for formatting line numbers and code, rather than spans.
|
||||
|
||||
|
47
vendor/github.com/alecthomas/chroma/formatters/html/html.go
generated
vendored
47
vendor/github.com/alecthomas/chroma/formatters/html/html.go
generated
vendored
@ -58,6 +58,15 @@ func LineNumbersInTable(b bool) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// LinkableLineNumbers decorates the line numbers HTML elements with an "id"
|
||||
// attribute so they can be linked.
|
||||
func LinkableLineNumbers(b bool, prefix string) Option {
|
||||
return func(f *Formatter) {
|
||||
f.linkableLineNumbers = b
|
||||
f.lineNumbersIDPrefix = prefix
|
||||
}
|
||||
}
|
||||
|
||||
// HighlightLines higlights the given line ranges with the Highlight style.
|
||||
//
|
||||
// A range is the beginning and ending of a range as 1-based line numbers, inclusive.
|
||||
@ -129,15 +138,17 @@ var (
|
||||
|
||||
// Formatter that generates HTML.
|
||||
type Formatter struct {
|
||||
standalone bool
|
||||
prefix string
|
||||
Classes bool // Exported field to detect when classes are being used
|
||||
preWrapper PreWrapper
|
||||
tabWidth int
|
||||
lineNumbers bool
|
||||
lineNumbersInTable bool
|
||||
highlightRanges highlightRanges
|
||||
baseLineNumber int
|
||||
standalone bool
|
||||
prefix string
|
||||
Classes bool // Exported field to detect when classes are being used
|
||||
preWrapper PreWrapper
|
||||
tabWidth int
|
||||
lineNumbers bool
|
||||
lineNumbersInTable bool
|
||||
linkableLineNumbers bool
|
||||
lineNumbersIDPrefix string
|
||||
highlightRanges highlightRanges
|
||||
baseLineNumber int
|
||||
}
|
||||
|
||||
type highlightRanges [][2]int
|
||||
@ -196,7 +207,7 @@ func (f *Formatter) writeHTML(w io.Writer, style *chroma.Style, tokens []chroma.
|
||||
fmt.Fprintf(w, "<span%s>", f.styleAttr(css, chroma.LineHighlight))
|
||||
}
|
||||
|
||||
fmt.Fprintf(w, "<span%s>%*d\n</span>", f.styleAttr(css, chroma.LineNumbersTable), lineDigits, line)
|
||||
fmt.Fprintf(w, "<span%s%s>%*d\n</span>", f.styleAttr(css, chroma.LineNumbersTable), f.lineIDAttribute(line), lineDigits, line)
|
||||
|
||||
if highlight {
|
||||
fmt.Fprintf(w, "</span>")
|
||||
@ -222,7 +233,7 @@ func (f *Formatter) writeHTML(w io.Writer, style *chroma.Style, tokens []chroma.
|
||||
}
|
||||
|
||||
if f.lineNumbers && !wrapInTable {
|
||||
fmt.Fprintf(w, "<span%s>%*d</span>", f.styleAttr(css, chroma.LineNumbers), lineDigits, line)
|
||||
fmt.Fprintf(w, "<span%s%s>%*d</span>", f.styleAttr(css, chroma.LineNumbers), f.lineIDAttribute(line), lineDigits, line)
|
||||
}
|
||||
|
||||
for _, token := range tokens {
|
||||
@ -253,6 +264,13 @@ func (f *Formatter) writeHTML(w io.Writer, style *chroma.Style, tokens []chroma.
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *Formatter) lineIDAttribute(line int) string {
|
||||
if !f.linkableLineNumbers {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf(" id=\"%s%d\"", f.lineNumbersIDPrefix, line)
|
||||
}
|
||||
|
||||
func (f *Formatter) shouldHighlight(highlightIndex, line int) (bool, bool) {
|
||||
next := false
|
||||
for highlightIndex < len(f.highlightRanges) && line > f.highlightRanges[highlightIndex][1] {
|
||||
@ -327,6 +345,13 @@ func (f *Formatter) WriteCSS(w io.Writer, style *chroma.Style) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// Special-case line number highlighting when targeted.
|
||||
if f.lineNumbers || f.lineNumbersInTable {
|
||||
targetedLineCSS := StyleEntryToCSS(style.Get(chroma.LineHighlight))
|
||||
for _, tt := range []chroma.TokenType{chroma.LineNumbers, chroma.LineNumbersTable} {
|
||||
fmt.Fprintf(w, "/* %s targeted by URL anchor */ .%schroma .%s:target { %s }\n", tt, f.prefix, f.class(tt), targetedLineCSS)
|
||||
}
|
||||
}
|
||||
tts := []int{}
|
||||
for tt := range css {
|
||||
tts = append(tts, int(tt))
|
||||
|
5
vendor/github.com/alecthomas/chroma/go.mod
generated
vendored
5
vendor/github.com/alecthomas/chroma/go.mod
generated
vendored
@ -1,17 +1,12 @@
|
||||
module github.com/alecthomas/chroma
|
||||
|
||||
require (
|
||||
github.com/GeertJohan/go.rice v1.0.0
|
||||
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38
|
||||
github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 // indirect
|
||||
github.com/alecthomas/kong v0.2.1-0.20190708041108-0548c6b1afae
|
||||
github.com/alecthomas/kong-hcl v0.1.8-0.20190615233001-b21fea9723c8
|
||||
github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 // indirect
|
||||
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964
|
||||
github.com/dlclark/regexp2 v1.1.6
|
||||
github.com/gorilla/csrf v1.6.0
|
||||
github.com/gorilla/handlers v1.4.1
|
||||
github.com/gorilla/mux v1.7.3
|
||||
github.com/mattn/go-colorable v0.0.9
|
||||
github.com/mattn/go-isatty v0.0.4
|
||||
github.com/sergi/go-diff v1.0.0 // indirect
|
||||
|
25
vendor/github.com/alecthomas/chroma/go.sum
generated
vendored
25
vendor/github.com/alecthomas/chroma/go.sum
generated
vendored
@ -1,20 +1,11 @@
|
||||
github.com/GeertJohan/go.incremental v1.0.0/go.mod h1:6fAjUhbVuX1KcMD3c8TEgVUqmo4seqhv0i0kdATSkM0=
|
||||
github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
|
||||
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/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/go.rice v1.0.1-0.20190719113735-961b99d742e7 h1:0cMlP9evwgTzs5JUe2C/3rLttYjmRm0kbz9fdGBIV1E=
|
||||
github.com/alecthomas/go.rice v1.0.1-0.20190719113735-961b99d742e7/go.mod h1:af5vUNlDNkCjOZeSGFgIJxDje9qdjsO6hshx0gTmZt4=
|
||||
github.com/alecthomas/kong v0.1.17-0.20190424132513-439c674f7ae0/go.mod h1:+inYUSluD+p4L8KdviBSgzcqEjUQOfC5fQDRFuc36lI=
|
||||
github.com/alecthomas/kong v0.2.1-0.20190708041108-0548c6b1afae h1:C4Q9m+oXOxcSWwYk9XzzafY2xAVAaeubZbUHJkw3PlY=
|
||||
github.com/alecthomas/kong v0.2.1-0.20190708041108-0548c6b1afae/go.mod h1:+inYUSluD+p4L8KdviBSgzcqEjUQOfC5fQDRFuc36lI=
|
||||
github.com/alecthomas/kong-hcl v0.1.8-0.20190615233001-b21fea9723c8 h1:atLL+K8Hg0e8863K2X+k7qu+xz3M2a/mWFIACAPf55M=
|
||||
github.com/alecthomas/kong-hcl v0.1.8-0.20190615233001-b21fea9723c8/go.mod h1:MRgZdU3vrFd05IQ89AxUZ0aYdF39BYoNFa324SodPCA=
|
||||
github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 h1:p9Sln00KOTlrYkxI1zYWl1QLnEqAqEARBEYa8FQnQcY=
|
||||
github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ=
|
||||
github.com/daaku/go.zipexe v1.0.0 h1:VSOgZtH418pH9L16hC/JrgSNJbbAL26pj7lmD1+CGdY=
|
||||
github.com/daaku/go.zipexe v1.0.0/go.mod h1:z8IiR6TsVLEYKwXAoE/I+8ys/sDkgTzSL0CLnGVd57E=
|
||||
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ=
|
||||
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
@ -22,25 +13,11 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dlclark/regexp2 v1.1.6 h1:CqB4MjHw0MFCDj+PHHjiESmHX+N7t0tJzKvC6M97BRg=
|
||||
github.com/dlclark/regexp2 v1.1.6/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
|
||||
github.com/gorilla/csrf v1.6.0 h1:60oN1cFdncCE8tjwQ3QEkFND5k37lQPcRjnlvm7CIJ0=
|
||||
github.com/gorilla/csrf v1.6.0/go.mod h1:7tSf8kmjNYr7IWDCYhd3U8Ck34iQ/Yw5CJu7bAkHEGI=
|
||||
github.com/gorilla/handlers v1.4.1 h1:BHvcRGJe/TrL+OqFxoKQGddTgeibiOjaBssV5a/N9sw=
|
||||
github.com/gorilla/handlers v1.4.1/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
|
||||
github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw=
|
||||
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ=
|
||||
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
|
||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||
github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=
|
||||
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
|
||||
github.com/nkovacs/streamquote v1.0.0/go.mod h1:BN+NaZ2CmdKqUuTUXUEm9j95B2TRbpOWpxbJYzzgUsc=
|
||||
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
|
||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
@ -52,7 +29,5 @@ github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
|
||||
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
|
||||
golang.org/x/sys v0.0.0-20181128092732-4ed8d59d0b35 h1:YAFjXN64LMvktoUZH9zgY4lGc/msGN7HQfoSuKCgaDU=
|
||||
golang.org/x/sys v0.0.0-20181128092732-4ed8d59d0b35/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
|
43
vendor/github.com/alecthomas/chroma/lexers/m/mlir.go
generated
vendored
Normal file
43
vendor/github.com/alecthomas/chroma/lexers/m/mlir.go
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
package m
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// MLIR lexer.
|
||||
var Mlir = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "MLIR",
|
||||
Aliases: []string{"mlir"},
|
||||
Filenames: []string{"*.mlir"},
|
||||
MimeTypes: []string{"text/x-mlir"},
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
Include("whitespace"),
|
||||
{`c?"[^"]*?"`, LiteralString, nil},
|
||||
{`\^([-a-zA-Z$._][\w\-$.0-9]*)\s*`, NameLabel, nil},
|
||||
{`([\w\d_$.]+)\s*=`, NameLabel, nil},
|
||||
Include("keyword"),
|
||||
{`->`, Punctuation, nil},
|
||||
{`@([\w_][\w\d_$.]*)`, NameFunction, nil},
|
||||
{`[%#][\w\d_$.]+`, NameVariable, nil},
|
||||
{`([1-9?][\d?]*\s*x)+`, LiteralNumber, nil},
|
||||
{`0[xX][a-fA-F0-9]+`, LiteralNumber, nil},
|
||||
{`-?\d+(?:[.]\d+)?(?:[eE][-+]?\d+(?:[.]\d+)?)?`, LiteralNumber, nil},
|
||||
{`[=<>{}\[\]()*.,!:]|x\b`, Punctuation, nil},
|
||||
{`[\w\d]+`, Text, nil},
|
||||
},
|
||||
"whitespace": {
|
||||
{`(\n|\s)+`, Text, nil},
|
||||
{`//.*?\n`, Comment, nil},
|
||||
},
|
||||
"keyword": {
|
||||
{Words(``, ``, `constant`, `return`), KeywordType, nil},
|
||||
{Words(``, ``, `func`, `loc`, `memref`, `tensor`, `vector`), KeywordType, nil},
|
||||
{`bf16|f16|f32|f64|index`, Keyword, nil},
|
||||
{`i[1-9]\d*`, Keyword, nil},
|
||||
},
|
||||
},
|
||||
))
|
4
vendor/github.com/alecthomas/chroma/lexers/p/powershell.go
generated
vendored
4
vendor/github.com/alecthomas/chroma/lexers/p/powershell.go
generated
vendored
@ -22,6 +22,7 @@ var Powershell = internal.Register(MustNewLexer(
|
||||
{`^(\s*#[#\s]*)(\.(?:component|description|example|externalhelp|forwardhelpcategory|forwardhelptargetname|functionality|inputs|link|notes|outputs|parameter|remotehelprunspace|role|synopsis))([^\n]*$)`, ByGroups(Comment, LiteralStringDoc, Comment), nil},
|
||||
{`#[^\n]*?$`, Comment, nil},
|
||||
{`(<|<)#`, CommentMultiline, Push("multline")},
|
||||
{`(?i)([A-Z]:)`, Name, nil},
|
||||
{`@"\n`, LiteralStringHeredoc, Push("heredoc-double")},
|
||||
{`@'\n.*?\n'@`, LiteralStringHeredoc, nil},
|
||||
{"`[\\'\"$@-]", Punctuation, nil},
|
||||
@ -30,7 +31,8 @@ var Powershell = internal.Register(MustNewLexer(
|
||||
{`(\$|@@|@)((global|script|private|env):)?\w+`, NameVariable, nil},
|
||||
{`(while|validateset|validaterange|validatepattern|validatelength|validatecount|until|trap|switch|return|ref|process|param|parameter|in|if|global:|function|foreach|for|finally|filter|end|elseif|else|dynamicparam|do|default|continue|cmdletbinding|break|begin|alias|\?|%|#script|#private|#local|#global|mandatory|parametersetname|position|valuefrompipeline|valuefrompipelinebypropertyname|valuefromremainingarguments|helpmessage|try|catch|throw)\b`, Keyword, nil},
|
||||
{`-(and|as|band|bnot|bor|bxor|casesensitive|ccontains|ceq|cge|cgt|cle|clike|clt|cmatch|cne|cnotcontains|cnotlike|cnotmatch|contains|creplace|eq|exact|f|file|ge|gt|icontains|ieq|ige|igt|ile|ilike|ilt|imatch|ine|inotcontains|inotlike|inotmatch|ireplace|is|isnot|le|like|lt|match|ne|not|notcontains|notlike|notmatch|or|regex|replace|wildcard)\b`, Operator, nil},
|
||||
{`(write|where|wait|use|update|unregister|undo|trace|test|tee|take|suspend|stop|start|split|sort|skip|show|set|send|select|scroll|resume|restore|restart|resolve|resize|reset|rename|remove|register|receive|read|push|pop|ping|out|new|move|measure|limit|join|invoke|import|group|get|format|foreach|export|expand|exit|enter|enable|disconnect|disable|debug|cxnew|copy|convertto|convertfrom|convert|connect|complete|compare|clear|checkpoint|aggregate|add)-[a-z_]\w*\b`, NameBuiltin, nil},
|
||||
{`(write|where|watch|wait|use|update|unregister|unpublish|unprotect|unlock|uninstall|undo|unblock|trace|test|tee|take|sync|switch|suspend|submit|stop|step|start|split|sort|skip|show|set|send|select|search|scroll|save|revoke|resume|restore|restart|resolve|resize|reset|request|repair|rename|remove|register|redo|receive|read|push|publish|protect|pop|ping|out|optimize|open|new|move|mount|merge|measure|lock|limit|join|invoke|install|initialize|import|hide|group|grant|get|format|foreach|find|export|expand|exit|enter|enable|edit|dismount|disconnect|disable|deny|debug|cxnew|copy|convertto|convertfrom|convert|connect|confirm|compress|complete|compare|close|clear|checkpoint|block|backup|assert|approve|aggregate|add)-[a-z_]\w*\b`, NameBuiltin, nil},
|
||||
{`(ac|asnp|cat|cd|cfs|chdir|clc|clear|clhy|cli|clp|cls|clv|cnsn|compare|copy|cp|cpi|cpp|curl|cvpa|dbp|del|diff|dir|dnsn|ebp|echo|epal|epcsv|epsn|erase|etsn|exsn|fc|fhx|fl|foreach|ft|fw|gal|gbp|gc|gci|gcm|gcs|gdr|ghy|gi|gjb|gl|gm|gmo|gp|gps|gpv|group|gsn|gsnp|gsv|gu|gv|gwmi|h|history|icm|iex|ihy|ii|ipal|ipcsv|ipmo|ipsn|irm|ise|iwmi|iwr|kill|lp|ls|man|md|measure|mi|mount|move|mp|mv|nal|ndr|ni|nmo|npssc|nsn|nv|ogv|oh|popd|ps|pushd|pwd|r|rbp|rcjb|rcsn|rd|rdr|ren|ri|rjb|rm|rmdir|rmo|rni|rnp|rp|rsn|rsnp|rujb|rv|rvpa|rwmi|sajb|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls|sort|sp|spjb|spps|spsv|start|sujb|sv|swmi|tee|trcm|type|wget|where|wjb|write)\s`, NameBuiltin, nil},
|
||||
{"\\[[a-z_\\[][\\w. `,\\[\\]]*\\]", NameConstant, nil},
|
||||
{`-[a-z_]\w*`, Name, nil},
|
||||
{`\w+`, Name, nil},
|
||||
|
200
vendor/github.com/alecthomas/chroma/lexers/s/sml.go
generated
vendored
Normal file
200
vendor/github.com/alecthomas/chroma/lexers/s/sml.go
generated
vendored
Normal file
@ -0,0 +1,200 @@
|
||||
package s
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// Standard ML lexer.
|
||||
var StandardML = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "Standard ML",
|
||||
Aliases: []string{"sml"},
|
||||
Filenames: []string{"*.sml", "*.sig", "*.fun"},
|
||||
MimeTypes: []string{"text/x-standardml", "application/x-standardml"},
|
||||
},
|
||||
Rules{
|
||||
"whitespace": {
|
||||
{`\s+`, Text, nil},
|
||||
{`\(\*`, CommentMultiline, Push("comment")},
|
||||
},
|
||||
"delimiters": {
|
||||
{`\(|\[|\{`, Punctuation, Push("main")},
|
||||
{`\)|\]|\}`, Punctuation, Pop(1)},
|
||||
{`\b(let|if|local)\b(?!\')`, KeywordReserved, Push("main", "main")},
|
||||
{`\b(struct|sig|while)\b(?!\')`, KeywordReserved, Push("main")},
|
||||
{`\b(do|else|end|in|then)\b(?!\')`, KeywordReserved, Pop(1)},
|
||||
},
|
||||
"core": {
|
||||
{`(_|\}|\{|\)|;|,|\[|\(|\]|\.\.\.)`, Punctuation, nil},
|
||||
{`#"`, LiteralStringChar, Push("char")},
|
||||
{`"`, LiteralStringDouble, Push("string")},
|
||||
{`~?0x[0-9a-fA-F]+`, LiteralNumberHex, nil},
|
||||
{`0wx[0-9a-fA-F]+`, LiteralNumberHex, nil},
|
||||
{`0w\d+`, LiteralNumberInteger, nil},
|
||||
{`~?\d+\.\d+[eE]~?\d+`, LiteralNumberFloat, nil},
|
||||
{`~?\d+\.\d+`, LiteralNumberFloat, nil},
|
||||
{`~?\d+[eE]~?\d+`, LiteralNumberFloat, nil},
|
||||
{`~?\d+`, LiteralNumberInteger, nil},
|
||||
{`#\s*[1-9][0-9]*`, NameLabel, nil},
|
||||
{`#\s*([a-zA-Z][\w']*)`, NameLabel, nil},
|
||||
{"#\\s+([!%&$#+\\-/:<=>?@\\\\~`^|*]+)", NameLabel, nil},
|
||||
{`\b(datatype|abstype)\b(?!\')`, KeywordReserved, Push("dname")},
|
||||
{`(?=\b(exception)\b(?!\'))`, Text, Push("ename")},
|
||||
{`\b(functor|include|open|signature|structure)\b(?!\')`, KeywordReserved, Push("sname")},
|
||||
{`\b(type|eqtype)\b(?!\')`, KeywordReserved, Push("tname")},
|
||||
{`\'[\w\']*`, NameDecorator, nil},
|
||||
{`([a-zA-Z][\w']*)(\.)`, NameNamespace, Push("dotted")},
|
||||
{`\b(abstype|and|andalso|as|case|datatype|do|else|end|exception|fn|fun|handle|if|in|infix|infixr|let|local|nonfix|of|op|open|orelse|raise|rec|then|type|val|with|withtype|while|eqtype|functor|include|sharing|sig|signature|struct|structure|where)\b`, KeywordReserved, nil},
|
||||
{`([a-zA-Z][\w']*)`, Name, nil},
|
||||
{`\b(:|\|,=|=>|->|#|:>)\b`, KeywordReserved, nil},
|
||||
{"([!%&$#+\\-/:<=>?@\\\\~`^|*]+)", Name, nil},
|
||||
},
|
||||
"dotted": {
|
||||
{`([a-zA-Z][\w']*)(\.)`, NameNamespace, nil},
|
||||
// ignoring reserved words
|
||||
{`([a-zA-Z][\w']*)`, Name, Pop(1)},
|
||||
// ignoring reserved words
|
||||
{"([!%&$#+\\-/:<=>?@\\\\~`^|*]+)", Name, Pop(1)},
|
||||
{`\s+`, Error, nil},
|
||||
{`\S+`, Error, nil},
|
||||
},
|
||||
"root": {
|
||||
Default(Push("main")),
|
||||
},
|
||||
"main": {
|
||||
Include("whitespace"),
|
||||
{`\b(val|and)\b(?!\')`, KeywordReserved, Push("vname")},
|
||||
{`\b(fun)\b(?!\')`, KeywordReserved, Push("#pop", "main-fun", "fname")},
|
||||
Include("delimiters"),
|
||||
Include("core"),
|
||||
{`\S+`, Error, nil},
|
||||
},
|
||||
"main-fun": {
|
||||
Include("whitespace"),
|
||||
{`\s`, Text, nil},
|
||||
{`\(\*`, CommentMultiline, Push("comment")},
|
||||
{`\b(fun|and)\b(?!\')`, KeywordReserved, Push("fname")},
|
||||
{`\b(val)\b(?!\')`, KeywordReserved, Push("#pop", "main", "vname")},
|
||||
{`\|`, Punctuation, Push("fname")},
|
||||
{`\b(case|handle)\b(?!\')`, KeywordReserved, Push("#pop", "main")},
|
||||
Include("delimiters"),
|
||||
Include("core"),
|
||||
{`\S+`, Error, nil},
|
||||
},
|
||||
"char": {
|
||||
{`[^"\\]`, LiteralStringChar, nil},
|
||||
{`\\[\\"abtnvfr]`, LiteralStringEscape, nil},
|
||||
{`\\\^[\x40-\x5e]`, LiteralStringEscape, nil},
|
||||
{`\\[0-9]{3}`, LiteralStringEscape, nil},
|
||||
{`\\u[0-9a-fA-F]{4}`, LiteralStringEscape, nil},
|
||||
{`\\\s+\\`, LiteralStringInterpol, nil},
|
||||
{`"`, LiteralStringChar, Pop(1)},
|
||||
},
|
||||
"string": {
|
||||
{`[^"\\]`, LiteralStringDouble, nil},
|
||||
{`\\[\\"abtnvfr]`, LiteralStringEscape, nil},
|
||||
{`\\\^[\x40-\x5e]`, LiteralStringEscape, nil},
|
||||
{`\\[0-9]{3}`, LiteralStringEscape, nil},
|
||||
{`\\u[0-9a-fA-F]{4}`, LiteralStringEscape, nil},
|
||||
{`\\\s+\\`, LiteralStringInterpol, nil},
|
||||
{`"`, LiteralStringDouble, Pop(1)},
|
||||
},
|
||||
"breakout": {
|
||||
{`(?=\b(where|do|handle|if|sig|op|while|case|as|else|signature|andalso|struct|infixr|functor|in|structure|then|local|rec|end|fun|of|orelse|val|include|fn|with|exception|let|and|infix|sharing|datatype|type|abstype|withtype|eqtype|nonfix|raise|open)\b(?!\'))`, Text, Pop(1)},
|
||||
},
|
||||
"sname": {
|
||||
Include("whitespace"),
|
||||
Include("breakout"),
|
||||
{`([a-zA-Z][\w']*)`, NameNamespace, nil},
|
||||
Default(Pop(1)),
|
||||
},
|
||||
"fname": {
|
||||
Include("whitespace"),
|
||||
{`\'[\w\']*`, NameDecorator, nil},
|
||||
{`\(`, Punctuation, Push("tyvarseq")},
|
||||
{`([a-zA-Z][\w']*)`, NameFunction, Pop(1)},
|
||||
{"([!%&$#+\\-/:<=>?@\\\\~`^|*]+)", NameFunction, Pop(1)},
|
||||
Default(Pop(1)),
|
||||
},
|
||||
"vname": {
|
||||
Include("whitespace"),
|
||||
{`\'[\w\']*`, NameDecorator, nil},
|
||||
{`\(`, Punctuation, Push("tyvarseq")},
|
||||
{"([a-zA-Z][\\w']*)(\\s*)(=(?![!%&$#+\\-/:<=>?@\\\\~`^|*]+))", ByGroups(NameVariable, Text, Punctuation), Pop(1)},
|
||||
{"([!%&$#+\\-/:<=>?@\\\\~`^|*]+)(\\s*)(=(?![!%&$#+\\-/:<=>?@\\\\~`^|*]+))", ByGroups(NameVariable, Text, Punctuation), Pop(1)},
|
||||
{`([a-zA-Z][\w']*)`, NameVariable, Pop(1)},
|
||||
{"([!%&$#+\\-/:<=>?@\\\\~`^|*]+)", NameVariable, Pop(1)},
|
||||
Default(Pop(1)),
|
||||
},
|
||||
"tname": {
|
||||
Include("whitespace"),
|
||||
Include("breakout"),
|
||||
{`\'[\w\']*`, NameDecorator, nil},
|
||||
{`\(`, Punctuation, Push("tyvarseq")},
|
||||
{"=(?![!%&$#+\\-/:<=>?@\\\\~`^|*]+)", Punctuation, Push("#pop", "typbind")},
|
||||
{`([a-zA-Z][\w']*)`, KeywordType, nil},
|
||||
{"([!%&$#+\\-/:<=>?@\\\\~`^|*]+)", KeywordType, nil},
|
||||
{`\S+`, Error, Pop(1)},
|
||||
},
|
||||
"typbind": {
|
||||
Include("whitespace"),
|
||||
{`\b(and)\b(?!\')`, KeywordReserved, Push("#pop", "tname")},
|
||||
Include("breakout"),
|
||||
Include("core"),
|
||||
{`\S+`, Error, Pop(1)},
|
||||
},
|
||||
"dname": {
|
||||
Include("whitespace"),
|
||||
Include("breakout"),
|
||||
{`\'[\w\']*`, NameDecorator, nil},
|
||||
{`\(`, Punctuation, Push("tyvarseq")},
|
||||
{`(=)(\s*)(datatype)`, ByGroups(Punctuation, Text, KeywordReserved), Pop(1)},
|
||||
{"=(?![!%&$#+\\-/:<=>?@\\\\~`^|*]+)", Punctuation, Push("#pop", "datbind", "datcon")},
|
||||
{`([a-zA-Z][\w']*)`, KeywordType, nil},
|
||||
{"([!%&$#+\\-/:<=>?@\\\\~`^|*]+)", KeywordType, nil},
|
||||
{`\S+`, Error, Pop(1)},
|
||||
},
|
||||
"datbind": {
|
||||
Include("whitespace"),
|
||||
{`\b(and)\b(?!\')`, KeywordReserved, Push("#pop", "dname")},
|
||||
{`\b(withtype)\b(?!\')`, KeywordReserved, Push("#pop", "tname")},
|
||||
{`\b(of)\b(?!\')`, KeywordReserved, nil},
|
||||
{`(\|)(\s*)([a-zA-Z][\w']*)`, ByGroups(Punctuation, Text, NameClass), nil},
|
||||
{"(\\|)(\\s+)([!%&$#+\\-/:<=>?@\\\\~`^|*]+)", ByGroups(Punctuation, Text, NameClass), nil},
|
||||
Include("breakout"),
|
||||
Include("core"),
|
||||
{`\S+`, Error, nil},
|
||||
},
|
||||
"ename": {
|
||||
Include("whitespace"),
|
||||
{`(exception|and)\b(\s+)([a-zA-Z][\w']*)`, ByGroups(KeywordReserved, Text, NameClass), nil},
|
||||
{"(exception|and)\\b(\\s*)([!%&$#+\\-/:<=>?@\\\\~`^|*]+)", ByGroups(KeywordReserved, Text, NameClass), nil},
|
||||
{`\b(of)\b(?!\')`, KeywordReserved, nil},
|
||||
Include("breakout"),
|
||||
Include("core"),
|
||||
{`\S+`, Error, nil},
|
||||
},
|
||||
"datcon": {
|
||||
Include("whitespace"),
|
||||
{`([a-zA-Z][\w']*)`, NameClass, Pop(1)},
|
||||
{"([!%&$#+\\-/:<=>?@\\\\~`^|*]+)", NameClass, Pop(1)},
|
||||
{`\S+`, Error, Pop(1)},
|
||||
},
|
||||
"tyvarseq": {
|
||||
{`\s`, Text, nil},
|
||||
{`\(\*`, CommentMultiline, Push("comment")},
|
||||
{`\'[\w\']*`, NameDecorator, nil},
|
||||
{`[a-zA-Z][\w']*`, Name, nil},
|
||||
{`,`, Punctuation, nil},
|
||||
{`\)`, Punctuation, Pop(1)},
|
||||
{"[!%&$#+\\-/:<=>?@\\\\~`^|*]+", Name, nil},
|
||||
},
|
||||
"comment": {
|
||||
{`[^(*)]`, CommentMultiline, nil},
|
||||
{`\(\*`, CommentMultiline, Push()},
|
||||
{`\*\)`, CommentMultiline, Pop(1)},
|
||||
{`[(*)]`, CommentMultiline, nil},
|
||||
},
|
||||
},
|
||||
))
|
42
vendor/github.com/alecthomas/chroma/lexers/t/tablegen.go
generated
vendored
Normal file
42
vendor/github.com/alecthomas/chroma/lexers/t/tablegen.go
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
package t
|
||||
|
||||
import (
|
||||
. "github.com/alecthomas/chroma" // nolint
|
||||
"github.com/alecthomas/chroma/lexers/internal"
|
||||
)
|
||||
|
||||
// TableGen lexer.
|
||||
var Tablegen = internal.Register(MustNewLexer(
|
||||
&Config{
|
||||
Name: "TableGen",
|
||||
Aliases: []string{"tablegen"},
|
||||
Filenames: []string{"*.td"},
|
||||
MimeTypes: []string{"text/x-tablegen"},
|
||||
},
|
||||
Rules{
|
||||
"root": {
|
||||
Include("macro"),
|
||||
Include("whitespace"),
|
||||
{`c?"[^"]*?"`, LiteralString, nil},
|
||||
Include("keyword"),
|
||||
{`\$[_a-zA-Z][_\w]*`, NameVariable, nil},
|
||||
{`\d*[_a-zA-Z][_\w]*`, NameVariable, nil},
|
||||
{`\[\{[\w\W]*?\}\]`, LiteralString, nil},
|
||||
{`[+-]?\d+|0x[\da-fA-F]+|0b[01]+`, LiteralNumber, nil},
|
||||
{`[=<>{}\[\]()*.,!:;]`, Punctuation, nil},
|
||||
},
|
||||
"macro": {
|
||||
{`(#include\s+)("[^"]*")`, ByGroups(CommentPreproc, LiteralString), nil},
|
||||
{`^\s*#(ifdef|ifndef)\s+[_\w][_\w\d]*`, CommentPreproc, nil},
|
||||
{`^\s*#define\s+[_\w][_\w\d]*`, CommentPreproc, nil},
|
||||
{`^\s*#endif`, CommentPreproc, nil},
|
||||
},
|
||||
"whitespace": {
|
||||
{`(\n|\s)+`, Text, nil},
|
||||
{`//.*?\n`, Comment, nil},
|
||||
},
|
||||
"keyword": {
|
||||
{Words(``, `\b`, `bit`, `bits`, `class`, `code`, `dag`, `def`, `defm`, `field`, `foreach`, `in`, `int`, `let`, `list`, `multiclass`, `string`), Keyword, nil},
|
||||
},
|
||||
},
|
||||
))
|
12
vendor/github.com/alecthomas/chroma/lexers/y/yaml.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/y/yaml.go
generated
vendored
@ -15,12 +15,15 @@ var YAML = internal.Register(MustNewLexer(
|
||||
Rules{
|
||||
"root": {
|
||||
Include("whitespace"),
|
||||
{`#.*`, Comment, nil},
|
||||
{`^---`, Text, nil},
|
||||
{`[\n?]?\s*- `, Text, nil},
|
||||
{`#.*$`, Comment, nil},
|
||||
{`!![^\s]+`, CommentPreproc, nil},
|
||||
{`&[^\s]+`, CommentPreproc, nil},
|
||||
{`\*[^\s]+`, CommentPreproc, nil},
|
||||
{`^%include\s+[^\n\r]+`, CommentPreproc, nil},
|
||||
{`([>|+-]\s+)(\s+)((?:(?:.*?$)(?:[\n\r]*?)?)*)`, ByGroups(StringDoc, StringDoc, StringDoc), nil},
|
||||
Include("key"),
|
||||
Include("value"),
|
||||
{`[?:,\[\]]`, Punctuation, nil},
|
||||
{`.`, Text, nil},
|
||||
@ -33,8 +36,15 @@ var YAML = internal.Register(MustNewLexer(
|
||||
{`\b[+\-]?(0x[\da-f]+|0o[0-7]+|(\d+\.?\d*|\.?\d+)(e[\+\-]?\d+)?|\.inf|\.nan)\b`, Number, nil},
|
||||
{`\b[\w]+\b`, Text, nil},
|
||||
},
|
||||
"key": {
|
||||
{`"[^"\n].*": `, Keyword, nil},
|
||||
{`(-)( )([^"\n{]*)(:)( )`, ByGroups(Punctuation, Whitespace, Keyword, Punctuation, Whitespace), nil},
|
||||
{`([^"\n{]*)(:)( )`, ByGroups(Keyword, Punctuation, Whitespace), nil},
|
||||
{`([^"\n{]*)(:)(\n)`, ByGroups(Keyword, Punctuation, Whitespace), nil},
|
||||
},
|
||||
"whitespace": {
|
||||
{`\s+`, Whitespace, nil},
|
||||
{`\n+`, Whitespace, nil},
|
||||
},
|
||||
},
|
||||
))
|
||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -1,4 +1,4 @@
|
||||
# github.com/alecthomas/chroma v0.7.0
|
||||
# github.com/alecthomas/chroma v0.7.1
|
||||
github.com/alecthomas/chroma
|
||||
github.com/alecthomas/chroma/formatters
|
||||
github.com/alecthomas/chroma/formatters/html
|
||||
|
Loading…
Reference in New Issue
Block a user