mirror of
https://github.com/cheat/cheat.git
synced 2025-09-01 17:48:30 +02:00
Compare commits
46 Commits
Author | SHA1 | Date | |
---|---|---|---|
cfd1702bc6 | |||
7406ebfb5e | |||
0737af2fec | |||
a23d372d1f | |||
fe66ff3768 | |||
7fed1f63a6 | |||
a297d1619c | |||
ef1da90a77 | |||
d8f405c112 | |||
f8403ff241 | |||
65f6be3fd8 | |||
1cb53697d2 | |||
14f321b0e6 | |||
d3250fda79 | |||
c482488c41 | |||
fe8f39013e | |||
1016b20ef2 | |||
def8985dcd | |||
e6f12147df | |||
a8c2c396ed | |||
35262df4f2 | |||
12ffa4cb5c | |||
d9c602f9e1 | |||
b67ff8b6a8 | |||
a500a621a1 | |||
23b6928874 | |||
9de39fb12b | |||
ad501c4cbe | |||
f17de401e5 | |||
2c097adeda | |||
b825e0f535 | |||
8385277b28 | |||
768d55e5d4 | |||
6aedc5c116 | |||
e881bb1f97 | |||
501f9c66ad | |||
a2aa82d9f3 | |||
018bce7ad5 | |||
17acefdd9b | |||
37918e09a4 | |||
86967873a8 | |||
d237d98c15 | |||
eb9b3e7798 | |||
b0a351033d | |||
1eb44e8809 | |||
55b18b4897 |
11
.github/dependabot.yml
vendored
Normal file
11
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: gomod
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: daily
|
||||||
|
open-pull-requests-limit: 10
|
||||||
|
ignore:
|
||||||
|
- dependency-name: github.com/alecthomas/chroma
|
||||||
|
versions:
|
||||||
|
- 0.9.1
|
57
.github/workflows/build.yml
vendored
Normal file
57
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
name: Go
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# TODO: is it possible to DRY out these jobs? Aside from `runs-on`, they are
|
||||||
|
# identical.
|
||||||
|
build-linux:
|
||||||
|
runs-on: [ ubuntu-latest ]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: 1.18
|
||||||
|
|
||||||
|
- name: Set up Revive (linter)
|
||||||
|
run: go get -u github.com/boyter/scc github.com/mgechev/revive
|
||||||
|
env:
|
||||||
|
GO111MODULE: off
|
||||||
|
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: make build
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: make test
|
||||||
|
|
||||||
|
build-osx:
|
||||||
|
runs-on: [ macos-latest ]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v2
|
||||||
|
with:
|
||||||
|
go-version: 1.18
|
||||||
|
|
||||||
|
- name: Set up Revive (linter)
|
||||||
|
run: go get -u github.com/boyter/scc github.com/mgechev/revive
|
||||||
|
env:
|
||||||
|
GO111MODULE: off
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: make build
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: make test
|
||||||
|
|
||||||
|
# TODO: windows
|
40
.github/workflows/codeql-analysis.yml
vendored
40
.github/workflows/codeql-analysis.yml
vendored
@ -1,23 +1,12 @@
|
|||||||
# For most projects, this workflow file will not need changing; you simply need
|
name: CodeQL
|
||||||
# to commit it to your repository.
|
|
||||||
#
|
|
||||||
# You may wish to alter this file to override the set of languages analyzed,
|
|
||||||
# or to provide custom queries or build logic.
|
|
||||||
#
|
|
||||||
# ******** NOTE ********
|
|
||||||
# We have attempted to detect the languages in your repository. Please check
|
|
||||||
# the `language` matrix defined below to confirm you have the correct set of
|
|
||||||
# supported CodeQL languages.
|
|
||||||
# ******** NOTE ********
|
|
||||||
|
|
||||||
name: "CodeQL"
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches: [ master ]
|
||||||
|
|
||||||
pull_request:
|
pull_request:
|
||||||
# The branches below must be a subset of the branches above
|
|
||||||
branches: [ master ]
|
branches: [ master ]
|
||||||
|
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '45 23 * * 0'
|
- cron: '45 23 * * 0'
|
||||||
|
|
||||||
@ -30,37 +19,18 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
language: [ 'go' ]
|
language: [ 'go' ]
|
||||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
|
|
||||||
# Learn more...
|
|
||||||
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v1
|
uses: github/codeql-action/init@v1
|
||||||
with:
|
with:
|
||||||
languages: ${{ matrix.language }}
|
languages: ${{ matrix.language }}
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
||||||
# By default, queries listed here will override any specified in a config file.
|
|
||||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
||||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
|
||||||
|
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
- name: Autobuild
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
uses: github/codeql-action/autobuild@v1
|
||||||
#- name: Autobuild
|
|
||||||
#uses: github/codeql-action/autobuild@v1
|
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
|
||||||
# 📚 https://git.io/JvXDl
|
|
||||||
|
|
||||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
|
||||||
# and modify them (or add more) to build your code if your project
|
|
||||||
# uses a compiled language
|
|
||||||
|
|
||||||
- run: make
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v1
|
uses: github/codeql-action/analyze@v1
|
||||||
|
15
.travis.yml
15
.travis.yml
@ -1,15 +0,0 @@
|
|||||||
language: go
|
|
||||||
|
|
||||||
go:
|
|
||||||
- 1.14.x
|
|
||||||
|
|
||||||
os:
|
|
||||||
- linux
|
|
||||||
- osx
|
|
||||||
|
|
||||||
env:
|
|
||||||
- GO111MODULE=on
|
|
||||||
|
|
||||||
install: true
|
|
||||||
|
|
||||||
script: make ci
|
|
@ -19,7 +19,8 @@ tracker][issues] to discuss with the maintainer whether it would be considered
|
|||||||
for merging.
|
for merging.
|
||||||
|
|
||||||
`cheat` is mostly mature and feature-complete, but may still have some room for
|
`cheat` is mostly mature and feature-complete, but may still have some room for
|
||||||
new features.
|
new features. See [HACKING.md][hacking] for a quick-start guide to `cheat`
|
||||||
|
development.
|
||||||
|
|
||||||
#### Add documentation ####
|
#### Add documentation ####
|
||||||
Did you encounter features, bugs, edge-cases, use-cases, or environment
|
Did you encounter features, bugs, edge-cases, use-cases, or environment
|
||||||
@ -35,9 +36,13 @@ Are you unable to do the above, but still want to contribute? You can help
|
|||||||
`cheat` simply by telling others about it. Share it with friends and coworkers
|
`cheat` simply by telling others about it. Share it with friends and coworkers
|
||||||
that might benefit from using it.
|
that might benefit from using it.
|
||||||
|
|
||||||
|
#### Pull Requests ####
|
||||||
|
Please open all pull-requests against the `develop` branch.
|
||||||
|
|
||||||
|
|
||||||
[cheat]: https://github.com/cheat/cheat
|
[cheat]: https://github.com/cheat/cheat
|
||||||
[cheatsheets]: https://github.com/cheat/cheatsheets
|
[cheatsheets]: https://github.com/cheat/cheatsheets
|
||||||
|
[hacking]: HACKING.md
|
||||||
[issues]: https://github.com/cheat/cheat/issues
|
[issues]: https://github.com/cheat/cheat/issues
|
||||||
[pr]: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork
|
[pr]: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork
|
||||||
[wiki]: https://github.com/cheat/cheat/wiki
|
[wiki]: https://github.com/cheat/cheat/wiki
|
||||||
|
57
HACKING.md
Normal file
57
HACKING.md
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
Hacking
|
||||||
|
=======
|
||||||
|
The following is a quickstart guide for developing `cheat`.
|
||||||
|
|
||||||
|
## 1. Install system dependencies
|
||||||
|
Before you begin, you must install a handful of system dependencies. The
|
||||||
|
following are required, and must be available on your `PATH`:
|
||||||
|
|
||||||
|
- `git`
|
||||||
|
- `go` (>= 1.17 is recommended)
|
||||||
|
- `make`
|
||||||
|
|
||||||
|
The following dependencies are optional:
|
||||||
|
- `docker`
|
||||||
|
- `pandoc` (necessary to generate a `man` page)
|
||||||
|
|
||||||
|
## 2. Install utility applications
|
||||||
|
Run `make setup` to install `scc` and `revive`, which are used by various
|
||||||
|
`make` targets.
|
||||||
|
|
||||||
|
## 3. Development workflow
|
||||||
|
After your environment has been configured, your development workflow will
|
||||||
|
resemble the following:
|
||||||
|
|
||||||
|
1. Make changes to the `cheat` source code.
|
||||||
|
2. Run `make test` to run unit-tests.
|
||||||
|
3. Fix compiler errors and failing tests as necessary.
|
||||||
|
4. Run `make`. A `cheat` executable will be written to the `dist` directory.
|
||||||
|
5. Use the new executable by running `dist/cheat <command>`.
|
||||||
|
6. Run `make install` to install `cheat` to your `PATH`.
|
||||||
|
7. Run `make build-release` to build cross-platform binaries in `dist`.
|
||||||
|
8. Run `make clean` to clean the `dist` directory when desired.
|
||||||
|
|
||||||
|
You may run `make help` to see a list of available `make` commands.
|
||||||
|
|
||||||
|
### Developing with docker
|
||||||
|
It may be useful to test your changes within a pristine environment. An
|
||||||
|
Alpine-based docker container has been provided for that purpose.
|
||||||
|
|
||||||
|
If you would like to build the docker container, run:
|
||||||
|
```sh
|
||||||
|
make docker-setup
|
||||||
|
```
|
||||||
|
|
||||||
|
To shell into the container, run:
|
||||||
|
```sh
|
||||||
|
make docker-sh
|
||||||
|
```
|
||||||
|
|
||||||
|
The `cheat` source code will be mounted at `/app` within the container.
|
||||||
|
|
||||||
|
If you would like to destroy this container, you may run:
|
||||||
|
```sh
|
||||||
|
make distclean
|
||||||
|
```
|
||||||
|
|
||||||
|
[go]: https://go.dev/
|
77
INSTALLING.md
Normal file
77
INSTALLING.md
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
Installing
|
||||||
|
==========
|
||||||
|
`cheat` has no runtime dependencies. As such, installing it is generally
|
||||||
|
straightforward. There are a few methods available:
|
||||||
|
|
||||||
|
### Install manually
|
||||||
|
#### Unix-like
|
||||||
|
On Unix-like systems, you may simply paste the following snippet into your terminal:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cd /tmp \
|
||||||
|
&& wget https://github.com/cheat/cheat/releases/download/4.2.5/cheat-linux-amd64.gz \
|
||||||
|
&& gunzip cheat-linux-amd64.gz \
|
||||||
|
&& chmod +x cheat-linux-amd64 \
|
||||||
|
&& sudo mv cheat-linux-amd64 /usr/local/bin/cheat
|
||||||
|
```
|
||||||
|
|
||||||
|
You may need to need to change the version number (`4.2.5`) and the archive
|
||||||
|
(`cheat-linux-amd64.gz`) depending on your platform.
|
||||||
|
|
||||||
|
See the [releases page][releases] for a list of supported platforms.
|
||||||
|
|
||||||
|
#### Windows
|
||||||
|
TODO: community support is requested here. Please open a PR if you'd like to
|
||||||
|
contribute installation instructions for Windows.
|
||||||
|
|
||||||
|
### Install via `go install`
|
||||||
|
If you have `go` version `>=1.17` available on your `PATH`, you can install
|
||||||
|
`cheat` via `go install`:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
go install github.com/cheat/cheat/cmd/cheat@latest
|
||||||
|
```
|
||||||
|
|
||||||
|
### Install via package manager
|
||||||
|
Several community-maintained packages are also available:
|
||||||
|
|
||||||
|
Package manager | Installing
|
||||||
|
---------------- | -----------
|
||||||
|
[brew][] | `brew install cheat`
|
||||||
|
[docker][] | `alias cheat='docker run --rm bannmann/docker-cheat'`
|
||||||
|
[nix][] | `nix-env -iA nixos.cheat`
|
||||||
|
[snap][] | `snap install cheat`
|
||||||
|
|
||||||
|
<!--[pacman][] |-->
|
||||||
|
|
||||||
|
## Configuring
|
||||||
|
Three things must be done before you can use `cheat`:
|
||||||
|
1. A config file must be generated
|
||||||
|
2. [`cheatpaths`][cheatpaths] must be configured
|
||||||
|
3. [Community cheatsheets][community] must be downloaded
|
||||||
|
|
||||||
|
On first run, `cheat` will run an installer that will do all of the above
|
||||||
|
automatically. After the installer is complete, it is strongly advised that you
|
||||||
|
view the configuration file that was generated, as you may want to change some
|
||||||
|
of its default values (to enable colorization, change the paginator, etc).
|
||||||
|
|
||||||
|
### conf.yml ###
|
||||||
|
`cheat` is configured by a YAML file that will be auto-generated on first run.
|
||||||
|
|
||||||
|
By default, the config file is assumed to exist on an XDG-compliant
|
||||||
|
configuration path like `~/.config/cheat/conf.yml`. If you would like to store
|
||||||
|
it elsewhere, you may export a `CHEAT_CONFIG_PATH` environment variable that
|
||||||
|
specifies its path:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
export CHEAT_CONFIG_PATH="~/.dotfiles/cheat/conf.yml"
|
||||||
|
```
|
||||||
|
|
||||||
|
[brew]: https://formulae.brew.sh/formula/cheat
|
||||||
|
[cheatpaths]: README.md#cheatpaths
|
||||||
|
[community]: https://github.com/cheat/cheatsheets/
|
||||||
|
[docker]: https://github.com/bannmann/docker-cheat
|
||||||
|
[nix]: https://search.nixos.org/packages?channel=unstable&show=cheat&from=0&size=50&sort=relevance&type=packages&query=cheat
|
||||||
|
[pacman]: #
|
||||||
|
[releases]: https://github.com/cheat/cheat/releases
|
||||||
|
[snap]: https://snapcraft.io/cheat
|
16
Makefile
16
Makefile
@ -36,21 +36,18 @@ releases := \
|
|||||||
$(dist_dir)/cheat-linux-arm5 \
|
$(dist_dir)/cheat-linux-arm5 \
|
||||||
$(dist_dir)/cheat-linux-arm6 \
|
$(dist_dir)/cheat-linux-arm6 \
|
||||||
$(dist_dir)/cheat-linux-arm7 \
|
$(dist_dir)/cheat-linux-arm7 \
|
||||||
|
$(dist_dir)/cheat-linux-arm64 \
|
||||||
$(dist_dir)/cheat-windows-amd64.exe
|
$(dist_dir)/cheat-windows-amd64.exe
|
||||||
|
|
||||||
## build: build an executable for your architecture
|
## build: build an executable for your architecture
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build: $(dist_dir) clean vendor generate man
|
build: $(dist_dir) clean fmt lint vet vendor generate man
|
||||||
$(GO) build $(BUILD_FLAGS) -o $(dist_dir)/cheat $(cmd_dir)
|
$(GO) build $(BUILD_FLAGS) -o $(dist_dir)/cheat $(cmd_dir)
|
||||||
|
|
||||||
## build-release: build release executables
|
## build-release: build release executables
|
||||||
.PHONY: build-release
|
.PHONY: build-release
|
||||||
build-release: $(releases)
|
build-release: $(releases)
|
||||||
|
|
||||||
## ci: build a "release" executable for the current architecture (used in ci)
|
|
||||||
.PHONY: ci
|
|
||||||
ci: | setup prepare build
|
|
||||||
|
|
||||||
# cheat-darwin-amd64
|
# cheat-darwin-amd64
|
||||||
$(dist_dir)/cheat-darwin-amd64: prepare
|
$(dist_dir)/cheat-darwin-amd64: prepare
|
||||||
GOARCH=amd64 GOOS=darwin \
|
GOARCH=amd64 GOOS=darwin \
|
||||||
@ -81,10 +78,15 @@ $(dist_dir)/cheat-linux-arm7: prepare
|
|||||||
GOARCH=arm GOOS=linux GOARM=7 \
|
GOARCH=arm GOOS=linux GOARM=7 \
|
||||||
$(GO) build $(BUILD_FLAGS) -o $@ $(cmd_dir) && $(GZIP) $@ && chmod -x $@.gz
|
$(GO) build $(BUILD_FLAGS) -o $@ $(cmd_dir) && $(GZIP) $@ && chmod -x $@.gz
|
||||||
|
|
||||||
|
# cheat-linux-arm64
|
||||||
|
$(dist_dir)/cheat-linux-arm64: prepare
|
||||||
|
GOARCH=arm64 GOOS=linux \
|
||||||
|
$(GO) build $(BUILD_FLAGS) -o $@ $(cmd_dir) && $(GZIP) $@ && chmod -x $@.gz
|
||||||
|
|
||||||
# cheat-windows-amd64
|
# cheat-windows-amd64
|
||||||
$(dist_dir)/cheat-windows-amd64.exe: prepare
|
$(dist_dir)/cheat-windows-amd64.exe: prepare
|
||||||
GOARCH=amd64 GOOS=windows \
|
GOARCH=amd64 GOOS=windows \
|
||||||
$(GO) build $(BUILD_FLAGS) -o $@ $(cmd_dir) && $(ZIP) $@.zip $@
|
$(GO) build $(BUILD_FLAGS) -o $@ $(cmd_dir) && $(ZIP) $@.zip $@ -j
|
||||||
|
|
||||||
# ./dist
|
# ./dist
|
||||||
$(dist_dir):
|
$(dist_dir):
|
||||||
@ -138,7 +140,7 @@ vendor:
|
|||||||
|
|
||||||
## vendor-update: update vendored dependencies
|
## vendor-update: update vendored dependencies
|
||||||
vendor-update:
|
vendor-update:
|
||||||
$(GO) get -t -u ./...
|
$(GO) get -t -u ./... && $(GO) mod vendor
|
||||||
|
|
||||||
## fmt: run go fmt
|
## fmt: run go fmt
|
||||||
.PHONY: fmt
|
.PHONY: fmt
|
||||||
|
181
README.md
181
README.md
@ -1,8 +1,9 @@
|
|||||||
|

|
||||||
|
|
||||||
|
|
||||||
cheat
|
cheat
|
||||||
=====
|
=====
|
||||||
|
|
||||||
[](https://travis-ci.com/cheat/cheat)
|
|
||||||
|
|
||||||
`cheat` allows you to create and view interactive cheatsheets on the
|
`cheat` allows you to create and view interactive cheatsheets on the
|
||||||
command-line. It was designed to help remind \*nix system administrators of
|
command-line. It was designed to help remind \*nix system administrators of
|
||||||
options for commands that they use frequently, but not frequently enough to
|
options for commands that they use frequently, but not frequently enough to
|
||||||
@ -41,99 +42,6 @@ tar -xjvf '/path/to/foo.tgz'
|
|||||||
tar -cjvf '/path/to/foo.tgz' '/path/to/foo/'
|
tar -cjvf '/path/to/foo.tgz' '/path/to/foo/'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
Installing
|
|
||||||
----------
|
|
||||||
`cheat` has no dependencies. To install it, download the executable from the
|
|
||||||
[releases][] page and place it on your `PATH`.
|
|
||||||
|
|
||||||
Alternatively, if you have [go][] installed, you may install `cheat` using `go
|
|
||||||
get`:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
go get -u github.com/cheat/cheat/cmd/cheat
|
|
||||||
```
|
|
||||||
|
|
||||||
Configuring
|
|
||||||
-----------
|
|
||||||
### conf.yml ###
|
|
||||||
`cheat` is configured by a YAML file that will be auto-generated on first run.
|
|
||||||
|
|
||||||
By default, the config file is assumed to exist on an XDG-compliant
|
|
||||||
configuration path like `~/.config/cheat/conf.yml`. If you would like to store
|
|
||||||
it elsewhere, you may export a `CHEAT_CONFIG_PATH` environment variable that
|
|
||||||
specifies its path:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
export CHEAT_CONFIG_PATH="~/.dotfiles/cheat/conf.yml"
|
|
||||||
```
|
|
||||||
|
|
||||||
Cheatsheets
|
|
||||||
-----------
|
|
||||||
Cheatsheets are plain-text files with no file extension, and are named
|
|
||||||
according to the command used to view them:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
cheat tar # file is named "tar"
|
|
||||||
cheat foo/bar # file is named "bar", in a "foo" subdirectory
|
|
||||||
```
|
|
||||||
|
|
||||||
Cheatsheet text may optionally be preceeded by a YAML frontmatter header that
|
|
||||||
assigns tags and specifies syntax:
|
|
||||||
|
|
||||||
```
|
|
||||||
---
|
|
||||||
syntax: javascript
|
|
||||||
tags: [ array, map ]
|
|
||||||
---
|
|
||||||
// To map over an array:
|
|
||||||
const squares = [1, 2, 3, 4].map(x => x * x);
|
|
||||||
```
|
|
||||||
|
|
||||||
The `cheat` executable includes no cheatsheets, but [community-sourced
|
|
||||||
cheatsheets are available][cheatsheets]. You will be asked if you would like to
|
|
||||||
install the community-sourced cheatsheets the first time you run `cheat`.
|
|
||||||
|
|
||||||
|
|
||||||
Cheatpaths
|
|
||||||
----------
|
|
||||||
Cheatsheets are stored on "cheatpaths", which are directories that contain
|
|
||||||
cheatsheets. Cheatpaths are specified in the `conf.yml` file.
|
|
||||||
|
|
||||||
It can be useful to configure `cheat` against multiple cheatpaths. A common
|
|
||||||
pattern is to store cheatsheets from multiple repositories on individual
|
|
||||||
cheatpaths:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
# conf.yml:
|
|
||||||
# ...
|
|
||||||
cheatpaths:
|
|
||||||
- name: community # a name for the cheatpath
|
|
||||||
path: ~/documents/cheat/community # the path's location on the filesystem
|
|
||||||
tags: [ community ] # these tags will be applied to all sheets on the path
|
|
||||||
readonly: true # if true, `cheat` will not create new cheatsheets here
|
|
||||||
|
|
||||||
- name: personal
|
|
||||||
path: ~/documents/cheat/personal # this is a separate directory and repository than above
|
|
||||||
tags: [ personal ]
|
|
||||||
readonly: false # new sheets may be written here
|
|
||||||
# ...
|
|
||||||
```
|
|
||||||
|
|
||||||
The `readonly` option instructs `cheat` not to edit (or create) any cheatsheets
|
|
||||||
on the path. This is useful to prevent merge-conflicts from arising on upstream
|
|
||||||
cheatsheet repositories.
|
|
||||||
|
|
||||||
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
|
Usage
|
||||||
-----
|
-----
|
||||||
To view a cheatsheet:
|
To view a cheatsheet:
|
||||||
@ -194,7 +102,77 @@ cheat -p personal -t networking --regex -s '(?:[0-9]{1,3}\.){3}[0-9]{1,3}'
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
Advanced Usage
|
|
||||||
|
Installing
|
||||||
|
----------
|
||||||
|
For installation and configuration instructions, see [INSTALLING.md][].
|
||||||
|
|
||||||
|
Cheatsheets
|
||||||
|
-----------
|
||||||
|
Cheatsheets are plain-text files with no file extension, and are named
|
||||||
|
according to the command used to view them:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cheat tar # file is named "tar"
|
||||||
|
cheat foo/bar # file is named "bar", in a "foo" subdirectory
|
||||||
|
```
|
||||||
|
|
||||||
|
Cheatsheet text may optionally be preceeded by a YAML frontmatter header that
|
||||||
|
assigns tags and specifies syntax:
|
||||||
|
|
||||||
|
```
|
||||||
|
---
|
||||||
|
syntax: javascript
|
||||||
|
tags: [ array, map ]
|
||||||
|
---
|
||||||
|
// To map over an array:
|
||||||
|
const squares = [1, 2, 3, 4].map(x => x * x);
|
||||||
|
```
|
||||||
|
|
||||||
|
The `cheat` executable includes no cheatsheets, but [community-sourced
|
||||||
|
cheatsheets are available][cheatsheets]. You will be asked if you would like to
|
||||||
|
install the community-sourced cheatsheets the first time you run `cheat`.
|
||||||
|
|
||||||
|
Cheatpaths
|
||||||
|
----------
|
||||||
|
Cheatsheets are stored on "cheatpaths", which are directories that contain
|
||||||
|
cheatsheets. Cheatpaths are specified in the `conf.yml` file.
|
||||||
|
|
||||||
|
It can be useful to configure `cheat` against multiple cheatpaths. A common
|
||||||
|
pattern is to store cheatsheets from multiple repositories on individual
|
||||||
|
cheatpaths:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# conf.yml:
|
||||||
|
# ...
|
||||||
|
cheatpaths:
|
||||||
|
- name: community # a name for the cheatpath
|
||||||
|
path: ~/documents/cheat/community # the path's location on the filesystem
|
||||||
|
tags: [ community ] # these tags will be applied to all sheets on the path
|
||||||
|
readonly: true # if true, `cheat` will not create new cheatsheets here
|
||||||
|
|
||||||
|
- name: personal
|
||||||
|
path: ~/documents/cheat/personal # this is a separate directory and repository than above
|
||||||
|
tags: [ personal ]
|
||||||
|
readonly: false # new sheets may be written here
|
||||||
|
# ...
|
||||||
|
```
|
||||||
|
|
||||||
|
The `readonly` option instructs `cheat` not to edit (or create) any cheatsheets
|
||||||
|
on the path. This is useful to prevent merge-conflicts from arising on upstream
|
||||||
|
cheatsheet repositories.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
Autocompletion
|
||||||
--------------
|
--------------
|
||||||
Shell autocompletion is currently available for `bash`, `fish`, and `zsh`. Copy
|
Shell autocompletion is currently available for `bash`, `fish`, and `zsh`. Copy
|
||||||
the relevant [completion script][completions] into the appropriate directory on
|
the relevant [completion script][completions] into the appropriate directory on
|
||||||
@ -207,8 +185,9 @@ Additionally, `cheat` supports enhanced autocompletion via integration with
|
|||||||
1. Ensure that `fzf` is available on your `$PATH`
|
1. Ensure that `fzf` is available on your `$PATH`
|
||||||
2. Set an envvar: `export CHEAT_USE_FZF=true`
|
2. Set an envvar: `export CHEAT_USE_FZF=true`
|
||||||
|
|
||||||
[Releases]: https://github.com/cheat/cheat/releases
|
[INSTALLING.md]: INSTALLING.md
|
||||||
[cheatsheets]: https://github.com/cheat/cheatsheets
|
[Releases]: https://github.com/cheat/cheat/releases
|
||||||
[completions]: https://github.com/cheat/cheat/tree/master/scripts
|
[cheatsheets]: https://github.com/cheat/cheatsheets
|
||||||
[fzf]: https://github.com/junegunn/fzf
|
[completions]: https://github.com/cheat/cheat/tree/master/scripts
|
||||||
[go]: https://golang.org
|
[fzf]: https://github.com/junegunn/fzf
|
||||||
|
[go]: https://golang.org
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
//go:build ignore
|
||||||
// +build ignore
|
// +build ignore
|
||||||
|
|
||||||
// This script embeds `docopt.txt and `conf.yml` into the binary during at
|
// This script embeds `docopt.txt and `conf.yml` into the binary during at
|
||||||
@ -5,13 +6,11 @@
|
|||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -52,10 +51,10 @@ func main() {
|
|||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
|
|
||||||
// delete the outfile
|
// delete the outfile
|
||||||
os.Remove(path.Join(root, file.Out))
|
os.Remove(filepath.Join(root, file.Out))
|
||||||
|
|
||||||
// read the static template
|
// read the static template
|
||||||
bytes, err := ioutil.ReadFile(path.Join(root, file.In))
|
bytes, err := ioutil.ReadFile(filepath.Join(root, file.In))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -64,7 +63,7 @@ func main() {
|
|||||||
data := template(file.Method, string(bytes))
|
data := template(file.Method, string(bytes))
|
||||||
|
|
||||||
// write the file to the specified outpath
|
// write the file to the specified outpath
|
||||||
spath := path.Join(root, file.Out)
|
spath := filepath.Join(root, file.Out)
|
||||||
err = ioutil.WriteFile(spath, []byte(data), 0644)
|
err = ioutil.WriteFile(spath, []byte(data), 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/cheat/cheat/internal/cheatpath"
|
"github.com/cheat/cheat/internal/cheatpath"
|
||||||
@ -58,10 +58,10 @@ func cmdEdit(opts map[string]interface{}, conf config.Config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// compute the new edit path
|
// compute the new edit path
|
||||||
editpath = path.Join(writepath.Path, sheet.Title)
|
editpath = filepath.Join(writepath.Path, sheet.Title)
|
||||||
|
|
||||||
// create any necessary subdirectories
|
// create any necessary subdirectories
|
||||||
dirs := path.Dir(editpath)
|
dirs := filepath.Dir(editpath)
|
||||||
if dirs != "." {
|
if dirs != "." {
|
||||||
if err := os.MkdirAll(dirs, 0755); err != nil {
|
if err := os.MkdirAll(dirs, 0755); err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "failed to create directory: %s, %v\n", dirs, err)
|
fmt.Fprintf(os.Stderr, "failed to create directory: %s, %v\n", dirs, err)
|
||||||
@ -87,10 +87,10 @@ func cmdEdit(opts map[string]interface{}, conf config.Config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// compute the new edit path
|
// compute the new edit path
|
||||||
editpath = path.Join(writepath.Path, cheatsheet)
|
editpath = filepath.Join(writepath.Path, cheatsheet)
|
||||||
|
|
||||||
// create any necessary subdirectories
|
// create any necessary subdirectories
|
||||||
dirs := path.Dir(editpath)
|
dirs := filepath.Dir(editpath)
|
||||||
if dirs != "." {
|
if dirs != "." {
|
||||||
if err := os.MkdirAll(dirs, 0755); err != nil {
|
if err := os.MkdirAll(dirs, 0755); err != nil {
|
||||||
fmt.Fprintf(os.Stderr, "failed to create directory: %s, %v\n", dirs, err)
|
fmt.Fprintf(os.Stderr, "failed to create directory: %s, %v\n", dirs, err)
|
||||||
|
@ -3,7 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -42,11 +42,11 @@ func cmdInit() {
|
|||||||
// determine the appropriate paths for config data and (optional) community
|
// determine the appropriate paths for config data and (optional) community
|
||||||
// cheatsheets based on the user's platform
|
// cheatsheets based on the user's platform
|
||||||
confpath := confpaths[0]
|
confpath := confpaths[0]
|
||||||
confdir := path.Dir(confpath)
|
confdir := filepath.Dir(confpath)
|
||||||
|
|
||||||
// create paths for community and personal cheatsheets
|
// create paths for community and personal cheatsheets
|
||||||
community := path.Join(confdir, "/cheatsheets/community")
|
community := filepath.Join(confdir, "cheatsheets", "community")
|
||||||
personal := path.Join(confdir, "/cheatsheets/personal")
|
personal := filepath.Join(confdir, "cheatsheets", "personal")
|
||||||
|
|
||||||
// template the above paths into the default configs
|
// template the above paths into the default configs
|
||||||
configs = strings.Replace(configs, "COMMUNITY_PATH", community, -1)
|
configs = strings.Replace(configs, "COMMUNITY_PATH", community, -1)
|
||||||
|
@ -25,7 +25,7 @@ func cmdList(opts map[string]interface{}, conf config.Config) {
|
|||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// filter cheatcheats by tag if --tag was provided
|
// filter cheatsheets by tag if --tag was provided
|
||||||
if opts["--tag"] != nil {
|
if opts["--tag"] != nil {
|
||||||
cheatsheets = sheets.Filter(
|
cheatsheets = sheets.Filter(
|
||||||
cheatsheets,
|
cheatsheets,
|
||||||
|
@ -16,12 +16,12 @@ import (
|
|||||||
"github.com/cheat/cheat/internal/installer"
|
"github.com/cheat/cheat/internal/installer"
|
||||||
)
|
)
|
||||||
|
|
||||||
const version = "4.2.0"
|
const version = "4.2.6"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
// initialize options
|
// initialize options
|
||||||
opts, err := docopt.Parse(usage(), nil, true, version, false)
|
opts, err := docopt.ParseArgs(usage(), nil, version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// panic here, because this should never happen
|
// panic here, because this should never happen
|
||||||
panic(fmt.Errorf("docopt failed to parse: %v", err))
|
panic(fmt.Errorf("docopt failed to parse: %v", err))
|
||||||
@ -45,6 +45,9 @@ func main() {
|
|||||||
envvars := map[string]string{}
|
envvars := map[string]string{}
|
||||||
for _, e := range os.Environ() {
|
for _, e := range os.Environ() {
|
||||||
pair := strings.SplitN(e, "=", 2)
|
pair := strings.SplitN(e, "=", 2)
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
pair[0] = strings.ToUpper(pair[0])
|
||||||
|
}
|
||||||
envvars[pair[0]] = pair[1]
|
envvars[pair[0]] = pair[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,22 +9,22 @@ import (
|
|||||||
func configs() string {
|
func configs() string {
|
||||||
return strings.TrimSpace(`---
|
return strings.TrimSpace(`---
|
||||||
# The editor to use with 'cheat -e <sheet>'. Defaults to $EDITOR or $VISUAL.
|
# The editor to use with 'cheat -e <sheet>'. Defaults to $EDITOR or $VISUAL.
|
||||||
editor: vim
|
# editor: vim
|
||||||
|
|
||||||
# Should 'cheat' always colorize output?
|
# Should 'cheat' always colorize output?
|
||||||
colorize: true
|
colorize: false
|
||||||
|
|
||||||
# Which 'chroma' colorscheme should be applied to the output?
|
# Which 'chroma' colorscheme should be applied to the output?
|
||||||
# Options are available here:
|
# Options are available here:
|
||||||
# https://github.com/alecthomas/chroma/tree/master/styles
|
# https://github.com/alecthomas/chroma/tree/master/styles
|
||||||
style: monokai
|
# style: monokai
|
||||||
|
|
||||||
# Which 'chroma' "formatter" should be applied?
|
# Which 'chroma' "formatter" should be applied?
|
||||||
# One of: "terminal", "terminal256", "terminal16m"
|
# One of: "terminal", "terminal256", "terminal16m"
|
||||||
formatter: terminal16m
|
formatter: terminal
|
||||||
|
|
||||||
# Through which pager should output be piped? (Unset this key for no pager.)
|
# Through which pager should output be piped?
|
||||||
pager: less -FRX
|
# pager: less -FRX # <- recommended where available
|
||||||
|
|
||||||
# The paths at which cheatsheets are available. Tags associated with a cheatpath
|
# The paths at which cheatsheets are available. Tags associated with a cheatpath
|
||||||
# are automatically attached to all cheatsheets residing on that path.
|
# are automatically attached to all cheatsheets residing on that path.
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
---
|
---
|
||||||
# The editor to use with 'cheat -e <sheet>'. Defaults to $EDITOR or $VISUAL.
|
# The editor to use with 'cheat -e <sheet>'. Defaults to $EDITOR or $VISUAL.
|
||||||
editor: vim
|
# editor: vim
|
||||||
|
|
||||||
# Should 'cheat' always colorize output?
|
# Should 'cheat' always colorize output?
|
||||||
colorize: true
|
colorize: false
|
||||||
|
|
||||||
# Which 'chroma' colorscheme should be applied to the output?
|
# Which 'chroma' colorscheme should be applied to the output?
|
||||||
# Options are available here:
|
# Options are available here:
|
||||||
# https://github.com/alecthomas/chroma/tree/master/styles
|
# https://github.com/alecthomas/chroma/tree/master/styles
|
||||||
style: monokai
|
# style: monokai
|
||||||
|
|
||||||
# Which 'chroma' "formatter" should be applied?
|
# Which 'chroma' "formatter" should be applied?
|
||||||
# One of: "terminal", "terminal256", "terminal16m"
|
# One of: "terminal", "terminal256", "terminal16m"
|
||||||
formatter: terminal16m
|
formatter: terminal
|
||||||
|
|
||||||
# Through which pager should output be piped? (Unset this key for no pager.)
|
# Through which pager should output be piped?
|
||||||
pager: less -FRX
|
# pager: less -FRX # <- recommended where available
|
||||||
|
|
||||||
# The paths at which cheatsheets are available. Tags associated with a cheatpath
|
# The paths at which cheatsheets are available. Tags associated with a cheatpath
|
||||||
# are automatically attached to all cheatsheets residing on that path.
|
# are automatically attached to all cheatsheets residing on that path.
|
||||||
|
9
go.mod
9
go.mod
@ -3,16 +3,15 @@ module github.com/cheat/cheat
|
|||||||
go 1.14
|
go 1.14
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/alecthomas/chroma v0.8.2
|
github.com/alecthomas/chroma v0.10.0
|
||||||
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.7.0 // indirect
|
||||||
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
|
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815
|
||||||
github.com/kr/text v0.2.0 // indirect
|
github.com/kr/text v0.2.0 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.12
|
github.com/mattn/go-isatty v0.0.14
|
||||||
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
|
golang.org/x/sys v0.0.0-20220731174439-a90be440212d // 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.4.0
|
gopkg.in/yaml.v2 v2.4.0
|
||||||
|
56
go.sum
56
go.sum
@ -1,68 +1,38 @@
|
|||||||
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U=
|
github.com/alecthomas/chroma v0.10.0 h1:7XDcGkCQopCNKjZHfYrNLraA+M7e0fMiJ/Mfikbfjek=
|
||||||
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI=
|
github.com/alecthomas/chroma v0.10.0/go.mod h1:jtJATyUxlIORhUOFNA9NZDWGAQ8wpxQQqNSB4rjA/1s=
|
||||||
github.com/alecthomas/chroma v0.8.2 h1:x3zkuE2lUk/RIekyAJ3XRqSCP4zwWDfcw/YJCuCAACg=
|
|
||||||
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/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0=
|
|
||||||
github.com/alecthomas/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE=
|
|
||||||
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/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||||
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=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
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/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/dlclark/regexp2 v1.2.0 h1:8sAhBGEM0dRWogWqWyQeIJnxjWO6oIjl8FKqREDsGfk=
|
|
||||||
github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
|
|
||||||
github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E=
|
|
||||||
github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
|
github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
|
||||||
|
github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo=
|
||||||
|
github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
|
||||||
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815 h1:bWDMxwH3px2JBh6AyO7hdCn/PkvCZXii8TGj7sbtEbQ=
|
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/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
|
||||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
|
||||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
|
||||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
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/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
|
||||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||||
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/pkg/errors v0.9.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 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
|
|
||||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
|
||||||
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
|
|
||||||
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
golang.org/x/sys v0.0.0-20220731174439-a90be440212d h1:Sv5ogFZatcgIMMtBSTTAgMYsicp25MXBubjXNDKwm80=
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
golang.org/x/sys v0.0.0-20220731174439-a90be440212d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg=
|
|
||||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/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/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20201126233918-771906719818 h1:f1CIuDlJhwANEC2MM87MBEVMr3jl5bifgsfj90XAF9c=
|
|
||||||
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/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-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
|
||||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0 h1:POO/ycCATvegFmVuPpQzZFJ+pGZeX22Ufu6fibxDVjU=
|
gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0 h1:POO/ycCATvegFmVuPpQzZFJ+pGZeX22Ufu6fibxDVjU=
|
||||||
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.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||||
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
@ -4,7 +4,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
cp "github.com/cheat/cheat/internal/cheatpath"
|
cp "github.com/cheat/cheat/internal/cheatpath"
|
||||||
@ -98,8 +100,22 @@ func New(opts map[string]interface{}, confPath string, resolve bool) (Config, er
|
|||||||
conf.Editor = os.Getenv("VISUAL")
|
conf.Editor = os.Getenv("VISUAL")
|
||||||
} else if os.Getenv("EDITOR") != "" {
|
} else if os.Getenv("EDITOR") != "" {
|
||||||
conf.Editor = os.Getenv("EDITOR")
|
conf.Editor = os.Getenv("EDITOR")
|
||||||
|
} else if runtime.GOOS == "windows" {
|
||||||
|
conf.Editor = "notepad"
|
||||||
} else {
|
} else {
|
||||||
return Config{}, fmt.Errorf("no editor set")
|
// try to fall back to `nano`
|
||||||
|
path, err := exec.LookPath("nano")
|
||||||
|
if err != nil {
|
||||||
|
return Config{}, fmt.Errorf("failed to locate nano: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// use `nano` if we found it
|
||||||
|
if path != "" {
|
||||||
|
conf.Editor = "nano"
|
||||||
|
// otherwise, give up
|
||||||
|
} else {
|
||||||
|
return Config{}, fmt.Errorf("no editor set")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,12 +126,41 @@ func New(opts map[string]interface{}, confPath string, resolve bool) (Config, er
|
|||||||
|
|
||||||
// if a chroma formatter was not provided, set a default
|
// if a chroma formatter was not provided, set a default
|
||||||
if conf.Formatter == "" {
|
if conf.Formatter == "" {
|
||||||
conf.Formatter = "terminal16m"
|
conf.Formatter = "terminal"
|
||||||
}
|
}
|
||||||
|
|
||||||
// if a pager was not provided, set a default
|
// attempt to fall back to `PAGER` if a pager is not specified in configs
|
||||||
if strings.TrimSpace(conf.Pager) == "" {
|
conf.Pager = strings.TrimSpace(conf.Pager)
|
||||||
conf.Pager = ""
|
if conf.Pager == "" {
|
||||||
|
// look for `pager`, `less`, and `more` on the system PATH
|
||||||
|
pagerPath, _ := exec.LookPath("pager")
|
||||||
|
lessPath, _ := exec.LookPath("less")
|
||||||
|
morePath, _ := exec.LookPath("more")
|
||||||
|
|
||||||
|
// search first for a `PAGER` envvar
|
||||||
|
if os.Getenv("PAGER") != "" {
|
||||||
|
conf.Pager = os.Getenv("PAGER")
|
||||||
|
|
||||||
|
// search for `pager`
|
||||||
|
} else if pagerPath != "" {
|
||||||
|
conf.Pager = pagerPath
|
||||||
|
|
||||||
|
// search for `less`
|
||||||
|
} else if lessPath != "" {
|
||||||
|
conf.Pager = lessPath
|
||||||
|
|
||||||
|
// search for `more`
|
||||||
|
//
|
||||||
|
// XXX: this causes issues on some Linux systems. See:
|
||||||
|
// https://github.com/cheat/cheat/issues/681#issuecomment-1201842334
|
||||||
|
//
|
||||||
|
// By checking for `more` last, we're hoping to at least mitigate
|
||||||
|
// the frequency of this occurrence, because `pager` and `less` are
|
||||||
|
// likely to be available on most systems on which a user is likely
|
||||||
|
// to have installed `cheat`.
|
||||||
|
} else if morePath != "" {
|
||||||
|
conf.Pager = morePath
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return conf, nil
|
return conf, nil
|
||||||
|
@ -39,17 +39,17 @@ func TestConfigSuccessful(t *testing.T) {
|
|||||||
// assert that the cheatpaths are correct
|
// assert that the cheatpaths are correct
|
||||||
want := []cheatpath.Cheatpath{
|
want := []cheatpath.Cheatpath{
|
||||||
cheatpath.Cheatpath{
|
cheatpath.Cheatpath{
|
||||||
Path: filepath.Join(home, ".dotfiles/cheat/community"),
|
Path: filepath.Join(home, ".dotfiles", "cheat", "community"),
|
||||||
ReadOnly: true,
|
ReadOnly: true,
|
||||||
Tags: []string{"community"},
|
Tags: []string{"community"},
|
||||||
},
|
},
|
||||||
cheatpath.Cheatpath{
|
cheatpath.Cheatpath{
|
||||||
Path: filepath.Join(home, ".dotfiles/cheat/work"),
|
Path: filepath.Join(home, ".dotfiles", "cheat", "work"),
|
||||||
ReadOnly: false,
|
ReadOnly: false,
|
||||||
Tags: []string{"work"},
|
Tags: []string{"work"},
|
||||||
},
|
},
|
||||||
cheatpath.Cheatpath{
|
cheatpath.Cheatpath{
|
||||||
Path: filepath.Join(home, ".dotfiles/cheat/personal"),
|
Path: filepath.Join(home, ".dotfiles", "cheat", "personal"),
|
||||||
ReadOnly: false,
|
ReadOnly: false,
|
||||||
Tags: []string{"personal"},
|
Tags: []string{"personal"},
|
||||||
},
|
},
|
||||||
@ -85,8 +85,8 @@ func TestEmptyEditor(t *testing.T) {
|
|||||||
|
|
||||||
// initialize a config
|
// initialize a config
|
||||||
conf, err := New(map[string]interface{}{}, mock.Path("conf/empty.yml"), false)
|
conf, err := New(map[string]interface{}{}, mock.Path("conf/empty.yml"), false)
|
||||||
if err == nil {
|
if err != nil {
|
||||||
t.Errorf("failed to return an error on empty editor")
|
t.Errorf("failed to initialize test: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// set editor, and assert that it is respected
|
// set editor, and assert that it is respected
|
||||||
|
@ -2,7 +2,7 @@ package config
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"path"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/mitchellh/go-homedir"
|
"github.com/mitchellh/go-homedir"
|
||||||
)
|
)
|
||||||
@ -28,25 +28,25 @@ func Paths(
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch sys {
|
switch sys {
|
||||||
case "darwin", "linux", "freebsd":
|
case "android", "darwin", "linux", "freebsd":
|
||||||
paths := []string{}
|
paths := []string{}
|
||||||
|
|
||||||
// don't include the `XDG_CONFIG_HOME` path if that envvar is not set
|
// don't include the `XDG_CONFIG_HOME` path if that envvar is not set
|
||||||
if xdgpath, ok := envvars["XDG_CONFIG_HOME"]; ok {
|
if xdgpath, ok := envvars["XDG_CONFIG_HOME"]; ok {
|
||||||
paths = append(paths, path.Join(xdgpath, "/cheat/conf.yml"))
|
paths = append(paths, filepath.Join(xdgpath, "cheat", "conf.yml"))
|
||||||
}
|
}
|
||||||
|
|
||||||
paths = append(paths, []string{
|
paths = append(paths, []string{
|
||||||
path.Join(home, ".config/cheat/conf.yml"),
|
filepath.Join(home, ".config", "cheat", "conf.yml"),
|
||||||
path.Join(home, ".cheat/conf.yml"),
|
filepath.Join(home, ".cheat", "conf.yml"),
|
||||||
"/etc/cheat/conf.yml",
|
"/etc/cheat/conf.yml",
|
||||||
}...)
|
}...)
|
||||||
|
|
||||||
return paths, nil
|
return paths, nil
|
||||||
case "windows":
|
case "windows":
|
||||||
return []string{
|
return []string{
|
||||||
path.Join(envvars["APPDATA"], "/cheat/conf.yml"),
|
filepath.Join(envvars["APPDATA"], "cheat", "conf.yml"),
|
||||||
path.Join(envvars["PROGRAMDATA"], "/cheat/conf.yml"),
|
filepath.Join(envvars["PROGRAMDATA"], "cheat", "conf.yml"),
|
||||||
}, nil
|
}, nil
|
||||||
default:
|
default:
|
||||||
return []string{}, fmt.Errorf("unsupported os: %s", sys)
|
return []string{}, fmt.Errorf("unsupported os: %s", sys)
|
||||||
|
@ -21,6 +21,7 @@ func TestValidatePathsNix(t *testing.T) {
|
|||||||
|
|
||||||
// specify the platforms to test
|
// specify the platforms to test
|
||||||
oses := []string{
|
oses := []string{
|
||||||
|
"android",
|
||||||
"darwin",
|
"darwin",
|
||||||
"freebsd",
|
"freebsd",
|
||||||
"linux",
|
"linux",
|
||||||
|
@ -23,7 +23,7 @@ func Prompt(prompt string, def bool) (bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// normalize the answer
|
// normalize the answer
|
||||||
ans = strings.ToLower(strings.TrimRight(ans, "\n"))
|
ans = strings.ToLower(strings.TrimSpace(ans))
|
||||||
|
|
||||||
// return the appropriate response
|
// return the appropriate response
|
||||||
switch ans {
|
switch ans {
|
||||||
|
@ -3,7 +3,7 @@ package installer
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/cheat/cheat/internal/config"
|
"github.com/cheat/cheat/internal/config"
|
||||||
@ -14,11 +14,11 @@ func Run(configs string, confpath string) error {
|
|||||||
|
|
||||||
// determine the appropriate paths for config data and (optional) community
|
// determine the appropriate paths for config data and (optional) community
|
||||||
// cheatsheets based on the user's platform
|
// cheatsheets based on the user's platform
|
||||||
confdir := path.Dir(confpath)
|
confdir := filepath.Dir(confpath)
|
||||||
|
|
||||||
// create paths for community and personal cheatsheets
|
// create paths for community and personal cheatsheets
|
||||||
community := path.Join(confdir, "/cheatsheets/community")
|
community := filepath.Join(confdir, "cheatsheets", "community")
|
||||||
personal := path.Join(confdir, "/cheatsheets/personal")
|
personal := filepath.Join(confdir, "cheatsheets", "personal")
|
||||||
|
|
||||||
// template the above paths into the default configs
|
// template the above paths into the default configs
|
||||||
configs = strings.Replace(configs, "COMMUNITY_PATH", community, -1)
|
configs = strings.Replace(configs, "COMMUNITY_PATH", community, -1)
|
||||||
@ -36,11 +36,13 @@ func Run(configs string, confpath string) error {
|
|||||||
// clone the community cheatsheets if so instructed
|
// clone the community cheatsheets if so instructed
|
||||||
if yes {
|
if yes {
|
||||||
// clone the community cheatsheets
|
// clone the community cheatsheets
|
||||||
|
fmt.Printf("Cloning community cheatsheets to %s.\n", community)
|
||||||
if err := clone(community); err != nil {
|
if err := clone(community); err != nil {
|
||||||
return fmt.Errorf("failed to clone cheatsheets: %v", err)
|
return fmt.Errorf("failed to clone cheatsheets: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// also create a directory for personal cheatsheets
|
// also create a directory for personal cheatsheets
|
||||||
|
fmt.Printf("Cloning personal cheatsheets to %s.\n", personal)
|
||||||
if err := os.MkdirAll(personal, os.ModePerm); err != nil {
|
if err := os.MkdirAll(personal, os.ModePerm); err != nil {
|
||||||
return fmt.Errorf("failed to create directory: %v", err)
|
return fmt.Errorf("failed to create directory: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Copy copies a cheatsheet to a new location
|
// Copy copies a cheatsheet to a new location
|
||||||
@ -22,7 +22,7 @@ func (s *Sheet) Copy(dest string) error {
|
|||||||
defer infile.Close()
|
defer infile.Close()
|
||||||
|
|
||||||
// create any necessary subdirectories
|
// create any necessary subdirectories
|
||||||
dirs := path.Dir(dest)
|
dirs := filepath.Dir(dest)
|
||||||
if dirs != "." {
|
if dirs != "." {
|
||||||
if err := os.MkdirAll(dirs, 0755); err != nil {
|
if err := os.MkdirAll(dirs, 0755); err != nil {
|
||||||
return fmt.Errorf("failed to create directory: %s, %v", dirs, err)
|
return fmt.Errorf("failed to create directory: %s, %v", dirs, err)
|
||||||
|
@ -40,8 +40,7 @@ _cheat() {
|
|||||||
'(-t --tag)'{-t,--tag}'[Return only sheets matching <tag>]: :->taglist' \
|
'(-t --tag)'{-t,--tag}'[Return only sheets matching <tag>]: :->taglist' \
|
||||||
'(-T --tags)'{-T,--tags}'[List all tags in use]: :->none' \
|
'(-T --tags)'{-T,--tags}'[List all tags in use]: :->none' \
|
||||||
'(-v --version)'{-v,--version}'[Print the version number]: :->none' \
|
'(-v --version)'{-v,--version}'[Print the version number]: :->none' \
|
||||||
'(--rm)--rm[Remove (delete) <sheet>]: :->personal' \
|
'(--rm)--rm[Remove (delete) <sheet>]: :->personal'
|
||||||
'(-)*: :->full'
|
|
||||||
|
|
||||||
case $state in
|
case $state in
|
||||||
(none)
|
(none)
|
||||||
@ -63,4 +62,4 @@ _cheat() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
_cheat
|
compdef _cheat cheat
|
||||||
|
46
scripts/git/cheatsheets
Executable file
46
scripts/git/cheatsheets
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
pull() {
|
||||||
|
for d in `cheat -d | awk '{print $2}'`;
|
||||||
|
do
|
||||||
|
echo "Update $d"
|
||||||
|
cd "$d"
|
||||||
|
[ -d ".git" ] && git pull || :
|
||||||
|
done
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Finished update"
|
||||||
|
}
|
||||||
|
|
||||||
|
push() {
|
||||||
|
for d in `cheat -d | grep -v "community" | awk '{print $2}'`;
|
||||||
|
do
|
||||||
|
cd "$d"
|
||||||
|
if [ -d ".git" ]
|
||||||
|
then
|
||||||
|
echo "Push modifications $d"
|
||||||
|
files=$(git ls-files -mo | tr '\n' ' ')
|
||||||
|
git add -A && git commit -m "Edited files: $files" && git push || :
|
||||||
|
else
|
||||||
|
echo "$(pwd) is not a git managed folder"
|
||||||
|
echo "First connect this to your personal git repository"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Finished push operation"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$1" = "pull" ]; then
|
||||||
|
pull
|
||||||
|
elif [ "$1" = "push" ]; then
|
||||||
|
push
|
||||||
|
else
|
||||||
|
echo "Usage:
|
||||||
|
# pull changes
|
||||||
|
cheatsheets pull
|
||||||
|
|
||||||
|
# push changes
|
||||||
|
cheatsheets push"
|
||||||
|
fi
|
16
vendor/github.com/alecthomas/chroma/.golangci.yml
generated
vendored
16
vendor/github.com/alecthomas/chroma/.golangci.yml
generated
vendored
@ -25,6 +25,17 @@ linters:
|
|||||||
- testpackage
|
- testpackage
|
||||||
- godot
|
- godot
|
||||||
- nestif
|
- nestif
|
||||||
|
- paralleltest
|
||||||
|
- nlreturn
|
||||||
|
- cyclop
|
||||||
|
- exhaustivestruct
|
||||||
|
- gci
|
||||||
|
- gofumpt
|
||||||
|
- errorlint
|
||||||
|
- exhaustive
|
||||||
|
- ifshort
|
||||||
|
- wrapcheck
|
||||||
|
- stylecheck
|
||||||
|
|
||||||
linters-settings:
|
linters-settings:
|
||||||
govet:
|
govet:
|
||||||
@ -36,6 +47,11 @@ linters-settings:
|
|||||||
goconst:
|
goconst:
|
||||||
min-len: 8
|
min-len: 8
|
||||||
min-occurrences: 3
|
min-occurrences: 3
|
||||||
|
forbidigo:
|
||||||
|
forbid:
|
||||||
|
- (Must)?NewLexer
|
||||||
|
exclude_godoc_examples: false
|
||||||
|
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
max-per-linter: 0
|
max-per-linter: 0
|
||||||
|
4
vendor/github.com/alecthomas/chroma/.goreleaser.yml
generated
vendored
4
vendor/github.com/alecthomas/chroma/.goreleaser.yml
generated
vendored
@ -14,11 +14,13 @@ builds:
|
|||||||
- darwin
|
- darwin
|
||||||
- windows
|
- windows
|
||||||
goarch:
|
goarch:
|
||||||
|
- arm64
|
||||||
- amd64
|
- amd64
|
||||||
- "386"
|
- "386"
|
||||||
goarm:
|
goarm:
|
||||||
- "6"
|
- "6"
|
||||||
main: ./cmd/chroma/main.go
|
dir: ./cmd/chroma
|
||||||
|
main: .
|
||||||
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
|
ldflags: -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
|
||||||
binary: chroma
|
binary: chroma
|
||||||
archives:
|
archives:
|
||||||
|
6
vendor/github.com/alecthomas/chroma/Makefile
generated
vendored
6
vendor/github.com/alecthomas/chroma/Makefile
generated
vendored
@ -1,5 +1,7 @@
|
|||||||
.PHONY: chromad upload all
|
.PHONY: chromad upload all
|
||||||
|
|
||||||
|
VERSION ?= $(shell git describe --tags --dirty --always)
|
||||||
|
|
||||||
all: README.md tokentype_string.go
|
all: README.md tokentype_string.go
|
||||||
|
|
||||||
README.md: lexers/*/*.go
|
README.md: lexers/*/*.go
|
||||||
@ -9,10 +11,8 @@ tokentype_string.go: types.go
|
|||||||
go generate
|
go generate
|
||||||
|
|
||||||
chromad:
|
chromad:
|
||||||
(cd ./cmd/chromad && go get github.com/GeertJohan/go.rice/rice@master && go install github.com/GeertJohan/go.rice/rice)
|
|
||||||
rm -f chromad
|
rm -f chromad
|
||||||
(export CGOENABLED=0 GOOS=linux ; cd ./cmd/chromad && go build -o ../../chromad .)
|
(export CGOENABLED=0 GOOS=linux GOARCH=amd64; cd ./cmd/chromad && go build -ldflags="-X 'main.version=$(VERSION)'" -o ../../chromad .)
|
||||||
rice append -i ./cmd/chromad --exec=./chromad
|
|
||||||
|
|
||||||
upload: chromad
|
upload: chromad
|
||||||
scp chromad root@swapoff.org: && \
|
scp chromad root@swapoff.org: && \
|
||||||
|
49
vendor/github.com/alecthomas/chroma/README.md
generated
vendored
49
vendor/github.com/alecthomas/chroma/README.md
generated
vendored
@ -1,4 +1,5 @@
|
|||||||
# Chroma — A general purpose syntax highlighter in pure Go [](https://godoc.org/github.com/alecthomas/chroma) [](https://circleci.com/gh/alecthomas/chroma) [](https://goreportcard.com/report/github.com/alecthomas/chroma) [](https://gophers.slack.com/messages/CN9DS8YF3)
|
# Chroma — A general purpose syntax highlighter in pure Go
|
||||||
|
[](https://godoc.org/github.com/alecthomas/chroma) [](https://github.com/alecthomas/chroma/actions/workflows/ci.yml) [](https://invite.slack.golangbridge.org/)
|
||||||
|
|
||||||
> **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,12 +37,12 @@ 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, BibTeX, BlitzBasic, BNF, Brainfuck
|
B | Ballerina, Base Makefile, Bash, Batchfile, BibTeX, Bicep, BlitzBasic, BNF, Brainfuck
|
||||||
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
|
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, Dylan
|
||||||
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, Gherkin, 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, Groff, Groovy
|
||||||
H | Handlebars, Haskell, Haxe, HCL, Hexdump, HLB, HTML, HTTP, Hy
|
H | Handlebars, Haskell, Haxe, HCL, Hexdump, HLB, HTML, HTTP, Hy
|
||||||
I | Idris, Igor, INI, Io
|
I | Idris, Igor, INI, Io
|
||||||
J | J, Java, JavaScript, JSON, Julia, Jungle
|
J | J, Java, JavaScript, JSON, Julia, Jungle
|
||||||
@ -49,11 +50,11 @@ 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, OnesEnterprise, OpenEdge ABL, OpenSCAD, Org Mode
|
||||||
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
|
P | PacmanConf, Perl, PHP, PHTML, Pig, PkgConfig, PL/pgSQL, plaintext, Pony, PostgreSQL SQL dialect, PostScript, POVRay, PowerShell, Prolog, PromQL, Protocol Buffer, Puppet, Python 2, Python
|
||||||
Q | QBasic
|
Q | QBasic
|
||||||
R | R, Racket, Ragel, react, ReasonML, reg, reStructuredText, Rexx, Ruby, Rust
|
R | R, Racket, Ragel, Raku, react, ReasonML, reg, reStructuredText, Rexx, Ruby, Rust
|
||||||
S | SAS, Sass, Scala, Scheme, Scilab, SCSS, Smalltalk, Smarty, Snobol, Solidity, SPARQL, SQL, SquidConf, Standard ML, Stylus, Swift, SYSTEMD, systemverilog
|
S | SAS, Sass, Scala, Scheme, Scilab, SCSS, Smalltalk, Smarty, Snobol, Solidity, SPARQL, SQL, SquidConf, Standard ML, Stylus, Svelte, 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
|
||||||
@ -210,13 +211,13 @@ using the included Python 3 script `pygments2chroma.py`. I use something like
|
|||||||
the following:
|
the following:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
python3 ~/Projects/chroma/_tools/pygments2chroma.py \
|
python3 _tools/pygments2chroma.py \
|
||||||
pygments.lexers.jvm.KotlinLexer \
|
pygments.lexers.jvm.KotlinLexer \
|
||||||
> ~/Projects/chroma/lexers/kotlin.go \
|
> lexers/k/kotlin.go \
|
||||||
&& gofmt -s -w ~/Projects/chroma/lexers/*.go
|
&& gofmt -s -w lexers/k/kotlin.go
|
||||||
```
|
```
|
||||||
|
|
||||||
See notes in [pygments-lexers.go](https://github.com/alecthomas/chroma/blob/master/pygments-lexers.txt)
|
See notes in [pygments-lexers.txt](https://github.com/alecthomas/chroma/blob/master/pygments-lexers.txt)
|
||||||
for a list of lexers, and notes on some of the issues importing them.
|
for a list of lexers, and notes on some of the issues importing them.
|
||||||
|
|
||||||
<a id="markdown-formatters" name="formatters"></a>
|
<a id="markdown-formatters" name="formatters"></a>
|
||||||
@ -249,18 +250,34 @@ For a quick overview of the available styles and how they look, check out the [C
|
|||||||
<a id="markdown-command-line-interface" name="command-line-interface"></a>
|
<a id="markdown-command-line-interface" name="command-line-interface"></a>
|
||||||
## Command-line interface
|
## Command-line interface
|
||||||
|
|
||||||
A command-line interface to Chroma is included. It can be installed with:
|
A command-line interface to Chroma is included.
|
||||||
|
|
||||||
```sh
|
Binaries are available to install from [the releases page](https://github.com/alecthomas/chroma/releases).
|
||||||
go get -u github.com/alecthomas/chroma/cmd/chroma
|
|
||||||
|
The CLI can be used as a preprocessor to colorise output of `less(1)`,
|
||||||
|
see documentation for the `LESSOPEN` environment variable.
|
||||||
|
|
||||||
|
The `--fail` flag can be used to suppress output and return with exit status
|
||||||
|
1 to facilitate falling back to some other preprocessor in case chroma
|
||||||
|
does not resolve a specific lexer to use for the given file. For example:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
export LESSOPEN='| p() { chroma --fail "$1" || cat "$1"; }; p "%s"'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Replace `cat` with your favourite fallback preprocessor.
|
||||||
|
|
||||||
|
When invoked as `.lessfilter`, the `--fail` flag is automatically turned
|
||||||
|
on under the hood for easy integration with [lesspipe shipping with
|
||||||
|
Debian and derivatives](https://manpages.debian.org/lesspipe#USER_DEFINED_FILTERS);
|
||||||
|
for that setup the `chroma` executable can be just symlinked to `~/.lessfilter`.
|
||||||
|
|
||||||
<a id="markdown-whats-missing-compared-to-pygments" name="whats-missing-compared-to-pygments"></a>
|
<a id="markdown-whats-missing-compared-to-pygments" name="whats-missing-compared-to-pygments"></a>
|
||||||
## What's missing compared to Pygments?
|
## What's missing compared to Pygments?
|
||||||
|
|
||||||
- Quite a few lexers, for various reasons (pull-requests welcome):
|
- Quite a few lexers, for various reasons (pull-requests welcome):
|
||||||
- Pygments lexers for complex languages often include custom code to
|
- Pygments lexers for complex languages often include custom code to
|
||||||
handle certain aspects, such as Perl6's ability to nest code inside
|
handle certain aspects, such as Raku's ability to nest code inside
|
||||||
regular expressions. These require time and effort to convert.
|
regular expressions. These require time and effort to convert.
|
||||||
- I mostly only converted languages I had heard of, to reduce the porting cost.
|
- I mostly only converted languages I had heard of, to reduce the porting cost.
|
||||||
- Some more esoteric features of Pygments are omitted for simplicity.
|
- Some more esoteric features of Pygments are omitted for simplicity.
|
||||||
|
73
vendor/github.com/alecthomas/chroma/formatters/html/html.go
generated
vendored
73
vendor/github.com/alecthomas/chroma/formatters/html/html.go
generated
vendored
@ -46,6 +46,13 @@ func WithPreWrapper(wrapper PreWrapper) Option {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WrapLongLines wraps long lines.
|
||||||
|
func WrapLongLines(b bool) Option {
|
||||||
|
return func(f *Formatter) {
|
||||||
|
f.wrapLongLines = b
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// WithLineNumbers formats output with line numbers.
|
// WithLineNumbers formats output with line numbers.
|
||||||
func WithLineNumbers(b bool) Option {
|
func WithLineNumbers(b bool) Option {
|
||||||
return func(f *Formatter) {
|
return func(f *Formatter) {
|
||||||
@ -131,10 +138,18 @@ var (
|
|||||||
}
|
}
|
||||||
defaultPreWrapper = preWrapper{
|
defaultPreWrapper = preWrapper{
|
||||||
start: func(code bool, styleAttr string) string {
|
start: func(code bool, styleAttr string) string {
|
||||||
return fmt.Sprintf("<pre%s>", styleAttr)
|
if code {
|
||||||
|
return fmt.Sprintf(`<pre tabindex="0"%s><code>`, styleAttr)
|
||||||
|
}
|
||||||
|
|
||||||
|
return fmt.Sprintf(`<pre tabindex="0"%s>`, styleAttr)
|
||||||
},
|
},
|
||||||
end: func(code bool) string {
|
end: func(code bool) string {
|
||||||
return "</pre>"
|
if code {
|
||||||
|
return `</code></pre>`
|
||||||
|
}
|
||||||
|
|
||||||
|
return `</pre>`
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -147,6 +162,7 @@ type Formatter struct {
|
|||||||
allClasses bool
|
allClasses bool
|
||||||
preWrapper PreWrapper
|
preWrapper PreWrapper
|
||||||
tabWidth int
|
tabWidth int
|
||||||
|
wrapLongLines bool
|
||||||
lineNumbers bool
|
lineNumbers bool
|
||||||
lineNumbersInTable bool
|
lineNumbersInTable bool
|
||||||
linkableLineNumbers bool
|
linkableLineNumbers bool
|
||||||
@ -197,10 +213,10 @@ func (f *Formatter) writeHTML(w io.Writer, style *chroma.Style, tokens []chroma.
|
|||||||
|
|
||||||
if wrapInTable {
|
if wrapInTable {
|
||||||
// List line numbers in its own <td>
|
// List line numbers in its own <td>
|
||||||
fmt.Fprintf(w, "<div%s>\n", f.styleAttr(css, chroma.Background))
|
fmt.Fprintf(w, "<div%s>\n", f.styleAttr(css, chroma.PreWrapper))
|
||||||
fmt.Fprintf(w, "<table%s><tr>", f.styleAttr(css, chroma.LineTable))
|
fmt.Fprintf(w, "<table%s><tr>", f.styleAttr(css, chroma.LineTable))
|
||||||
fmt.Fprintf(w, "<td%s>\n", f.styleAttr(css, chroma.LineTableTD))
|
fmt.Fprintf(w, "<td%s>\n", f.styleAttr(css, chroma.LineTableTD))
|
||||||
fmt.Fprintf(w, f.preWrapper.Start(false, f.styleAttr(css, chroma.Background)))
|
fmt.Fprintf(w, f.preWrapper.Start(false, f.styleAttr(css, chroma.PreWrapper)))
|
||||||
for index := range lines {
|
for index := range lines {
|
||||||
line := f.baseLineNumber + index
|
line := f.baseLineNumber + index
|
||||||
highlight, next := f.shouldHighlight(highlightIndex, line)
|
highlight, next := f.shouldHighlight(highlightIndex, line)
|
||||||
@ -222,7 +238,7 @@ func (f *Formatter) writeHTML(w io.Writer, style *chroma.Style, tokens []chroma.
|
|||||||
fmt.Fprintf(w, "<td%s>\n", f.styleAttr(css, chroma.LineTableTD, "width:100%"))
|
fmt.Fprintf(w, "<td%s>\n", f.styleAttr(css, chroma.LineTableTD, "width:100%"))
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintf(w, f.preWrapper.Start(true, f.styleAttr(css, chroma.Background)))
|
fmt.Fprintf(w, f.preWrapper.Start(true, f.styleAttr(css, chroma.PreWrapper)))
|
||||||
|
|
||||||
highlightIndex = 0
|
highlightIndex = 0
|
||||||
for index, tokens := range lines {
|
for index, tokens := range lines {
|
||||||
@ -232,14 +248,28 @@ func (f *Formatter) writeHTML(w io.Writer, style *chroma.Style, tokens []chroma.
|
|||||||
if next {
|
if next {
|
||||||
highlightIndex++
|
highlightIndex++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Start of Line
|
||||||
|
fmt.Fprint(w, `<span`)
|
||||||
if highlight {
|
if highlight {
|
||||||
fmt.Fprintf(w, "<span%s>", f.styleAttr(css, chroma.LineHighlight))
|
// Line + LineHighlight
|
||||||
|
if f.Classes {
|
||||||
|
fmt.Fprintf(w, ` class="%s %s"`, f.class(chroma.Line), f.class(chroma.LineHighlight))
|
||||||
|
} else {
|
||||||
|
fmt.Fprintf(w, ` style="%s %s"`, css[chroma.Line], css[chroma.LineHighlight])
|
||||||
|
}
|
||||||
|
fmt.Fprint(w, `>`)
|
||||||
|
} else {
|
||||||
|
fmt.Fprintf(w, "%s>", f.styleAttr(css, chroma.Line))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Line number
|
||||||
if f.lineNumbers && !wrapInTable {
|
if f.lineNumbers && !wrapInTable {
|
||||||
fmt.Fprintf(w, "<span%s%s>%s</span>", f.styleAttr(css, chroma.LineNumbers), f.lineIDAttribute(line), f.lineTitleWithLinkIfNeeded(lineDigits, line))
|
fmt.Fprintf(w, "<span%s%s>%s</span>", f.styleAttr(css, chroma.LineNumbers), f.lineIDAttribute(line), f.lineTitleWithLinkIfNeeded(lineDigits, line))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Fprintf(w, `<span%s>`, f.styleAttr(css, chroma.CodeLine))
|
||||||
|
|
||||||
for _, token := range tokens {
|
for _, token := range tokens {
|
||||||
html := html.EscapeString(token.String())
|
html := html.EscapeString(token.String())
|
||||||
attr := f.styleAttr(css, token.Type)
|
attr := f.styleAttr(css, token.Type)
|
||||||
@ -248,9 +278,10 @@ func (f *Formatter) writeHTML(w io.Writer, style *chroma.Style, tokens []chroma.
|
|||||||
}
|
}
|
||||||
fmt.Fprint(w, html)
|
fmt.Fprint(w, html)
|
||||||
}
|
}
|
||||||
if highlight {
|
|
||||||
fmt.Fprintf(w, "</span>")
|
fmt.Fprint(w, `</span>`) // End of CodeLine
|
||||||
}
|
|
||||||
|
fmt.Fprint(w, `</span>`) // End of Line
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintf(w, f.preWrapper.End(true))
|
fmt.Fprintf(w, f.preWrapper.End(true))
|
||||||
@ -351,7 +382,11 @@ func (f *Formatter) tabWidthStyle() string {
|
|||||||
func (f *Formatter) WriteCSS(w io.Writer, style *chroma.Style) error {
|
func (f *Formatter) WriteCSS(w io.Writer, style *chroma.Style) error {
|
||||||
css := f.styleToCSS(style)
|
css := f.styleToCSS(style)
|
||||||
// Special-case background as it is mapped to the outer ".chroma" class.
|
// Special-case background as it is mapped to the outer ".chroma" class.
|
||||||
if _, err := fmt.Fprintf(w, "/* %s */ .%schroma { %s }\n", chroma.Background, f.prefix, css[chroma.Background]); err != nil {
|
if _, err := fmt.Fprintf(w, "/* %s */ .%sbg { %s }\n", chroma.Background, f.prefix, css[chroma.Background]); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
// Special-case PreWrapper as it is the ".chroma" class.
|
||||||
|
if _, err := fmt.Fprintf(w, "/* %s */ .%schroma { %s }\n", chroma.PreWrapper, f.prefix, css[chroma.PreWrapper]); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// Special-case code column of table to expand width.
|
// Special-case code column of table to expand width.
|
||||||
@ -375,7 +410,8 @@ func (f *Formatter) WriteCSS(w io.Writer, style *chroma.Style) error {
|
|||||||
sort.Ints(tts)
|
sort.Ints(tts)
|
||||||
for _, ti := range tts {
|
for _, ti := range tts {
|
||||||
tt := chroma.TokenType(ti)
|
tt := chroma.TokenType(ti)
|
||||||
if tt == chroma.Background {
|
switch tt {
|
||||||
|
case chroma.Background, chroma.PreWrapper:
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
class := f.class(tt)
|
class := f.class(tt)
|
||||||
@ -405,12 +441,21 @@ func (f *Formatter) styleToCSS(style *chroma.Style) map[chroma.TokenType]string
|
|||||||
classes[t] = StyleEntryToCSS(entry)
|
classes[t] = StyleEntryToCSS(entry)
|
||||||
}
|
}
|
||||||
classes[chroma.Background] += f.tabWidthStyle()
|
classes[chroma.Background] += f.tabWidthStyle()
|
||||||
lineNumbersStyle := "margin-right: 0.4em; padding: 0 0.4em 0 0.4em;"
|
classes[chroma.PreWrapper] += classes[chroma.Background] + `;`
|
||||||
|
// Make PreWrapper a grid to show highlight style with full width.
|
||||||
|
if len(f.highlightRanges) > 0 {
|
||||||
|
classes[chroma.PreWrapper] += `display: grid;`
|
||||||
|
}
|
||||||
|
// Make PreWrapper wrap long lines.
|
||||||
|
if f.wrapLongLines {
|
||||||
|
classes[chroma.PreWrapper] += `white-space: pre-wrap; word-break: break-word;`
|
||||||
|
}
|
||||||
|
lineNumbersStyle := `white-space: pre; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;`
|
||||||
// All rules begin with default rules followed by user provided rules
|
// All rules begin with default rules followed by user provided rules
|
||||||
|
classes[chroma.Line] = `display: flex;` + classes[chroma.Line]
|
||||||
classes[chroma.LineNumbers] = lineNumbersStyle + classes[chroma.LineNumbers]
|
classes[chroma.LineNumbers] = lineNumbersStyle + classes[chroma.LineNumbers]
|
||||||
classes[chroma.LineNumbersTable] = lineNumbersStyle + classes[chroma.LineNumbersTable]
|
classes[chroma.LineNumbersTable] = lineNumbersStyle + classes[chroma.LineNumbersTable]
|
||||||
classes[chroma.LineHighlight] = "display: block; width: 100%;" + classes[chroma.LineHighlight]
|
classes[chroma.LineTable] = "border-spacing: 0; padding: 0; margin: 0; border: 0;" + classes[chroma.LineTable]
|
||||||
classes[chroma.LineTable] = "border-spacing: 0; padding: 0; margin: 0; border: 0; width: auto; overflow: auto; display: block;" + classes[chroma.LineTable]
|
|
||||||
classes[chroma.LineTableTD] = "vertical-align: top; padding: 0; margin: 0; border: 0;" + classes[chroma.LineTableTD]
|
classes[chroma.LineTableTD] = "vertical-align: top; padding: 0; margin: 0; border: 0;" + classes[chroma.LineTableTD]
|
||||||
return classes
|
return classes
|
||||||
}
|
}
|
||||||
|
4
vendor/github.com/alecthomas/chroma/formatters/svg/svg.go
generated
vendored
4
vendor/github.com/alecthomas/chroma/formatters/svg/svg.go
generated
vendored
@ -120,7 +120,7 @@ func maxLineWidth(lines [][]chroma.Token) int {
|
|||||||
for _, tokens := range lines {
|
for _, tokens := range lines {
|
||||||
length := 0
|
length := 0
|
||||||
for _, token := range tokens {
|
for _, token := range tokens {
|
||||||
length += len(strings.Replace(token.String(), ` `, " ", -1))
|
length += len(strings.ReplaceAll(token.String(), ` `, " "))
|
||||||
}
|
}
|
||||||
if length > maxWidth {
|
if length > maxWidth {
|
||||||
maxWidth = length
|
maxWidth = length
|
||||||
@ -136,7 +136,7 @@ func (f *Formatter) writeTokenBackgrounds(w io.Writer, lines [][]chroma.Token, s
|
|||||||
for index, tokens := range lines {
|
for index, tokens := range lines {
|
||||||
lineLength := 0
|
lineLength := 0
|
||||||
for _, token := range tokens {
|
for _, token := range tokens {
|
||||||
length := len(strings.Replace(token.String(), ` `, " ", -1))
|
length := len(strings.ReplaceAll(token.String(), ` `, " "))
|
||||||
tokenBackground := style.Get(token.Type).Background
|
tokenBackground := style.Get(token.Type).Background
|
||||||
if tokenBackground.IsSet() && tokenBackground != style.Get(chroma.Background).Background {
|
if tokenBackground.IsSet() && tokenBackground != style.Get(chroma.Background).Background {
|
||||||
fmt.Fprintf(w, "<rect id=\"%s\" x=\"%dch\" y=\"%fem\" width=\"%dch\" height=\"1.2em\" fill=\"%s\" />\n", escapeString(token.String()), lineLength, 1.2*float64(index)+0.25, length, style.Get(token.Type).Background.String())
|
fmt.Fprintf(w, "<rect id=\"%s\" x=\"%dch\" y=\"%fem\" width=\"%dch\" height=\"1.2em\" fill=\"%s\" />\n", escapeString(token.String()), lineLength, 1.2*float64(index)+0.25, length, style.Get(token.Type).Background.String())
|
||||||
|
32
vendor/github.com/alecthomas/chroma/formatters/tty_indexed.go
generated
vendored
32
vendor/github.com/alecthomas/chroma/formatters/tty_indexed.go
generated
vendored
@ -17,6 +17,20 @@ var c = chroma.MustParseColour
|
|||||||
|
|
||||||
var ttyTables = map[int]*ttyTable{
|
var ttyTables = map[int]*ttyTable{
|
||||||
8: {
|
8: {
|
||||||
|
foreground: map[chroma.Colour]string{
|
||||||
|
c("#000000"): "\033[30m", c("#7f0000"): "\033[31m", c("#007f00"): "\033[32m", c("#7f7fe0"): "\033[33m",
|
||||||
|
c("#00007f"): "\033[34m", c("#7f007f"): "\033[35m", c("#007f7f"): "\033[36m", c("#e5e5e5"): "\033[37m",
|
||||||
|
c("#555555"): "\033[1m\033[30m", c("#ff0000"): "\033[1m\033[31m", c("#00ff00"): "\033[1m\033[32m", c("#ffff00"): "\033[1m\033[33m",
|
||||||
|
c("#0000ff"): "\033[1m\033[34m", c("#ff00ff"): "\033[1m\033[35m", c("#00ffff"): "\033[1m\033[36m", c("#ffffff"): "\033[1m\033[37m",
|
||||||
|
},
|
||||||
|
background: map[chroma.Colour]string{
|
||||||
|
c("#000000"): "\033[40m", c("#7f0000"): "\033[41m", c("#007f00"): "\033[42m", c("#7f7fe0"): "\033[43m",
|
||||||
|
c("#00007f"): "\033[44m", c("#7f007f"): "\033[45m", c("#007f7f"): "\033[46m", c("#e5e5e5"): "\033[47m",
|
||||||
|
c("#555555"): "\033[1m\033[40m", c("#ff0000"): "\033[1m\033[41m", c("#00ff00"): "\033[1m\033[42m", c("#ffff00"): "\033[1m\033[43m",
|
||||||
|
c("#0000ff"): "\033[1m\033[44m", c("#ff00ff"): "\033[1m\033[45m", c("#00ffff"): "\033[1m\033[46m", c("#ffffff"): "\033[1m\033[47m",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
16: {
|
||||||
foreground: map[chroma.Colour]string{
|
foreground: map[chroma.Colour]string{
|
||||||
c("#000000"): "\033[30m", c("#7f0000"): "\033[31m", c("#007f00"): "\033[32m", c("#7f7fe0"): "\033[33m",
|
c("#000000"): "\033[30m", c("#7f0000"): "\033[31m", c("#007f00"): "\033[32m", c("#7f7fe0"): "\033[33m",
|
||||||
c("#00007f"): "\033[34m", c("#7f007f"): "\033[35m", c("#007f7f"): "\033[36m", c("#e5e5e5"): "\033[37m",
|
c("#00007f"): "\033[34m", c("#7f007f"): "\033[35m", c("#007f7f"): "\033[36m", c("#e5e5e5"): "\033[37m",
|
||||||
@ -227,15 +241,11 @@ type indexedTTYFormatter struct {
|
|||||||
func (c *indexedTTYFormatter) Format(w io.Writer, style *chroma.Style, it chroma.Iterator) (err error) {
|
func (c *indexedTTYFormatter) Format(w io.Writer, style *chroma.Style, it chroma.Iterator) (err error) {
|
||||||
theme := styleToEscapeSequence(c.table, style)
|
theme := styleToEscapeSequence(c.table, style)
|
||||||
for token := it(); token != chroma.EOF; token = it() {
|
for token := it(); token != chroma.EOF; token = it() {
|
||||||
// TODO: Cache token lookups?
|
|
||||||
clr, ok := theme[token.Type]
|
clr, ok := theme[token.Type]
|
||||||
if !ok {
|
if !ok {
|
||||||
clr, ok = theme[token.Type.SubCategory()]
|
clr, ok = theme[token.Type.SubCategory()]
|
||||||
if !ok {
|
if !ok {
|
||||||
clr = theme[token.Type.Category()]
|
clr = theme[token.Type.Category()]
|
||||||
// if !ok {
|
|
||||||
// clr = theme[chroma.InheritStyle]
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if clr != "" {
|
if clr != "" {
|
||||||
@ -249,10 +259,22 @@ func (c *indexedTTYFormatter) Format(w io.Writer, style *chroma.Style, it chroma
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TTY is an 8-colour terminal formatter.
|
||||||
|
//
|
||||||
|
// The Lab colour space is used to map RGB values to the most appropriate index colour.
|
||||||
|
var TTY = Register("terminal", &indexedTTYFormatter{ttyTables[8]})
|
||||||
|
|
||||||
// TTY8 is an 8-colour terminal formatter.
|
// TTY8 is an 8-colour terminal formatter.
|
||||||
//
|
//
|
||||||
// The Lab colour space is used to map RGB values to the most appropriate index colour.
|
// The Lab colour space is used to map RGB values to the most appropriate index colour.
|
||||||
var TTY8 = Register("terminal", &indexedTTYFormatter{ttyTables[8]})
|
var TTY8 = Register("terminal8", &indexedTTYFormatter{ttyTables[8]})
|
||||||
|
|
||||||
|
// TTY16 is a 16-colour terminal formatter.
|
||||||
|
//
|
||||||
|
// It uses \033[3xm for normal colours and \033[90Xm for bright colours.
|
||||||
|
//
|
||||||
|
// The Lab colour space is used to map RGB values to the most appropriate index colour.
|
||||||
|
var TTY16 = Register("terminal16", &indexedTTYFormatter{ttyTables[16]})
|
||||||
|
|
||||||
// TTY256 is a 256-colour terminal formatter.
|
// TTY256 is a 256-colour terminal formatter.
|
||||||
//
|
//
|
||||||
|
15
vendor/github.com/alecthomas/chroma/go.mod
generated
vendored
15
vendor/github.com/alecthomas/chroma/go.mod
generated
vendored
@ -3,16 +3,7 @@ module github.com/alecthomas/chroma
|
|||||||
go 1.13
|
go 1.13
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 // indirect
|
github.com/dlclark/regexp2 v1.4.0
|
||||||
github.com/alecthomas/kong v0.2.4
|
github.com/stretchr/testify v1.7.0
|
||||||
github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 // indirect
|
|
||||||
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964
|
|
||||||
github.com/dlclark/regexp2 v1.2.0
|
|
||||||
github.com/mattn/go-colorable v0.1.6
|
|
||||||
github.com/mattn/go-isatty v0.0.12
|
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
|
||||||
github.com/sergi/go-diff v1.0.0 // indirect
|
|
||||||
github.com/stretchr/testify v1.3.0 // indirect
|
|
||||||
golang.org/x/sys v0.0.0-20200413165638-669c56c373c4 // indirect
|
|
||||||
)
|
)
|
||||||
|
38
vendor/github.com/alecthomas/chroma/go.sum
generated
vendored
38
vendor/github.com/alecthomas/chroma/go.sum
generated
vendored
@ -1,36 +1,14 @@
|
|||||||
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/kong v0.2.4 h1:Y0ZBCHAvHhTHw7FFJ2FzCAAG4pkbTgA45nc7BpMhDNk=
|
|
||||||
github.com/alecthomas/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE=
|
|
||||||
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/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=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
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/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/dlclark/regexp2 v1.2.0 h1:8sAhBGEM0dRWogWqWyQeIJnxjWO6oIjl8FKqREDsGfk=
|
github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E=
|
||||||
github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
|
github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
|
||||||
github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE=
|
|
||||||
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
|
||||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
|
||||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
|
||||||
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/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
|
||||||
github.com/pkg/errors v0.9.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 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
|
|
||||||
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
|
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
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=
|
|
||||||
|
2
vendor/github.com/alecthomas/chroma/iterator.go
generated
vendored
2
vendor/github.com/alecthomas/chroma/iterator.go
generated
vendored
@ -4,7 +4,7 @@ import "strings"
|
|||||||
|
|
||||||
// An Iterator across tokens.
|
// An Iterator across tokens.
|
||||||
//
|
//
|
||||||
// nil will be returned at the end of the Token stream.
|
// EOF will be returned at the end of the Token stream.
|
||||||
//
|
//
|
||||||
// If an error occurs within an Iterator, it may propagate this in a panic. Formatters should recover.
|
// If an error occurs within an Iterator, it may propagate this in a panic. Formatters should recover.
|
||||||
type Iterator func() Token
|
type Iterator func() Token
|
||||||
|
9
vendor/github.com/alecthomas/chroma/lexer.go
generated
vendored
9
vendor/github.com/alecthomas/chroma/lexer.go
generated
vendored
@ -2,6 +2,7 @@ package chroma
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -98,9 +99,11 @@ type Lexer interface {
|
|||||||
// Lexers is a slice of lexers sortable by name.
|
// Lexers is a slice of lexers sortable by name.
|
||||||
type Lexers []Lexer
|
type Lexers []Lexer
|
||||||
|
|
||||||
func (l Lexers) Len() int { return len(l) }
|
func (l Lexers) Len() int { return len(l) }
|
||||||
func (l Lexers) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
|
func (l Lexers) Swap(i, j int) { l[i], l[j] = l[j], l[i] }
|
||||||
func (l Lexers) Less(i, j int) bool { return l[i].Config().Name < l[j].Config().Name }
|
func (l Lexers) Less(i, j int) bool {
|
||||||
|
return strings.ToLower(l[i].Config().Name) < strings.ToLower(l[j].Config().Name)
|
||||||
|
}
|
||||||
|
|
||||||
// PrioritisedLexers is a slice of lexers sortable by priority.
|
// PrioritisedLexers is a slice of lexers sortable by priority.
|
||||||
type PrioritisedLexers []Lexer
|
type PrioritisedLexers []Lexer
|
||||||
|
3
vendor/github.com/alecthomas/chroma/lexers/README.md
generated
vendored
3
vendor/github.com/alecthomas/chroma/lexers/README.md
generated
vendored
@ -3,6 +3,9 @@
|
|||||||
The tests in this directory feed a known input `testdata/<name>.actual` into the parser for `<name>` and check
|
The tests in this directory feed a known input `testdata/<name>.actual` into the parser for `<name>` and check
|
||||||
that its output matches `<name>.exported`.
|
that its output matches `<name>.exported`.
|
||||||
|
|
||||||
|
It is also possible to perform several tests on a same parser `<name>`, by placing know inputs `*.actual` into a
|
||||||
|
directory `testdata/<name>/`.
|
||||||
|
|
||||||
## Running the tests
|
## Running the tests
|
||||||
|
|
||||||
Run the tests as normal:
|
Run the tests as normal:
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/a/abap.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/a/abap.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// ABAP lexer.
|
// ABAP lexer.
|
||||||
var Abap = internal.Register(MustNewLexer(
|
var Abap = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "ABAP",
|
Name: "ABAP",
|
||||||
Aliases: []string{"abap"},
|
Aliases: []string{"abap"},
|
||||||
@ -14,7 +14,11 @@ var Abap = internal.Register(MustNewLexer(
|
|||||||
MimeTypes: []string{"text/x-abap"},
|
MimeTypes: []string{"text/x-abap"},
|
||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
},
|
},
|
||||||
Rules{
|
abapRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func abapRules() Rules {
|
||||||
|
return Rules{
|
||||||
"common": {
|
"common": {
|
||||||
{`\s+`, Text, nil},
|
{`\s+`, Text, nil},
|
||||||
{`^\*.*$`, CommentSingle, nil},
|
{`^\*.*$`, CommentSingle, nil},
|
||||||
@ -52,5 +56,5 @@ var Abap = internal.Register(MustNewLexer(
|
|||||||
{`[/;:()\[\],.]`, Punctuation, nil},
|
{`[/;:()\[\],.]`, Punctuation, nil},
|
||||||
{`(!)(\w+)`, ByGroups(Operator, Name), nil},
|
{`(!)(\w+)`, ByGroups(Operator, Name), nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/a/abnf.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/a/abnf.go
generated
vendored
@ -6,14 +6,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Abnf lexer.
|
// Abnf lexer.
|
||||||
var Abnf = internal.Register(MustNewLexer(
|
var Abnf = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "ABNF",
|
Name: "ABNF",
|
||||||
Aliases: []string{"abnf"},
|
Aliases: []string{"abnf"},
|
||||||
Filenames: []string{"*.abnf"},
|
Filenames: []string{"*.abnf"},
|
||||||
MimeTypes: []string{"text/x-abnf"},
|
MimeTypes: []string{"text/x-abnf"},
|
||||||
},
|
},
|
||||||
Rules{
|
abnfRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func abnfRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`;.*$`, CommentSingle, nil},
|
{`;.*$`, CommentSingle, nil},
|
||||||
{`(%[si])?"[^"]*"`, Literal, nil},
|
{`(%[si])?"[^"]*"`, Literal, nil},
|
||||||
@ -34,5 +38,5 @@ var Abnf = internal.Register(MustNewLexer(
|
|||||||
{`\s+`, Text, nil},
|
{`\s+`, Text, nil},
|
||||||
{`.`, Text, nil},
|
{`.`, Text, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/a/actionscript.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/a/actionscript.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Actionscript lexer.
|
// Actionscript lexer.
|
||||||
var Actionscript = internal.Register(MustNewLexer(
|
var Actionscript = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "ActionScript",
|
Name: "ActionScript",
|
||||||
Aliases: []string{"as", "actionscript"},
|
Aliases: []string{"as", "actionscript"},
|
||||||
@ -15,7 +15,11 @@ var Actionscript = internal.Register(MustNewLexer(
|
|||||||
NotMultiline: true,
|
NotMultiline: true,
|
||||||
DotAll: true,
|
DotAll: true,
|
||||||
},
|
},
|
||||||
Rules{
|
actionscriptRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func actionscriptRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`\s+`, Text, nil},
|
{`\s+`, Text, nil},
|
||||||
{`//.*?\n`, CommentSingle, nil},
|
{`//.*?\n`, CommentSingle, nil},
|
||||||
@ -35,5 +39,5 @@ var Actionscript = internal.Register(MustNewLexer(
|
|||||||
{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
|
{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
|
||||||
{`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil},
|
{`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/a/actionscript3.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/a/actionscript3.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Actionscript 3 lexer.
|
// Actionscript 3 lexer.
|
||||||
var Actionscript3 = internal.Register(MustNewLexer(
|
var Actionscript3 = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "ActionScript 3",
|
Name: "ActionScript 3",
|
||||||
Aliases: []string{"as3", "actionscript3"},
|
Aliases: []string{"as3", "actionscript3"},
|
||||||
@ -14,7 +14,11 @@ var Actionscript3 = internal.Register(MustNewLexer(
|
|||||||
MimeTypes: []string{"application/x-actionscript3", "text/x-actionscript3", "text/actionscript3"},
|
MimeTypes: []string{"application/x-actionscript3", "text/x-actionscript3", "text/actionscript3"},
|
||||||
DotAll: true,
|
DotAll: true,
|
||||||
},
|
},
|
||||||
Rules{
|
actionscript3Rules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func actionscript3Rules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`\s+`, Text, nil},
|
{`\s+`, Text, nil},
|
||||||
{`(function\s+)([$a-zA-Z_]\w*)(\s*)(\()`, ByGroups(KeywordDeclaration, NameFunction, Text, Operator), Push("funcparams")},
|
{`(function\s+)([$a-zA-Z_]\w*)(\s*)(\()`, ByGroups(KeywordDeclaration, NameFunction, Text, Operator), Push("funcparams")},
|
||||||
@ -52,5 +56,5 @@ var Actionscript3 = internal.Register(MustNewLexer(
|
|||||||
{`,`, Operator, Pop(1)},
|
{`,`, Operator, Pop(1)},
|
||||||
Default(Pop(1)),
|
Default(Pop(1)),
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/a/ada.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/a/ada.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Ada lexer.
|
// Ada lexer.
|
||||||
var Ada = internal.Register(MustNewLexer(
|
var Ada = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Ada",
|
Name: "Ada",
|
||||||
Aliases: []string{"ada", "ada95", "ada2005"},
|
Aliases: []string{"ada", "ada95", "ada2005"},
|
||||||
@ -14,7 +14,11 @@ var Ada = internal.Register(MustNewLexer(
|
|||||||
MimeTypes: []string{"text/x-ada"},
|
MimeTypes: []string{"text/x-ada"},
|
||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
},
|
},
|
||||||
Rules{
|
adaRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func adaRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`[^\S\n]+`, Text, nil},
|
{`[^\S\n]+`, Text, nil},
|
||||||
{`--.*?\n`, CommentSingle, nil},
|
{`--.*?\n`, CommentSingle, nil},
|
||||||
@ -110,5 +114,5 @@ var Ada = internal.Register(MustNewLexer(
|
|||||||
{`\)`, Punctuation, Pop(1)},
|
{`\)`, Punctuation, Pop(1)},
|
||||||
Include("root"),
|
Include("root"),
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
47
vendor/github.com/alecthomas/chroma/lexers/a/al.go
generated
vendored
Normal file
47
vendor/github.com/alecthomas/chroma/lexers/a/al.go
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
import (
|
||||||
|
. "github.com/alecthomas/chroma" // nolint
|
||||||
|
"github.com/alecthomas/chroma/lexers/internal"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Al lexer.
|
||||||
|
var Al = internal.Register(MustNewLazyLexer(
|
||||||
|
&Config{
|
||||||
|
Name: "AL",
|
||||||
|
Aliases: []string{"al"},
|
||||||
|
Filenames: []string{"*.al", "*.dal"},
|
||||||
|
MimeTypes: []string{"text/x-al"},
|
||||||
|
DotAll: true,
|
||||||
|
CaseInsensitive: true,
|
||||||
|
},
|
||||||
|
alRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
// https://github.com/microsoft/AL/blob/master/grammar/alsyntax.tmlanguage
|
||||||
|
func alRules() Rules {
|
||||||
|
return Rules{
|
||||||
|
"root": {
|
||||||
|
{`\s+`, TextWhitespace, nil},
|
||||||
|
{`(?s)\/\*.*?\\*\*\/`, CommentMultiline, nil},
|
||||||
|
{`(?s)//.*?\n`, CommentSingle, nil},
|
||||||
|
{`\"([^\"])*\"`, Text, nil},
|
||||||
|
{`'([^'])*'`, LiteralString, nil},
|
||||||
|
{`\b(?i:(ARRAY|ASSERTERROR|BEGIN|BREAK|CASE|DO|DOWNTO|ELSE|END|EVENT|EXIT|FOR|FOREACH|FUNCTION|IF|IMPLEMENTS|IN|INDATASET|INTERFACE|INTERNAL|LOCAL|OF|PROCEDURE|PROGRAM|PROTECTED|REPEAT|RUNONCLIENT|SECURITYFILTERING|SUPPRESSDISPOSE|TEMPORARY|THEN|TO|TRIGGER|UNTIL|VAR|WHILE|WITH|WITHEVENTS))\b`, Keyword, nil},
|
||||||
|
{`\b(?i:(AND|DIV|MOD|NOT|OR|XOR))\b`, OperatorWord, nil},
|
||||||
|
{`\b(?i:(AVERAGE|CONST|COUNT|EXIST|FIELD|FILTER|LOOKUP|MAX|MIN|ORDER|SORTING|SUM|TABLEDATA|UPPERLIMIT|WHERE|ASCENDING|DESCENDING))\b`, Keyword, nil},
|
||||||
|
{`\b(?i:(CODEUNIT|PAGE|PAGEEXTENSION|PAGECUSTOMIZATION|DOTNET|ENUM|ENUMEXTENSION|VALUE|QUERY|REPORT|TABLE|TABLEEXTENSION|XMLPORT|PROFILE|CONTROLADDIN|REPORTEXTENSION|INTERFACE|PERMISSIONSET|PERMISSIONSETEXTENSION|ENTITLEMENT))\b`, Keyword, nil},
|
||||||
|
{`\b(?i:(Action|Array|Automation|BigInteger|BigText|Blob|Boolean|Byte|Char|ClientType|Code|Codeunit|CompletionTriggerErrorLevel|ConnectionType|Database|DataClassification|DataScope|Date|DateFormula|DateTime|Decimal|DefaultLayout|Dialog|Dictionary|DotNet|DotNetAssembly|DotNetTypeDeclaration|Duration|Enum|ErrorInfo|ErrorType|ExecutionContext|ExecutionMode|FieldClass|FieldRef|FieldType|File|FilterPageBuilder|Guid|InStream|Integer|Joker|KeyRef|List|ModuleDependencyInfo|ModuleInfo|None|Notification|NotificationScope|ObjectType|Option|OutStream|Page|PageResult|Query|Record|RecordId|RecordRef|Report|ReportFormat|SecurityFilter|SecurityFiltering|Table|TableConnectionType|TableFilter|TestAction|TestField|TestFilterField|TestPage|TestPermissions|TestRequestPage|Text|TextBuilder|TextConst|TextEncoding|Time|TransactionModel|TransactionType|Variant|Verbosity|Version|XmlPort|HttpContent|HttpHeaders|HttpClient|HttpRequestMessage|HttpResponseMessage|JsonToken|JsonValue|JsonArray|JsonObject|View|Views|XmlAttribute|XmlAttributeCollection|XmlComment|XmlCData|XmlDeclaration|XmlDocument|XmlDocumentType|XmlElement|XmlNamespaceManager|XmlNameTable|XmlNode|XmlNodeList|XmlProcessingInstruction|XmlReadOptions|XmlText|XmlWriteOptions|WebServiceActionContext|WebServiceActionResultCode|SessionSettings))\b`, Keyword, nil},
|
||||||
|
{`\b([<>]=|<>|<|>)\b?`, Operator, nil},
|
||||||
|
{`\b(\-|\+|\/|\*)\b`, Operator, nil},
|
||||||
|
{`\s*(\:=|\+=|-=|\/=|\*=)\s*?`, Operator, nil},
|
||||||
|
{`\b(?i:(ADD|ADDFIRST|ADDLAST|ADDAFTER|ADDBEFORE|ACTION|ACTIONS|AREA|ASSEMBLY|CHARTPART|CUEGROUP|CUSTOMIZES|COLUMN|DATAITEM|DATASET|ELEMENTS|EXTENDS|FIELD|FIELDGROUP|FIELDATTRIBUTE|FIELDELEMENT|FIELDGROUPS|FIELDS|FILTER|FIXED|GRID|GROUP|MOVEAFTER|MOVEBEFORE|KEY|KEYS|LABEL|LABELS|LAYOUT|MODIFY|MOVEFIRST|MOVELAST|MOVEBEFORE|MOVEAFTER|PART|REPEATER|USERCONTROL|REQUESTPAGE|SCHEMA|SEPARATOR|SYSTEMPART|TABLEELEMENT|TEXTATTRIBUTE|TEXTELEMENT|TYPE))\b`, Keyword, nil},
|
||||||
|
{`\s*[(\.\.)&\|]\s*`, Operator, nil},
|
||||||
|
{`\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\b`, LiteralNumber, nil},
|
||||||
|
{`[;:,]`, Punctuation, nil},
|
||||||
|
{`#[ \t]*(if|else|elif|endif|define|undef|region|endregion|pragma)\b.*?\n`, CommentPreproc, nil},
|
||||||
|
{`\w+`, Text, nil},
|
||||||
|
{`.`, Text, nil},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
12
vendor/github.com/alecthomas/chroma/lexers/a/angular2.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/a/angular2.go
generated
vendored
@ -6,14 +6,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Angular2 lexer.
|
// Angular2 lexer.
|
||||||
var Angular2 = internal.Register(MustNewLexer(
|
var Angular2 = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Angular2",
|
Name: "Angular2",
|
||||||
Aliases: []string{"ng2"},
|
Aliases: []string{"ng2"},
|
||||||
Filenames: []string{},
|
Filenames: []string{},
|
||||||
MimeTypes: []string{},
|
MimeTypes: []string{},
|
||||||
},
|
},
|
||||||
Rules{
|
angular2Rules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func angular2Rules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`[^{([*#]+`, Other, nil},
|
{`[^{([*#]+`, Other, nil},
|
||||||
{`(\{\{)(\s*)`, ByGroups(CommentPreproc, Text), Push("ngExpression")},
|
{`(\{\{)(\s*)`, ByGroups(CommentPreproc, Text), Push("ngExpression")},
|
||||||
@ -38,5 +42,5 @@ var Angular2 = internal.Register(MustNewLexer(
|
|||||||
{`'.*?'`, LiteralString, Pop(1)},
|
{`'.*?'`, LiteralString, Pop(1)},
|
||||||
{`[^\s>]+`, LiteralString, Pop(1)},
|
{`[^\s>]+`, LiteralString, Pop(1)},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/a/antlr.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/a/antlr.go
generated
vendored
@ -6,14 +6,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// ANTLR lexer.
|
// ANTLR lexer.
|
||||||
var ANTLR = internal.Register(MustNewLexer(
|
var ANTLR = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "ANTLR",
|
Name: "ANTLR",
|
||||||
Aliases: []string{"antlr"},
|
Aliases: []string{"antlr"},
|
||||||
Filenames: []string{},
|
Filenames: []string{},
|
||||||
MimeTypes: []string{},
|
MimeTypes: []string{},
|
||||||
},
|
},
|
||||||
Rules{
|
antlrRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func antlrRules() Rules {
|
||||||
|
return Rules{
|
||||||
"whitespace": {
|
"whitespace": {
|
||||||
{`\s+`, TextWhitespace, nil},
|
{`\s+`, TextWhitespace, nil},
|
||||||
},
|
},
|
||||||
@ -97,5 +101,5 @@ var ANTLR = internal.Register(MustNewLexer(
|
|||||||
{`(\$[a-zA-Z]+)(\.?)(text|value)?`, ByGroups(NameVariable, Punctuation, NameProperty), nil},
|
{`(\$[a-zA-Z]+)(\.?)(text|value)?`, ByGroups(NameVariable, Punctuation, NameProperty), nil},
|
||||||
{`(\\\\|\\\]|\\\[|[^\[\]])+`, Other, nil},
|
{`(\\\\|\\\]|\\\[|[^\[\]])+`, Other, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/a/apache.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/a/apache.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Apacheconf lexer.
|
// Apacheconf lexer.
|
||||||
var Apacheconf = internal.Register(MustNewLexer(
|
var Apacheconf = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "ApacheConf",
|
Name: "ApacheConf",
|
||||||
Aliases: []string{"apacheconf", "aconf", "apache"},
|
Aliases: []string{"apacheconf", "aconf", "apache"},
|
||||||
@ -14,7 +14,11 @@ var Apacheconf = internal.Register(MustNewLexer(
|
|||||||
MimeTypes: []string{"text/x-apacheconf"},
|
MimeTypes: []string{"text/x-apacheconf"},
|
||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
},
|
},
|
||||||
Rules{
|
apacheconfRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func apacheconfRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`\s+`, Text, nil},
|
{`\s+`, Text, nil},
|
||||||
{`(#.*?)$`, Comment, nil},
|
{`(#.*?)$`, Comment, nil},
|
||||||
@ -34,5 +38,5 @@ var Apacheconf = internal.Register(MustNewLexer(
|
|||||||
{`"([^"\\]*(?:\\.[^"\\]*)*)"`, LiteralStringDouble, nil},
|
{`"([^"\\]*(?:\\.[^"\\]*)*)"`, LiteralStringDouble, nil},
|
||||||
{`[^\s"\\]+`, Text, nil},
|
{`[^\s"\\]+`, Text, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
18
vendor/github.com/alecthomas/chroma/lexers/a/apl.go
generated
vendored
18
vendor/github.com/alecthomas/chroma/lexers/a/apl.go
generated
vendored
@ -6,14 +6,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Apl lexer.
|
// Apl lexer.
|
||||||
var Apl = internal.Register(MustNewLexer(
|
var Apl = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "APL",
|
Name: "APL",
|
||||||
Aliases: []string{"apl"},
|
Aliases: []string{"apl"},
|
||||||
Filenames: []string{"*.apl"},
|
Filenames: []string{"*.apl"},
|
||||||
MimeTypes: []string{},
|
MimeTypes: []string{},
|
||||||
},
|
},
|
||||||
Rules{
|
aplRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func aplRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`\s+`, Text, nil},
|
{`\s+`, Text, nil},
|
||||||
{`[⍝#].*$`, CommentSingle, nil},
|
{`[⍝#].*$`, CommentSingle, nil},
|
||||||
@ -22,15 +26,15 @@ var Apl = internal.Register(MustNewLexer(
|
|||||||
{`[⋄◇()]`, Punctuation, nil},
|
{`[⋄◇()]`, Punctuation, nil},
|
||||||
{`[\[\];]`, LiteralStringRegex, nil},
|
{`[\[\];]`, LiteralStringRegex, nil},
|
||||||
{`⎕[A-Za-zΔ∆⍙][A-Za-zΔ∆⍙_¯0-9]*`, NameFunction, nil},
|
{`⎕[A-Za-zΔ∆⍙][A-Za-zΔ∆⍙_¯0-9]*`, NameFunction, nil},
|
||||||
{`[A-Za-zΔ∆⍙][A-Za-zΔ∆⍙_¯0-9]*`, NameVariable, nil},
|
{`[A-Za-zΔ∆⍙_][A-Za-zΔ∆⍙_¯0-9]*`, NameVariable, nil},
|
||||||
{`¯?(0[Xx][0-9A-Fa-f]+|[0-9]*\.?[0-9]+([Ee][+¯]?[0-9]+)?|¯|∞)([Jj]¯?(0[Xx][0-9A-Fa-f]+|[0-9]*\.?[0-9]+([Ee][+¯]?[0-9]+)?|¯|∞))?`, LiteralNumber, nil},
|
{`¯?(0[Xx][0-9A-Fa-f]+|[0-9]*\.?[0-9]+([Ee][+¯]?[0-9]+)?|¯|∞)([Jj]¯?(0[Xx][0-9A-Fa-f]+|[0-9]*\.?[0-9]+([Ee][+¯]?[0-9]+)?|¯|∞))?`, LiteralNumber, nil},
|
||||||
{`[\.\\/⌿⍀¨⍣⍨⍠⍤∘]`, NameAttribute, nil},
|
{`[\.\\/⌿⍀¨⍣⍨⍠⍤∘⍥@⌺⌶⍢]`, NameAttribute, nil},
|
||||||
{`[+\-×÷⌈⌊∣|⍳?*⍟○!⌹<≤=>≥≠≡≢∊⍷∪∩~∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⌷⍋⍒⊤⊥⍕⍎⊣⊢⍁⍂≈⌸⍯↗]`, Operator, nil},
|
{`[+\-×÷⌈⌊∣|⍳?*⍟○!⌹<≤=>≥≠≡≢∊⍷∪∩~∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⌷⍋⍒⊤⊥⍕⍎⊣⊢⍁⍂≈⌸⍯↗⊆⍸]`, Operator, nil},
|
||||||
{`⍬`, NameConstant, nil},
|
{`⍬`, NameConstant, nil},
|
||||||
{`[⎕⍞]`, NameVariableGlobal, nil},
|
{`[⎕⍞]`, NameVariableGlobal, nil},
|
||||||
{`[←→]`, KeywordDeclaration, nil},
|
{`[←→]`, KeywordDeclaration, nil},
|
||||||
{`[⍺⍵⍶⍹∇:]`, NameBuiltinPseudo, nil},
|
{`[⍺⍵⍶⍹∇:]`, NameBuiltinPseudo, nil},
|
||||||
{`[{}]`, KeywordType, nil},
|
{`[{}]`, KeywordType, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/a/applescript.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/a/applescript.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Applescript lexer.
|
// Applescript lexer.
|
||||||
var Applescript = internal.Register(MustNewLexer(
|
var Applescript = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "AppleScript",
|
Name: "AppleScript",
|
||||||
Aliases: []string{"applescript"},
|
Aliases: []string{"applescript"},
|
||||||
@ -14,7 +14,11 @@ var Applescript = internal.Register(MustNewLexer(
|
|||||||
MimeTypes: []string{},
|
MimeTypes: []string{},
|
||||||
DotAll: true,
|
DotAll: true,
|
||||||
},
|
},
|
||||||
Rules{
|
applescriptRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func applescriptRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`\s+`, Text, nil},
|
{`\s+`, Text, nil},
|
||||||
{`¬\n`, LiteralStringEscape, nil},
|
{`¬\n`, LiteralStringEscape, nil},
|
||||||
@ -51,5 +55,5 @@ var Applescript = internal.Register(MustNewLexer(
|
|||||||
{`[^*(]+`, CommentMultiline, nil},
|
{`[^*(]+`, CommentMultiline, nil},
|
||||||
{`[*(]`, CommentMultiline, nil},
|
{`[*(]`, CommentMultiline, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/a/arduino.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/a/arduino.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Arduino lexer.
|
// Arduino lexer.
|
||||||
var Arduino = internal.Register(MustNewLexer(
|
var Arduino = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Arduino",
|
Name: "Arduino",
|
||||||
Aliases: []string{"arduino"},
|
Aliases: []string{"arduino"},
|
||||||
@ -14,7 +14,11 @@ var Arduino = internal.Register(MustNewLexer(
|
|||||||
MimeTypes: []string{"text/x-arduino"},
|
MimeTypes: []string{"text/x-arduino"},
|
||||||
EnsureNL: true,
|
EnsureNL: true,
|
||||||
},
|
},
|
||||||
Rules{
|
arduinoRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func arduinoRules() Rules {
|
||||||
|
return Rules{
|
||||||
"statements": {
|
"statements": {
|
||||||
{Words(``, `\b`, `catch`, `const_cast`, `delete`, `dynamic_cast`, `explicit`, `export`, `friend`, `mutable`, `namespace`, `new`, `operator`, `private`, `protected`, `public`, `reinterpret_cast`, `restrict`, `static_cast`, `template`, `this`, `throw`, `throws`, `try`, `typeid`, `typename`, `using`, `virtual`, `constexpr`, `nullptr`, `decltype`, `thread_local`, `alignas`, `alignof`, `static_assert`, `noexcept`, `override`, `final`), Keyword, nil},
|
{Words(``, `\b`, `catch`, `const_cast`, `delete`, `dynamic_cast`, `explicit`, `export`, `friend`, `mutable`, `namespace`, `new`, `operator`, `private`, `protected`, `public`, `reinterpret_cast`, `restrict`, `static_cast`, `template`, `this`, `throw`, `throws`, `try`, `typeid`, `typename`, `using`, `virtual`, `constexpr`, `nullptr`, `decltype`, `thread_local`, `alignas`, `alignof`, `static_assert`, `noexcept`, `override`, `final`), Keyword, nil},
|
||||||
{`char(16_t|32_t)\b`, KeywordType, nil},
|
{`char(16_t|32_t)\b`, KeywordType, nil},
|
||||||
@ -106,5 +110,5 @@ var Arduino = internal.Register(MustNewLexer(
|
|||||||
{`^\s*#endif.*?(?<!\\)\n`, CommentPreproc, Pop(1)},
|
{`^\s*#endif.*?(?<!\\)\n`, CommentPreproc, Pop(1)},
|
||||||
{`.*?\n`, Comment, nil},
|
{`.*?\n`, Comment, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
72
vendor/github.com/alecthomas/chroma/lexers/a/armasm.go
generated
vendored
Normal file
72
vendor/github.com/alecthomas/chroma/lexers/a/armasm.go
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
package a
|
||||||
|
|
||||||
|
import (
|
||||||
|
. "github.com/alecthomas/chroma" // nolint
|
||||||
|
"github.com/alecthomas/chroma/lexers/internal"
|
||||||
|
)
|
||||||
|
|
||||||
|
var ArmAsm = internal.Register(MustNewLazyLexer(
|
||||||
|
&Config{
|
||||||
|
Name: "ArmAsm",
|
||||||
|
Aliases: []string{"armasm"},
|
||||||
|
EnsureNL: true,
|
||||||
|
Filenames: []string{"*.s", "*.S"},
|
||||||
|
MimeTypes: []string{"text/x-armasm", "text/x-asm"},
|
||||||
|
},
|
||||||
|
armasmRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func armasmRules() Rules {
|
||||||
|
return Rules{
|
||||||
|
"commentsandwhitespace": {
|
||||||
|
{`\s+`, Text, nil},
|
||||||
|
{`[@;].*?\n`, CommentSingle, nil},
|
||||||
|
{`/\*.*?\*/`, CommentMultiline, nil},
|
||||||
|
},
|
||||||
|
"literal": {
|
||||||
|
// Binary
|
||||||
|
{`0b[01]+`, NumberBin, Pop(1)},
|
||||||
|
// Hex
|
||||||
|
{`0x\w{1,8}`, NumberHex, Pop(1)},
|
||||||
|
// Octal
|
||||||
|
{`0\d+`, NumberOct, Pop(1)},
|
||||||
|
// Float
|
||||||
|
{`\d+?\.\d+?`, NumberFloat, Pop(1)},
|
||||||
|
// Integer
|
||||||
|
{`\d+`, NumberInteger, Pop(1)},
|
||||||
|
// String
|
||||||
|
{`(")(.+)(")`, ByGroups(Punctuation, StringDouble, Punctuation), Pop(1)},
|
||||||
|
// Char
|
||||||
|
{`(')(.{1}|\\.{1})(')`, ByGroups(Punctuation, StringChar, Punctuation), Pop(1)},
|
||||||
|
},
|
||||||
|
"opcode": {
|
||||||
|
// Escape at line end
|
||||||
|
{`\n`, Text, Pop(1)},
|
||||||
|
// Comment
|
||||||
|
{`(@|;).*\n`, CommentSingle, Pop(1)},
|
||||||
|
// Whitespace
|
||||||
|
{`(\s+|,)`, Text, nil},
|
||||||
|
// Register by number
|
||||||
|
{`[rapcfxwbhsdqv]\d{1,2}`, NameClass, nil},
|
||||||
|
// Address by hex
|
||||||
|
{`=0x\w+`, ByGroups(Text, NameLabel), nil},
|
||||||
|
// Pseudo address by label
|
||||||
|
{`(=)(\w+)`, ByGroups(Text, NameLabel), nil},
|
||||||
|
// Immediate
|
||||||
|
{`#`, Text, Push("literal")},
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
Include("commentsandwhitespace"),
|
||||||
|
// Directive with optional param
|
||||||
|
{`(\.\w+)([ \t]+\w+\s+?)?`, ByGroups(KeywordNamespace, NameLabel), nil},
|
||||||
|
// Label with data
|
||||||
|
{`(\w+)(:)(\s+\.\w+\s+)`, ByGroups(NameLabel, Punctuation, KeywordNamespace), Push("literal")},
|
||||||
|
// Label
|
||||||
|
{`(\w+)(:)`, ByGroups(NameLabel, Punctuation), nil},
|
||||||
|
// Syscall Op
|
||||||
|
{`svc\s+\w+`, NameNamespace, nil},
|
||||||
|
// Opcode
|
||||||
|
{`[a-zA-Z]+`, Text, Push("opcode")},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
12
vendor/github.com/alecthomas/chroma/lexers/a/awk.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/a/awk.go
generated
vendored
@ -6,14 +6,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Awk lexer.
|
// Awk lexer.
|
||||||
var Awk = internal.Register(MustNewLexer(
|
var Awk = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Awk",
|
Name: "Awk",
|
||||||
Aliases: []string{"awk", "gawk", "mawk", "nawk"},
|
Aliases: []string{"awk", "gawk", "mawk", "nawk"},
|
||||||
Filenames: []string{"*.awk"},
|
Filenames: []string{"*.awk"},
|
||||||
MimeTypes: []string{"application/x-awk"},
|
MimeTypes: []string{"application/x-awk"},
|
||||||
},
|
},
|
||||||
Rules{
|
awkRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func awkRules() Rules {
|
||||||
|
return Rules{
|
||||||
"commentsandwhitespace": {
|
"commentsandwhitespace": {
|
||||||
{`\s+`, Text, nil},
|
{`\s+`, Text, nil},
|
||||||
{`#.*$`, CommentSingle, nil},
|
{`#.*$`, CommentSingle, nil},
|
||||||
@ -44,5 +48,5 @@ var Awk = internal.Register(MustNewLexer(
|
|||||||
{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
|
{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
|
||||||
{`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil},
|
{`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/b/ballerina.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/b/ballerina.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Ballerina lexer.
|
// Ballerina lexer.
|
||||||
var Ballerina = internal.Register(MustNewLexer(
|
var Ballerina = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Ballerina",
|
Name: "Ballerina",
|
||||||
Aliases: []string{"ballerina"},
|
Aliases: []string{"ballerina"},
|
||||||
@ -14,7 +14,11 @@ var Ballerina = internal.Register(MustNewLexer(
|
|||||||
MimeTypes: []string{"text/x-ballerina"},
|
MimeTypes: []string{"text/x-ballerina"},
|
||||||
DotAll: true,
|
DotAll: true,
|
||||||
},
|
},
|
||||||
Rules{
|
ballerinaRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func ballerinaRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`[^\S\n]+`, Text, nil},
|
{`[^\S\n]+`, Text, nil},
|
||||||
{`//.*?\n`, CommentSingle, nil},
|
{`//.*?\n`, CommentSingle, nil},
|
||||||
@ -42,5 +46,5 @@ var Ballerina = internal.Register(MustNewLexer(
|
|||||||
"import": {
|
"import": {
|
||||||
{`[\w.]+`, NameNamespace, Pop(1)},
|
{`[\w.]+`, NameNamespace, Pop(1)},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
21
vendor/github.com/alecthomas/chroma/lexers/b/bash.go
generated
vendored
21
vendor/github.com/alecthomas/chroma/lexers/b/bash.go
generated
vendored
@ -7,17 +7,27 @@ import (
|
|||||||
"github.com/alecthomas/chroma/lexers/internal"
|
"github.com/alecthomas/chroma/lexers/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// TODO(moorereason): can this be factored away?
|
||||||
var bashAnalyserRe = regexp.MustCompile(`(?m)^#!.*/bin/(?:env |)(?:bash|zsh|sh|ksh)`)
|
var bashAnalyserRe = regexp.MustCompile(`(?m)^#!.*/bin/(?:env |)(?:bash|zsh|sh|ksh)`)
|
||||||
|
|
||||||
// Bash lexer.
|
// Bash lexer.
|
||||||
var Bash = internal.Register(MustNewLexer(
|
var Bash = internal.Register(MustNewLazyLexer(
|
||||||
&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", ".env", "*.env", "*.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{
|
bashRules,
|
||||||
|
).SetAnalyser(func(text string) float32 {
|
||||||
|
if bashAnalyserRe.FindString(text) != "" {
|
||||||
|
return 1.0
|
||||||
|
}
|
||||||
|
return 0.0
|
||||||
|
}))
|
||||||
|
|
||||||
|
func bashRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
Include("basic"),
|
Include("basic"),
|
||||||
{"`", LiteralStringBacktick, Push("backticks")},
|
{"`", LiteralStringBacktick, Push("backticks")},
|
||||||
@ -86,10 +96,5 @@ var Bash = internal.Register(MustNewLexer(
|
|||||||
{"`", LiteralStringBacktick, Pop(1)},
|
{"`", LiteralStringBacktick, Pop(1)},
|
||||||
Include("root"),
|
Include("root"),
|
||||||
},
|
},
|
||||||
},
|
|
||||||
).SetAnalyser(func(text string) float32 {
|
|
||||||
if bashAnalyserRe.FindString(text) != "" {
|
|
||||||
return 1.0
|
|
||||||
}
|
}
|
||||||
return 0.0
|
}
|
||||||
}))
|
|
||||||
|
27
vendor/github.com/alecthomas/chroma/lexers/b/bashsession.go
generated
vendored
Normal file
27
vendor/github.com/alecthomas/chroma/lexers/b/bashsession.go
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package b
|
||||||
|
|
||||||
|
import (
|
||||||
|
. "github.com/alecthomas/chroma" // nolint
|
||||||
|
"github.com/alecthomas/chroma/lexers/internal"
|
||||||
|
)
|
||||||
|
|
||||||
|
// BashSession lexer.
|
||||||
|
var BashSession = internal.Register(MustNewLazyLexer(
|
||||||
|
&Config{
|
||||||
|
Name: "BashSession",
|
||||||
|
Aliases: []string{"bash-session", "console", "shell-session"},
|
||||||
|
Filenames: []string{".sh-session"},
|
||||||
|
MimeTypes: []string{"text/x-sh"},
|
||||||
|
EnsureNL: true,
|
||||||
|
},
|
||||||
|
bashsessionRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func bashsessionRules() Rules {
|
||||||
|
return Rules{
|
||||||
|
"root": {
|
||||||
|
{`^((?:\[[^]]+@[^]]+\]\s?)?[#$%>])(\s*)(.*\n?)`, ByGroups(GenericPrompt, Text, Using(Bash)), nil},
|
||||||
|
{`^.+\n?`, GenericOutput, nil},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
12
vendor/github.com/alecthomas/chroma/lexers/b/batch.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/b/batch.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Batchfile lexer.
|
// Batchfile lexer.
|
||||||
var Batchfile = internal.Register(MustNewLexer(
|
var Batchfile = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Batchfile",
|
Name: "Batchfile",
|
||||||
Aliases: []string{"bat", "batch", "dosbatch", "winbatch"},
|
Aliases: []string{"bat", "batch", "dosbatch", "winbatch"},
|
||||||
@ -14,7 +14,11 @@ var Batchfile = internal.Register(MustNewLexer(
|
|||||||
MimeTypes: []string{"application/x-dos-batch"},
|
MimeTypes: []string{"application/x-dos-batch"},
|
||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
},
|
},
|
||||||
Rules{
|
batchfileRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func batchfileRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`\)((?=\()|(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a]))(?:(?:[^\n\x1a^]|\^[\n\x1a]?[\w\W])*)`, CommentSingle, nil},
|
{`\)((?=\()|(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a]))(?:(?:[^\n\x1a^]|\^[\n\x1a]?[\w\W])*)`, CommentSingle, nil},
|
||||||
{`(?=((?:(?<=^[^:])|^[^:]?)[\t\v\f\r ,;=\xa0]*)(:))`, Text, Push("follow")},
|
{`(?=((?:(?<=^[^:])|^[^:]?)[\t\v\f\r ,;=\xa0]*)(:))`, Text, Push("follow")},
|
||||||
@ -190,5 +194,5 @@ var Batchfile = internal.Register(MustNewLexer(
|
|||||||
{`else(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a])`, Keyword, Pop(1)},
|
{`else(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a])`, Keyword, Pop(1)},
|
||||||
Default(Pop(1)),
|
Default(Pop(1)),
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/b/bibtex.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/b/bibtex.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Bibtex lexer.
|
// Bibtex lexer.
|
||||||
var Bibtex = internal.Register(MustNewLexer(
|
var Bibtex = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "BibTeX",
|
Name: "BibTeX",
|
||||||
Aliases: []string{"bib", "bibtex"},
|
Aliases: []string{"bib", "bibtex"},
|
||||||
@ -15,7 +15,11 @@ var Bibtex = internal.Register(MustNewLexer(
|
|||||||
NotMultiline: true,
|
NotMultiline: true,
|
||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
},
|
},
|
||||||
Rules{
|
bibtexRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func bibtexRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
Include("whitespace"),
|
Include("whitespace"),
|
||||||
{`@comment`, Comment, nil},
|
{`@comment`, Comment, nil},
|
||||||
@ -72,5 +76,5 @@ var Bibtex = internal.Register(MustNewLexer(
|
|||||||
"whitespace": {
|
"whitespace": {
|
||||||
{`\s+`, Text, nil},
|
{`\s+`, Text, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
112
vendor/github.com/alecthomas/chroma/lexers/b/bicep.go
generated
vendored
Normal file
112
vendor/github.com/alecthomas/chroma/lexers/b/bicep.go
generated
vendored
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
package b
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
. "github.com/alecthomas/chroma" // nolint
|
||||||
|
"github.com/alecthomas/chroma/lexers/internal"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Bicep lexer.
|
||||||
|
var Bicep = internal.Register(MustNewLazyLexer(
|
||||||
|
&Config{
|
||||||
|
Name: "Bicep",
|
||||||
|
Aliases: []string{"bicep"},
|
||||||
|
Filenames: []string{"*.bicep"},
|
||||||
|
},
|
||||||
|
bicepRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func bicepRules() Rules {
|
||||||
|
bicepFunctions := []string{
|
||||||
|
"any",
|
||||||
|
"array",
|
||||||
|
"concat",
|
||||||
|
"contains",
|
||||||
|
"empty",
|
||||||
|
"first",
|
||||||
|
"intersection",
|
||||||
|
"items",
|
||||||
|
"last",
|
||||||
|
"length",
|
||||||
|
"min",
|
||||||
|
"max",
|
||||||
|
"range",
|
||||||
|
"skip",
|
||||||
|
"take",
|
||||||
|
"union",
|
||||||
|
"dateTimeAdd",
|
||||||
|
"utcNow",
|
||||||
|
"deployment",
|
||||||
|
"environment",
|
||||||
|
"loadFileAsBase64",
|
||||||
|
"loadTextContent",
|
||||||
|
"int",
|
||||||
|
"json",
|
||||||
|
"extensionResourceId",
|
||||||
|
"getSecret",
|
||||||
|
"list",
|
||||||
|
"listKeys",
|
||||||
|
"listKeyValue",
|
||||||
|
"listAccountSas",
|
||||||
|
"listSecrets",
|
||||||
|
"pickZones",
|
||||||
|
"reference",
|
||||||
|
"resourceId",
|
||||||
|
"subscriptionResourceId",
|
||||||
|
"tenantResourceId",
|
||||||
|
"managementGroup",
|
||||||
|
"resourceGroup",
|
||||||
|
"subscription",
|
||||||
|
"tenant",
|
||||||
|
"base64",
|
||||||
|
"base64ToJson",
|
||||||
|
"base64ToString",
|
||||||
|
"dataUri",
|
||||||
|
"dataUriToString",
|
||||||
|
"endsWith",
|
||||||
|
"format",
|
||||||
|
"guid",
|
||||||
|
"indexOf",
|
||||||
|
"lastIndexOf",
|
||||||
|
"length",
|
||||||
|
"newGuid",
|
||||||
|
"padLeft",
|
||||||
|
"replace",
|
||||||
|
"split",
|
||||||
|
"startsWith",
|
||||||
|
"string",
|
||||||
|
"substring",
|
||||||
|
"toLower",
|
||||||
|
"toUpper",
|
||||||
|
"trim",
|
||||||
|
"uniqueString",
|
||||||
|
"uri",
|
||||||
|
"uriComponent",
|
||||||
|
"uriComponentToString",
|
||||||
|
}
|
||||||
|
|
||||||
|
return Rules{
|
||||||
|
"root": {
|
||||||
|
{`//[^\n\r]+`, CommentSingle, nil},
|
||||||
|
{`/\*.*?\*/`, CommentMultiline, nil},
|
||||||
|
{`([']?\w+[']?)(:)`, ByGroups(NameProperty, Punctuation), nil},
|
||||||
|
{`\b('(resourceGroup|subscription|managementGroup|tenant)')\b`, KeywordNamespace, nil},
|
||||||
|
{`'[\w\$\{\(\)\}\.]{1,}?'`, LiteralStringInterpol, nil},
|
||||||
|
{`('''|').*?('''|')`, LiteralString, nil},
|
||||||
|
{`\b(allowed|batchSize|description|maxLength|maxValue|metadata|minLength|minValue|secure)\b`, NameDecorator, nil},
|
||||||
|
{`\b(az|sys)\.`, NameNamespace, nil},
|
||||||
|
{`\b(` + strings.Join(bicepFunctions, "|") + `)\b`, NameFunction, nil},
|
||||||
|
// https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions-logical
|
||||||
|
{`\b(bool)(\()`, ByGroups(NameFunction, Punctuation), nil},
|
||||||
|
{`\b(for|if|in)\b`, Keyword, nil},
|
||||||
|
{`\b(module|output|param|resource|var)\b`, KeywordDeclaration, nil},
|
||||||
|
{`\b(array|bool|int|object|string)\b`, KeywordType, nil},
|
||||||
|
// https://docs.microsoft.com/en-us/azure/azure-resource-manager/bicep/operators
|
||||||
|
{`(>=|>|<=|<|==|!=|=~|!~|::|&&|\?\?|!|-|%|\*|\/|\+)`, Operator, nil},
|
||||||
|
{`[\(\)\[\]\.:\?{}@=]`, Punctuation, nil},
|
||||||
|
{`[\w_-]+`, Text, nil},
|
||||||
|
{`\s+`, TextWhitespace, nil},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
12
vendor/github.com/alecthomas/chroma/lexers/b/blitz.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/b/blitz.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Blitzbasic lexer.
|
// Blitzbasic lexer.
|
||||||
var Blitzbasic = internal.Register(MustNewLexer(
|
var Blitzbasic = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "BlitzBasic",
|
Name: "BlitzBasic",
|
||||||
Aliases: []string{"blitzbasic", "b3d", "bplus"},
|
Aliases: []string{"blitzbasic", "b3d", "bplus"},
|
||||||
@ -14,7 +14,11 @@ var Blitzbasic = internal.Register(MustNewLexer(
|
|||||||
MimeTypes: []string{"text/x-bb"},
|
MimeTypes: []string{"text/x-bb"},
|
||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
},
|
},
|
||||||
Rules{
|
blitzbasicRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func blitzbasicRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`[ \t]+`, Text, nil},
|
{`[ \t]+`, Text, nil},
|
||||||
{`;.*?\n`, CommentSingle, nil},
|
{`;.*?\n`, CommentSingle, nil},
|
||||||
@ -44,5 +48,5 @@ var Blitzbasic = internal.Register(MustNewLexer(
|
|||||||
{`"C?`, LiteralStringDouble, Pop(1)},
|
{`"C?`, LiteralStringDouble, Pop(1)},
|
||||||
{`[^"]+`, LiteralStringDouble, nil},
|
{`[^"]+`, LiteralStringDouble, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/b/bnf.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/b/bnf.go
generated
vendored
@ -6,19 +6,23 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Bnf lexer.
|
// Bnf lexer.
|
||||||
var Bnf = internal.Register(MustNewLexer(
|
var Bnf = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "BNF",
|
Name: "BNF",
|
||||||
Aliases: []string{"bnf"},
|
Aliases: []string{"bnf"},
|
||||||
Filenames: []string{"*.bnf"},
|
Filenames: []string{"*.bnf"},
|
||||||
MimeTypes: []string{"text/x-bnf"},
|
MimeTypes: []string{"text/x-bnf"},
|
||||||
},
|
},
|
||||||
Rules{
|
bnfRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func bnfRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`(<)([ -;=?-~]+)(>)`, ByGroups(Punctuation, NameClass, Punctuation), nil},
|
{`(<)([ -;=?-~]+)(>)`, ByGroups(Punctuation, NameClass, Punctuation), nil},
|
||||||
{`::=`, Operator, nil},
|
{`::=`, Operator, nil},
|
||||||
{`[^<>:]+`, Text, nil},
|
{`[^<>:]+`, Text, nil},
|
||||||
{`.`, Text, nil},
|
{`.`, Text, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/b/brainfuck.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/b/brainfuck.go
generated
vendored
@ -6,14 +6,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Brainfuck lexer.
|
// Brainfuck lexer.
|
||||||
var Brainfuck = internal.Register(MustNewLexer(
|
var Brainfuck = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Brainfuck",
|
Name: "Brainfuck",
|
||||||
Aliases: []string{"brainfuck", "bf"},
|
Aliases: []string{"brainfuck", "bf"},
|
||||||
Filenames: []string{"*.bf", "*.b"},
|
Filenames: []string{"*.bf", "*.b"},
|
||||||
MimeTypes: []string{"application/x-brainfuck"},
|
MimeTypes: []string{"application/x-brainfuck"},
|
||||||
},
|
},
|
||||||
Rules{
|
brainfuckRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func brainfuckRules() Rules {
|
||||||
|
return Rules{
|
||||||
"common": {
|
"common": {
|
||||||
{`[.,]+`, NameTag, nil},
|
{`[.,]+`, NameTag, nil},
|
||||||
{`[+-]+`, NameBuiltin, nil},
|
{`[+-]+`, NameBuiltin, nil},
|
||||||
@ -30,5 +34,5 @@ var Brainfuck = internal.Register(MustNewLexer(
|
|||||||
{`\]`, Keyword, Pop(1)},
|
{`\]`, Keyword, Pop(1)},
|
||||||
Include("common"),
|
Include("common"),
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
19
vendor/github.com/alecthomas/chroma/lexers/c/c.go
generated
vendored
19
vendor/github.com/alecthomas/chroma/lexers/c/c.go
generated
vendored
@ -6,14 +6,19 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// C lexer.
|
// C lexer.
|
||||||
var C = internal.Register(MustNewLexer(
|
var C = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "C",
|
Name: "C",
|
||||||
Aliases: []string{"c"},
|
Aliases: []string{"c"},
|
||||||
Filenames: []string{"*.c", "*.h", "*.idc"},
|
Filenames: []string{"*.c", "*.h", "*.idc", "*.x[bp]m"},
|
||||||
MimeTypes: []string{"text/x-chdr", "text/x-csrc"},
|
MimeTypes: []string{"text/x-chdr", "text/x-csrc", "image/x-xbitmap", "image/x-xpixmap"},
|
||||||
|
EnsureNL: true,
|
||||||
},
|
},
|
||||||
Rules{
|
cRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func cRules() Rules {
|
||||||
|
return Rules{
|
||||||
"whitespace": {
|
"whitespace": {
|
||||||
{`^#if\s+0`, CommentPreproc, Push("if0")},
|
{`^#if\s+0`, CommentPreproc, Push("if0")},
|
||||||
{`^#`, CommentPreproc, Push("macro")},
|
{`^#`, CommentPreproc, Push("macro")},
|
||||||
@ -38,7 +43,7 @@ var C = internal.Register(MustNewLexer(
|
|||||||
{`[~!%^&*+=|?:<>/-]`, Operator, nil},
|
{`[~!%^&*+=|?:<>/-]`, Operator, nil},
|
||||||
{`[()\[\],.]`, Punctuation, nil},
|
{`[()\[\],.]`, Punctuation, nil},
|
||||||
{Words(``, `\b`, `asm`, `auto`, `break`, `case`, `const`, `continue`, `default`, `do`, `else`, `enum`, `extern`, `for`, `goto`, `if`, `register`, `restricted`, `return`, `sizeof`, `static`, `struct`, `switch`, `typedef`, `union`, `volatile`, `while`), Keyword, nil},
|
{Words(``, `\b`, `asm`, `auto`, `break`, `case`, `const`, `continue`, `default`, `do`, `else`, `enum`, `extern`, `for`, `goto`, `if`, `register`, `restricted`, `return`, `sizeof`, `static`, `struct`, `switch`, `typedef`, `union`, `volatile`, `while`), Keyword, nil},
|
||||||
{`(bool|int|long|float|short|double|char|unsigned|signed|void)\b`, KeywordType, nil},
|
{`(bool|int|long|float|short|double|char((8|16|32)_t)?|unsigned|signed|void|u?int(_fast|_least|)(8|16|32|64)_t)\b`, KeywordType, nil},
|
||||||
{Words(``, `\b`, `inline`, `_inline`, `__inline`, `naked`, `restrict`, `thread`, `typename`), KeywordReserved, nil},
|
{Words(``, `\b`, `inline`, `_inline`, `__inline`, `naked`, `restrict`, `thread`, `typename`), KeywordReserved, nil},
|
||||||
{`(__m(128i|128d|128|64))\b`, KeywordReserved, nil},
|
{`(__m(128i|128d|128|64))\b`, KeywordReserved, nil},
|
||||||
{Words(`__`, `\b`, `asm`, `int8`, `based`, `except`, `int16`, `stdcall`, `cdecl`, `fastcall`, `int32`, `declspec`, `finally`, `int64`, `try`, `leave`, `wchar_t`, `w64`, `unaligned`, `raise`, `noop`, `identifier`, `forceinline`, `assume`), KeywordReserved, nil},
|
{Words(`__`, `\b`, `asm`, `int8`, `based`, `except`, `int16`, `stdcall`, `cdecl`, `fastcall`, `int32`, `declspec`, `finally`, `int64`, `try`, `leave`, `wchar_t`, `w64`, `unaligned`, `raise`, `noop`, `identifier`, `forceinline`, `assume`), KeywordReserved, nil},
|
||||||
@ -87,5 +92,5 @@ var C = internal.Register(MustNewLexer(
|
|||||||
{`^\s*#endif.*?(?<!\\)\n`, CommentPreproc, Pop(1)},
|
{`^\s*#endif.*?(?<!\\)\n`, CommentPreproc, Pop(1)},
|
||||||
{`.*?\n`, Comment, nil},
|
{`.*?\n`, Comment, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
278
vendor/github.com/alecthomas/chroma/lexers/c/caddyfile.go
generated
vendored
278
vendor/github.com/alecthomas/chroma/lexers/c/caddyfile.go
generated
vendored
@ -6,143 +6,149 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// caddyfileCommon are the rules common to both of the lexer variants
|
// caddyfileCommon are the rules common to both of the lexer variants
|
||||||
var caddyfileCommon = Rules{
|
func caddyfileCommonRules() Rules {
|
||||||
"site_block_common": {
|
return Rules{
|
||||||
// Import keyword
|
"site_block_common": {
|
||||||
{`(import)(\s+)([^\s]+)`, ByGroups(Keyword, Text, NameVariableMagic), nil},
|
// Import keyword
|
||||||
// Matcher definition
|
{`(import)(\s+)([^\s]+)`, ByGroups(Keyword, Text, NameVariableMagic), nil},
|
||||||
{`@[^\s]+(?=\s)`, NameDecorator, Push("matcher")},
|
// Matcher definition
|
||||||
// Matcher token stub for docs
|
{`@[^\s]+(?=\s)`, NameDecorator, Push("matcher")},
|
||||||
{`\[\<matcher\>\]`, NameDecorator, Push("matcher")},
|
// Matcher token stub for docs
|
||||||
// These cannot have matchers but may have things that look like
|
{`\[\<matcher\>\]`, NameDecorator, Push("matcher")},
|
||||||
// matchers in their arguments, so we just parse as a subdirective.
|
// These cannot have matchers but may have things that look like
|
||||||
{`try_files`, Keyword, Push("subdirective")},
|
// matchers in their arguments, so we just parse as a subdirective.
|
||||||
// These are special, they can nest more directives
|
{`try_files`, Keyword, Push("subdirective")},
|
||||||
{`handle_errors|handle|route|handle_path|not`, Keyword, Push("nested_directive")},
|
// These are special, they can nest more directives
|
||||||
// Any other directive
|
{`handle_errors|handle|route|handle_path|not`, Keyword, Push("nested_directive")},
|
||||||
{`[^\s#]+`, Keyword, Push("directive")},
|
// Any other directive
|
||||||
Include("base"),
|
{`[^\s#]+`, Keyword, Push("directive")},
|
||||||
},
|
Include("base"),
|
||||||
"matcher": {
|
},
|
||||||
{`\{`, Punctuation, Push("block")},
|
"matcher": {
|
||||||
// Not can be one-liner
|
{`\{`, Punctuation, Push("block")},
|
||||||
{`not`, Keyword, Push("deep_not_matcher")},
|
// Not can be one-liner
|
||||||
// Any other same-line matcher
|
{`not`, Keyword, Push("deep_not_matcher")},
|
||||||
{`[^\s#]+`, Keyword, Push("arguments")},
|
// Any other same-line matcher
|
||||||
// Terminators
|
{`[^\s#]+`, Keyword, Push("arguments")},
|
||||||
{`\n`, Text, Pop(1)},
|
// Terminators
|
||||||
{`\}`, Punctuation, Pop(1)},
|
{`\n`, Text, Pop(1)},
|
||||||
Include("base"),
|
{`\}`, Punctuation, Pop(1)},
|
||||||
},
|
Include("base"),
|
||||||
"block": {
|
},
|
||||||
{`\}`, Punctuation, Pop(2)},
|
"block": {
|
||||||
// Not can be one-liner
|
{`\}`, Punctuation, Pop(2)},
|
||||||
{`not`, Keyword, Push("not_matcher")},
|
// Not can be one-liner
|
||||||
// Any other subdirective
|
{`not`, Keyword, Push("not_matcher")},
|
||||||
{`[^\s#]+`, Keyword, Push("subdirective")},
|
// Any other subdirective
|
||||||
Include("base"),
|
{`[^\s#]+`, Keyword, Push("subdirective")},
|
||||||
},
|
Include("base"),
|
||||||
"nested_block": {
|
},
|
||||||
{`\}`, Punctuation, Pop(2)},
|
"nested_block": {
|
||||||
// Matcher definition
|
{`\}`, Punctuation, Pop(2)},
|
||||||
{`@[^\s]+(?=\s)`, NameDecorator, Push("matcher")},
|
// Matcher definition
|
||||||
// Something that starts with literally < is probably a docs stub
|
{`@[^\s]+(?=\s)`, NameDecorator, Push("matcher")},
|
||||||
{`\<[^#]+\>`, Keyword, Push("nested_directive")},
|
// Something that starts with literally < is probably a docs stub
|
||||||
// Any other directive
|
{`\<[^#]+\>`, Keyword, Push("nested_directive")},
|
||||||
{`[^\s#]+`, Keyword, Push("nested_directive")},
|
// Any other directive
|
||||||
Include("base"),
|
{`[^\s#]+`, Keyword, Push("nested_directive")},
|
||||||
},
|
Include("base"),
|
||||||
"not_matcher": {
|
},
|
||||||
{`\}`, Punctuation, Pop(2)},
|
"not_matcher": {
|
||||||
{`\{(?=\s)`, Punctuation, Push("block")},
|
{`\}`, Punctuation, Pop(2)},
|
||||||
{`[^\s#]+`, Keyword, Push("arguments")},
|
{`\{(?=\s)`, Punctuation, Push("block")},
|
||||||
{`\s+`, Text, nil},
|
{`[^\s#]+`, Keyword, Push("arguments")},
|
||||||
},
|
{`\s+`, Text, nil},
|
||||||
"deep_not_matcher": {
|
},
|
||||||
{`\}`, Punctuation, Pop(2)},
|
"deep_not_matcher": {
|
||||||
{`\{(?=\s)`, Punctuation, Push("block")},
|
{`\}`, Punctuation, Pop(2)},
|
||||||
{`[^\s#]+`, Keyword, Push("deep_subdirective")},
|
{`\{(?=\s)`, Punctuation, Push("block")},
|
||||||
{`\s+`, Text, nil},
|
{`[^\s#]+`, Keyword, Push("deep_subdirective")},
|
||||||
},
|
{`\s+`, Text, nil},
|
||||||
"directive": {
|
},
|
||||||
{`\{(?=\s)`, Punctuation, Push("block")},
|
"directive": {
|
||||||
Include("matcher_token"),
|
{`\{(?=\s)`, Punctuation, Push("block")},
|
||||||
Include("comments_pop_1"),
|
Include("matcher_token"),
|
||||||
{`\n`, Text, Pop(1)},
|
Include("comments_pop_1"),
|
||||||
Include("base"),
|
{`\n`, Text, Pop(1)},
|
||||||
},
|
Include("base"),
|
||||||
"nested_directive": {
|
},
|
||||||
{`\{(?=\s)`, Punctuation, Push("nested_block")},
|
"nested_directive": {
|
||||||
Include("matcher_token"),
|
{`\{(?=\s)`, Punctuation, Push("nested_block")},
|
||||||
Include("comments_pop_1"),
|
Include("matcher_token"),
|
||||||
{`\n`, Text, Pop(1)},
|
Include("comments_pop_1"),
|
||||||
Include("base"),
|
{`\n`, Text, Pop(1)},
|
||||||
},
|
Include("base"),
|
||||||
"subdirective": {
|
},
|
||||||
{`\{(?=\s)`, Punctuation, Push("block")},
|
"subdirective": {
|
||||||
Include("comments_pop_1"),
|
{`\{(?=\s)`, Punctuation, Push("block")},
|
||||||
{`\n`, Text, Pop(1)},
|
Include("comments_pop_1"),
|
||||||
Include("base"),
|
{`\n`, Text, Pop(1)},
|
||||||
},
|
Include("base"),
|
||||||
"arguments": {
|
},
|
||||||
{`\{(?=\s)`, Punctuation, Push("block")},
|
"arguments": {
|
||||||
Include("comments_pop_2"),
|
{`\{(?=\s)`, Punctuation, Push("block")},
|
||||||
{`\\\n`, Text, nil}, // Skip escaped newlines
|
Include("comments_pop_2"),
|
||||||
{`\n`, Text, Pop(2)},
|
{`\\\n`, Text, nil}, // Skip escaped newlines
|
||||||
Include("base"),
|
{`\n`, Text, Pop(2)},
|
||||||
},
|
Include("base"),
|
||||||
"deep_subdirective": {
|
},
|
||||||
{`\{(?=\s)`, Punctuation, Push("block")},
|
"deep_subdirective": {
|
||||||
Include("comments_pop_3"),
|
{`\{(?=\s)`, Punctuation, Push("block")},
|
||||||
{`\n`, Text, Pop(3)},
|
Include("comments_pop_3"),
|
||||||
Include("base"),
|
{`\n`, Text, Pop(3)},
|
||||||
},
|
Include("base"),
|
||||||
"matcher_token": {
|
},
|
||||||
{`@[^\s]+`, NameDecorator, Push("arguments")}, // Named matcher
|
"matcher_token": {
|
||||||
{`/[^\s]+`, NameDecorator, Push("arguments")}, // Path matcher
|
{`@[^\s]+`, NameDecorator, Push("arguments")}, // Named matcher
|
||||||
{`\*`, NameDecorator, Push("arguments")}, // Wildcard path matcher
|
{`/[^\s]+`, NameDecorator, Push("arguments")}, // Path matcher
|
||||||
{`\[\<matcher\>\]`, NameDecorator, Push("arguments")}, // Matcher token stub for docs
|
{`\*`, NameDecorator, Push("arguments")}, // Wildcard path matcher
|
||||||
},
|
{`\[\<matcher\>\]`, NameDecorator, Push("arguments")}, // Matcher token stub for docs
|
||||||
"comments": {
|
},
|
||||||
{`^#.*\n`, CommentSingle, nil}, // Comment at start of line
|
"comments": {
|
||||||
{`\s+#.*\n`, CommentSingle, nil}, // Comment preceded by whitespace
|
{`^#.*\n`, CommentSingle, nil}, // Comment at start of line
|
||||||
},
|
{`\s+#.*\n`, CommentSingle, nil}, // Comment preceded by whitespace
|
||||||
"comments_pop_1": {
|
},
|
||||||
{`^#.*\n`, CommentSingle, Pop(1)}, // Comment at start of line
|
"comments_pop_1": {
|
||||||
{`\s+#.*\n`, CommentSingle, Pop(1)}, // Comment preceded by whitespace
|
{`^#.*\n`, CommentSingle, Pop(1)}, // Comment at start of line
|
||||||
},
|
{`\s+#.*\n`, CommentSingle, Pop(1)}, // Comment preceded by whitespace
|
||||||
"comments_pop_2": {
|
},
|
||||||
{`^#.*\n`, CommentSingle, Pop(2)}, // Comment at start of line
|
"comments_pop_2": {
|
||||||
{`\s+#.*\n`, CommentSingle, Pop(2)}, // Comment preceded by whitespace
|
{`^#.*\n`, CommentSingle, Pop(2)}, // Comment at start of line
|
||||||
},
|
{`\s+#.*\n`, CommentSingle, Pop(2)}, // Comment preceded by whitespace
|
||||||
"comments_pop_3": {
|
},
|
||||||
{`^#.*\n`, CommentSingle, Pop(3)}, // Comment at start of line
|
"comments_pop_3": {
|
||||||
{`\s+#.*\n`, CommentSingle, Pop(3)}, // Comment preceded by whitespace
|
{`^#.*\n`, CommentSingle, Pop(3)}, // Comment at start of line
|
||||||
},
|
{`\s+#.*\n`, CommentSingle, Pop(3)}, // Comment preceded by whitespace
|
||||||
"base": {
|
},
|
||||||
Include("comments"),
|
"base": {
|
||||||
{`(on|off|first|last|before|after|internal|strip_prefix|strip_suffix|replace)\b`, NameConstant, nil},
|
Include("comments"),
|
||||||
{`(https?://)?([a-z0-9.-]+)(:)([0-9]+)`, ByGroups(Name, Name, Punctuation, LiteralNumberInteger), nil},
|
{`(on|off|first|last|before|after|internal|strip_prefix|strip_suffix|replace)\b`, NameConstant, nil},
|
||||||
{`[a-z-]+/[a-z-+]+`, LiteralString, nil},
|
{`(https?://)?([a-z0-9.-]+)(:)([0-9]+)`, ByGroups(Name, Name, Punctuation, LiteralNumberInteger), nil},
|
||||||
{`[0-9]+[km]?\b`, LiteralNumberInteger, nil},
|
{`[a-z-]+/[a-z-+]+`, LiteralString, nil},
|
||||||
{`\{[\w+.\$-]+\}`, LiteralStringEscape, nil}, // Placeholder
|
{`[0-9]+[km]?\b`, LiteralNumberInteger, nil},
|
||||||
{`\[(?=[^#{}$]+\])`, Punctuation, nil},
|
{`\{[\w+.\$-]+\}`, LiteralStringEscape, nil}, // Placeholder
|
||||||
{`\]|\|`, Punctuation, nil},
|
{`\[(?=[^#{}$]+\])`, Punctuation, nil},
|
||||||
{`[^\s#{}$\]]+`, LiteralString, nil},
|
{`\]|\|`, Punctuation, nil},
|
||||||
{`/[^\s#]*`, Name, nil},
|
{`[^\s#{}$\]]+`, LiteralString, nil},
|
||||||
{`\s+`, Text, nil},
|
{`/[^\s#]*`, Name, nil},
|
||||||
},
|
{`\s+`, Text, nil},
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Caddyfile lexer.
|
// Caddyfile lexer.
|
||||||
var Caddyfile = internal.Register(MustNewLexer(
|
var Caddyfile = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Caddyfile",
|
Name: "Caddyfile",
|
||||||
Aliases: []string{"caddyfile", "caddy"},
|
Aliases: []string{"caddyfile", "caddy"},
|
||||||
Filenames: []string{"Caddyfile*"},
|
Filenames: []string{"Caddyfile*"},
|
||||||
MimeTypes: []string{},
|
MimeTypes: []string{},
|
||||||
},
|
},
|
||||||
Rules{
|
caddyfileRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func caddyfileRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
Include("comments"),
|
Include("comments"),
|
||||||
// Global options block
|
// Global options block
|
||||||
@ -186,21 +192,25 @@ var Caddyfile = internal.Register(MustNewLexer(
|
|||||||
{`\}`, Punctuation, Pop(2)},
|
{`\}`, Punctuation, Pop(2)},
|
||||||
Include("site_block_common"),
|
Include("site_block_common"),
|
||||||
},
|
},
|
||||||
}.Merge(caddyfileCommon),
|
}.Merge(caddyfileCommonRules())
|
||||||
))
|
}
|
||||||
|
|
||||||
// Caddyfile directive-only lexer.
|
// Caddyfile directive-only lexer.
|
||||||
var CaddyfileDirectives = internal.Register(MustNewLexer(
|
var CaddyfileDirectives = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Caddyfile Directives",
|
Name: "Caddyfile Directives",
|
||||||
Aliases: []string{"caddyfile-directives", "caddyfile-d", "caddy-d"},
|
Aliases: []string{"caddyfile-directives", "caddyfile-d", "caddy-d"},
|
||||||
Filenames: []string{},
|
Filenames: []string{},
|
||||||
MimeTypes: []string{},
|
MimeTypes: []string{},
|
||||||
},
|
},
|
||||||
Rules{
|
caddyfileDirectivesRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func caddyfileDirectivesRules() Rules {
|
||||||
|
return Rules{
|
||||||
// Same as "site_block" in Caddyfile
|
// Same as "site_block" in Caddyfile
|
||||||
"root": {
|
"root": {
|
||||||
Include("site_block_common"),
|
Include("site_block_common"),
|
||||||
},
|
},
|
||||||
}.Merge(caddyfileCommon),
|
}.Merge(caddyfileCommonRules())
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/c/capnproto.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/c/capnproto.go
generated
vendored
@ -6,14 +6,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Cap'N'Proto Proto lexer.
|
// Cap'N'Proto Proto lexer.
|
||||||
var CapNProto = internal.Register(MustNewLexer(
|
var CapNProto = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Cap'n Proto",
|
Name: "Cap'n Proto",
|
||||||
Aliases: []string{"capnp"},
|
Aliases: []string{"capnp"},
|
||||||
Filenames: []string{"*.capnp"},
|
Filenames: []string{"*.capnp"},
|
||||||
MimeTypes: []string{},
|
MimeTypes: []string{},
|
||||||
},
|
},
|
||||||
Rules{
|
capNProtoRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func capNProtoRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`#.*?$`, CommentSingle, nil},
|
{`#.*?$`, CommentSingle, nil},
|
||||||
{`@[0-9a-zA-Z]*`, NameDecorator, nil},
|
{`@[0-9a-zA-Z]*`, NameDecorator, nil},
|
||||||
@ -57,5 +61,5 @@ var CapNProto = internal.Register(MustNewLexer(
|
|||||||
{`[])]`, NameAttribute, Pop(1)},
|
{`[])]`, NameAttribute, Pop(1)},
|
||||||
Default(Pop(1)),
|
Default(Pop(1)),
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/c/ceylon.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/c/ceylon.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Ceylon lexer.
|
// Ceylon lexer.
|
||||||
var Ceylon = internal.Register(MustNewLexer(
|
var Ceylon = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Ceylon",
|
Name: "Ceylon",
|
||||||
Aliases: []string{"ceylon"},
|
Aliases: []string{"ceylon"},
|
||||||
@ -14,7 +14,11 @@ var Ceylon = internal.Register(MustNewLexer(
|
|||||||
MimeTypes: []string{"text/x-ceylon"},
|
MimeTypes: []string{"text/x-ceylon"},
|
||||||
DotAll: true,
|
DotAll: true,
|
||||||
},
|
},
|
||||||
Rules{
|
ceylonRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func ceylonRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)([a-zA-Z_]\w*)(\s*)(\()`, ByGroups(UsingSelf("root"), NameFunction, Text, Operator), nil},
|
{`^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)([a-zA-Z_]\w*)(\s*)(\()`, ByGroups(UsingSelf("root"), NameFunction, Text, Operator), nil},
|
||||||
{`[^\S\n]+`, Text, nil},
|
{`[^\S\n]+`, Text, nil},
|
||||||
@ -59,5 +63,5 @@ var Ceylon = internal.Register(MustNewLexer(
|
|||||||
{`\*/`, CommentMultiline, Pop(1)},
|
{`\*/`, CommentMultiline, Pop(1)},
|
||||||
{`[*/]`, CommentMultiline, nil},
|
{`[*/]`, CommentMultiline, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/c/cfengine3.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/c/cfengine3.go
generated
vendored
@ -6,14 +6,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Cfengine3 lexer.
|
// Cfengine3 lexer.
|
||||||
var Cfengine3 = internal.Register(MustNewLexer(
|
var Cfengine3 = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "CFEngine3",
|
Name: "CFEngine3",
|
||||||
Aliases: []string{"cfengine3", "cf3"},
|
Aliases: []string{"cfengine3", "cf3"},
|
||||||
Filenames: []string{"*.cf"},
|
Filenames: []string{"*.cf"},
|
||||||
MimeTypes: []string{},
|
MimeTypes: []string{},
|
||||||
},
|
},
|
||||||
Rules{
|
cfengine3Rules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func cfengine3Rules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`#.*?\n`, Comment, nil},
|
{`#.*?\n`, Comment, nil},
|
||||||
{`(body)(\s+)(\S+)(\s+)(control)`, ByGroups(Keyword, Text, Keyword, Text, Keyword), nil},
|
{`(body)(\s+)(\S+)(\s+)(control)`, ByGroups(Keyword, Text, Keyword, Text, Keyword), nil},
|
||||||
@ -52,5 +56,5 @@ var Cfengine3 = internal.Register(MustNewLexer(
|
|||||||
{`\w+`, NameVariable, nil},
|
{`\w+`, NameVariable, nil},
|
||||||
{`\s+`, Text, nil},
|
{`\s+`, Text, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/c/chaiscript.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/c/chaiscript.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Chaiscript lexer.
|
// Chaiscript lexer.
|
||||||
var Chaiscript = internal.Register(MustNewLexer(
|
var Chaiscript = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "ChaiScript",
|
Name: "ChaiScript",
|
||||||
Aliases: []string{"chai", "chaiscript"},
|
Aliases: []string{"chai", "chaiscript"},
|
||||||
@ -14,7 +14,11 @@ var Chaiscript = internal.Register(MustNewLexer(
|
|||||||
MimeTypes: []string{"text/x-chaiscript", "application/x-chaiscript"},
|
MimeTypes: []string{"text/x-chaiscript", "application/x-chaiscript"},
|
||||||
DotAll: true,
|
DotAll: true,
|
||||||
},
|
},
|
||||||
Rules{
|
chaiscriptRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func chaiscriptRules() Rules {
|
||||||
|
return Rules{
|
||||||
"commentsandwhitespace": {
|
"commentsandwhitespace": {
|
||||||
{`\s+`, Text, nil},
|
{`\s+`, Text, nil},
|
||||||
{`//.*?\n`, CommentSingle, nil},
|
{`//.*?\n`, CommentSingle, nil},
|
||||||
@ -59,5 +63,5 @@ var Chaiscript = internal.Register(MustNewLexer(
|
|||||||
{`[^\\"$]+`, LiteralStringDouble, nil},
|
{`[^\\"$]+`, LiteralStringDouble, nil},
|
||||||
{`"`, LiteralStringDouble, Pop(1)},
|
{`"`, LiteralStringDouble, Pop(1)},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/c/cheetah.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/c/cheetah.go
generated
vendored
@ -7,14 +7,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Cheetah lexer.
|
// Cheetah lexer.
|
||||||
var Cheetah = internal.Register(MustNewLexer(
|
var Cheetah = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Cheetah",
|
Name: "Cheetah",
|
||||||
Aliases: []string{"cheetah", "spitfire"},
|
Aliases: []string{"cheetah", "spitfire"},
|
||||||
Filenames: []string{"*.tmpl", "*.spt"},
|
Filenames: []string{"*.tmpl", "*.spt"},
|
||||||
MimeTypes: []string{"application/x-cheetah", "application/x-spitfire"},
|
MimeTypes: []string{"application/x-cheetah", "application/x-spitfire"},
|
||||||
},
|
},
|
||||||
Rules{
|
cheetahRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func cheetahRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`(##[^\n]*)$`, ByGroups(Comment), nil},
|
{`(##[^\n]*)$`, ByGroups(Comment), nil},
|
||||||
{`#[*](.|\n)*?[*]#`, Comment, nil},
|
{`#[*](.|\n)*?[*]#`, Comment, nil},
|
||||||
@ -33,5 +37,5 @@ var Cheetah = internal.Register(MustNewLexer(
|
|||||||
`, Other, nil},
|
`, Other, nil},
|
||||||
{`\s+`, Text, nil},
|
{`\s+`, Text, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
28
vendor/github.com/alecthomas/chroma/lexers/c/cl.go
generated
vendored
28
vendor/github.com/alecthomas/chroma/lexers/c/cl.go
generated
vendored
@ -230,7 +230,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Common Lisp lexer.
|
// Common Lisp lexer.
|
||||||
var CommonLisp = internal.Register(TypeRemappingLexer(MustNewLexer(
|
var CommonLisp = internal.Register(TypeRemappingLexer(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Common Lisp",
|
Name: "Common Lisp",
|
||||||
Aliases: []string{"common-lisp", "cl", "lisp"},
|
Aliases: []string{"common-lisp", "cl", "lisp"},
|
||||||
@ -238,7 +238,19 @@ var CommonLisp = internal.Register(TypeRemappingLexer(MustNewLexer(
|
|||||||
MimeTypes: []string{"text/x-common-lisp"},
|
MimeTypes: []string{"text/x-common-lisp"},
|
||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
},
|
},
|
||||||
Rules{
|
commonLispRules,
|
||||||
|
), TypeMapping{
|
||||||
|
{NameVariable, NameFunction, clBuiltinFunctions},
|
||||||
|
{NameVariable, Keyword, clSpecialForms},
|
||||||
|
{NameVariable, NameBuiltin, clMacros},
|
||||||
|
{NameVariable, Keyword, clLambdaListKeywords},
|
||||||
|
{NameVariable, Keyword, clDeclarations},
|
||||||
|
{NameVariable, KeywordType, clBuiltinTypes},
|
||||||
|
{NameVariable, NameClass, clBuiltinClasses},
|
||||||
|
}))
|
||||||
|
|
||||||
|
func commonLispRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
Default(Push("body")),
|
Default(Push("body")),
|
||||||
},
|
},
|
||||||
@ -294,13 +306,5 @@ var CommonLisp = internal.Register(TypeRemappingLexer(MustNewLexer(
|
|||||||
{`\(`, Punctuation, Push("body")},
|
{`\(`, Punctuation, Push("body")},
|
||||||
{`\)`, Punctuation, Pop(1)},
|
{`\)`, Punctuation, Pop(1)},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
), TypeMapping{
|
}
|
||||||
{NameVariable, NameFunction, clBuiltinFunctions},
|
|
||||||
{NameVariable, Keyword, clSpecialForms},
|
|
||||||
{NameVariable, NameBuiltin, clMacros},
|
|
||||||
{NameVariable, Keyword, clLambdaListKeywords},
|
|
||||||
{NameVariable, Keyword, clDeclarations},
|
|
||||||
{NameVariable, KeywordType, clBuiltinTypes},
|
|
||||||
{NameVariable, NameClass, clBuiltinClasses},
|
|
||||||
}))
|
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/c/clojure.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/c/clojure.go
generated
vendored
@ -6,14 +6,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Clojure lexer.
|
// Clojure lexer.
|
||||||
var Clojure = internal.Register(MustNewLexer(
|
var Clojure = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Clojure",
|
Name: "Clojure",
|
||||||
Aliases: []string{"clojure", "clj"},
|
Aliases: []string{"clojure", "clj"},
|
||||||
Filenames: []string{"*.clj"},
|
Filenames: []string{"*.clj"},
|
||||||
MimeTypes: []string{"text/x-clojure", "application/x-clojure"},
|
MimeTypes: []string{"text/x-clojure", "application/x-clojure"},
|
||||||
},
|
},
|
||||||
Rules{
|
clojureRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func clojureRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`;.*$`, CommentSingle, nil},
|
{`;.*$`, CommentSingle, nil},
|
||||||
{`[,\s]+`, Text, nil},
|
{`[,\s]+`, Text, nil},
|
||||||
@ -34,5 +38,5 @@ var Clojure = internal.Register(MustNewLexer(
|
|||||||
{`(\{|\})`, Punctuation, nil},
|
{`(\{|\})`, Punctuation, nil},
|
||||||
{`(\(|\))`, Punctuation, nil},
|
{`(\(|\))`, Punctuation, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/c/cmake.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/c/cmake.go
generated
vendored
@ -6,14 +6,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Cmake lexer.
|
// Cmake lexer.
|
||||||
var Cmake = internal.Register(MustNewLexer(
|
var Cmake = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "CMake",
|
Name: "CMake",
|
||||||
Aliases: []string{"cmake"},
|
Aliases: []string{"cmake"},
|
||||||
Filenames: []string{"*.cmake", "CMakeLists.txt"},
|
Filenames: []string{"*.cmake", "CMakeLists.txt"},
|
||||||
MimeTypes: []string{"text/x-cmake"},
|
MimeTypes: []string{"text/x-cmake"},
|
||||||
},
|
},
|
||||||
Rules{
|
cmakeRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func cmakeRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`\b(\w+)([ \t]*)(\()`, ByGroups(NameBuiltin, Text, Punctuation), Push("args")},
|
{`\b(\w+)([ \t]*)(\()`, ByGroups(NameBuiltin, Text, Punctuation), Push("args")},
|
||||||
Include("keywords"),
|
Include("keywords"),
|
||||||
@ -40,5 +44,5 @@ var Cmake = internal.Register(MustNewLexer(
|
|||||||
{`[ \t]+`, Text, nil},
|
{`[ \t]+`, Text, nil},
|
||||||
{`#.*\n`, Comment, nil},
|
{`#.*\n`, Comment, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/c/cobol.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/c/cobol.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Cobol lexer.
|
// Cobol lexer.
|
||||||
var Cobol = internal.Register(MustNewLexer(
|
var Cobol = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "COBOL",
|
Name: "COBOL",
|
||||||
Aliases: []string{"cobol"},
|
Aliases: []string{"cobol"},
|
||||||
@ -14,7 +14,11 @@ var Cobol = internal.Register(MustNewLexer(
|
|||||||
MimeTypes: []string{"text/x-cobol"},
|
MimeTypes: []string{"text/x-cobol"},
|
||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
},
|
},
|
||||||
Rules{
|
cobolRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func cobolRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
Include("comment"),
|
Include("comment"),
|
||||||
Include("strings"),
|
Include("strings"),
|
||||||
@ -47,5 +51,5 @@ var Cobol = internal.Register(MustNewLexer(
|
|||||||
{`[+-]?\d*\.\d+(E[-+]?\d+)?`, LiteralNumberFloat, nil},
|
{`[+-]?\d*\.\d+(E[-+]?\d+)?`, LiteralNumberFloat, nil},
|
||||||
{`[+-]?\d+\.\d*(E[-+]?\d+)?`, LiteralNumberFloat, nil},
|
{`[+-]?\d+\.\d*(E[-+]?\d+)?`, LiteralNumberFloat, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/c/coffee.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/c/coffee.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Coffeescript lexer.
|
// Coffeescript lexer.
|
||||||
var Coffeescript = internal.Register(MustNewLexer(
|
var Coffeescript = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "CoffeeScript",
|
Name: "CoffeeScript",
|
||||||
Aliases: []string{"coffee-script", "coffeescript", "coffee"},
|
Aliases: []string{"coffee-script", "coffeescript", "coffee"},
|
||||||
@ -15,7 +15,11 @@ var Coffeescript = internal.Register(MustNewLexer(
|
|||||||
NotMultiline: true,
|
NotMultiline: true,
|
||||||
DotAll: true,
|
DotAll: true,
|
||||||
},
|
},
|
||||||
Rules{
|
coffeescriptRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func coffeescriptRules() Rules {
|
||||||
|
return Rules{
|
||||||
"commentsandwhitespace": {
|
"commentsandwhitespace": {
|
||||||
{`\s+`, Text, nil},
|
{`\s+`, Text, nil},
|
||||||
{`###[^#].*?###`, CommentMultiline, nil},
|
{`###[^#].*?###`, CommentMultiline, nil},
|
||||||
@ -87,5 +91,5 @@ var Coffeescript = internal.Register(MustNewLexer(
|
|||||||
{`#|\\.|\'|"`, LiteralString, nil},
|
{`#|\\.|\'|"`, LiteralString, nil},
|
||||||
Include("strings"),
|
Include("strings"),
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/c/coldfusion.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/c/coldfusion.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Cfstatement lexer.
|
// Cfstatement lexer.
|
||||||
var Cfstatement = internal.Register(MustNewLexer(
|
var Cfstatement = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "cfstatement",
|
Name: "cfstatement",
|
||||||
Aliases: []string{"cfs"},
|
Aliases: []string{"cfs"},
|
||||||
@ -15,7 +15,11 @@ var Cfstatement = internal.Register(MustNewLexer(
|
|||||||
NotMultiline: true,
|
NotMultiline: true,
|
||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
},
|
},
|
||||||
Rules{
|
cfstatementRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func cfstatementRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`//.*?\n`, CommentSingle, nil},
|
{`//.*?\n`, CommentSingle, nil},
|
||||||
{`/\*(?:.|\n)*?\*/`, CommentMultiline, nil},
|
{`/\*(?:.|\n)*?\*/`, CommentMultiline, nil},
|
||||||
@ -44,5 +48,5 @@ var Cfstatement = internal.Register(MustNewLexer(
|
|||||||
{`#`, LiteralStringDouble, nil},
|
{`#`, LiteralStringDouble, nil},
|
||||||
{`"`, LiteralStringDouble, Pop(1)},
|
{`"`, LiteralStringDouble, Pop(1)},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/c/coq.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/c/coq.go
generated
vendored
@ -6,14 +6,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Coq lexer.
|
// Coq lexer.
|
||||||
var Coq = internal.Register(MustNewLexer(
|
var Coq = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Coq",
|
Name: "Coq",
|
||||||
Aliases: []string{"coq"},
|
Aliases: []string{"coq"},
|
||||||
Filenames: []string{"*.v"},
|
Filenames: []string{"*.v"},
|
||||||
MimeTypes: []string{"text/x-coq"},
|
MimeTypes: []string{"text/x-coq"},
|
||||||
},
|
},
|
||||||
Rules{
|
coqRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func coqRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`\s+`, Text, nil},
|
{`\s+`, Text, nil},
|
||||||
{`false|true|\(\)|\[\]`, NameBuiltinPseudo, nil},
|
{`false|true|\(\)|\[\]`, NameBuiltinPseudo, nil},
|
||||||
@ -59,5 +63,5 @@ var Coq = internal.Register(MustNewLexer(
|
|||||||
{`[a-z][a-z0-9_\']*`, Name, Pop(1)},
|
{`[a-z][a-z0-9_\']*`, Name, Pop(1)},
|
||||||
Default(Pop(1)),
|
Default(Pop(1)),
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/c/cpp.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/c/cpp.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// CPP lexer.
|
// CPP lexer.
|
||||||
var CPP = internal.Register(MustNewLexer(
|
var CPP = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "C++",
|
Name: "C++",
|
||||||
Aliases: []string{"cpp", "c++"},
|
Aliases: []string{"cpp", "c++"},
|
||||||
@ -14,7 +14,11 @@ var CPP = internal.Register(MustNewLexer(
|
|||||||
MimeTypes: []string{"text/x-c++hdr", "text/x-c++src"},
|
MimeTypes: []string{"text/x-c++hdr", "text/x-c++src"},
|
||||||
EnsureNL: true,
|
EnsureNL: true,
|
||||||
},
|
},
|
||||||
Rules{
|
cppRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func cppRules() Rules {
|
||||||
|
return Rules{
|
||||||
"statements": {
|
"statements": {
|
||||||
{Words(``, `\b`, `catch`, `const_cast`, `delete`, `dynamic_cast`, `explicit`, `export`, `friend`, `mutable`, `namespace`, `new`, `operator`, `private`, `protected`, `public`, `reinterpret_cast`, `restrict`, `static_cast`, `template`, `this`, `throw`, `throws`, `try`, `typeid`, `typename`, `using`, `virtual`, `constexpr`, `nullptr`, `decltype`, `thread_local`, `alignas`, `alignof`, `static_assert`, `noexcept`, `override`, `final`, `concept`, `requires`, `consteval`, `co_await`, `co_return`, `co_yield`), Keyword, nil},
|
{Words(``, `\b`, `catch`, `const_cast`, `delete`, `dynamic_cast`, `explicit`, `export`, `friend`, `mutable`, `namespace`, `new`, `operator`, `private`, `protected`, `public`, `reinterpret_cast`, `restrict`, `static_cast`, `template`, `this`, `throw`, `throws`, `try`, `typeid`, `typename`, `using`, `virtual`, `constexpr`, `nullptr`, `decltype`, `thread_local`, `alignas`, `alignof`, `static_assert`, `noexcept`, `override`, `final`, `concept`, `requires`, `consteval`, `co_await`, `co_return`, `co_yield`), Keyword, nil},
|
||||||
{`(enum)\b(\s+)(class)\b(\s*)`, ByGroups(Keyword, Text, Keyword, Text), Push("classname")},
|
{`(enum)\b(\s+)(class)\b(\s*)`, ByGroups(Keyword, Text, Keyword, Text), Push("classname")},
|
||||||
@ -102,5 +106,5 @@ var CPP = internal.Register(MustNewLexer(
|
|||||||
{`^\s*#endif.*?(?<!\\)\n`, CommentPreproc, Pop(1)},
|
{`^\s*#endif.*?(?<!\\)\n`, CommentPreproc, Pop(1)},
|
||||||
{`.*?\n`, Comment, nil},
|
{`.*?\n`, Comment, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
15
vendor/github.com/alecthomas/chroma/lexers/c/cql.go
generated
vendored
15
vendor/github.com/alecthomas/chroma/lexers/c/cql.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// CassandraCQL lexer.
|
// CassandraCQL lexer.
|
||||||
var CassandraCQL = internal.Register(MustNewLexer(
|
var CassandraCQL = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Cassandra CQL",
|
Name: "Cassandra CQL",
|
||||||
Aliases: []string{"cassandra", "cql"},
|
Aliases: []string{"cassandra", "cql"},
|
||||||
@ -15,7 +15,11 @@ var CassandraCQL = internal.Register(MustNewLexer(
|
|||||||
NotMultiline: true,
|
NotMultiline: true,
|
||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
},
|
},
|
||||||
Rules{
|
cassandraCQLRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func cassandraCQLRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`\s+`, TextWhitespace, nil},
|
{`\s+`, TextWhitespace, nil},
|
||||||
{`(--|\/\/).*\n?`, CommentSingle, nil},
|
{`(--|\/\/).*\n?`, CommentSingle, nil},
|
||||||
@ -23,7 +27,8 @@ var CassandraCQL = internal.Register(MustNewLexer(
|
|||||||
{`(ascii|bigint|blob|boolean|counter|date|decimal|double|float|frozen|inet|int|list|map|set|smallint|text|time|timestamp|timeuuid|tinyint|tuple|uuid|varchar|varint)\b`, NameBuiltin, nil},
|
{`(ascii|bigint|blob|boolean|counter|date|decimal|double|float|frozen|inet|int|list|map|set|smallint|text|time|timestamp|timeuuid|tinyint|tuple|uuid|varchar|varint)\b`, NameBuiltin, nil},
|
||||||
{Words(``, `\b`, `ADD`, `AGGREGATE`, `ALL`, `ALLOW`, `ALTER`, `AND`, `ANY`, `APPLY`, `AS`, `ASC`, `AUTHORIZE`, `BATCH`, `BEGIN`, `BY`, `CLUSTERING`, `COLUMNFAMILY`, `COMPACT`, `CONSISTENCY`, `COUNT`, `CREATE`, `CUSTOM`, `DELETE`, `DESC`, `DISTINCT`, `DROP`, `EACH_QUORUM`, `ENTRIES`, `EXISTS`, `FILTERING`, `FROM`, `FULL`, `GRANT`, `IF`, `IN`, `INDEX`, `INFINITY`, `INSERT`, `INTO`, `KEY`, `KEYS`, `KEYSPACE`, `KEYSPACES`, `LEVEL`, `LIMIT`, `LOCAL_ONE`, `LOCAL_QUORUM`, `MATERIALIZED`, `MODIFY`, `NAN`, `NORECURSIVE`, `NOSUPERUSER`, `NOT`, `OF`, `ON`, `ONE`, `ORDER`, `PARTITION`, `PASSWORD`, `PER`, `PERMISSION`, `PERMISSIONS`, `PRIMARY`, `QUORUM`, `RENAME`, `REVOKE`, `SCHEMA`, `SELECT`, `STATIC`, `STORAGE`, `SUPERUSER`, `TABLE`, `THREE`, `TO`, `TOKEN`, `TRUNCATE`, `TTL`, `TWO`, `TYPE`, `UNLOGGED`, `UPDATE`, `USE`, `USER`, `USERS`, `USING`, `VALUES`, `VIEW`, `WHERE`, `WITH`, `WRITETIME`, `REPLICATION`, `OR`, `REPLACE`, `FUNCTION`, `CALLED`, `INPUT`, `RETURNS`, `LANGUAGE`, `ROLE`, `ROLES`, `TRIGGER`, `DURABLE_WRITES`, `LOGIN`, `OPTIONS`, `LOGGED`, `SFUNC`, `STYPE`, `FINALFUNC`, `INITCOND`, `IS`, `CONTAINS`, `JSON`, `PAGING`, `OFF`), Keyword, nil},
|
{Words(``, `\b`, `ADD`, `AGGREGATE`, `ALL`, `ALLOW`, `ALTER`, `AND`, `ANY`, `APPLY`, `AS`, `ASC`, `AUTHORIZE`, `BATCH`, `BEGIN`, `BY`, `CLUSTERING`, `COLUMNFAMILY`, `COMPACT`, `CONSISTENCY`, `COUNT`, `CREATE`, `CUSTOM`, `DELETE`, `DESC`, `DISTINCT`, `DROP`, `EACH_QUORUM`, `ENTRIES`, `EXISTS`, `FILTERING`, `FROM`, `FULL`, `GRANT`, `IF`, `IN`, `INDEX`, `INFINITY`, `INSERT`, `INTO`, `KEY`, `KEYS`, `KEYSPACE`, `KEYSPACES`, `LEVEL`, `LIMIT`, `LOCAL_ONE`, `LOCAL_QUORUM`, `MATERIALIZED`, `MODIFY`, `NAN`, `NORECURSIVE`, `NOSUPERUSER`, `NOT`, `OF`, `ON`, `ONE`, `ORDER`, `PARTITION`, `PASSWORD`, `PER`, `PERMISSION`, `PERMISSIONS`, `PRIMARY`, `QUORUM`, `RENAME`, `REVOKE`, `SCHEMA`, `SELECT`, `STATIC`, `STORAGE`, `SUPERUSER`, `TABLE`, `THREE`, `TO`, `TOKEN`, `TRUNCATE`, `TTL`, `TWO`, `TYPE`, `UNLOGGED`, `UPDATE`, `USE`, `USER`, `USERS`, `USING`, `VALUES`, `VIEW`, `WHERE`, `WITH`, `WRITETIME`, `REPLICATION`, `OR`, `REPLACE`, `FUNCTION`, `CALLED`, `INPUT`, `RETURNS`, `LANGUAGE`, `ROLE`, `ROLES`, `TRIGGER`, `DURABLE_WRITES`, `LOGIN`, `OPTIONS`, `LOGGED`, `SFUNC`, `STYPE`, `FINALFUNC`, `INITCOND`, `IS`, `CONTAINS`, `JSON`, `PAGING`, `OFF`), Keyword, nil},
|
||||||
{"[+*/<>=~!@#%^&|`?-]+", Operator, nil},
|
{"[+*/<>=~!@#%^&|`?-]+", Operator, nil},
|
||||||
{`(?s)(java|javascript)(\s+)(AS)(\s+)('|\$\$)(.*?)(\5)`,
|
{
|
||||||
|
`(?s)(java|javascript)(\s+)(AS)(\s+)('|\$\$)(.*?)(\5)`,
|
||||||
UsingByGroup(
|
UsingByGroup(
|
||||||
internal.Get,
|
internal.Get,
|
||||||
1, 6,
|
1, 6,
|
||||||
@ -65,5 +70,5 @@ var CassandraCQL = internal.Register(MustNewLexer(
|
|||||||
{`[^\$]+`, LiteralStringHeredoc, nil},
|
{`[^\$]+`, LiteralStringHeredoc, nil},
|
||||||
{`\$\$`, LiteralStringHeredoc, Pop(1)},
|
{`\$\$`, LiteralStringHeredoc, Pop(1)},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/c/crystal.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/c/crystal.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Crystal lexer.
|
// Crystal lexer.
|
||||||
var Crystal = internal.Register(MustNewLexer(
|
var Crystal = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Crystal",
|
Name: "Crystal",
|
||||||
Aliases: []string{"cr", "crystal"},
|
Aliases: []string{"cr", "crystal"},
|
||||||
@ -14,7 +14,11 @@ var Crystal = internal.Register(MustNewLexer(
|
|||||||
MimeTypes: []string{"text/x-crystal"},
|
MimeTypes: []string{"text/x-crystal"},
|
||||||
DotAll: true,
|
DotAll: true,
|
||||||
},
|
},
|
||||||
Rules{
|
crystalRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func crystalRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`#.*?$`, CommentSingle, nil},
|
{`#.*?$`, CommentSingle, nil},
|
||||||
{Words(``, `\b`, `abstract`, `asm`, `as`, `begin`, `break`, `case`, `do`, `else`, `elsif`, `end`, `ensure`, `extend`, `ifdef`, `if`, `include`, `instance_sizeof`, `next`, `of`, `pointerof`, `private`, `protected`, `rescue`, `return`, `require`, `sizeof`, `super`, `then`, `typeof`, `unless`, `until`, `when`, `while`, `with`, `yield`), Keyword, nil},
|
{Words(``, `\b`, `abstract`, `asm`, `as`, `begin`, `break`, `case`, `do`, `else`, `elsif`, `end`, `ensure`, `extend`, `ifdef`, `if`, `include`, `instance_sizeof`, `next`, `of`, `pointerof`, `private`, `protected`, `rescue`, `return`, `require`, `sizeof`, `super`, `then`, `typeof`, `unless`, `until`, `when`, `while`, `with`, `yield`), Keyword, nil},
|
||||||
@ -258,5 +262,5 @@ var Crystal = internal.Register(MustNewLexer(
|
|||||||
{`[\\#<>]`, LiteralStringRegex, nil},
|
{`[\\#<>]`, LiteralStringRegex, nil},
|
||||||
{`[^\\#<>]+`, LiteralStringRegex, nil},
|
{`[^\\#<>]+`, LiteralStringRegex, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
23
vendor/github.com/alecthomas/chroma/lexers/c/csharp.go
generated
vendored
23
vendor/github.com/alecthomas/chroma/lexers/c/csharp.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// CSharp lexer.
|
// CSharp lexer.
|
||||||
var CSharp = internal.Register(MustNewLexer(
|
var CSharp = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "C#",
|
Name: "C#",
|
||||||
Aliases: []string{"csharp", "c#"},
|
Aliases: []string{"csharp", "c#"},
|
||||||
@ -15,12 +15,17 @@ var CSharp = internal.Register(MustNewLexer(
|
|||||||
DotAll: true,
|
DotAll: true,
|
||||||
EnsureNL: true,
|
EnsureNL: true,
|
||||||
},
|
},
|
||||||
Rules{
|
cSharpRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func cSharpRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`^\s*\[.*?\]`, NameAttribute, nil},
|
{`^\s*\[.*?\]`, NameAttribute, nil},
|
||||||
{`[^\S\n]+`, Text, nil},
|
{`[^\S\n]+`, Text, nil},
|
||||||
{`\\\n`, Text, nil},
|
{`\\\n`, Text, nil},
|
||||||
{`//.*?\n`, CommentSingle, nil},
|
{`///[^\n\r]+`, CommentSpecial, nil},
|
||||||
|
{`//[^\n\r]+`, CommentSingle, nil},
|
||||||
{`/[*].*?[*]/`, CommentMultiline, nil},
|
{`/[*].*?[*]/`, CommentMultiline, nil},
|
||||||
{`\n`, Text, nil},
|
{`\n`, Text, nil},
|
||||||
{`[~!%^&*()+=|\[\]:;,.<>/?-]`, Punctuation, nil},
|
{`[~!%^&*()+=|\[\]:;,.<>/?-]`, Punctuation, nil},
|
||||||
@ -29,13 +34,13 @@ var CSharp = internal.Register(MustNewLexer(
|
|||||||
{`\$@?"(""|[^"])*"`, LiteralString, nil},
|
{`\$@?"(""|[^"])*"`, LiteralString, nil},
|
||||||
{`"(\\\\|\\"|[^"\n])*["\n]`, LiteralString, nil},
|
{`"(\\\\|\\"|[^"\n])*["\n]`, LiteralString, nil},
|
||||||
{`'\\.'|'[^\\]'`, LiteralStringChar, nil},
|
{`'\\.'|'[^\\]'`, LiteralStringChar, nil},
|
||||||
{`[0-9](\.[0-9]*)?([eE][+-][0-9]+)?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?`, LiteralNumber, nil},
|
{`0[xX][0-9a-fA-F]+[Ll]?|[0-9_](\.[0-9]*)?([eE][+-]?[0-9]+)?[flFLdD]?`, LiteralNumber, nil},
|
||||||
{`#[ \t]*(if|endif|else|elif|define|undef|line|error|warning|region|endregion|pragma)\b.*?\n`, CommentPreproc, nil},
|
{`#[ \t]*(if|endif|else|elif|define|undef|line|error|warning|region|endregion|pragma|nullable)\b[^\n\r]+`, CommentPreproc, nil},
|
||||||
{`\b(extern)(\s+)(alias)\b`, ByGroups(Keyword, Text, Keyword), nil},
|
{`\b(extern)(\s+)(alias)\b`, ByGroups(Keyword, Text, Keyword), nil},
|
||||||
{`(abstract|as|async|await|base|break|by|case|catch|checked|const|continue|default|delegate|do|else|enum|event|explicit|extern|false|finally|fixed|for|foreach|goto|if|implicit|in|interface|internal|is|let|lock|new|null|on|operator|out|override|params|private|protected|public|readonly|ref|return|sealed|sizeof|stackalloc|static|switch|this|throw|true|try|typeof|unchecked|unsafe|virtual|void|while|get|set|new|partial|yield|add|remove|value|alias|ascending|descending|from|group|into|orderby|select|thenby|where|join|equals)\b`, Keyword, nil},
|
{`(abstract|as|async|await|base|break|by|case|catch|checked|const|continue|default|delegate|do|else|enum|event|explicit|extern|false|finally|fixed|for|foreach|goto|if|implicit|in|init|internal|is|let|lock|new|null|on|operator|out|override|params|private|protected|public|readonly|ref|return|sealed|sizeof|stackalloc|static|switch|this|throw|true|try|typeof|unchecked|unsafe|virtual|void|while|get|set|new|partial|yield|add|remove|value|alias|ascending|descending|from|group|into|orderby|select|thenby|where|join|equals)\b`, Keyword, nil},
|
||||||
{`(global)(::)`, ByGroups(Keyword, Punctuation), nil},
|
{`(global)(::)`, ByGroups(Keyword, Punctuation), nil},
|
||||||
{`(bool|byte|char|decimal|double|dynamic|float|int|long|object|sbyte|short|string|uint|ulong|ushort|var)\b\??`, KeywordType, nil},
|
{`(bool|byte|char|decimal|double|dynamic|float|int|long|object|sbyte|short|string|uint|ulong|ushort|var)\b\??`, KeywordType, nil},
|
||||||
{`(class|struct)(\s+)`, ByGroups(Keyword, Text), Push("class")},
|
{`(class|struct|record|interface)(\s+)`, ByGroups(Keyword, Text), Push("class")},
|
||||||
{`(namespace|using)(\s+)`, ByGroups(Keyword, Text), Push("namespace")},
|
{`(namespace|using)(\s+)`, ByGroups(Keyword, Text), Push("namespace")},
|
||||||
{`@?[_a-zA-Z]\w*`, Name, nil},
|
{`@?[_a-zA-Z]\w*`, Name, nil},
|
||||||
},
|
},
|
||||||
@ -47,5 +52,5 @@ var CSharp = internal.Register(MustNewLexer(
|
|||||||
{`(?=\()`, Text, Pop(1)},
|
{`(?=\()`, Text, Pop(1)},
|
||||||
{`(@?[_a-zA-Z]\w*|\.)+`, NameNamespace, Pop(1)},
|
{`(@?[_a-zA-Z]\w*|\.)+`, NameNamespace, Pop(1)},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
25
vendor/github.com/alecthomas/chroma/lexers/c/css.go
generated
vendored
25
vendor/github.com/alecthomas/chroma/lexers/c/css.go
generated
vendored
@ -6,14 +6,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// CSS lexer.
|
// CSS lexer.
|
||||||
var CSS = internal.Register(MustNewLexer(
|
var CSS = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "CSS",
|
Name: "CSS",
|
||||||
Aliases: []string{"css"},
|
Aliases: []string{"css"},
|
||||||
Filenames: []string{"*.css"},
|
Filenames: []string{"*.css"},
|
||||||
MimeTypes: []string{"text/css"},
|
MimeTypes: []string{"text/css"},
|
||||||
},
|
},
|
||||||
Rules{
|
cssRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func cssRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
Include("basics"),
|
Include("basics"),
|
||||||
},
|
},
|
||||||
@ -39,6 +43,18 @@ var CSS = internal.Register(MustNewLexer(
|
|||||||
Include("basics"),
|
Include("basics"),
|
||||||
{`\}`, Punctuation, Pop(2)},
|
{`\}`, Punctuation, Pop(2)},
|
||||||
},
|
},
|
||||||
|
"atparenthesis": {
|
||||||
|
Include("common-values"),
|
||||||
|
{`/\*(?:.|\n)*?\*/`, Comment, nil},
|
||||||
|
Include("numeric-values"),
|
||||||
|
{`[*+/-]`, Operator, nil},
|
||||||
|
{`[,]`, Punctuation, nil},
|
||||||
|
{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
|
||||||
|
{`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil},
|
||||||
|
{`[a-zA-Z_-]\w*`, Name, nil},
|
||||||
|
{`\(`, Punctuation, Push("atparenthesis")},
|
||||||
|
{`\)`, Punctuation, Pop(1)},
|
||||||
|
},
|
||||||
"content": {
|
"content": {
|
||||||
{`\s+`, Text, nil},
|
{`\s+`, Text, nil},
|
||||||
{`\}`, Punctuation, Pop(1)},
|
{`\}`, Punctuation, Pop(1)},
|
||||||
@ -73,6 +89,7 @@ var CSS = internal.Register(MustNewLexer(
|
|||||||
{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
|
{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
|
||||||
{`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil},
|
{`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil},
|
||||||
{`[a-zA-Z_-]\w*`, Name, nil},
|
{`[a-zA-Z_-]\w*`, Name, nil},
|
||||||
|
{`\(`, Punctuation, Push("atparenthesis")},
|
||||||
{`\)`, Punctuation, Pop(1)},
|
{`\)`, Punctuation, Pop(1)},
|
||||||
},
|
},
|
||||||
"common-values": {
|
"common-values": {
|
||||||
@ -100,5 +117,5 @@ var CSS = internal.Register(MustNewLexer(
|
|||||||
{`%`, KeywordType, nil},
|
{`%`, KeywordType, nil},
|
||||||
Default(Pop(1)),
|
Default(Pop(1)),
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/c/cython.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/c/cython.go
generated
vendored
@ -6,14 +6,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Cython lexer.
|
// Cython lexer.
|
||||||
var Cython = internal.Register(MustNewLexer(
|
var Cython = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Cython",
|
Name: "Cython",
|
||||||
Aliases: []string{"cython", "pyx", "pyrex"},
|
Aliases: []string{"cython", "pyx", "pyrex"},
|
||||||
Filenames: []string{"*.pyx", "*.pxd", "*.pxi"},
|
Filenames: []string{"*.pyx", "*.pxd", "*.pxi"},
|
||||||
MimeTypes: []string{"text/x-cython", "application/x-cython"},
|
MimeTypes: []string{"text/x-cython", "application/x-cython"},
|
||||||
},
|
},
|
||||||
Rules{
|
cythonRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func cythonRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`\n`, Text, nil},
|
{`\n`, Text, nil},
|
||||||
{`^(\s*)("""(?:.|\n)*?""")`, ByGroups(Text, LiteralStringDoc), nil},
|
{`^(\s*)("""(?:.|\n)*?""")`, ByGroups(Text, LiteralStringDoc), nil},
|
||||||
@ -131,5 +135,5 @@ var Cython = internal.Register(MustNewLexer(
|
|||||||
Include("strings"),
|
Include("strings"),
|
||||||
Include("nl"),
|
Include("nl"),
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
126
vendor/github.com/alecthomas/chroma/lexers/circular/php.go
generated
vendored
126
vendor/github.com/alecthomas/chroma/lexers/circular/php.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// PHP lexer for pure PHP code (not embedded in HTML).
|
// PHP lexer for pure PHP code (not embedded in HTML).
|
||||||
var PHP = internal.Register(MustNewLexer(
|
var PHP = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "PHP",
|
Name: "PHP",
|
||||||
Aliases: []string{"php", "php3", "php4", "php5"},
|
Aliases: []string{"php", "php3", "php4", "php5"},
|
||||||
@ -16,65 +16,71 @@ var PHP = internal.Register(MustNewLexer(
|
|||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
EnsureNL: true,
|
EnsureNL: true,
|
||||||
},
|
},
|
||||||
phpCommonRules.Rename("php", "root"),
|
phpRules,
|
||||||
))
|
))
|
||||||
|
|
||||||
var phpCommonRules = Rules{
|
func phpRules() Rules {
|
||||||
"php": {
|
return phpCommonRules().Rename("php", "root")
|
||||||
{`\?>`, CommentPreproc, Pop(1)},
|
}
|
||||||
{`(<<<)([\'"]?)((?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*)(\2\n.*?\n\s*)(\3)(;?)(\n)`, ByGroups(LiteralString, LiteralString, LiteralStringDelimiter, LiteralString, LiteralStringDelimiter, Punctuation, Text), nil},
|
|
||||||
{`\s+`, Text, nil},
|
func phpCommonRules() Rules {
|
||||||
{`#.*?\n`, CommentSingle, nil},
|
return Rules{
|
||||||
{`//.*?\n`, CommentSingle, nil},
|
"php": {
|
||||||
{`/\*\*/`, CommentMultiline, nil},
|
{`\?>`, CommentPreproc, Pop(1)},
|
||||||
{`/\*\*.*?\*/`, LiteralStringDoc, nil},
|
{`(<<<)([\'"]?)((?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*)(\2\n.*?\n\s*)(\3)(;?)(\n)`, ByGroups(LiteralString, LiteralString, LiteralStringDelimiter, LiteralString, LiteralStringDelimiter, Punctuation, Text), nil},
|
||||||
{`/\*.*?\*/`, CommentMultiline, nil},
|
{`\s+`, Text, nil},
|
||||||
{`(->|::)(\s*)((?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*)`, ByGroups(Operator, Text, NameAttribute), nil},
|
{`#.*?\n`, CommentSingle, nil},
|
||||||
{`[~!%^&*+=|:.<>/@-]+`, Operator, nil},
|
{`//.*?\n`, CommentSingle, nil},
|
||||||
{`\?`, Operator, nil},
|
{`/\*\*/`, CommentMultiline, nil},
|
||||||
{`[\[\]{}();,]+`, Punctuation, nil},
|
{`/\*\*.*?\*/`, LiteralStringDoc, nil},
|
||||||
{`(class)(\s+)`, ByGroups(Keyword, Text), Push("classname")},
|
{`/\*.*?\*/`, CommentMultiline, nil},
|
||||||
{`(function)(\s*)(?=\()`, ByGroups(Keyword, Text), nil},
|
{`(->|::)(\s*)((?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*)`, ByGroups(Operator, Text, NameAttribute), nil},
|
||||||
{`(function)(\s+)(&?)(\s*)`, ByGroups(Keyword, Text, Operator, Text), Push("functionname")},
|
{`[~!%^&*+=|:.<>/@-]+`, Operator, nil},
|
||||||
{`(const)(\s+)((?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*)`, ByGroups(Keyword, Text, NameConstant), nil},
|
{`\?`, Operator, nil},
|
||||||
{`(and|E_PARSE|old_function|E_ERROR|or|as|E_WARNING|parent|eval|PHP_OS|break|exit|case|extends|PHP_VERSION|cfunction|FALSE|print|for|require|continue|foreach|require_once|declare|return|default|static|do|switch|die|stdClass|echo|else|TRUE|elseif|var|empty|if|xor|enddeclare|include|virtual|endfor|include_once|while|endforeach|global|endif|list|endswitch|new|endwhile|not|array|E_ALL|NULL|final|php_user_filter|interface|implements|public|private|protected|abstract|clone|try|catch|throw|this|use|namespace|trait|yield|finally)\b`, Keyword, nil},
|
{`[\[\]{}();,]+`, Punctuation, nil},
|
||||||
{`(true|false|null)\b`, KeywordConstant, nil},
|
{`(class)(\s+)`, ByGroups(Keyword, Text), Push("classname")},
|
||||||
Include("magicconstants"),
|
{`(function)(\s*)(?=\()`, ByGroups(Keyword, Text), nil},
|
||||||
{`\$\{\$+(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*\}`, NameVariable, nil},
|
{`(function)(\s+)(&?)(\s*)`, ByGroups(Keyword, Text, Operator, Text), Push("functionname")},
|
||||||
{`\$+(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*`, NameVariable, nil},
|
{`(const)(\s+)((?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*)`, ByGroups(Keyword, Text, NameConstant), nil},
|
||||||
{`(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*`, NameOther, nil},
|
{`(and|E_PARSE|old_function|E_ERROR|or|as|E_WARNING|parent|eval|PHP_OS|break|exit|case|extends|PHP_VERSION|cfunction|FALSE|print|for|require|continue|foreach|require_once|declare|return|default|static|do|switch|die|stdClass|echo|else|TRUE|elseif|var|empty|if|xor|enddeclare|include|virtual|endfor|include_once|while|endforeach|global|endif|list|endswitch|new|endwhile|not|array|E_ALL|NULL|final|php_user_filter|interface|implements|public|private|protected|abstract|clone|try|catch|throw|this|use|namespace|trait|yield|finally)\b`, Keyword, nil},
|
||||||
{`(\d+\.\d*|\d*\.\d+)(e[+-]?[0-9]+)?`, LiteralNumberFloat, nil},
|
{`(true|false|null)\b`, KeywordConstant, nil},
|
||||||
{`\d+e[+-]?[0-9]+`, LiteralNumberFloat, nil},
|
Include("magicconstants"),
|
||||||
{`0[0-7]+`, LiteralNumberOct, nil},
|
{`\$\{\$+(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*\}`, NameVariable, nil},
|
||||||
{`0x[a-f0-9]+`, LiteralNumberHex, nil},
|
{`\$+(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*`, NameVariable, nil},
|
||||||
{`\d+`, LiteralNumberInteger, nil},
|
{`(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*`, NameOther, nil},
|
||||||
{`0b[01]+`, LiteralNumberBin, nil},
|
{`(\d+\.\d*|\d*\.\d+)(e[+-]?[0-9]+)?`, LiteralNumberFloat, nil},
|
||||||
{`'([^'\\]*(?:\\.[^'\\]*)*)'`, LiteralStringSingle, nil},
|
{`\d+e[+-]?[0-9]+`, LiteralNumberFloat, nil},
|
||||||
{"`([^`\\\\]*(?:\\\\.[^`\\\\]*)*)`", LiteralStringBacktick, nil},
|
{`0[0-7]+`, LiteralNumberOct, nil},
|
||||||
{`"`, LiteralStringDouble, Push("string")},
|
{`0x[a-f0-9_]+`, LiteralNumberHex, nil},
|
||||||
},
|
{`\d[\d_]*`, LiteralNumberInteger, nil},
|
||||||
"magicfuncs": {
|
{`0b[01]+`, LiteralNumberBin, nil},
|
||||||
{Words(``, `\b`, `__construct`, `__destruct`, `__call`, `__callStatic`, `__get`, `__set`, `__isset`, `__unset`, `__sleep`, `__wakeup`, `__toString`, `__invoke`, `__set_state`, `__clone`, `__debugInfo`), NameFunctionMagic, nil},
|
{`'([^'\\]*(?:\\.[^'\\]*)*)'`, LiteralStringSingle, nil},
|
||||||
},
|
{"`([^`\\\\]*(?:\\\\.[^`\\\\]*)*)`", LiteralStringBacktick, nil},
|
||||||
"magicconstants": {
|
{`"`, LiteralStringDouble, Push("string")},
|
||||||
{Words(``, `\b`, `__LINE__`, `__FILE__`, `__DIR__`, `__FUNCTION__`, `__CLASS__`, `__TRAIT__`, `__METHOD__`, `__NAMESPACE__`), NameConstant, nil},
|
},
|
||||||
},
|
"magicfuncs": {
|
||||||
"classname": {
|
{Words(``, `\b`, `__construct`, `__destruct`, `__call`, `__callStatic`, `__get`, `__set`, `__isset`, `__unset`, `__sleep`, `__wakeup`, `__toString`, `__invoke`, `__set_state`, `__clone`, `__debugInfo`), NameFunctionMagic, nil},
|
||||||
{`(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*`, NameClass, Pop(1)},
|
},
|
||||||
},
|
"magicconstants": {
|
||||||
"functionname": {
|
{Words(``, `\b`, `__LINE__`, `__FILE__`, `__DIR__`, `__FUNCTION__`, `__CLASS__`, `__TRAIT__`, `__METHOD__`, `__NAMESPACE__`), NameConstant, nil},
|
||||||
Include("magicfuncs"),
|
},
|
||||||
{`(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*`, NameFunction, Pop(1)},
|
"classname": {
|
||||||
Default(Pop(1)),
|
{`(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*`, NameClass, Pop(1)},
|
||||||
},
|
},
|
||||||
"string": {
|
"functionname": {
|
||||||
{`"`, LiteralStringDouble, Pop(1)},
|
Include("magicfuncs"),
|
||||||
{`[^{$"\\]+`, LiteralStringDouble, nil},
|
{`(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*`, NameFunction, Pop(1)},
|
||||||
{`\\([nrt"$\\]|[0-7]{1,3}|x[0-9a-f]{1,2})`, LiteralStringEscape, nil},
|
Default(Pop(1)),
|
||||||
{`\$(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*(\[\S+?\]|->(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*)?`, LiteralStringInterpol, nil},
|
},
|
||||||
{`(\{\$\{)(.*?)(\}\})`, ByGroups(LiteralStringInterpol, UsingSelf("root"), LiteralStringInterpol), nil},
|
"string": {
|
||||||
{`(\{)(\$.*?)(\})`, ByGroups(LiteralStringInterpol, UsingSelf("root"), LiteralStringInterpol), nil},
|
{`"`, LiteralStringDouble, Pop(1)},
|
||||||
{`(\$\{)(\S+)(\})`, ByGroups(LiteralStringInterpol, NameVariable, LiteralStringInterpol), nil},
|
{`[^{$"\\]+`, LiteralStringDouble, nil},
|
||||||
{`[${\\]`, LiteralStringDouble, nil},
|
{`\\([nrt"$\\]|[0-7]{1,3}|x[0-9a-f]{1,2})`, LiteralStringEscape, nil},
|
||||||
},
|
{`\$(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*(\[\S+?\]|->(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*)?`, LiteralStringInterpol, nil},
|
||||||
|
{`(\{\$\{)(.*?)(\}\})`, ByGroups(LiteralStringInterpol, UsingSelf("root"), LiteralStringInterpol), nil},
|
||||||
|
{`(\{)(\$.*?)(\})`, ByGroups(LiteralStringInterpol, UsingSelf("root"), LiteralStringInterpol), nil},
|
||||||
|
{`(\$\{)(\S+)(\})`, ByGroups(LiteralStringInterpol, NameVariable, LiteralStringInterpol), nil},
|
||||||
|
{`[${\\]`, LiteralStringDouble, nil},
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
25
vendor/github.com/alecthomas/chroma/lexers/circular/phtml.go
generated
vendored
25
vendor/github.com/alecthomas/chroma/lexers/circular/phtml.go
generated
vendored
@ -9,26 +9,31 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// PHTML lexer is PHP in HTML.
|
// PHTML lexer is PHP in HTML.
|
||||||
var PHTML = internal.Register(DelegatingLexer(h.HTML, MustNewLexer(
|
var PHTML = internal.Register(DelegatingLexer(h.HTML, MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "PHTML",
|
Name: "PHTML",
|
||||||
Aliases: []string{"phtml"},
|
Aliases: []string{"phtml"},
|
||||||
Filenames: []string{"*.phtml"},
|
Filenames: []string{"*.phtml", "*.php", "*.php[345]", "*.inc"},
|
||||||
MimeTypes: []string{"application/x-php", "application/x-httpd-php", "application/x-httpd-php3", "application/x-httpd-php4", "application/x-httpd-php5"},
|
MimeTypes: []string{"application/x-php", "application/x-httpd-php", "application/x-httpd-php3", "application/x-httpd-php4", "application/x-httpd-php5", "text/x-php"},
|
||||||
DotAll: true,
|
DotAll: true,
|
||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
EnsureNL: true,
|
EnsureNL: true,
|
||||||
|
Priority: 2,
|
||||||
},
|
},
|
||||||
Rules{
|
phtmlRules,
|
||||||
"root": {
|
|
||||||
{`<\?(php)?`, CommentPreproc, Push("php")},
|
|
||||||
{`[^<]+`, Other, nil},
|
|
||||||
{`<`, Other, nil},
|
|
||||||
},
|
|
||||||
}.Merge(phpCommonRules),
|
|
||||||
).SetAnalyser(func(text string) float32 {
|
).SetAnalyser(func(text string) float32 {
|
||||||
if strings.Contains(text, "<?php") {
|
if strings.Contains(text, "<?php") {
|
||||||
return 0.5
|
return 0.5
|
||||||
}
|
}
|
||||||
return 0.0
|
return 0.0
|
||||||
})))
|
})))
|
||||||
|
|
||||||
|
func phtmlRules() Rules {
|
||||||
|
return Rules{
|
||||||
|
"root": {
|
||||||
|
{`<\?(php)?`, CommentPreproc, Push("php")},
|
||||||
|
{`[^<]+`, Other, nil},
|
||||||
|
{`<`, Other, nil},
|
||||||
|
},
|
||||||
|
}.Merge(phpCommonRules())
|
||||||
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/d/d.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/d/d.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// D lexer. https://dlang.org/spec/lex.html
|
// D lexer. https://dlang.org/spec/lex.html
|
||||||
var D = internal.Register(MustNewLexer(
|
var D = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "D",
|
Name: "D",
|
||||||
Aliases: []string{"d"},
|
Aliases: []string{"d"},
|
||||||
@ -14,7 +14,11 @@ var D = internal.Register(MustNewLexer(
|
|||||||
MimeTypes: []string{"text/x-d"},
|
MimeTypes: []string{"text/x-d"},
|
||||||
EnsureNL: true,
|
EnsureNL: true,
|
||||||
},
|
},
|
||||||
Rules{
|
dRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func dRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`[^\S\n]+`, Text, nil},
|
{`[^\S\n]+`, Text, nil},
|
||||||
|
|
||||||
@ -65,5 +69,5 @@ var D = internal.Register(MustNewLexer(
|
|||||||
"import": {
|
"import": {
|
||||||
{`[\w.]+\*?`, NameNamespace, Pop(1)},
|
{`[\w.]+\*?`, NameNamespace, Pop(1)},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/d/dart.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/d/dart.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Dart lexer.
|
// Dart lexer.
|
||||||
var Dart = internal.Register(MustNewLexer(
|
var Dart = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Dart",
|
Name: "Dart",
|
||||||
Aliases: []string{"dart"},
|
Aliases: []string{"dart"},
|
||||||
@ -14,7 +14,11 @@ var Dart = internal.Register(MustNewLexer(
|
|||||||
MimeTypes: []string{"text/x-dart"},
|
MimeTypes: []string{"text/x-dart"},
|
||||||
DotAll: true,
|
DotAll: true,
|
||||||
},
|
},
|
||||||
Rules{
|
dartRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func dartRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
Include("string_literal"),
|
Include("string_literal"),
|
||||||
{`#!(.*?)$`, CommentPreproc, nil},
|
{`#!(.*?)$`, CommentPreproc, nil},
|
||||||
@ -87,5 +91,5 @@ var Dart = internal.Register(MustNewLexer(
|
|||||||
Include("string_common"),
|
Include("string_common"),
|
||||||
{`(\$|\')+`, LiteralStringSingle, nil},
|
{`(\$|\')+`, LiteralStringSingle, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/d/diff.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/d/diff.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Diff lexer.
|
// Diff lexer.
|
||||||
var Diff = internal.Register(MustNewLexer(
|
var Diff = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Diff",
|
Name: "Diff",
|
||||||
Aliases: []string{"diff", "udiff"},
|
Aliases: []string{"diff", "udiff"},
|
||||||
@ -14,7 +14,11 @@ var Diff = internal.Register(MustNewLexer(
|
|||||||
Filenames: []string{"*.diff", "*.patch"},
|
Filenames: []string{"*.diff", "*.patch"},
|
||||||
MimeTypes: []string{"text/x-diff", "text/x-patch"},
|
MimeTypes: []string{"text/x-diff", "text/x-patch"},
|
||||||
},
|
},
|
||||||
Rules{
|
diffRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func diffRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{` .*\n`, Text, nil},
|
{` .*\n`, Text, nil},
|
||||||
{`\+.*\n`, GenericInserted, nil},
|
{`\+.*\n`, GenericInserted, nil},
|
||||||
@ -25,5 +29,5 @@ var Diff = internal.Register(MustNewLexer(
|
|||||||
{`=.*\n`, GenericHeading, nil},
|
{`=.*\n`, GenericHeading, nil},
|
||||||
{`.*\n`, Text, nil},
|
{`.*\n`, Text, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/d/django.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/d/django.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Django/Jinja lexer.
|
// Django/Jinja lexer.
|
||||||
var DjangoJinja = internal.Register(MustNewLexer(
|
var DjangoJinja = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Django/Jinja",
|
Name: "Django/Jinja",
|
||||||
Aliases: []string{"django", "jinja"},
|
Aliases: []string{"django", "jinja"},
|
||||||
@ -14,7 +14,11 @@ var DjangoJinja = internal.Register(MustNewLexer(
|
|||||||
MimeTypes: []string{"application/x-django-templating", "application/x-jinja"},
|
MimeTypes: []string{"application/x-django-templating", "application/x-jinja"},
|
||||||
DotAll: true,
|
DotAll: true,
|
||||||
},
|
},
|
||||||
Rules{
|
djangoJinjaRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func djangoJinjaRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`[^{]+`, Other, nil},
|
{`[^{]+`, Other, nil},
|
||||||
{`\{\{`, CommentPreproc, Push("var")},
|
{`\{\{`, CommentPreproc, Push("var")},
|
||||||
@ -49,5 +53,5 @@ var DjangoJinja = internal.Register(MustNewLexer(
|
|||||||
Include("varnames"),
|
Include("varnames"),
|
||||||
{`.`, Punctuation, nil},
|
{`.`, Punctuation, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/d/docker.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/d/docker.go
generated
vendored
@ -8,7 +8,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Docker lexer.
|
// Docker lexer.
|
||||||
var Docker = internal.Register(MustNewLexer(
|
var Docker = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Docker",
|
Name: "Docker",
|
||||||
Aliases: []string{"docker", "dockerfile"},
|
Aliases: []string{"docker", "dockerfile"},
|
||||||
@ -16,7 +16,11 @@ var Docker = internal.Register(MustNewLexer(
|
|||||||
MimeTypes: []string{"text/x-dockerfile-config"},
|
MimeTypes: []string{"text/x-dockerfile-config"},
|
||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
},
|
},
|
||||||
Rules{
|
dockerRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func dockerRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`#.*`, Comment, nil},
|
{`#.*`, Comment, nil},
|
||||||
{`(ONBUILD)((?:\s*\\?\s*))`, ByGroups(Keyword, Using(b.Bash)), nil},
|
{`(ONBUILD)((?:\s*\\?\s*))`, ByGroups(Keyword, Using(b.Bash)), nil},
|
||||||
@ -27,5 +31,5 @@ var Docker = internal.Register(MustNewLexer(
|
|||||||
{`((?:RUN|CMD|ENTRYPOINT|ENV|ARG|LABEL|ADD|COPY))`, Keyword, nil},
|
{`((?:RUN|CMD|ENTRYPOINT|ENV|ARG|LABEL|ADD|COPY))`, Keyword, nil},
|
||||||
{`(.*\\\n)*.+`, Using(b.Bash), nil},
|
{`(.*\\\n)*.+`, Using(b.Bash), nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/d/dtd.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/d/dtd.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Dtd lexer.
|
// Dtd lexer.
|
||||||
var Dtd = internal.Register(MustNewLexer(
|
var Dtd = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "DTD",
|
Name: "DTD",
|
||||||
Aliases: []string{"dtd"},
|
Aliases: []string{"dtd"},
|
||||||
@ -14,7 +14,11 @@ var Dtd = internal.Register(MustNewLexer(
|
|||||||
MimeTypes: []string{"application/xml-dtd"},
|
MimeTypes: []string{"application/xml-dtd"},
|
||||||
DotAll: true,
|
DotAll: true,
|
||||||
},
|
},
|
||||||
Rules{
|
dtdRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func dtdRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
Include("common"),
|
Include("common"),
|
||||||
{`(<!ELEMENT)(\s+)(\S+)`, ByGroups(Keyword, Text, NameTag), Push("element")},
|
{`(<!ELEMENT)(\s+)(\S+)`, ByGroups(Keyword, Text, NameTag), Push("element")},
|
||||||
@ -65,5 +69,5 @@ var Dtd = internal.Register(MustNewLexer(
|
|||||||
{`[^>\s|()?+*,]+`, NameAttribute, nil},
|
{`[^>\s|()?+*,]+`, NameAttribute, nil},
|
||||||
{`>`, Keyword, Pop(1)},
|
{`>`, Keyword, Pop(1)},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
76
vendor/github.com/alecthomas/chroma/lexers/d/dylan.go
generated
vendored
Normal file
76
vendor/github.com/alecthomas/chroma/lexers/d/dylan.go
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
package d
|
||||||
|
|
||||||
|
import (
|
||||||
|
. "github.com/alecthomas/chroma" // nolint
|
||||||
|
"github.com/alecthomas/chroma/lexers/internal"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Dylan lexer.
|
||||||
|
var Dylan = internal.Register(MustNewLazyLexer(
|
||||||
|
&Config{
|
||||||
|
Name: "Dylan",
|
||||||
|
Aliases: []string{"dylan"},
|
||||||
|
Filenames: []string{"*.dylan", "*.dyl", "*.intr"},
|
||||||
|
MimeTypes: []string{"text/x-dylan"},
|
||||||
|
CaseInsensitive: true,
|
||||||
|
},
|
||||||
|
func() Rules {
|
||||||
|
return Rules{
|
||||||
|
"root": {
|
||||||
|
{`\s+`, Whitespace, nil},
|
||||||
|
{`//.*?\n`, CommentSingle, nil},
|
||||||
|
{`([a-z0-9-]+:)([ \t]*)(.*(?:\n[ \t].+)*)`, ByGroups(NameAttribute, Whitespace, LiteralString), nil},
|
||||||
|
Default(Push("code")),
|
||||||
|
},
|
||||||
|
"code": {
|
||||||
|
{`\s+`, Whitespace, nil},
|
||||||
|
{`//.*?\n`, CommentSingle, nil},
|
||||||
|
{`/\*`, CommentMultiline, Push("comment")},
|
||||||
|
{`"`, LiteralString, Push("string")},
|
||||||
|
{`'(\\.|\\[0-7]{1,3}|\\x[a-f0-9]{1,2}|[^\\\'\n])'`, LiteralStringChar, nil},
|
||||||
|
{`#b[01]+`, LiteralNumberBin, nil},
|
||||||
|
{`#o[0-7]+`, LiteralNumberOct, nil},
|
||||||
|
{`[-+]?(\d*\.\d+([ed][-+]?\d+)?|\d+(\.\d*)?e[-+]?\d+)`, LiteralNumberFloat, nil},
|
||||||
|
{`[-+]?\d+`, LiteralNumberInteger, nil},
|
||||||
|
{`#x[0-9a-f]+`, LiteralNumberHex, nil},
|
||||||
|
|
||||||
|
{`(\?\\?)([\w!&*<>|^$%@+~?/=-]+)(:)(token|name|variable|expression|body|case-body|\*)`,
|
||||||
|
ByGroups(Operator, NameVariable, Operator, NameBuiltin), nil},
|
||||||
|
{`(\?)(:)(token|name|variable|expression|body|case-body|\*)`,
|
||||||
|
ByGroups(Operator, Operator, NameVariable), nil},
|
||||||
|
{`(\?\\?)([\w!&*<>|^$%@+~?/=-]+)`, ByGroups(Operator, NameVariable), nil},
|
||||||
|
|
||||||
|
{`(=>|::|#\(|#\[|##|\?\?|\?=|\?|[(){}\[\],.;])`, Punctuation, nil},
|
||||||
|
{`:=`, Operator, nil},
|
||||||
|
{`#[tf]`, Literal, nil},
|
||||||
|
{`#"`, LiteralStringSymbol, Push("symbol")},
|
||||||
|
{`#[a-z0-9-]+`, Keyword, nil},
|
||||||
|
{`#(all-keys|include|key|next|rest)`, Keyword, nil},
|
||||||
|
{`[\w!&*<>|^$%@+~?/=-]+:`, KeywordConstant, nil},
|
||||||
|
{`<[\w!&*<>|^$%@+~?/=-]+>`, NameClass, nil},
|
||||||
|
{`\*[\w!&*<>|^$%@+~?/=-]+\*`, NameVariableGlobal, nil},
|
||||||
|
{`\$[\w!&*<>|^$%@+~?/=-]+`, NameConstant, nil},
|
||||||
|
{`(let|method|function)([ \t]+)([\w!&*<>|^$%@+~?/=-]+)`, ByGroups(NameBuiltin, Whitespace, NameVariable), nil},
|
||||||
|
{`(error|signal|return|break)`, NameException, nil},
|
||||||
|
{`(\\?)([\w!&*<>|^$%@+~?/=-]+)`, ByGroups(Operator, Name), nil},
|
||||||
|
},
|
||||||
|
"comment": {
|
||||||
|
{`[^*/]`, CommentMultiline, nil},
|
||||||
|
{`/\*`, CommentMultiline, Push()},
|
||||||
|
{`\*/`, CommentMultiline, Pop(1)},
|
||||||
|
{`[*/]`, CommentMultiline, nil},
|
||||||
|
},
|
||||||
|
"symbol": {
|
||||||
|
{`"`, LiteralStringSymbol, Pop(1)},
|
||||||
|
{`[^\\"]+`, LiteralStringSymbol, nil},
|
||||||
|
},
|
||||||
|
"string": {
|
||||||
|
{`"`, LiteralString, Pop(1)},
|
||||||
|
{`\\([\\abfnrtv"\']|x[a-f0-9]{2,4}|[0-7]{1,3})`, LiteralStringEscape, nil},
|
||||||
|
{`[^\\"\n]+`, LiteralString, nil},
|
||||||
|
{`\\\n`, LiteralString, nil},
|
||||||
|
{`\\`, LiteralString, nil},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
))
|
12
vendor/github.com/alecthomas/chroma/lexers/e/ebnf.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/e/ebnf.go
generated
vendored
@ -6,14 +6,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Ebnf lexer.
|
// Ebnf lexer.
|
||||||
var Ebnf = internal.Register(MustNewLexer(
|
var Ebnf = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "EBNF",
|
Name: "EBNF",
|
||||||
Aliases: []string{"ebnf"},
|
Aliases: []string{"ebnf"},
|
||||||
Filenames: []string{"*.ebnf"},
|
Filenames: []string{"*.ebnf"},
|
||||||
MimeTypes: []string{"text/x-ebnf"},
|
MimeTypes: []string{"text/x-ebnf"},
|
||||||
},
|
},
|
||||||
Rules{
|
ebnfRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func ebnfRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
Include("whitespace"),
|
Include("whitespace"),
|
||||||
Include("comment_start"),
|
Include("comment_start"),
|
||||||
@ -47,5 +51,5 @@ var Ebnf = internal.Register(MustNewLexer(
|
|||||||
"identifier": {
|
"identifier": {
|
||||||
{`([a-zA-Z][\w \-]*)`, Keyword, nil},
|
{`([a-zA-Z][\w \-]*)`, Keyword, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/e/elixir.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/e/elixir.go
generated
vendored
@ -6,14 +6,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Elixir lexer.
|
// Elixir lexer.
|
||||||
var Elixir = internal.Register(MustNewLexer(
|
var Elixir = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Elixir",
|
Name: "Elixir",
|
||||||
Aliases: []string{"elixir", "ex", "exs"},
|
Aliases: []string{"elixir", "ex", "exs"},
|
||||||
Filenames: []string{"*.ex", "*.exs"},
|
Filenames: []string{"*.ex", "*.exs"},
|
||||||
MimeTypes: []string{"text/x-elixir"},
|
MimeTypes: []string{"text/x-elixir"},
|
||||||
},
|
},
|
||||||
Rules{
|
elixirRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func elixirRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`\s+`, Text, nil},
|
{`\s+`, Text, nil},
|
||||||
{`#.*$`, CommentSingle, nil},
|
{`#.*$`, CommentSingle, nil},
|
||||||
@ -273,5 +277,5 @@ var Elixir = internal.Register(MustNewLexer(
|
|||||||
{`\\.`, LiteralStringOther, nil},
|
{`\\.`, LiteralStringOther, nil},
|
||||||
{`'[a-zA-Z]*`, LiteralStringOther, Pop(1)},
|
{`'[a-zA-Z]*`, LiteralStringOther, Pop(1)},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/e/elm.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/e/elm.go
generated
vendored
@ -6,14 +6,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Elm lexer.
|
// Elm lexer.
|
||||||
var Elm = internal.Register(MustNewLexer(
|
var Elm = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Elm",
|
Name: "Elm",
|
||||||
Aliases: []string{"elm"},
|
Aliases: []string{"elm"},
|
||||||
Filenames: []string{"*.elm"},
|
Filenames: []string{"*.elm"},
|
||||||
MimeTypes: []string{"text/x-elm"},
|
MimeTypes: []string{"text/x-elm"},
|
||||||
},
|
},
|
||||||
Rules{
|
elmRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func elmRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`\{-`, CommentMultiline, Push("comment")},
|
{`\{-`, CommentMultiline, Push("comment")},
|
||||||
{`--.*`, CommentSingle, nil},
|
{`--.*`, CommentSingle, nil},
|
||||||
@ -55,5 +59,5 @@ var Elm = internal.Register(MustNewLexer(
|
|||||||
{`\|\]`, NameEntity, Pop(1)},
|
{`\|\]`, NameEntity, Pop(1)},
|
||||||
{`.*\n`, NameEntity, nil},
|
{`.*\n`, NameEntity, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
24
vendor/github.com/alecthomas/chroma/lexers/e/emacs.go
generated
vendored
24
vendor/github.com/alecthomas/chroma/lexers/e/emacs.go
generated
vendored
@ -522,14 +522,24 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// EmacsLisp lexer.
|
// EmacsLisp lexer.
|
||||||
var EmacsLisp = internal.Register(TypeRemappingLexer(MustNewLexer(
|
var EmacsLisp = internal.Register(TypeRemappingLexer(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "EmacsLisp",
|
Name: "EmacsLisp",
|
||||||
Aliases: []string{"emacs", "elisp", "emacs-lisp"},
|
Aliases: []string{"emacs", "elisp", "emacs-lisp"},
|
||||||
Filenames: []string{"*.el"},
|
Filenames: []string{"*.el"},
|
||||||
MimeTypes: []string{"text/x-elisp", "application/x-elisp"},
|
MimeTypes: []string{"text/x-elisp", "application/x-elisp"},
|
||||||
},
|
},
|
||||||
Rules{
|
emacsLispRules,
|
||||||
|
), TypeMapping{
|
||||||
|
{NameVariable, NameFunction, emacsBuiltinFunction},
|
||||||
|
{NameVariable, NameBuiltin, emacsSpecialForms},
|
||||||
|
{NameVariable, NameException, emacsErrorKeywords},
|
||||||
|
{NameVariable, NameBuiltin, append(emacsBuiltinFunctionHighlighted, emacsMacros...)},
|
||||||
|
{NameVariable, KeywordPseudo, emacsLambdaListKeywords},
|
||||||
|
}))
|
||||||
|
|
||||||
|
func emacsLispRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
Default(Push("body")),
|
Default(Push("body")),
|
||||||
},
|
},
|
||||||
@ -572,11 +582,5 @@ var EmacsLisp = internal.Register(TypeRemappingLexer(MustNewLexer(
|
|||||||
{`\\\n`, LiteralString, nil},
|
{`\\\n`, LiteralString, nil},
|
||||||
{`"`, LiteralString, Pop(1)},
|
{`"`, LiteralString, Pop(1)},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
), TypeMapping{
|
}
|
||||||
{NameVariable, NameFunction, emacsBuiltinFunction},
|
|
||||||
{NameVariable, NameBuiltin, emacsSpecialForms},
|
|
||||||
{NameVariable, NameException, emacsErrorKeywords},
|
|
||||||
{NameVariable, NameBuiltin, append(emacsBuiltinFunctionHighlighted, emacsMacros...)},
|
|
||||||
{NameVariable, KeywordPseudo, emacsLambdaListKeywords},
|
|
||||||
}))
|
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/e/erlang.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/e/erlang.go
generated
vendored
@ -6,14 +6,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Erlang lexer.
|
// Erlang lexer.
|
||||||
var Erlang = internal.Register(MustNewLexer(
|
var Erlang = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Erlang",
|
Name: "Erlang",
|
||||||
Aliases: []string{"erlang"},
|
Aliases: []string{"erlang"},
|
||||||
Filenames: []string{"*.erl", "*.hrl", "*.es", "*.escript"},
|
Filenames: []string{"*.erl", "*.hrl", "*.es", "*.escript"},
|
||||||
MimeTypes: []string{"text/x-erlang"},
|
MimeTypes: []string{"text/x-erlang"},
|
||||||
},
|
},
|
||||||
Rules{
|
erlangRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func erlangRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`\s+`, Text, nil},
|
{`\s+`, Text, nil},
|
||||||
{`%.*\n`, Comment, nil},
|
{`%.*\n`, Comment, nil},
|
||||||
@ -62,5 +66,5 @@ var Erlang = internal.Register(MustNewLexer(
|
|||||||
{`,`, Punctuation, Pop(1)},
|
{`,`, Punctuation, Pop(1)},
|
||||||
{`(?=\})`, Punctuation, Pop(1)},
|
{`(?=\})`, Punctuation, Pop(1)},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/f/factor.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/f/factor.go
generated
vendored
@ -6,14 +6,18 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Factor lexer.
|
// Factor lexer.
|
||||||
var Factor = internal.Register(MustNewLexer(
|
var Factor = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Factor",
|
Name: "Factor",
|
||||||
Aliases: []string{"factor"},
|
Aliases: []string{"factor"},
|
||||||
Filenames: []string{"*.factor"},
|
Filenames: []string{"*.factor"},
|
||||||
MimeTypes: []string{"text/x-factor"},
|
MimeTypes: []string{"text/x-factor"},
|
||||||
},
|
},
|
||||||
Rules{
|
factorRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func factorRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`#!.*$`, CommentPreproc, nil},
|
{`#!.*$`, CommentPreproc, nil},
|
||||||
Default(Push("base")),
|
Default(Push("base")),
|
||||||
@ -111,5 +115,5 @@ var Factor = internal.Register(MustNewLexer(
|
|||||||
{`;\s`, Keyword, Pop(1)},
|
{`;\s`, Keyword, Pop(1)},
|
||||||
{`\S+`, NameFunction, nil},
|
{`\S+`, NameFunction, nil},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
66
vendor/github.com/alecthomas/chroma/lexers/f/fennel.go
generated
vendored
Normal file
66
vendor/github.com/alecthomas/chroma/lexers/f/fennel.go
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
package f
|
||||||
|
|
||||||
|
import (
|
||||||
|
. "github.com/alecthomas/chroma" // nolint
|
||||||
|
"github.com/alecthomas/chroma/lexers/internal"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Fennel lexer.
|
||||||
|
var Fennel = internal.Register(MustNewLazyLexer(
|
||||||
|
&Config{
|
||||||
|
Name: "Fennel",
|
||||||
|
Aliases: []string{"fennel", "fnl"},
|
||||||
|
Filenames: []string{"*.fennel"},
|
||||||
|
MimeTypes: []string{"text/x-fennel", "application/x-fennel"},
|
||||||
|
},
|
||||||
|
fennelRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
// Here's some Fennel code used to generate the lists of keywords:
|
||||||
|
// (local fennel (require :fennel))
|
||||||
|
//
|
||||||
|
// (fn member? [t x] (each [_ y (ipairs t)] (when (= y x) (lua "return true"))))
|
||||||
|
//
|
||||||
|
// (local declarations [:fn :lambda :λ :local :var :global :macro :macros])
|
||||||
|
// (local keywords [])
|
||||||
|
// (local globals [])
|
||||||
|
//
|
||||||
|
// (each [name data (pairs (fennel.syntax))]
|
||||||
|
// (if (member? declarations name) nil ; already populated
|
||||||
|
// data.special? (table.insert keywords name)
|
||||||
|
// data.macro? (table.insert keywords name)
|
||||||
|
// data.global? (table.insert globals name)))
|
||||||
|
//
|
||||||
|
// (fn quoted [tbl]
|
||||||
|
// (table.sort tbl)
|
||||||
|
// (table.concat (icollect [_ k (ipairs tbl)]
|
||||||
|
// (string.format "`%s`" k)) ", "))
|
||||||
|
//
|
||||||
|
// (print :Keyword (quoted keywords))
|
||||||
|
// (print :KeywordDeclaration (quoted declarations))
|
||||||
|
// (print :NameBuiltin (quoted globals))
|
||||||
|
|
||||||
|
func fennelRules() Rules {
|
||||||
|
return Rules{
|
||||||
|
"root": {
|
||||||
|
{`;.*$`, CommentSingle, nil},
|
||||||
|
{`\s+`, Whitespace, nil},
|
||||||
|
{`-?\d+\.\d+`, LiteralNumberFloat, nil},
|
||||||
|
{`-?\d+`, LiteralNumberInteger, nil},
|
||||||
|
{`0x-?[abcdef\d]+`, LiteralNumberHex, nil},
|
||||||
|
{`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
|
||||||
|
{`'(?!#)[\w!$%*+<=>?/.#-]+`, LiteralStringSymbol, nil},
|
||||||
|
{`\\(.|[a-z]+)`, LiteralStringChar, nil},
|
||||||
|
{`::?#?(?!#)[\w!$%*+<=>?/.#-]+`, LiteralStringSymbol, nil},
|
||||||
|
{"~@|[`\\'#^~&@]", Operator, nil},
|
||||||
|
{Words(``, ` `, `#`, `%`, `*`, `+`, `-`, `->`, `->>`, `-?>`, `-?>>`, `.`, `..`, `/`, `//`, `:`, `<`, `<=`, `=`, `>`, `>=`, `?.`, `^`, `accumulate`, `and`, `band`, `bnot`, `bor`, `bxor`, `collect`, `comment`, `do`, `doc`, `doto`, `each`, `eval-compiler`, `for`, `hashfn`, `icollect`, `if`, `import-macros`, `include`, `length`, `let`, `lshift`, `lua`, `macrodebug`, `match`, `not`, `not=`, `or`, `partial`, `pick-args`, `pick-values`, `quote`, `require-macros`, `rshift`, `set`, `set-forcibly!`, `tset`, `values`, `when`, `while`, `with-open`, `~=`), Keyword, nil},
|
||||||
|
{Words(``, ` `, `fn`, `global`, `lambda`, `local`, `macro`, `macros`, `var`, `λ`), KeywordDeclaration, nil},
|
||||||
|
{Words(``, ` `, `_G`, `arg`, `assert`, `bit32`, `bit32.arshift`, `bit32.band`, `bit32.bnot`, `bit32.bor`, `bit32.btest`, `bit32.bxor`, `bit32.extract`, `bit32.lrotate`, `bit32.lshift`, `bit32.replace`, `bit32.rrotate`, `bit32.rshift`, `collectgarbage`, `coroutine`, `coroutine.create`, `coroutine.resume`, `coroutine.running`, `coroutine.status`, `coroutine.wrap`, `coroutine.yield`, `debug`, `debug.debug`, `debug.gethook`, `debug.getinfo`, `debug.getlocal`, `debug.getmetatable`, `debug.getregistry`, `debug.getupvalue`, `debug.getuservalue`, `debug.sethook`, `debug.setlocal`, `debug.setmetatable`, `debug.setupvalue`, `debug.setuservalue`, `debug.traceback`, `debug.upvalueid`, `debug.upvaluejoin`, `dofile`, `error`, `getmetatable`, `io`, `io.close`, `io.flush`, `io.input`, `io.lines`, `io.open`, `io.output`, `io.popen`, `io.read`, `io.tmpfile`, `io.type`, `io.write`, `ipairs`, `load`, `loadfile`, `loadstring`, `math`, `math.abs`, `math.acos`, `math.asin`, `math.atan`, `math.atan2`, `math.ceil`, `math.cos`, `math.cosh`, `math.deg`, `math.exp`, `math.floor`, `math.fmod`, `math.frexp`, `math.ldexp`, `math.log`, `math.log10`, `math.max`, `math.min`, `math.modf`, `math.pow`, `math.rad`, `math.random`, `math.randomseed`, `math.sin`, `math.sinh`, `math.sqrt`, `math.tan`, `math.tanh`, `module`, `next`, `os`, `os.clock`, `os.date`, `os.difftime`, `os.execute`, `os.exit`, `os.getenv`, `os.remove`, `os.rename`, `os.setlocale`, `os.time`, `os.tmpname`, `package`, `package.loadlib`, `package.searchpath`, `package.seeall`, `pairs`, `pcall`, `print`, `rawequal`, `rawget`, `rawlen`, `rawset`, `require`, `select`, `setmetatable`, `string`, `string.byte`, `string.char`, `string.dump`, `string.find`, `string.format`, `string.gmatch`, `string.gsub`, `string.len`, `string.lower`, `string.match`, `string.rep`, `string.reverse`, `string.sub`, `string.upper`, `table`, `table.concat`, `table.insert`, `table.maxn`, `table.pack`, `table.remove`, `table.sort`, `table.unpack`, `tonumber`, `tostring`, `type`, `unpack`, `xpcall`), NameBuiltin, nil},
|
||||||
|
{`(?<=\()(?!#)[\w!$%*+<=>?/.#-]+`, NameFunction, nil},
|
||||||
|
{`(?!#)[\w!$%*+<=>?/.#-]+`, NameVariable, nil},
|
||||||
|
{`(\[|\])`, Punctuation, nil},
|
||||||
|
{`(\{|\})`, Punctuation, nil},
|
||||||
|
{`(\(|\))`, Punctuation, nil},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
55
vendor/github.com/alecthomas/chroma/lexers/f/fish.go
generated
vendored
55
vendor/github.com/alecthomas/chroma/lexers/f/fish.go
generated
vendored
@ -6,18 +6,43 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Fish lexer.
|
// Fish lexer.
|
||||||
var Fish = internal.Register(MustNewLexer(
|
var Fish = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Fish",
|
Name: "Fish",
|
||||||
Aliases: []string{"fish", "fishshell"},
|
Aliases: []string{"fish", "fishshell"},
|
||||||
Filenames: []string{"*.fish", "*.load"},
|
Filenames: []string{"*.fish", "*.load"},
|
||||||
MimeTypes: []string{"application/x-fish"},
|
MimeTypes: []string{"application/x-fish"},
|
||||||
},
|
},
|
||||||
Rules{
|
fishRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func fishRules() Rules {
|
||||||
|
keywords := []string{
|
||||||
|
`begin`, `end`, `if`, `else`, `while`, `break`, `for`, `return`, `function`, `block`,
|
||||||
|
`case`, `continue`, `switch`, `not`, `and`, `or`, `set`, `echo`, `exit`, `pwd`, `true`,
|
||||||
|
`false`, `cd`, `cdh`, `count`, `test`,
|
||||||
|
}
|
||||||
|
keywordsPattern := Words(`\b`, `\b`, keywords...)
|
||||||
|
|
||||||
|
builtins := []string{
|
||||||
|
`alias`, `bg`, `bind`, `breakpoint`, `builtin`, `argparse`, `abbr`, `string`, `command`,
|
||||||
|
`commandline`, `complete`, `contains`, `dirh`, `dirs`, `disown`, `emit`, `eval`, `exec`,
|
||||||
|
`fg`, `fish`, `fish_add_path`, `fish_breakpoint_prompt`, `fish_command_not_found`,
|
||||||
|
`fish_config`, `fish_git_prompt`, `fish_greeting`, `fish_hg_prompt`, `fish_indent`,
|
||||||
|
`fish_is_root_user`, `fish_key_reader`, `fish_mode_prompt`, `fish_opt`, `fish_pager`,
|
||||||
|
`fish_prompt`, `fish_right_prompt`, `fish_status_to_signal`, `fish_svn_prompt`,
|
||||||
|
`fish_title`, `fish_update_completions`, `fish_vcs_prompt`, `fishd`, `funced`,
|
||||||
|
`funcsave`, `functions`, `help`, `history`, `isatty`, `jobs`, `math`, `mimedb`, `nextd`,
|
||||||
|
`open`, `prompt_pwd`, `realpath`, `popd`, `prevd`, `psub`, `pushd`, `random`, `read`,
|
||||||
|
`set_color`, `source`, `status`, `suspend`, `trap`, `type`, `ulimit`, `umask`, `vared`,
|
||||||
|
`fc`, `getopts`, `hash`, `kill`, `printf`, `time`, `wait`,
|
||||||
|
}
|
||||||
|
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
Include("basic"),
|
Include("basic"),
|
||||||
Include("data"),
|
|
||||||
Include("interp"),
|
Include("interp"),
|
||||||
|
Include("data"),
|
||||||
},
|
},
|
||||||
"interp": {
|
"interp": {
|
||||||
{`\$\(\(`, Keyword, Push("math")},
|
{`\$\(\(`, Keyword, Push("math")},
|
||||||
@ -25,13 +50,20 @@ var Fish = internal.Register(MustNewLexer(
|
|||||||
{`\$#?(\w+|.)`, NameVariable, nil},
|
{`\$#?(\w+|.)`, NameVariable, nil},
|
||||||
},
|
},
|
||||||
"basic": {
|
"basic": {
|
||||||
{`\b(begin|end|if|else|while|break|for|in|return|function|block|case|continue|switch|not|and|or|set|echo|exit|pwd|true|false|cd|count|test)(\s*)\b`, ByGroups(Keyword, Text), nil},
|
{Words(`(?<=(?:^|\A|;|&&|\|\||\||`+keywordsPattern+`)\s*)`, `(?=;?\b)`, keywords...), Keyword, nil},
|
||||||
{`\b(alias|bg|bind|breakpoint|builtin|command|commandline|complete|contains|dirh|dirs|emit|eval|exec|fg|fish|fish_config|fish_indent|fish_pager|fish_prompt|fish_right_prompt|fish_update_completions|fishd|funced|funcsave|functions|help|history|isatty|jobs|math|mimedb|nextd|open|popd|prevd|psub|pushd|random|read|set_color|source|status|trap|type|ulimit|umask|vared|fc|getopts|hash|kill|printf|time|wait)\s*\b(?!\.)`, NameBuiltin, nil},
|
{`(?<=for\s+\S+\s+)in\b`, Keyword, nil},
|
||||||
|
{Words(`\b`, `\s*\b(?!\.)`, builtins...), NameBuiltin, nil},
|
||||||
|
{`#!.*\n`, CommentHashbang, nil},
|
||||||
{`#.*\n`, Comment, nil},
|
{`#.*\n`, Comment, nil},
|
||||||
{`\\[\w\W]`, LiteralStringEscape, nil},
|
{`\\[\w\W]`, LiteralStringEscape, nil},
|
||||||
{`(\b\w+)(\s*)(=)`, ByGroups(NameVariable, Text, Operator), nil},
|
{`(\b\w+)(\s*)(=)`, ByGroups(NameVariable, Text, Operator), nil},
|
||||||
{`[\[\]()=]`, Operator, nil},
|
{`[\[\]()={}]`, Operator, nil},
|
||||||
|
{`(?<=\[[^\]]+)\.\.|-(?=[^\[]+\])`, Operator, nil},
|
||||||
{`<<-?\s*(\'?)\\?(\w+)[\w\W]+?\2`, LiteralString, nil},
|
{`<<-?\s*(\'?)\\?(\w+)[\w\W]+?\2`, LiteralString, nil},
|
||||||
|
{`(?<=set\s+(?:--?[^\d\W][\w-]*\s+)?)\w+`, NameVariable, nil},
|
||||||
|
{`(?<=for\s+)\w[\w-]*(?=\s+in)`, NameVariable, nil},
|
||||||
|
{`(?<=function\s+)\w(?:[^\n])*?(?= *[-\n])`, NameFunction, nil},
|
||||||
|
{`(?<=(?:^|\b(?:and|or|sudo)\b|;|\|\||&&|\||\(|(?:\b\w+\s*=\S+\s)) *)\w[\w-]*`, NameFunction, nil},
|
||||||
},
|
},
|
||||||
"data": {
|
"data": {
|
||||||
{`(?s)\$?"(\\\\|\\[0-7]+|\\.|[^"\\$])*"`, LiteralStringDouble, nil},
|
{`(?s)\$?"(\\\\|\\[0-7]+|\\.|[^"\\$])*"`, LiteralStringDouble, nil},
|
||||||
@ -39,10 +71,11 @@ var Fish = internal.Register(MustNewLexer(
|
|||||||
{`(?s)\$'(\\\\|\\[0-7]+|\\.|[^'\\])*'`, LiteralStringSingle, nil},
|
{`(?s)\$'(\\\\|\\[0-7]+|\\.|[^'\\])*'`, LiteralStringSingle, nil},
|
||||||
{`(?s)'.*?'`, LiteralStringSingle, nil},
|
{`(?s)'.*?'`, LiteralStringSingle, nil},
|
||||||
{`;`, Punctuation, nil},
|
{`;`, Punctuation, nil},
|
||||||
{`&|\||\^|<|>`, Operator, nil},
|
{`&&|\|\||&|\||\^|<|>`, Operator, nil},
|
||||||
{`\s+`, Text, nil},
|
{`\s+`, Text, nil},
|
||||||
{`\d+(?= |\Z)`, LiteralNumber, nil},
|
{`\b\d+\b`, LiteralNumber, nil},
|
||||||
{"[^=\\s\\[\\]{}()$\"\\'`\\\\<&|;]+", Text, nil},
|
{`(?<=\s+)--?[^\d][\w-]*`, NameAttribute, nil},
|
||||||
|
{".+?", Text, nil},
|
||||||
},
|
},
|
||||||
"string": {
|
"string": {
|
||||||
{`"`, LiteralStringDouble, Pop(1)},
|
{`"`, LiteralStringDouble, Pop(1)},
|
||||||
@ -61,5 +94,5 @@ var Fish = internal.Register(MustNewLexer(
|
|||||||
{`\d+`, LiteralNumber, nil},
|
{`\d+`, LiteralNumber, nil},
|
||||||
Include("root"),
|
Include("root"),
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
12
vendor/github.com/alecthomas/chroma/lexers/f/forth.go
generated
vendored
12
vendor/github.com/alecthomas/chroma/lexers/f/forth.go
generated
vendored
@ -6,7 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Forth lexer.
|
// Forth lexer.
|
||||||
var Forth = internal.Register(MustNewLexer(
|
var Forth = internal.Register(MustNewLazyLexer(
|
||||||
&Config{
|
&Config{
|
||||||
Name: "Forth",
|
Name: "Forth",
|
||||||
Aliases: []string{"forth"},
|
Aliases: []string{"forth"},
|
||||||
@ -14,7 +14,11 @@ var Forth = internal.Register(MustNewLexer(
|
|||||||
MimeTypes: []string{"application/x-forth"},
|
MimeTypes: []string{"application/x-forth"},
|
||||||
CaseInsensitive: true,
|
CaseInsensitive: true,
|
||||||
},
|
},
|
||||||
Rules{
|
forthRules,
|
||||||
|
))
|
||||||
|
|
||||||
|
func forthRules() Rules {
|
||||||
|
return Rules{
|
||||||
"root": {
|
"root": {
|
||||||
{`\s+`, Text, nil},
|
{`\s+`, Text, nil},
|
||||||
{`\\.*?\n`, CommentSingle, nil},
|
{`\\.*?\n`, CommentSingle, nil},
|
||||||
@ -36,5 +40,5 @@ var Forth = internal.Register(MustNewLexer(
|
|||||||
"stringdef": {
|
"stringdef": {
|
||||||
{`[^"]+`, LiteralString, Pop(1)},
|
{`[^"]+`, LiteralString, Pop(1)},
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
))
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user