vendor: update chroma to latest version
This commit is contained in:
		
							parent
							
								
									d40413602b
								
							
						
					
					
						commit
						de865fd332
					
				| 
						 | 
				
			
			@ -2,7 +2,7 @@
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
[[projects]]
 | 
			
		||||
  digest = "1:d0038638a197fe6bbc26587366f10a35d9545a4e763bc7783cb36b84726f323c"
 | 
			
		||||
  digest = "1:a41877f8e11b1ad96a7d47ba3585e145217679cd9ad2236ad93c5643db15fc48"
 | 
			
		||||
  name = "github.com/alecthomas/chroma"
 | 
			
		||||
  packages = [
 | 
			
		||||
    ".",
 | 
			
		||||
| 
						 | 
				
			
			@ -34,10 +34,11 @@
 | 
			
		|||
    "lexers/w",
 | 
			
		||||
    "lexers/x",
 | 
			
		||||
    "lexers/y",
 | 
			
		||||
    "lexers/z",
 | 
			
		||||
    "styles",
 | 
			
		||||
  ]
 | 
			
		||||
  pruneopts = "UT"
 | 
			
		||||
  revision = "v0.7.3"
 | 
			
		||||
  revision = "v0.9.2"
 | 
			
		||||
 | 
			
		||||
[[projects]]
 | 
			
		||||
  branch = "master"
 | 
			
		||||
| 
						 | 
				
			
			@ -48,15 +49,14 @@
 | 
			
		|||
  revision = "cbb64ac3d964b81592e64f957ad53df015803288"
 | 
			
		||||
 | 
			
		||||
[[projects]]
 | 
			
		||||
  digest = "1:72dc2b6056e7097f829260e4a2ff08d32fec6017df1982a66e110ab4128486f8"
 | 
			
		||||
  digest = "1:1d760033af7697966e33f900ddd0e68bfa2637b50fa25e7384e45f73f54e3276"
 | 
			
		||||
  name = "github.com/dlclark/regexp2"
 | 
			
		||||
  packages = [
 | 
			
		||||
    ".",
 | 
			
		||||
    "syntax",
 | 
			
		||||
  ]
 | 
			
		||||
  pruneopts = "UT"
 | 
			
		||||
  revision = "487489b64fb796de2e55f4e8a4ad1e145f80e957"
 | 
			
		||||
  version = "v1.1.6"
 | 
			
		||||
  revision = "v1.4.0"
 | 
			
		||||
 | 
			
		||||
[[projects]]
 | 
			
		||||
  branch = "master"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,11 @@
 | 
			
		|||
 | 
			
		||||
[[constraint]]
 | 
			
		||||
  name = "github.com/alecthomas/chroma"
 | 
			
		||||
  revision = "v0.7.3"
 | 
			
		||||
  revision = "v0.9.2"
 | 
			
		||||
 | 
			
		||||
[[override]]
 | 
			
		||||
  name = "github.com/dlclark/regexp2"
 | 
			
		||||
  revision = "v1.4.0"
 | 
			
		||||
 | 
			
		||||
[[constraint]]
 | 
			
		||||
  name = "golang.org/x/sys"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,6 +20,22 @@ linters:
 | 
			
		|||
    - wsl
 | 
			
		||||
    - gomnd
 | 
			
		||||
    - gocognit
 | 
			
		||||
    - goerr113
 | 
			
		||||
    - nolintlint
 | 
			
		||||
    - testpackage
 | 
			
		||||
    - godot
 | 
			
		||||
    - nestif
 | 
			
		||||
    - paralleltest
 | 
			
		||||
    - nlreturn
 | 
			
		||||
    - cyclop
 | 
			
		||||
    - exhaustivestruct
 | 
			
		||||
    - gci
 | 
			
		||||
    - gofumpt
 | 
			
		||||
    - errorlint
 | 
			
		||||
    - exhaustive
 | 
			
		||||
    - ifshort
 | 
			
		||||
    - wrapcheck
 | 
			
		||||
    - stylecheck
 | 
			
		||||
 | 
			
		||||
linters-settings:
 | 
			
		||||
  govet:
 | 
			
		||||
| 
						 | 
				
			
			@ -31,6 +47,11 @@ linters-settings:
 | 
			
		|||
  goconst:
 | 
			
		||||
    min-len: 8
 | 
			
		||||
    min-occurrences: 3
 | 
			
		||||
  forbidigo:
 | 
			
		||||
    forbid:
 | 
			
		||||
      - (Must)?NewLexer
 | 
			
		||||
    exclude_godoc_examples: false
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
issues:
 | 
			
		||||
  max-per-linter: 0
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,8 @@ release:
 | 
			
		|||
brews:
 | 
			
		||||
  -
 | 
			
		||||
    install: bin.install "chroma"
 | 
			
		||||
env:
 | 
			
		||||
  - CGO_ENABLED=0
 | 
			
		||||
builds:
 | 
			
		||||
- goos:
 | 
			
		||||
    - linux
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,12 +0,0 @@
 | 
			
		|||
sudo: false
 | 
			
		||||
language: go
 | 
			
		||||
go:
 | 
			
		||||
  - "1.13.x"
 | 
			
		||||
script:
 | 
			
		||||
  - go test -v ./...
 | 
			
		||||
  - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s v1.22.2
 | 
			
		||||
  - ./bin/golangci-lint run
 | 
			
		||||
  - git clean -fdx .
 | 
			
		||||
after_success:
 | 
			
		||||
  curl -sL https://git.io/goreleaser | bash && goreleaser
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1,5 +1,7 @@
 | 
			
		|||
.PHONY: chromad upload all
 | 
			
		||||
 | 
			
		||||
VERSION ?= $(shell git describe --tags --dirty  --always)
 | 
			
		||||
 | 
			
		||||
all: README.md tokentype_string.go
 | 
			
		||||
 | 
			
		||||
README.md: lexers/*/*.go
 | 
			
		||||
| 
						 | 
				
			
			@ -9,10 +11,8 @@ tokentype_string.go: types.go
 | 
			
		|||
	go generate
 | 
			
		||||
 | 
			
		||||
chromad:
 | 
			
		||||
	(cd ./cmd/chromad && go get github.com/GeertJohan/go.rice/rice@master && go install github.com/GeertJohan/go.rice/rice)
 | 
			
		||||
	rm -f chromad
 | 
			
		||||
	(export CGOENABLED=0 GOOS=linux ; cd ./cmd/chromad && go build -o ../../chromad .)
 | 
			
		||||
	rice append -i ./cmd/chromad --exec=./chromad
 | 
			
		||||
	(export CGOENABLED=0 GOOS=linux ; cd ./cmd/chromad && go build -ldflags="-X 'main.version=$(VERSION)'" -o ../../chromad .)
 | 
			
		||||
 | 
			
		||||
upload: chromad
 | 
			
		||||
	scp chromad root@swapoff.org: && \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
# Chroma — A general purpose syntax highlighter in pure Go [](https://godoc.org/github.com/alecthomas/chroma) [](https://travis-ci.org/alecthomas/chroma) [](https://gitter.im/alecthomas/Lobby)
 | 
			
		||||
# 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://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.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -36,29 +36,30 @@ translators for Pygments lexers and styles.
 | 
			
		|||
Prefix | Language
 | 
			
		||||
:----: | --------
 | 
			
		||||
A | ABAP, ABNF, ActionScript, ActionScript 3, Ada, Angular2, ANTLR, ApacheConf, APL, AppleScript, Arduino, Awk
 | 
			
		||||
B | Ballerina, Base Makefile, Bash, Batchfile, BlitzBasic, BNF, Brainfuck
 | 
			
		||||
C | C, C#, C++, Cap'n Proto, Cassandra CQL, Ceylon, CFEngine3, cfstatement, ChaiScript, Cheetah, Clojure, CMake, COBOL, CoffeeScript, Common Lisp, Coq, Crystal, CSS, Cython
 | 
			
		||||
D | D, Dart, Diff, Django/Jinja, Docker, DTD
 | 
			
		||||
B | Ballerina, Base Makefile, Bash, Batchfile, BibTeX, 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
 | 
			
		||||
D | D, Dart, Diff, Django/Jinja, Docker, DTD, Dylan
 | 
			
		||||
E | EBNF, Elixir, Elm, EmacsLisp, Erlang
 | 
			
		||||
F | Factor, Fish, Forth, Fortran, FSharp
 | 
			
		||||
G | GAS, GDScript, Genshi, Genshi HTML, Genshi Text, GLSL, Gnuplot, Go, Go HTML Template, Go Text Template, GraphQL, Groovy
 | 
			
		||||
H | Handlebars, Haskell, Haxe, HCL, Hexdump, HTML, HTTP, Hy
 | 
			
		||||
I | Idris, INI, Io
 | 
			
		||||
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
 | 
			
		||||
I | Idris, Igor, INI, Io
 | 
			
		||||
J | J, Java, JavaScript, JSON, Julia, Jungle
 | 
			
		||||
K | Kotlin
 | 
			
		||||
L | Lighttpd configuration file, LLVM, Lua
 | 
			
		||||
M | Mako, markdown, Mason, Mathematica, Matlab, MiniZinc, MLIR, Modula-2, MonkeyC, MorrowindScript, Myghty, MySQL
 | 
			
		||||
N | NASM, Newspeak, Nginx configuration file, Nim, Nix
 | 
			
		||||
O | Objective-C, OCaml, Octave, OpenSCAD, Org Mode
 | 
			
		||||
P | PacmanConf, Perl, PHP, Pig, PkgConfig, PL/pgSQL, plaintext, PostgreSQL SQL dialect, PostScript, POVRay, PowerShell, Prolog, Protocol Buffer, Puppet, Python, Python 3
 | 
			
		||||
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
 | 
			
		||||
R | R, Racket, Ragel, react, reg, reStructuredText, Rexx, Ruby, Rust
 | 
			
		||||
S | Sass, Scala, Scheme, Scilab, SCSS, Smalltalk, Smarty, SML, Snobol, Solidity, SPARQL, SQL, SquidConf, Swift, SYSTEMD, systemverilog
 | 
			
		||||
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, 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
 | 
			
		||||
V | VB.net, verilog, VHDL, VimL, vue
 | 
			
		||||
W | WDTE
 | 
			
		||||
X | XML, Xorg
 | 
			
		||||
Y | YAML
 | 
			
		||||
Y | YAML, YANG
 | 
			
		||||
Z | Zig
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
_I will attempt to keep this section up to date, but an authoritative list can be
 | 
			
		||||
| 
						 | 
				
			
			@ -183,7 +184,7 @@ following constructor options:
 | 
			
		|||
- `ClassPrefix(prefix)` - prefix each generated CSS class.
 | 
			
		||||
- `TabWidth(width)` - Set the rendered tab width, in characters.
 | 
			
		||||
- `WithLineNumbers()` - Render line numbers (style with `LineNumbers`).
 | 
			
		||||
- `LinkableLineNumbers()` - Make the line numbers linkable.
 | 
			
		||||
- `LinkableLineNumbers()` - Make the line numbers linkable and be a link to themselves.
 | 
			
		||||
- `HighlightLines(ranges)` - Highlight lines in these ranges (style with `LineHighlight`).
 | 
			
		||||
- `LineNumbersInTable()` - Use a table for formatting line numbers and code, rather than spans.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -209,13 +210,13 @@ using the included Python 3 script `pygments2chroma.py`. I use something like
 | 
			
		|||
the following:
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
python3 ~/Projects/chroma/_tools/pygments2chroma.py \
 | 
			
		||||
python3 _tools/pygments2chroma.py \
 | 
			
		||||
  pygments.lexers.jvm.KotlinLexer \
 | 
			
		||||
  > ~/Projects/chroma/lexers/kotlin.go \
 | 
			
		||||
  && gofmt -s -w ~/Projects/chroma/lexers/*.go
 | 
			
		||||
  > lexers/k/kotlin.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.
 | 
			
		||||
 | 
			
		||||
<a id="markdown-formatters" name="formatters"></a>
 | 
			
		||||
| 
						 | 
				
			
			@ -254,12 +255,30 @@ A command-line interface to Chroma is included. It can be installed with:
 | 
			
		|||
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>
 | 
			
		||||
## What's missing compared to Pygments?
 | 
			
		||||
 | 
			
		||||
- Quite a few lexers, for various reasons (pull-requests welcome):
 | 
			
		||||
    - 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.
 | 
			
		||||
    - I mostly only converted languages I had heard of, to reduce the porting cost.
 | 
			
		||||
- Some more esoteric features of Pygments are omitted for simplicity.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
hermit
 | 
			
		||||
							
								
								
									
										1
									
								
								vendor/github.com/alecthomas/chroma/bin/.golangci-lint-1.37.0.pkg
								
								
									generated
								
								
									vendored
								
								
									Symbolic link
								
							
							
						
						
									
										1
									
								
								vendor/github.com/alecthomas/chroma/bin/.golangci-lint-1.37.0.pkg
								
								
									generated
								
								
									vendored
								
								
									Symbolic link
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
hermit
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
.go-1.16.3.pkg
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
.go-1.16.3.pkg
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
.golangci-lint-1.37.0.pkg
 | 
			
		||||
| 
						 | 
				
			
			@ -131,7 +131,7 @@ var (
 | 
			
		|||
	}
 | 
			
		||||
	defaultPreWrapper = preWrapper{
 | 
			
		||||
		start: func(code bool, styleAttr string) string {
 | 
			
		||||
			return fmt.Sprintf("<pre%s>", styleAttr)
 | 
			
		||||
			return fmt.Sprintf(`<pre tabindex="0"%s>`, styleAttr)
 | 
			
		||||
		},
 | 
			
		||||
		end: func(code bool) string {
 | 
			
		||||
			return "</pre>"
 | 
			
		||||
| 
						 | 
				
			
			@ -211,7 +211,7 @@ func (f *Formatter) writeHTML(w io.Writer, style *chroma.Style, tokens []chroma.
 | 
			
		|||
				fmt.Fprintf(w, "<span%s>", f.styleAttr(css, chroma.LineHighlight))
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			fmt.Fprintf(w, "<span%s%s>%*d\n</span>", f.styleAttr(css, chroma.LineNumbersTable), f.lineIDAttribute(line), lineDigits, line)
 | 
			
		||||
			fmt.Fprintf(w, "<span%s%s>%s\n</span>", f.styleAttr(css, chroma.LineNumbersTable), f.lineIDAttribute(line), f.lineTitleWithLinkIfNeeded(lineDigits, line))
 | 
			
		||||
 | 
			
		||||
			if highlight {
 | 
			
		||||
				fmt.Fprintf(w, "</span>")
 | 
			
		||||
| 
						 | 
				
			
			@ -237,7 +237,7 @@ func (f *Formatter) writeHTML(w io.Writer, style *chroma.Style, tokens []chroma.
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		if f.lineNumbers && !wrapInTable {
 | 
			
		||||
			fmt.Fprintf(w, "<span%s%s>%*d</span>", f.styleAttr(css, chroma.LineNumbers), f.lineIDAttribute(line), lineDigits, line)
 | 
			
		||||
			fmt.Fprintf(w, "<span%s%s>%s</span>", f.styleAttr(css, chroma.LineNumbers), f.lineIDAttribute(line), f.lineTitleWithLinkIfNeeded(lineDigits, line))
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		for _, token := range tokens {
 | 
			
		||||
| 
						 | 
				
			
			@ -272,7 +272,19 @@ func (f *Formatter) lineIDAttribute(line int) string {
 | 
			
		|||
	if !f.linkableLineNumbers {
 | 
			
		||||
		return ""
 | 
			
		||||
	}
 | 
			
		||||
	return fmt.Sprintf(" id=\"%s%d\"", f.lineNumbersIDPrefix, line)
 | 
			
		||||
	return fmt.Sprintf(" id=\"%s\"", f.lineID(line))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (f *Formatter) lineTitleWithLinkIfNeeded(lineDigits, line int) string {
 | 
			
		||||
	title := fmt.Sprintf("%*d", lineDigits, line)
 | 
			
		||||
	if !f.linkableLineNumbers {
 | 
			
		||||
		return title
 | 
			
		||||
	}
 | 
			
		||||
	return fmt.Sprintf("<a style=\"outline: none; text-decoration:none; color:inherit\" href=\"#%s\">%s</a>", f.lineID(line), title)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (f *Formatter) lineID(line int) string {
 | 
			
		||||
	return fmt.Sprintf("%s%d", f.lineNumbersIDPrefix, line)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (f *Formatter) shouldHighlight(highlightIndex, line int) (bool, bool) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,7 @@ require (
 | 
			
		|||
	github.com/alecthomas/kong v0.2.4
 | 
			
		||||
	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/dlclark/regexp2 v1.4.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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,13 +11,12 @@ github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9
 | 
			
		|||
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/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/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=
 | 
			
		||||
| 
						 | 
				
			
			@ -26,7 +25,6 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
 | 
			
		|||
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/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
 | 
			
		||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
 | 
			
		||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
 | 
			
		||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,7 @@ import "strings"
 | 
			
		|||
 | 
			
		||||
// 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.
 | 
			
		||||
type Iterator func() Token
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,6 +2,7 @@ package chroma
 | 
			
		|||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"strings"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
| 
						 | 
				
			
			@ -100,7 +101,9 @@ type Lexers []Lexer
 | 
			
		|||
 | 
			
		||||
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) 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.
 | 
			
		||||
type PrioritisedLexers []Lexer
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,9 @@
 | 
			
		|||
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`.
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
 | 
			
		||||
Run the tests as normal:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// ABAP lexer.
 | 
			
		||||
var Abap = internal.Register(MustNewLexer(
 | 
			
		||||
var Abap = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:            "ABAP",
 | 
			
		||||
		Aliases:         []string{"abap"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var Abap = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes:       []string{"text/x-abap"},
 | 
			
		||||
		CaseInsensitive: true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	abapRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func abapRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"common": {
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
			{`^\*.*$`, CommentSingle, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -52,5 +56,5 @@ var Abap = internal.Register(MustNewLexer(
 | 
			
		|||
			{`[/;:()\[\],.]`, Punctuation, nil},
 | 
			
		||||
			{`(!)(\w+)`, ByGroups(Operator, Name), nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Abnf lexer.
 | 
			
		||||
var Abnf = internal.Register(MustNewLexer(
 | 
			
		||||
var Abnf = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "ABNF",
 | 
			
		||||
		Aliases:   []string{"abnf"},
 | 
			
		||||
		Filenames: []string{"*.abnf"},
 | 
			
		||||
		MimeTypes: []string{"text/x-abnf"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	abnfRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func abnfRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`;.*$`, CommentSingle, nil},
 | 
			
		||||
			{`(%[si])?"[^"]*"`, Literal, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -34,5 +38,5 @@ var Abnf = internal.Register(MustNewLexer(
 | 
			
		|||
			{`\s+`, Text, nil},
 | 
			
		||||
			{`.`, Text, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Actionscript lexer.
 | 
			
		||||
var Actionscript = internal.Register(MustNewLexer(
 | 
			
		||||
var Actionscript = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:         "ActionScript",
 | 
			
		||||
		Aliases:      []string{"as", "actionscript"},
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +15,11 @@ var Actionscript = internal.Register(MustNewLexer(
 | 
			
		|||
		NotMultiline: true,
 | 
			
		||||
		DotAll:       true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	actionscriptRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func actionscriptRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
			{`//.*?\n`, CommentSingle, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -35,5 +39,5 @@ var Actionscript = internal.Register(MustNewLexer(
 | 
			
		|||
			{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
 | 
			
		||||
			{`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Actionscript 3 lexer.
 | 
			
		||||
var Actionscript3 = internal.Register(MustNewLexer(
 | 
			
		||||
var Actionscript3 = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "ActionScript 3",
 | 
			
		||||
		Aliases:   []string{"as3", "actionscript3"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var Actionscript3 = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes: []string{"application/x-actionscript3", "text/x-actionscript3", "text/actionscript3"},
 | 
			
		||||
		DotAll:    true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	actionscript3Rules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func actionscript3Rules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
			{`(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)},
 | 
			
		||||
			Default(Pop(1)),
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Ada lexer.
 | 
			
		||||
var Ada = internal.Register(MustNewLexer(
 | 
			
		||||
var Ada = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:            "Ada",
 | 
			
		||||
		Aliases:         []string{"ada", "ada95", "ada2005"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var Ada = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes:       []string{"text/x-ada"},
 | 
			
		||||
		CaseInsensitive: true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	adaRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func adaRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`[^\S\n]+`, Text, nil},
 | 
			
		||||
			{`--.*?\n`, CommentSingle, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -110,5 +114,5 @@ var Ada = internal.Register(MustNewLexer(
 | 
			
		|||
			{`\)`, Punctuation, Pop(1)},
 | 
			
		||||
			Include("root"),
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,48 @@
 | 
			
		|||
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},
 | 
			
		||||
			// Added new objects types of BC 2021 wave 1 (REPORTEXTENSION|Entitlement|PermissionSet|PermissionSetExtension)
 | 
			
		||||
			{`\b(?i:(CODEUNIT|PAGE|PAGEEXTENSION|PAGECUSTOMIZATION|DOTNET|ENUM|ENUMEXTENSION|VALUE|QUERY|REPORT|TABLE|TABLEEXTENSION|XMLPORT|PROFILE|CONTROLADDIN|REPORTEXTENSION|Entitlement|PermissionSet|PermissionSetExtension))\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:(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},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Angular2 lexer.
 | 
			
		||||
var Angular2 = internal.Register(MustNewLexer(
 | 
			
		||||
var Angular2 = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Angular2",
 | 
			
		||||
		Aliases:   []string{"ng2"},
 | 
			
		||||
		Filenames: []string{},
 | 
			
		||||
		MimeTypes: []string{},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	angular2Rules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func angular2Rules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`[^{([*#]+`, Other, nil},
 | 
			
		||||
			{`(\{\{)(\s*)`, ByGroups(CommentPreproc, Text), Push("ngExpression")},
 | 
			
		||||
| 
						 | 
				
			
			@ -38,5 +42,5 @@ var Angular2 = internal.Register(MustNewLexer(
 | 
			
		|||
			{`'.*?'`, LiteralString, Pop(1)},
 | 
			
		||||
			{`[^\s>]+`, LiteralString, Pop(1)},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// ANTLR lexer.
 | 
			
		||||
var ANTLR = internal.Register(MustNewLexer(
 | 
			
		||||
var ANTLR = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "ANTLR",
 | 
			
		||||
		Aliases:   []string{"antlr"},
 | 
			
		||||
		Filenames: []string{},
 | 
			
		||||
		MimeTypes: []string{},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	antlrRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func antlrRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"whitespace": {
 | 
			
		||||
			{`\s+`, TextWhitespace, nil},
 | 
			
		||||
		},
 | 
			
		||||
| 
						 | 
				
			
			@ -97,5 +101,5 @@ var ANTLR = internal.Register(MustNewLexer(
 | 
			
		|||
			{`(\$[a-zA-Z]+)(\.?)(text|value)?`, ByGroups(NameVariable, Punctuation, NameProperty), nil},
 | 
			
		||||
			{`(\\\\|\\\]|\\\[|[^\[\]])+`, Other, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Apacheconf lexer.
 | 
			
		||||
var Apacheconf = internal.Register(MustNewLexer(
 | 
			
		||||
var Apacheconf = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:            "ApacheConf",
 | 
			
		||||
		Aliases:         []string{"apacheconf", "aconf", "apache"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var Apacheconf = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes:       []string{"text/x-apacheconf"},
 | 
			
		||||
		CaseInsensitive: true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	apacheconfRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func apacheconfRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
			{`(#.*?)$`, Comment, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -34,5 +38,5 @@ var Apacheconf = internal.Register(MustNewLexer(
 | 
			
		|||
			{`"([^"\\]*(?:\\.[^"\\]*)*)"`, LiteralStringDouble, nil},
 | 
			
		||||
			{`[^\s"\\]+`, Text, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Apl lexer.
 | 
			
		||||
var Apl = internal.Register(MustNewLexer(
 | 
			
		||||
var Apl = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "APL",
 | 
			
		||||
		Aliases:   []string{"apl"},
 | 
			
		||||
		Filenames: []string{"*.apl"},
 | 
			
		||||
		MimeTypes: []string{},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	aplRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func aplRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
			{`[⍝#].*$`, CommentSingle, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -32,5 +36,5 @@ var Apl = internal.Register(MustNewLexer(
 | 
			
		|||
			{`[⍺⍵⍶⍹∇:]`, NameBuiltinPseudo, nil},
 | 
			
		||||
			{`[{}]`, KeywordType, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Applescript lexer.
 | 
			
		||||
var Applescript = internal.Register(MustNewLexer(
 | 
			
		||||
var Applescript = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "AppleScript",
 | 
			
		||||
		Aliases:   []string{"applescript"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var Applescript = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes: []string{},
 | 
			
		||||
		DotAll:    true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	applescriptRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func applescriptRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
			{`¬\n`, LiteralStringEscape, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -51,5 +55,5 @@ var Applescript = internal.Register(MustNewLexer(
 | 
			
		|||
			{`[^*(]+`, CommentMultiline, nil},
 | 
			
		||||
			{`[*(]`, CommentMultiline, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Arduino lexer.
 | 
			
		||||
var Arduino = internal.Register(MustNewLexer(
 | 
			
		||||
var Arduino = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Arduino",
 | 
			
		||||
		Aliases:   []string{"arduino"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var Arduino = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes: []string{"text/x-arduino"},
 | 
			
		||||
		EnsureNL:  true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	arduinoRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func arduinoRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"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},
 | 
			
		||||
			{`char(16_t|32_t)\b`, KeywordType, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -106,5 +110,5 @@ var Arduino = internal.Register(MustNewLexer(
 | 
			
		|||
			{`^\s*#endif.*?(?<!\\)\n`, CommentPreproc, Pop(1)},
 | 
			
		||||
			{`.*?\n`, Comment, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Awk lexer.
 | 
			
		||||
var Awk = internal.Register(MustNewLexer(
 | 
			
		||||
var Awk = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Awk",
 | 
			
		||||
		Aliases:   []string{"awk", "gawk", "mawk", "nawk"},
 | 
			
		||||
		Filenames: []string{"*.awk"},
 | 
			
		||||
		MimeTypes: []string{"application/x-awk"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	awkRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func awkRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"commentsandwhitespace": {
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
			{`#.*$`, CommentSingle, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -30,19 +34,19 @@ var Awk = internal.Register(MustNewLexer(
 | 
			
		|||
		"root": {
 | 
			
		||||
			{`^(?=\s|/)`, Text, Push("slashstartsregex")},
 | 
			
		||||
			Include("commentsandwhitespace"),
 | 
			
		||||
			{`\+\+|--|\|\||&&|in\b|\$|!?~|(\*\*|[-<>+*%\^/!=|])=?`, Operator, Push("slashstartsregex")},
 | 
			
		||||
			{`\+\+|--|\|\||&&|in\b|\$|!?~|\|&|(\*\*|[-<>+*%\^/!=|])=?`, Operator, Push("slashstartsregex")},
 | 
			
		||||
			{`[{(\[;,]`, Punctuation, Push("slashstartsregex")},
 | 
			
		||||
			{`[})\].]`, Punctuation, nil},
 | 
			
		||||
			{`(break|continue|do|while|exit|for|if|else|return)\b`, Keyword, Push("slashstartsregex")},
 | 
			
		||||
			{`(break|continue|do|while|exit|for|if|else|return|switch|case|default)\b`, Keyword, Push("slashstartsregex")},
 | 
			
		||||
			{`function\b`, KeywordDeclaration, Push("slashstartsregex")},
 | 
			
		||||
			{`(atan2|cos|exp|int|log|rand|sin|sqrt|srand|gensub|gsub|index|length|match|split|sprintf|sub|substr|tolower|toupper|close|fflush|getline|next|nextfile|print|printf|strftime|systime|delete|system)\b`, KeywordReserved, nil},
 | 
			
		||||
			{`(ARGC|ARGIND|ARGV|BEGIN|CONVFMT|ENVIRON|END|ERRNO|FIELDWIDTHS|FILENAME|FNR|FS|IGNORECASE|NF|NR|OFMT|OFS|ORFS|RLENGTH|RS|RSTART|RT|SUBSEP)\b`, NameBuiltin, nil},
 | 
			
		||||
			{`[$a-zA-Z_]\w*`, NameOther, nil},
 | 
			
		||||
			{`(atan2|cos|exp|int|log|rand|sin|sqrt|srand|gensub|gsub|index|length|match|split|patsplit|sprintf|sub|substr|tolower|toupper|close|fflush|getline|next(file)|print|printf|strftime|systime|mktime|delete|system|strtonum|and|compl|lshift|or|rshift|asorti?|isarray|bindtextdomain|dcn?gettext|@(include|load|namespace))\b`, KeywordReserved, nil},
 | 
			
		||||
			{`(ARGC|ARGIND|ARGV|BEGIN(FILE)?|BINMODE|CONVFMT|ENVIRON|END(FILE)?|ERRNO|FIELDWIDTHS|FILENAME|FNR|FPAT|FS|IGNORECASE|LINT|NF|NR|OFMT|OFS|ORS|PROCINFO|RLENGTH|RS|RSTART|RT|SUBSEP|TEXTDOMAIN)\b`, NameBuiltin, nil},
 | 
			
		||||
			{`[@$a-zA-Z_]\w*`, NameOther, nil},
 | 
			
		||||
			{`[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?`, LiteralNumberFloat, nil},
 | 
			
		||||
			{`0x[0-9a-fA-F]+`, LiteralNumberHex, nil},
 | 
			
		||||
			{`[0-9]+`, LiteralNumberInteger, nil},
 | 
			
		||||
			{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
 | 
			
		||||
			{`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Ballerina lexer.
 | 
			
		||||
var Ballerina = internal.Register(MustNewLexer(
 | 
			
		||||
var Ballerina = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Ballerina",
 | 
			
		||||
		Aliases:   []string{"ballerina"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var Ballerina = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes: []string{"text/x-ballerina"},
 | 
			
		||||
		DotAll:    true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	ballerinaRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func ballerinaRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`[^\S\n]+`, Text, nil},
 | 
			
		||||
			{`//.*?\n`, CommentSingle, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -42,5 +46,5 @@ var Ballerina = internal.Register(MustNewLexer(
 | 
			
		|||
		"import": {
 | 
			
		||||
			{`[\w.]+`, NameNamespace, Pop(1)},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,17 +7,27 @@ import (
 | 
			
		|||
	"github.com/alecthomas/chroma/lexers/internal"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// TODO(moorereason): can this be factored away?
 | 
			
		||||
var bashAnalyserRe = regexp.MustCompile(`(?m)^#!.*/bin/(?:env |)(?:bash|zsh|sh|ksh)`)
 | 
			
		||||
 | 
			
		||||
// Bash lexer.
 | 
			
		||||
var Bash = internal.Register(MustNewLexer(
 | 
			
		||||
var Bash = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Bash",
 | 
			
		||||
		Aliases:   []string{"bash", "sh", "ksh", "zsh", "shell"},
 | 
			
		||||
		Filenames: []string{"*.sh", "*.ksh", "*.bash", "*.ebuild", "*.eclass", "*.exheres-0", "*.exlib", "*.zsh", "*.zshrc", ".bashrc", "bashrc", ".bash_*", "bash_*", "zshrc", ".zshrc", "PKGBUILD"},
 | 
			
		||||
		Filenames: []string{"*.sh", "*.ksh", "*.bash", "*.ebuild", "*.eclass", ".env", "*.env", "*.exheres-0", "*.exlib", "*.zsh", "*.zshrc", ".bashrc", "bashrc", ".bash_*", "bash_*", "zshrc", ".zshrc", "PKGBUILD"},
 | 
			
		||||
		MimeTypes: []string{"application/x-sh", "application/x-shellscript"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	bashRules,
 | 
			
		||||
).SetAnalyser(func(text string) float32 {
 | 
			
		||||
	if bashAnalyserRe.FindString(text) != "" {
 | 
			
		||||
		return 1.0
 | 
			
		||||
	}
 | 
			
		||||
	return 0.0
 | 
			
		||||
}))
 | 
			
		||||
 | 
			
		||||
func bashRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			Include("basic"),
 | 
			
		||||
			{"`", LiteralStringBacktick, Push("backticks")},
 | 
			
		||||
| 
						 | 
				
			
			@ -36,7 +46,7 @@ var Bash = internal.Register(MustNewLexer(
 | 
			
		|||
			{`\b(if|fi|else|while|do|done|for|then|return|function|case|select|continue|until|esac|elif)(\s*)\b`, ByGroups(Keyword, Text), nil},
 | 
			
		||||
			{"\\b(alias|bg|bind|break|builtin|caller|cd|command|compgen|complete|declare|dirs|disown|echo|enable|eval|exec|exit|export|false|fc|fg|getopts|hash|help|history|jobs|kill|let|local|logout|popd|printf|pushd|pwd|read|readonly|set|shift|shopt|source|suspend|test|time|times|trap|true|type|typeset|ulimit|umask|unalias|unset|wait)(?=[\\s)`])", NameBuiltin, nil},
 | 
			
		||||
			{`\A#!.+\n`, CommentPreproc, nil},
 | 
			
		||||
			{`#.*\S`, CommentSingle, nil},
 | 
			
		||||
			{`#.*(\S|$)`, CommentSingle, nil},
 | 
			
		||||
			{`\\[\w\W]`, LiteralStringEscape, nil},
 | 
			
		||||
			{`(\b\w+)(\s*)(\+?=)`, ByGroups(NameVariable, Text, Operator), nil},
 | 
			
		||||
			{`[\[\]{}()=]`, Operator, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -86,10 +96,5 @@ var Bash = internal.Register(MustNewLexer(
 | 
			
		|||
			{"`", LiteralStringBacktick, Pop(1)},
 | 
			
		||||
			Include("root"),
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
).SetAnalyser(func(text string) float32 {
 | 
			
		||||
	if bashAnalyserRe.FindString(text) != "" {
 | 
			
		||||
		return 1.0
 | 
			
		||||
	}
 | 
			
		||||
	return 0.0
 | 
			
		||||
}))
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Batchfile lexer.
 | 
			
		||||
var Batchfile = internal.Register(MustNewLexer(
 | 
			
		||||
var Batchfile = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:            "Batchfile",
 | 
			
		||||
		Aliases:         []string{"bat", "batch", "dosbatch", "winbatch"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var Batchfile = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes:       []string{"application/x-dos-batch"},
 | 
			
		||||
		CaseInsensitive: true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	batchfileRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func batchfileRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`\)((?=\()|(?=\^?[\t\v\f\r ,;=\xa0]|[&<>|\n\x1a]))(?:(?:[^\n\x1a^]|\^[\n\x1a]?[\w\W])*)`, CommentSingle, nil},
 | 
			
		||||
			{`(?=((?:(?<=^[^:])|^[^:]?)[\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)},
 | 
			
		||||
			Default(Pop(1)),
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Bibtex lexer.
 | 
			
		||||
var Bibtex = internal.Register(MustNewLexer(
 | 
			
		||||
var Bibtex = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:            "BibTeX",
 | 
			
		||||
		Aliases:         []string{"bib", "bibtex"},
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +15,11 @@ var Bibtex = internal.Register(MustNewLexer(
 | 
			
		|||
		NotMultiline:    true,
 | 
			
		||||
		CaseInsensitive: true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	bibtexRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func bibtexRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			Include("whitespace"),
 | 
			
		||||
			{`@comment`, Comment, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -72,5 +76,5 @@ var Bibtex = internal.Register(MustNewLexer(
 | 
			
		|||
		"whitespace": {
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Blitzbasic lexer.
 | 
			
		||||
var Blitzbasic = internal.Register(MustNewLexer(
 | 
			
		||||
var Blitzbasic = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:            "BlitzBasic",
 | 
			
		||||
		Aliases:         []string{"blitzbasic", "b3d", "bplus"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var Blitzbasic = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes:       []string{"text/x-bb"},
 | 
			
		||||
		CaseInsensitive: true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	blitzbasicRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func blitzbasicRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`[ \t]+`, Text, nil},
 | 
			
		||||
			{`;.*?\n`, CommentSingle, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -44,5 +48,5 @@ var Blitzbasic = internal.Register(MustNewLexer(
 | 
			
		|||
			{`"C?`, LiteralStringDouble, Pop(1)},
 | 
			
		||||
			{`[^"]+`, LiteralStringDouble, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,19 +6,23 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Bnf lexer.
 | 
			
		||||
var Bnf = internal.Register(MustNewLexer(
 | 
			
		||||
var Bnf = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "BNF",
 | 
			
		||||
		Aliases:   []string{"bnf"},
 | 
			
		||||
		Filenames: []string{"*.bnf"},
 | 
			
		||||
		MimeTypes: []string{"text/x-bnf"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	bnfRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func bnfRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`(<)([ -;=?-~]+)(>)`, ByGroups(Punctuation, NameClass, Punctuation), nil},
 | 
			
		||||
			{`::=`, Operator, nil},
 | 
			
		||||
			{`[^<>:]+`, Text, nil},
 | 
			
		||||
			{`.`, Text, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Brainfuck lexer.
 | 
			
		||||
var Brainfuck = internal.Register(MustNewLexer(
 | 
			
		||||
var Brainfuck = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Brainfuck",
 | 
			
		||||
		Aliases:   []string{"brainfuck", "bf"},
 | 
			
		||||
		Filenames: []string{"*.bf", "*.b"},
 | 
			
		||||
		MimeTypes: []string{"application/x-brainfuck"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	brainfuckRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func brainfuckRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"common": {
 | 
			
		||||
			{`[.,]+`, NameTag, nil},
 | 
			
		||||
			{`[+-]+`, NameBuiltin, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -30,5 +34,5 @@ var Brainfuck = internal.Register(MustNewLexer(
 | 
			
		|||
			{`\]`, Keyword, Pop(1)},
 | 
			
		||||
			Include("common"),
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,19 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// C lexer.
 | 
			
		||||
var C = internal.Register(MustNewLexer(
 | 
			
		||||
var C = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "C",
 | 
			
		||||
		Aliases:   []string{"c"},
 | 
			
		||||
		Filenames: []string{"*.c", "*.h", "*.idc"},
 | 
			
		||||
		MimeTypes: []string{"text/x-chdr", "text/x-csrc"},
 | 
			
		||||
		Filenames: []string{"*.c", "*.h", "*.idc", "*.x[bp]m"},
 | 
			
		||||
		MimeTypes: []string{"text/x-chdr", "text/x-csrc", "image/x-xbitmap", "image/x-xpixmap"},
 | 
			
		||||
		EnsureNL:  true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	cRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func cRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"whitespace": {
 | 
			
		||||
			{`^#if\s+0`, CommentPreproc, Push("if0")},
 | 
			
		||||
			{`^#`, CommentPreproc, Push("macro")},
 | 
			
		||||
| 
						 | 
				
			
			@ -38,7 +43,7 @@ var C = internal.Register(MustNewLexer(
 | 
			
		|||
			{`[~!%^&*+=|?:<>/-]`, Operator, 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},
 | 
			
		||||
			{`(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},
 | 
			
		||||
			{`(__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},
 | 
			
		||||
| 
						 | 
				
			
			@ -87,5 +92,5 @@ var C = internal.Register(MustNewLexer(
 | 
			
		|||
			{`^\s*#endif.*?(?<!\\)\n`, CommentPreproc, Pop(1)},
 | 
			
		||||
			{`.*?\n`, Comment, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,216 @@
 | 
			
		|||
package c
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	. "github.com/alecthomas/chroma" // nolint
 | 
			
		||||
	"github.com/alecthomas/chroma/lexers/internal"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// caddyfileCommon are the rules common to both of the lexer variants
 | 
			
		||||
func caddyfileCommonRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"site_block_common": {
 | 
			
		||||
			// Import keyword
 | 
			
		||||
			{`(import)(\s+)([^\s]+)`, ByGroups(Keyword, Text, NameVariableMagic), nil},
 | 
			
		||||
			// Matcher definition
 | 
			
		||||
			{`@[^\s]+(?=\s)`, NameDecorator, Push("matcher")},
 | 
			
		||||
			// Matcher token stub for docs
 | 
			
		||||
			{`\[\<matcher\>\]`, NameDecorator, Push("matcher")},
 | 
			
		||||
			// These cannot have matchers but may have things that look like
 | 
			
		||||
			// matchers in their arguments, so we just parse as a subdirective.
 | 
			
		||||
			{`try_files`, Keyword, Push("subdirective")},
 | 
			
		||||
			// These are special, they can nest more directives
 | 
			
		||||
			{`handle_errors|handle|route|handle_path|not`, Keyword, Push("nested_directive")},
 | 
			
		||||
			// Any other directive
 | 
			
		||||
			{`[^\s#]+`, Keyword, Push("directive")},
 | 
			
		||||
			Include("base"),
 | 
			
		||||
		},
 | 
			
		||||
		"matcher": {
 | 
			
		||||
			{`\{`, Punctuation, Push("block")},
 | 
			
		||||
			// Not can be one-liner
 | 
			
		||||
			{`not`, Keyword, Push("deep_not_matcher")},
 | 
			
		||||
			// Any other same-line matcher
 | 
			
		||||
			{`[^\s#]+`, Keyword, Push("arguments")},
 | 
			
		||||
			// Terminators
 | 
			
		||||
			{`\n`, Text, Pop(1)},
 | 
			
		||||
			{`\}`, Punctuation, Pop(1)},
 | 
			
		||||
			Include("base"),
 | 
			
		||||
		},
 | 
			
		||||
		"block": {
 | 
			
		||||
			{`\}`, Punctuation, Pop(2)},
 | 
			
		||||
			// Not can be one-liner
 | 
			
		||||
			{`not`, Keyword, Push("not_matcher")},
 | 
			
		||||
			// Any other subdirective
 | 
			
		||||
			{`[^\s#]+`, Keyword, Push("subdirective")},
 | 
			
		||||
			Include("base"),
 | 
			
		||||
		},
 | 
			
		||||
		"nested_block": {
 | 
			
		||||
			{`\}`, Punctuation, Pop(2)},
 | 
			
		||||
			// Matcher definition
 | 
			
		||||
			{`@[^\s]+(?=\s)`, NameDecorator, Push("matcher")},
 | 
			
		||||
			// Something that starts with literally < is probably a docs stub
 | 
			
		||||
			{`\<[^#]+\>`, Keyword, Push("nested_directive")},
 | 
			
		||||
			// Any other directive
 | 
			
		||||
			{`[^\s#]+`, Keyword, Push("nested_directive")},
 | 
			
		||||
			Include("base"),
 | 
			
		||||
		},
 | 
			
		||||
		"not_matcher": {
 | 
			
		||||
			{`\}`, Punctuation, Pop(2)},
 | 
			
		||||
			{`\{(?=\s)`, Punctuation, Push("block")},
 | 
			
		||||
			{`[^\s#]+`, Keyword, Push("arguments")},
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
		},
 | 
			
		||||
		"deep_not_matcher": {
 | 
			
		||||
			{`\}`, Punctuation, Pop(2)},
 | 
			
		||||
			{`\{(?=\s)`, Punctuation, Push("block")},
 | 
			
		||||
			{`[^\s#]+`, Keyword, Push("deep_subdirective")},
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
		},
 | 
			
		||||
		"directive": {
 | 
			
		||||
			{`\{(?=\s)`, Punctuation, Push("block")},
 | 
			
		||||
			Include("matcher_token"),
 | 
			
		||||
			Include("comments_pop_1"),
 | 
			
		||||
			{`\n`, Text, Pop(1)},
 | 
			
		||||
			Include("base"),
 | 
			
		||||
		},
 | 
			
		||||
		"nested_directive": {
 | 
			
		||||
			{`\{(?=\s)`, Punctuation, Push("nested_block")},
 | 
			
		||||
			Include("matcher_token"),
 | 
			
		||||
			Include("comments_pop_1"),
 | 
			
		||||
			{`\n`, Text, Pop(1)},
 | 
			
		||||
			Include("base"),
 | 
			
		||||
		},
 | 
			
		||||
		"subdirective": {
 | 
			
		||||
			{`\{(?=\s)`, Punctuation, Push("block")},
 | 
			
		||||
			Include("comments_pop_1"),
 | 
			
		||||
			{`\n`, Text, Pop(1)},
 | 
			
		||||
			Include("base"),
 | 
			
		||||
		},
 | 
			
		||||
		"arguments": {
 | 
			
		||||
			{`\{(?=\s)`, Punctuation, Push("block")},
 | 
			
		||||
			Include("comments_pop_2"),
 | 
			
		||||
			{`\\\n`, Text, nil}, // Skip escaped newlines
 | 
			
		||||
			{`\n`, Text, Pop(2)},
 | 
			
		||||
			Include("base"),
 | 
			
		||||
		},
 | 
			
		||||
		"deep_subdirective": {
 | 
			
		||||
			{`\{(?=\s)`, Punctuation, Push("block")},
 | 
			
		||||
			Include("comments_pop_3"),
 | 
			
		||||
			{`\n`, Text, Pop(3)},
 | 
			
		||||
			Include("base"),
 | 
			
		||||
		},
 | 
			
		||||
		"matcher_token": {
 | 
			
		||||
			{`@[^\s]+`, NameDecorator, Push("arguments")},         // Named matcher
 | 
			
		||||
			{`/[^\s]+`, NameDecorator, Push("arguments")},         // Path matcher
 | 
			
		||||
			{`\*`, NameDecorator, Push("arguments")},              // Wildcard path matcher
 | 
			
		||||
			{`\[\<matcher\>\]`, NameDecorator, Push("arguments")}, // Matcher token stub for docs
 | 
			
		||||
		},
 | 
			
		||||
		"comments": {
 | 
			
		||||
			{`^#.*\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
 | 
			
		||||
			{`\s+#.*\n`, CommentSingle, Pop(1)}, // Comment preceded by whitespace
 | 
			
		||||
		},
 | 
			
		||||
		"comments_pop_2": {
 | 
			
		||||
			{`^#.*\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
 | 
			
		||||
			{`\s+#.*\n`, CommentSingle, Pop(3)}, // Comment preceded by whitespace
 | 
			
		||||
		},
 | 
			
		||||
		"base": {
 | 
			
		||||
			Include("comments"),
 | 
			
		||||
			{`(on|off|first|last|before|after|internal|strip_prefix|strip_suffix|replace)\b`, NameConstant, nil},
 | 
			
		||||
			{`(https?://)?([a-z0-9.-]+)(:)([0-9]+)`, ByGroups(Name, Name, Punctuation, LiteralNumberInteger), nil},
 | 
			
		||||
			{`[a-z-]+/[a-z-+]+`, LiteralString, nil},
 | 
			
		||||
			{`[0-9]+[km]?\b`, LiteralNumberInteger, nil},
 | 
			
		||||
			{`\{[\w+.\$-]+\}`, LiteralStringEscape, nil}, // Placeholder
 | 
			
		||||
			{`\[(?=[^#{}$]+\])`, Punctuation, nil},
 | 
			
		||||
			{`\]|\|`, Punctuation, nil},
 | 
			
		||||
			{`[^\s#{}$\]]+`, LiteralString, nil},
 | 
			
		||||
			{`/[^\s#]*`, Name, nil},
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Caddyfile lexer.
 | 
			
		||||
var Caddyfile = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Caddyfile",
 | 
			
		||||
		Aliases:   []string{"caddyfile", "caddy"},
 | 
			
		||||
		Filenames: []string{"Caddyfile*"},
 | 
			
		||||
		MimeTypes: []string{},
 | 
			
		||||
	},
 | 
			
		||||
	caddyfileRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func caddyfileRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			Include("comments"),
 | 
			
		||||
			// Global options block
 | 
			
		||||
			{`^\s*(\{)\s*$`, ByGroups(Punctuation), Push("globals")},
 | 
			
		||||
			// Snippets
 | 
			
		||||
			{`(\([^\s#]+\))(\s*)(\{)`, ByGroups(NameVariableAnonymous, Text, Punctuation), Push("snippet")},
 | 
			
		||||
			// Site label
 | 
			
		||||
			{`[^#{(\s,]+`, GenericHeading, Push("label")},
 | 
			
		||||
			// Site label with placeholder
 | 
			
		||||
			{`\{[\w+.\$-]+\}`, LiteralStringEscape, Push("label")},
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
		},
 | 
			
		||||
		"globals": {
 | 
			
		||||
			{`\}`, Punctuation, Pop(1)},
 | 
			
		||||
			{`[^\s#]+`, Keyword, Push("directive")},
 | 
			
		||||
			Include("base"),
 | 
			
		||||
		},
 | 
			
		||||
		"snippet": {
 | 
			
		||||
			{`\}`, Punctuation, Pop(1)},
 | 
			
		||||
			// Matcher definition
 | 
			
		||||
			{`@[^\s]+(?=\s)`, NameDecorator, Push("matcher")},
 | 
			
		||||
			// Any directive
 | 
			
		||||
			{`[^\s#]+`, Keyword, Push("directive")},
 | 
			
		||||
			Include("base"),
 | 
			
		||||
		},
 | 
			
		||||
		"label": {
 | 
			
		||||
			// Allow multiple labels, comma separated, newlines after
 | 
			
		||||
			// a comma means another label is coming
 | 
			
		||||
			{`,\s*\n?`, Text, nil},
 | 
			
		||||
			{` `, Text, nil},
 | 
			
		||||
			// Site label with placeholder
 | 
			
		||||
			{`\{[\w+.\$-]+\}`, LiteralStringEscape, nil},
 | 
			
		||||
			// Site label
 | 
			
		||||
			{`[^#{(\s,]+`, GenericHeading, nil},
 | 
			
		||||
			// Comment after non-block label (hack because comments end in \n)
 | 
			
		||||
			{`#.*\n`, CommentSingle, Push("site_block")},
 | 
			
		||||
			// Note: if \n, we'll never pop out of the site_block, it's valid
 | 
			
		||||
			{`\{(?=\s)|\n`, Punctuation, Push("site_block")},
 | 
			
		||||
		},
 | 
			
		||||
		"site_block": {
 | 
			
		||||
			{`\}`, Punctuation, Pop(2)},
 | 
			
		||||
			Include("site_block_common"),
 | 
			
		||||
		},
 | 
			
		||||
	}.Merge(caddyfileCommonRules())
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Caddyfile directive-only lexer.
 | 
			
		||||
var CaddyfileDirectives = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Caddyfile Directives",
 | 
			
		||||
		Aliases:   []string{"caddyfile-directives", "caddyfile-d", "caddy-d"},
 | 
			
		||||
		Filenames: []string{},
 | 
			
		||||
		MimeTypes: []string{},
 | 
			
		||||
	},
 | 
			
		||||
	caddyfileDirectivesRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func caddyfileDirectivesRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		// Same as "site_block" in Caddyfile
 | 
			
		||||
		"root": {
 | 
			
		||||
			Include("site_block_common"),
 | 
			
		||||
		},
 | 
			
		||||
	}.Merge(caddyfileCommonRules())
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Cap'N'Proto Proto lexer.
 | 
			
		||||
var CapNProto = internal.Register(MustNewLexer(
 | 
			
		||||
var CapNProto = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Cap'n Proto",
 | 
			
		||||
		Aliases:   []string{"capnp"},
 | 
			
		||||
		Filenames: []string{"*.capnp"},
 | 
			
		||||
		MimeTypes: []string{},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	capNProtoRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func capNProtoRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`#.*?$`, CommentSingle, nil},
 | 
			
		||||
			{`@[0-9a-zA-Z]*`, NameDecorator, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -57,5 +61,5 @@ var CapNProto = internal.Register(MustNewLexer(
 | 
			
		|||
			{`[])]`, NameAttribute, Pop(1)},
 | 
			
		||||
			Default(Pop(1)),
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Ceylon lexer.
 | 
			
		||||
var Ceylon = internal.Register(MustNewLexer(
 | 
			
		||||
var Ceylon = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Ceylon",
 | 
			
		||||
		Aliases:   []string{"ceylon"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var Ceylon = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes: []string{"text/x-ceylon"},
 | 
			
		||||
		DotAll:    true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	ceylonRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func ceylonRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)([a-zA-Z_]\w*)(\s*)(\()`, ByGroups(UsingSelf("root"), NameFunction, Text, Operator), nil},
 | 
			
		||||
			{`[^\S\n]+`, Text, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -59,5 +63,5 @@ var Ceylon = internal.Register(MustNewLexer(
 | 
			
		|||
			{`\*/`, CommentMultiline, Pop(1)},
 | 
			
		||||
			{`[*/]`, CommentMultiline, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Cfengine3 lexer.
 | 
			
		||||
var Cfengine3 = internal.Register(MustNewLexer(
 | 
			
		||||
var Cfengine3 = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "CFEngine3",
 | 
			
		||||
		Aliases:   []string{"cfengine3", "cf3"},
 | 
			
		||||
		Filenames: []string{"*.cf"},
 | 
			
		||||
		MimeTypes: []string{},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	cfengine3Rules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func cfengine3Rules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`#.*?\n`, Comment, 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},
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Chaiscript lexer.
 | 
			
		||||
var Chaiscript = internal.Register(MustNewLexer(
 | 
			
		||||
var Chaiscript = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "ChaiScript",
 | 
			
		||||
		Aliases:   []string{"chai", "chaiscript"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var Chaiscript = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes: []string{"text/x-chaiscript", "application/x-chaiscript"},
 | 
			
		||||
		DotAll:    true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	chaiscriptRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func chaiscriptRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"commentsandwhitespace": {
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
			{`//.*?\n`, CommentSingle, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -59,5 +63,5 @@ var Chaiscript = internal.Register(MustNewLexer(
 | 
			
		|||
			{`[^\\"$]+`, LiteralStringDouble, nil},
 | 
			
		||||
			{`"`, LiteralStringDouble, Pop(1)},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,14 +7,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Cheetah lexer.
 | 
			
		||||
var Cheetah = internal.Register(MustNewLexer(
 | 
			
		||||
var Cheetah = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Cheetah",
 | 
			
		||||
		Aliases:   []string{"cheetah", "spitfire"},
 | 
			
		||||
		Filenames: []string{"*.tmpl", "*.spt"},
 | 
			
		||||
		MimeTypes: []string{"application/x-cheetah", "application/x-spitfire"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	cheetahRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func cheetahRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`(##[^\n]*)$`, ByGroups(Comment), nil},
 | 
			
		||||
			{`#[*](.|\n)*?[*]#`, Comment, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -33,5 +37,5 @@ var Cheetah = internal.Register(MustNewLexer(
 | 
			
		|||
            `, Other, nil},
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -230,7 +230,7 @@ var (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Common Lisp lexer.
 | 
			
		||||
var CommonLisp = internal.Register(TypeRemappingLexer(MustNewLexer(
 | 
			
		||||
var CommonLisp = internal.Register(TypeRemappingLexer(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:            "Common Lisp",
 | 
			
		||||
		Aliases:         []string{"common-lisp", "cl", "lisp"},
 | 
			
		||||
| 
						 | 
				
			
			@ -238,7 +238,19 @@ var CommonLisp = internal.Register(TypeRemappingLexer(MustNewLexer(
 | 
			
		|||
		MimeTypes:       []string{"text/x-common-lisp"},
 | 
			
		||||
		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": {
 | 
			
		||||
			Default(Push("body")),
 | 
			
		||||
		},
 | 
			
		||||
| 
						 | 
				
			
			@ -294,13 +306,5 @@ var CommonLisp = internal.Register(TypeRemappingLexer(MustNewLexer(
 | 
			
		|||
			{`\(`, Punctuation, Push("body")},
 | 
			
		||||
			{`\)`, 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},
 | 
			
		||||
}))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Clojure lexer.
 | 
			
		||||
var Clojure = internal.Register(MustNewLexer(
 | 
			
		||||
var Clojure = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Clojure",
 | 
			
		||||
		Aliases:   []string{"clojure", "clj"},
 | 
			
		||||
		Filenames: []string{"*.clj"},
 | 
			
		||||
		MimeTypes: []string{"text/x-clojure", "application/x-clojure"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	clojureRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func clojureRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`;.*$`, CommentSingle, nil},
 | 
			
		||||
			{`[,\s]+`, Text, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -34,5 +38,5 @@ var Clojure = internal.Register(MustNewLexer(
 | 
			
		|||
			{`(\{|\})`, Punctuation, nil},
 | 
			
		||||
			{`(\(|\))`, Punctuation, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Cmake lexer.
 | 
			
		||||
var Cmake = internal.Register(MustNewLexer(
 | 
			
		||||
var Cmake = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "CMake",
 | 
			
		||||
		Aliases:   []string{"cmake"},
 | 
			
		||||
		Filenames: []string{"*.cmake", "CMakeLists.txt"},
 | 
			
		||||
		MimeTypes: []string{"text/x-cmake"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	cmakeRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func cmakeRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`\b(\w+)([ \t]*)(\()`, ByGroups(NameBuiltin, Text, Punctuation), Push("args")},
 | 
			
		||||
			Include("keywords"),
 | 
			
		||||
| 
						 | 
				
			
			@ -40,5 +44,5 @@ var Cmake = internal.Register(MustNewLexer(
 | 
			
		|||
			{`[ \t]+`, Text, nil},
 | 
			
		||||
			{`#.*\n`, Comment, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Cobol lexer.
 | 
			
		||||
var Cobol = internal.Register(MustNewLexer(
 | 
			
		||||
var Cobol = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:            "COBOL",
 | 
			
		||||
		Aliases:         []string{"cobol"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var Cobol = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes:       []string{"text/x-cobol"},
 | 
			
		||||
		CaseInsensitive: true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	cobolRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func cobolRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			Include("comment"),
 | 
			
		||||
			Include("strings"),
 | 
			
		||||
| 
						 | 
				
			
			@ -47,5 +51,5 @@ var Cobol = internal.Register(MustNewLexer(
 | 
			
		|||
			{`[+-]?\d*\.\d+(E[-+]?\d+)?`, LiteralNumberFloat, nil},
 | 
			
		||||
			{`[+-]?\d+\.\d*(E[-+]?\d+)?`, LiteralNumberFloat, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Coffeescript lexer.
 | 
			
		||||
var Coffeescript = internal.Register(MustNewLexer(
 | 
			
		||||
var Coffeescript = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:         "CoffeeScript",
 | 
			
		||||
		Aliases:      []string{"coffee-script", "coffeescript", "coffee"},
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +15,11 @@ var Coffeescript = internal.Register(MustNewLexer(
 | 
			
		|||
		NotMultiline: true,
 | 
			
		||||
		DotAll:       true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	coffeescriptRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func coffeescriptRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"commentsandwhitespace": {
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
			{`###[^#].*?###`, CommentMultiline, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -87,5 +91,5 @@ var Coffeescript = internal.Register(MustNewLexer(
 | 
			
		|||
			{`#|\\.|\'|"`, LiteralString, nil},
 | 
			
		||||
			Include("strings"),
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Cfstatement lexer.
 | 
			
		||||
var Cfstatement = internal.Register(MustNewLexer(
 | 
			
		||||
var Cfstatement = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:            "cfstatement",
 | 
			
		||||
		Aliases:         []string{"cfs"},
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +15,11 @@ var Cfstatement = internal.Register(MustNewLexer(
 | 
			
		|||
		NotMultiline:    true,
 | 
			
		||||
		CaseInsensitive: true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	cfstatementRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func cfstatementRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`//.*?\n`, CommentSingle, nil},
 | 
			
		||||
			{`/\*(?:.|\n)*?\*/`, CommentMultiline, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -44,5 +48,5 @@ var Cfstatement = internal.Register(MustNewLexer(
 | 
			
		|||
			{`#`, LiteralStringDouble, nil},
 | 
			
		||||
			{`"`, LiteralStringDouble, Pop(1)},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Coq lexer.
 | 
			
		||||
var Coq = internal.Register(MustNewLexer(
 | 
			
		||||
var Coq = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Coq",
 | 
			
		||||
		Aliases:   []string{"coq"},
 | 
			
		||||
		Filenames: []string{"*.v"},
 | 
			
		||||
		MimeTypes: []string{"text/x-coq"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	coqRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func coqRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
			{`false|true|\(\)|\[\]`, NameBuiltinPseudo, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -59,5 +63,5 @@ var Coq = internal.Register(MustNewLexer(
 | 
			
		|||
			{`[a-z][a-z0-9_\']*`, Name, Pop(1)},
 | 
			
		||||
			Default(Pop(1)),
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// CPP lexer.
 | 
			
		||||
var CPP = internal.Register(MustNewLexer(
 | 
			
		||||
var CPP = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "C++",
 | 
			
		||||
		Aliases:   []string{"cpp", "c++"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var CPP = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes: []string{"text/x-c++hdr", "text/x-c++src"},
 | 
			
		||||
		EnsureNL:  true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	cppRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func cppRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"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},
 | 
			
		||||
			{`(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)},
 | 
			
		||||
			{`.*?\n`, Comment, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// CassandraCQL lexer.
 | 
			
		||||
var CassandraCQL = internal.Register(MustNewLexer(
 | 
			
		||||
var CassandraCQL = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:            "Cassandra CQL",
 | 
			
		||||
		Aliases:         []string{"cassandra", "cql"},
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +15,11 @@ var CassandraCQL = internal.Register(MustNewLexer(
 | 
			
		|||
		NotMultiline:    true,
 | 
			
		||||
		CaseInsensitive: true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	cassandraCQLRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func cassandraCQLRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`\s+`, TextWhitespace, 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},
 | 
			
		||||
			{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},
 | 
			
		||||
			{`(?s)(java|javascript)(\s+)(AS)(\s+)('|\$\$)(.*?)(\5)`,
 | 
			
		||||
			{
 | 
			
		||||
				`(?s)(java|javascript)(\s+)(AS)(\s+)('|\$\$)(.*?)(\5)`,
 | 
			
		||||
				UsingByGroup(
 | 
			
		||||
					internal.Get,
 | 
			
		||||
					1, 6,
 | 
			
		||||
| 
						 | 
				
			
			@ -65,5 +70,5 @@ var CassandraCQL = internal.Register(MustNewLexer(
 | 
			
		|||
			{`[^\$]+`, LiteralStringHeredoc, nil},
 | 
			
		||||
			{`\$\$`, LiteralStringHeredoc, Pop(1)},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Crystal lexer.
 | 
			
		||||
var Crystal = internal.Register(MustNewLexer(
 | 
			
		||||
var Crystal = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Crystal",
 | 
			
		||||
		Aliases:   []string{"cr", "crystal"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var Crystal = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes: []string{"text/x-crystal"},
 | 
			
		||||
		DotAll:    true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	crystalRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func crystalRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`#.*?$`, 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},
 | 
			
		||||
| 
						 | 
				
			
			@ -258,5 +262,5 @@ var Crystal = internal.Register(MustNewLexer(
 | 
			
		|||
			{`[\\#<>]`, LiteralStringRegex, nil},
 | 
			
		||||
			{`[^\\#<>]+`, LiteralStringRegex, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// CSharp lexer.
 | 
			
		||||
var CSharp = internal.Register(MustNewLexer(
 | 
			
		||||
var CSharp = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "C#",
 | 
			
		||||
		Aliases:   []string{"csharp", "c#"},
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +15,11 @@ var CSharp = internal.Register(MustNewLexer(
 | 
			
		|||
		DotAll:    true,
 | 
			
		||||
		EnsureNL:  true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	cSharpRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func cSharpRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`^\s*\[.*?\]`, NameAttribute, nil},
 | 
			
		||||
			{`[^\S\n]+`, Text, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -29,7 +33,7 @@ var CSharp = internal.Register(MustNewLexer(
 | 
			
		|||
			{`\$@?"(""|[^"])*"`, LiteralString, nil},
 | 
			
		||||
			{`"(\\\\|\\"|[^"\n])*["\n]`, LiteralString, 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},
 | 
			
		||||
			{`\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},
 | 
			
		||||
| 
						 | 
				
			
			@ -47,5 +51,5 @@ var CSharp = internal.Register(MustNewLexer(
 | 
			
		|||
			{`(?=\()`, Text, Pop(1)},
 | 
			
		||||
			{`(@?[_a-zA-Z]\w*|\.)+`, NameNamespace, Pop(1)},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// CSS lexer.
 | 
			
		||||
var CSS = internal.Register(MustNewLexer(
 | 
			
		||||
var CSS = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "CSS",
 | 
			
		||||
		Aliases:   []string{"css"},
 | 
			
		||||
		Filenames: []string{"*.css"},
 | 
			
		||||
		MimeTypes: []string{"text/css"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	cssRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func cssRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			Include("basics"),
 | 
			
		||||
		},
 | 
			
		||||
| 
						 | 
				
			
			@ -39,6 +43,18 @@ var CSS = internal.Register(MustNewLexer(
 | 
			
		|||
			Include("basics"),
 | 
			
		||||
			{`\}`, 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": {
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
			{`\}`, Punctuation, Pop(1)},
 | 
			
		||||
| 
						 | 
				
			
			@ -73,6 +89,7 @@ var CSS = internal.Register(MustNewLexer(
 | 
			
		|||
			{`"(\\\\|\\"|[^"])*"`, LiteralStringDouble, nil},
 | 
			
		||||
			{`'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil},
 | 
			
		||||
			{`[a-zA-Z_-]\w*`, Name, nil},
 | 
			
		||||
			{`\(`, Punctuation, Push("atparenthesis")},
 | 
			
		||||
			{`\)`, Punctuation, Pop(1)},
 | 
			
		||||
		},
 | 
			
		||||
		"common-values": {
 | 
			
		||||
| 
						 | 
				
			
			@ -100,5 +117,5 @@ var CSS = internal.Register(MustNewLexer(
 | 
			
		|||
			{`%`, KeywordType, nil},
 | 
			
		||||
			Default(Pop(1)),
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Cython lexer.
 | 
			
		||||
var Cython = internal.Register(MustNewLexer(
 | 
			
		||||
var Cython = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Cython",
 | 
			
		||||
		Aliases:   []string{"cython", "pyx", "pyrex"},
 | 
			
		||||
		Filenames: []string{"*.pyx", "*.pxd", "*.pxi"},
 | 
			
		||||
		MimeTypes: []string{"text/x-cython", "application/x-cython"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	cythonRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func cythonRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`\n`, Text, nil},
 | 
			
		||||
			{`^(\s*)("""(?:.|\n)*?""")`, ByGroups(Text, LiteralStringDoc), nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -131,5 +135,5 @@ var Cython = internal.Register(MustNewLexer(
 | 
			
		|||
			Include("strings"),
 | 
			
		||||
			Include("nl"),
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,15 +1,12 @@
 | 
			
		|||
package circular
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	. "github.com/alecthomas/chroma" // nolint
 | 
			
		||||
	"github.com/alecthomas/chroma/lexers/h"
 | 
			
		||||
	"github.com/alecthomas/chroma/lexers/internal"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// PHP lexer.
 | 
			
		||||
var PHP = internal.Register(DelegatingLexer(h.HTML, MustNewLexer(
 | 
			
		||||
// PHP lexer for pure PHP code (not embedded in HTML).
 | 
			
		||||
var PHP = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:            "PHP",
 | 
			
		||||
		Aliases:         []string{"php", "php3", "php4", "php5"},
 | 
			
		||||
| 
						 | 
				
			
			@ -19,12 +16,15 @@ var PHP = internal.Register(DelegatingLexer(h.HTML, MustNewLexer(
 | 
			
		|||
		CaseInsensitive: true,
 | 
			
		||||
		EnsureNL:        true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`<\?(php)?`, CommentPreproc, Push("php")},
 | 
			
		||||
			{`[^<]+`, Other, nil},
 | 
			
		||||
			{`<`, Other, nil},
 | 
			
		||||
		},
 | 
			
		||||
	phpRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func phpRules() Rules {
 | 
			
		||||
	return phpCommonRules().Rename("php", "root")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func phpCommonRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"php": {
 | 
			
		||||
			{`\?>`, 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},
 | 
			
		||||
| 
						 | 
				
			
			@ -51,8 +51,8 @@ var PHP = internal.Register(DelegatingLexer(h.HTML, MustNewLexer(
 | 
			
		|||
			{`(\d+\.\d*|\d*\.\d+)(e[+-]?[0-9]+)?`, LiteralNumberFloat, nil},
 | 
			
		||||
			{`\d+e[+-]?[0-9]+`, LiteralNumberFloat, nil},
 | 
			
		||||
			{`0[0-7]+`, LiteralNumberOct, nil},
 | 
			
		||||
			{`0x[a-f0-9]+`, LiteralNumberHex, nil},
 | 
			
		||||
			{`\d+`, LiteralNumberInteger, nil},
 | 
			
		||||
			{`0x[a-f0-9_]+`, LiteralNumberHex, nil},
 | 
			
		||||
			{`[\d_]+`, LiteralNumberInteger, nil},
 | 
			
		||||
			{`0b[01]+`, LiteralNumberBin, nil},
 | 
			
		||||
			{`'([^'\\]*(?:\\.[^'\\]*)*)'`, LiteralStringSingle, nil},
 | 
			
		||||
			{"`([^`\\\\]*(?:\\\\.[^`\\\\]*)*)`", LiteralStringBacktick, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -82,10 +82,5 @@ var PHP = internal.Register(DelegatingLexer(h.HTML, MustNewLexer(
 | 
			
		|||
			{`(\$\{)(\S+)(\})`, ByGroups(LiteralStringInterpol, NameVariable, LiteralStringInterpol), nil},
 | 
			
		||||
			{`[${\\]`, LiteralStringDouble, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
).SetAnalyser(func(text string) float32 {
 | 
			
		||||
	if strings.Contains(text, "<?php") {
 | 
			
		||||
		return 0.5
 | 
			
		||||
	}
 | 
			
		||||
	return 0.0
 | 
			
		||||
})))
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,39 @@
 | 
			
		|||
package circular
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	. "github.com/alecthomas/chroma" // nolint
 | 
			
		||||
	"github.com/alecthomas/chroma/lexers/h"
 | 
			
		||||
	"github.com/alecthomas/chroma/lexers/internal"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// PHTML lexer is PHP in HTML.
 | 
			
		||||
var PHTML = internal.Register(DelegatingLexer(h.HTML, MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:            "PHTML",
 | 
			
		||||
		Aliases:         []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", "text/x-php"},
 | 
			
		||||
		DotAll:          true,
 | 
			
		||||
		CaseInsensitive: true,
 | 
			
		||||
		EnsureNL:        true,
 | 
			
		||||
		Priority:        2,
 | 
			
		||||
	},
 | 
			
		||||
	phtmlRules,
 | 
			
		||||
).SetAnalyser(func(text string) float32 {
 | 
			
		||||
	if strings.Contains(text, "<?php") {
 | 
			
		||||
		return 0.5
 | 
			
		||||
	}
 | 
			
		||||
	return 0.0
 | 
			
		||||
})))
 | 
			
		||||
 | 
			
		||||
func phtmlRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`<\?(php)?`, CommentPreproc, Push("php")},
 | 
			
		||||
			{`[^<]+`, Other, nil},
 | 
			
		||||
			{`<`, Other, nil},
 | 
			
		||||
		},
 | 
			
		||||
	}.Merge(phpCommonRules())
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// D lexer. https://dlang.org/spec/lex.html
 | 
			
		||||
var D = internal.Register(MustNewLexer(
 | 
			
		||||
var D = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "D",
 | 
			
		||||
		Aliases:   []string{"d"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var D = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes: []string{"text/x-d"},
 | 
			
		||||
		EnsureNL:  true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	dRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func dRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`[^\S\n]+`, Text, nil},
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -65,5 +69,5 @@ var D = internal.Register(MustNewLexer(
 | 
			
		|||
		"import": {
 | 
			
		||||
			{`[\w.]+\*?`, NameNamespace, Pop(1)},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Dart lexer.
 | 
			
		||||
var Dart = internal.Register(MustNewLexer(
 | 
			
		||||
var Dart = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Dart",
 | 
			
		||||
		Aliases:   []string{"dart"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var Dart = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes: []string{"text/x-dart"},
 | 
			
		||||
		DotAll:    true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	dartRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func dartRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			Include("string_literal"),
 | 
			
		||||
			{`#!(.*?)$`, CommentPreproc, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -87,5 +91,5 @@ var Dart = internal.Register(MustNewLexer(
 | 
			
		|||
			Include("string_common"),
 | 
			
		||||
			{`(\$|\')+`, LiteralStringSingle, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Diff lexer.
 | 
			
		||||
var Diff = internal.Register(MustNewLexer(
 | 
			
		||||
var Diff = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Diff",
 | 
			
		||||
		Aliases:   []string{"diff", "udiff"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var Diff = internal.Register(MustNewLexer(
 | 
			
		|||
		Filenames: []string{"*.diff", "*.patch"},
 | 
			
		||||
		MimeTypes: []string{"text/x-diff", "text/x-patch"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	diffRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func diffRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{` .*\n`, Text, nil},
 | 
			
		||||
			{`\+.*\n`, GenericInserted, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -25,5 +29,5 @@ var Diff = internal.Register(MustNewLexer(
 | 
			
		|||
			{`=.*\n`, GenericHeading, nil},
 | 
			
		||||
			{`.*\n`, Text, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Django/Jinja lexer.
 | 
			
		||||
var DjangoJinja = internal.Register(MustNewLexer(
 | 
			
		||||
var DjangoJinja = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Django/Jinja",
 | 
			
		||||
		Aliases:   []string{"django", "jinja"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var DjangoJinja = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes: []string{"application/x-django-templating", "application/x-jinja"},
 | 
			
		||||
		DotAll:    true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	djangoJinjaRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func djangoJinjaRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`[^{]+`, Other, nil},
 | 
			
		||||
			{`\{\{`, CommentPreproc, Push("var")},
 | 
			
		||||
| 
						 | 
				
			
			@ -49,5 +53,5 @@ var DjangoJinja = internal.Register(MustNewLexer(
 | 
			
		|||
			Include("varnames"),
 | 
			
		||||
			{`.`, Punctuation, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Docker lexer.
 | 
			
		||||
var Docker = internal.Register(MustNewLexer(
 | 
			
		||||
var Docker = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:            "Docker",
 | 
			
		||||
		Aliases:         []string{"docker", "dockerfile"},
 | 
			
		||||
| 
						 | 
				
			
			@ -16,7 +16,11 @@ var Docker = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes:       []string{"text/x-dockerfile-config"},
 | 
			
		||||
		CaseInsensitive: true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	dockerRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func dockerRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`#.*`, Comment, 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},
 | 
			
		||||
			{`(.*\\\n)*.+`, Using(b.Bash), nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Dtd lexer.
 | 
			
		||||
var Dtd = internal.Register(MustNewLexer(
 | 
			
		||||
var Dtd = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "DTD",
 | 
			
		||||
		Aliases:   []string{"dtd"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var Dtd = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes: []string{"application/xml-dtd"},
 | 
			
		||||
		DotAll:    true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	dtdRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func dtdRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			Include("common"),
 | 
			
		||||
			{`(<!ELEMENT)(\s+)(\S+)`, ByGroups(Keyword, Text, NameTag), Push("element")},
 | 
			
		||||
| 
						 | 
				
			
			@ -65,5 +69,5 @@ var Dtd = internal.Register(MustNewLexer(
 | 
			
		|||
			{`[^>\s|()?+*,]+`, NameAttribute, nil},
 | 
			
		||||
			{`>`, Keyword, Pop(1)},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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},
 | 
			
		||||
			},
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Ebnf lexer.
 | 
			
		||||
var Ebnf = internal.Register(MustNewLexer(
 | 
			
		||||
var Ebnf = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "EBNF",
 | 
			
		||||
		Aliases:   []string{"ebnf"},
 | 
			
		||||
		Filenames: []string{"*.ebnf"},
 | 
			
		||||
		MimeTypes: []string{"text/x-ebnf"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	ebnfRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func ebnfRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			Include("whitespace"),
 | 
			
		||||
			Include("comment_start"),
 | 
			
		||||
| 
						 | 
				
			
			@ -47,5 +51,5 @@ var Ebnf = internal.Register(MustNewLexer(
 | 
			
		|||
		"identifier": {
 | 
			
		||||
			{`([a-zA-Z][\w \-]*)`, Keyword, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Elixir lexer.
 | 
			
		||||
var Elixir = internal.Register(MustNewLexer(
 | 
			
		||||
var Elixir = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Elixir",
 | 
			
		||||
		Aliases:   []string{"elixir", "ex", "exs"},
 | 
			
		||||
		Filenames: []string{"*.ex", "*.exs"},
 | 
			
		||||
		MimeTypes: []string{"text/x-elixir"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	elixirRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func elixirRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
			{`#.*$`, CommentSingle, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -28,6 +32,13 @@ var Elixir = internal.Register(MustNewLexer(
 | 
			
		|||
			{`:"`, LiteralStringSymbol, Push("string_double_atom")},
 | 
			
		||||
			{`:'`, LiteralStringSymbol, Push("string_single_atom")},
 | 
			
		||||
			{`((?:\.\.\.|<<>>|%\{\}|%|\{\})|(?:(?:\.\.\.|[a-z_]\w*[!?]?)|[A-Z]\w*(?:\.[A-Z]\w*)*|(?:\<\<\<|\>\>\>|\|\|\||\&\&\&|\^\^\^|\~\~\~|\=\=\=|\!\=\=|\~\>\>|\<\~\>|\|\~\>|\<\|\>|\=\=|\!\=|\<\=|\>\=|\&\&|\|\||\<\>|\+\+|\-\-|\|\>|\=\~|\-\>|\<\-|\||\.|\=|\~\>|\<\~|\<|\>|\+|\-|\*|\/|\!|\^|\&)))(:)(?=\s|\n)`, ByGroups(LiteralStringSymbol, Punctuation), nil},
 | 
			
		||||
			{`(fn|do|end|after|else|rescue|catch)\b`, Keyword, nil},
 | 
			
		||||
			{`(not|and|or|when|in)\b`, OperatorWord, nil},
 | 
			
		||||
			{`(case|cond|for|if|unless|try|receive|raise|quote|unquote|unquote_splicing|throw|super|while)\b`, Keyword, nil},
 | 
			
		||||
			{`(def|defp|defmodule|defprotocol|defmacro|defmacrop|defdelegate|defexception|defstruct|defimpl|defcallback)\b`, KeywordDeclaration, nil},
 | 
			
		||||
			{`(import|require|use|alias)\b`, KeywordNamespace, nil},
 | 
			
		||||
			{`(nil|true|false)\b`, NameConstant, nil},
 | 
			
		||||
			{`(_|__MODULE__|__DIR__|__ENV__|__CALLER__)\b`, NamePseudo, nil},
 | 
			
		||||
			{`@(?:\.\.\.|[a-z_]\w*[!?]?)`, NameAttribute, nil},
 | 
			
		||||
			{`(?:\.\.\.|[a-z_]\w*[!?]?)`, Name, nil},
 | 
			
		||||
			{`(%?)([A-Z]\w*(?:\.[A-Z]\w*)*)`, ByGroups(Punctuation, NameClass), nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -266,5 +277,5 @@ var Elixir = internal.Register(MustNewLexer(
 | 
			
		|||
			{`\\.`, LiteralStringOther, nil},
 | 
			
		||||
			{`'[a-zA-Z]*`, LiteralStringOther, Pop(1)},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Elm lexer.
 | 
			
		||||
var Elm = internal.Register(MustNewLexer(
 | 
			
		||||
var Elm = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Elm",
 | 
			
		||||
		Aliases:   []string{"elm"},
 | 
			
		||||
		Filenames: []string{"*.elm"},
 | 
			
		||||
		MimeTypes: []string{"text/x-elm"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	elmRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func elmRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`\{-`, CommentMultiline, Push("comment")},
 | 
			
		||||
			{`--.*`, CommentSingle, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -55,5 +59,5 @@ var Elm = internal.Register(MustNewLexer(
 | 
			
		|||
			{`\|\]`, NameEntity, Pop(1)},
 | 
			
		||||
			{`.*\n`, NameEntity, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -522,14 +522,24 @@ var (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// EmacsLisp lexer.
 | 
			
		||||
var EmacsLisp = internal.Register(TypeRemappingLexer(MustNewLexer(
 | 
			
		||||
var EmacsLisp = internal.Register(TypeRemappingLexer(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "EmacsLisp",
 | 
			
		||||
		Aliases:   []string{"emacs", "elisp", "emacs-lisp"},
 | 
			
		||||
		Filenames: []string{"*.el"},
 | 
			
		||||
		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": {
 | 
			
		||||
			Default(Push("body")),
 | 
			
		||||
		},
 | 
			
		||||
| 
						 | 
				
			
			@ -572,11 +582,5 @@ var EmacsLisp = internal.Register(TypeRemappingLexer(MustNewLexer(
 | 
			
		|||
			{`\\\n`, LiteralString, nil},
 | 
			
		||||
			{`"`, LiteralString, Pop(1)},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
), TypeMapping{
 | 
			
		||||
	{NameVariable, NameFunction, emacsBuiltinFunction},
 | 
			
		||||
	{NameVariable, NameBuiltin, emacsSpecialForms},
 | 
			
		||||
	{NameVariable, NameException, emacsErrorKeywords},
 | 
			
		||||
	{NameVariable, NameBuiltin, append(emacsBuiltinFunctionHighlighted, emacsMacros...)},
 | 
			
		||||
	{NameVariable, KeywordPseudo, emacsLambdaListKeywords},
 | 
			
		||||
}))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Erlang lexer.
 | 
			
		||||
var Erlang = internal.Register(MustNewLexer(
 | 
			
		||||
var Erlang = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Erlang",
 | 
			
		||||
		Aliases:   []string{"erlang"},
 | 
			
		||||
		Filenames: []string{"*.erl", "*.hrl", "*.es", "*.escript"},
 | 
			
		||||
		MimeTypes: []string{"text/x-erlang"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	erlangRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func erlangRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
			{`%.*\n`, Comment, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -62,5 +66,5 @@ var Erlang = internal.Register(MustNewLexer(
 | 
			
		|||
			{`,`, Punctuation, Pop(1)},
 | 
			
		||||
			{`(?=\})`, Punctuation, Pop(1)},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Factor lexer.
 | 
			
		||||
var Factor = internal.Register(MustNewLexer(
 | 
			
		||||
var Factor = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Factor",
 | 
			
		||||
		Aliases:   []string{"factor"},
 | 
			
		||||
		Filenames: []string{"*.factor"},
 | 
			
		||||
		MimeTypes: []string{"text/x-factor"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	factorRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func factorRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`#!.*$`, CommentPreproc, nil},
 | 
			
		||||
			Default(Push("base")),
 | 
			
		||||
| 
						 | 
				
			
			@ -111,5 +115,5 @@ var Factor = internal.Register(MustNewLexer(
 | 
			
		|||
			{`;\s`, Keyword, Pop(1)},
 | 
			
		||||
			{`\S+`, NameFunction, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,18 +6,43 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Fish lexer.
 | 
			
		||||
var Fish = internal.Register(MustNewLexer(
 | 
			
		||||
var Fish = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Fish",
 | 
			
		||||
		Aliases:   []string{"fish", "fishshell"},
 | 
			
		||||
		Filenames: []string{"*.fish", "*.load"},
 | 
			
		||||
		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": {
 | 
			
		||||
			Include("basic"),
 | 
			
		||||
			Include("data"),
 | 
			
		||||
			Include("interp"),
 | 
			
		||||
			Include("data"),
 | 
			
		||||
		},
 | 
			
		||||
		"interp": {
 | 
			
		||||
			{`\$\(\(`, Keyword, Push("math")},
 | 
			
		||||
| 
						 | 
				
			
			@ -25,13 +50,20 @@ var Fish = internal.Register(MustNewLexer(
 | 
			
		|||
			{`\$#?(\w+|.)`, NameVariable, nil},
 | 
			
		||||
		},
 | 
			
		||||
		"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},
 | 
			
		||||
			{`\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},
 | 
			
		||||
			{Words(`(?<=(?:^|\A|;|&&|\|\||\||`+keywordsPattern+`)\s*)`, `(?=;?\b)`, keywords...), Keyword, nil},
 | 
			
		||||
			{`(?<=for\s+\S+\s+)in\b`, Keyword, nil},
 | 
			
		||||
			{Words(`\b`, `\s*\b(?!\.)`, builtins...), NameBuiltin, nil},
 | 
			
		||||
			{`#!.*\n`, CommentHashbang, nil},
 | 
			
		||||
			{`#.*\n`, Comment, nil},
 | 
			
		||||
			{`\\[\w\W]`, LiteralStringEscape, nil},
 | 
			
		||||
			{`(\b\w+)(\s*)(=)`, ByGroups(NameVariable, Text, Operator), nil},
 | 
			
		||||
			{`[\[\]()=]`, Operator, nil},
 | 
			
		||||
			{`[\[\]()={}]`, Operator, nil},
 | 
			
		||||
			{`(?<=\[[^\]]+)\.\.|-(?=[^\[]+\])`, Operator, 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": {
 | 
			
		||||
			{`(?s)\$?"(\\\\|\\[0-7]+|\\.|[^"\\$])*"`, LiteralStringDouble, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -39,10 +71,11 @@ var Fish = internal.Register(MustNewLexer(
 | 
			
		|||
			{`(?s)\$'(\\\\|\\[0-7]+|\\.|[^'\\])*'`, LiteralStringSingle, nil},
 | 
			
		||||
			{`(?s)'.*?'`, LiteralStringSingle, nil},
 | 
			
		||||
			{`;`, Punctuation, nil},
 | 
			
		||||
			{`&|\||\^|<|>`, Operator, nil},
 | 
			
		||||
			{`&&|\|\||&|\||\^|<|>`, Operator, nil},
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
			{`\d+(?= |\Z)`, LiteralNumber, nil},
 | 
			
		||||
			{"[^=\\s\\[\\]{}()$\"\\'`\\\\<&|;]+", Text, nil},
 | 
			
		||||
			{`\b\d+\b`, LiteralNumber, nil},
 | 
			
		||||
			{`--?[^\d][\w-]*`, NameAttribute, nil},
 | 
			
		||||
			{".+?", Text, nil},
 | 
			
		||||
		},
 | 
			
		||||
		"string": {
 | 
			
		||||
			{`"`, LiteralStringDouble, Pop(1)},
 | 
			
		||||
| 
						 | 
				
			
			@ -61,5 +94,5 @@ var Fish = internal.Register(MustNewLexer(
 | 
			
		|||
			{`\d+`, LiteralNumber, nil},
 | 
			
		||||
			Include("root"),
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Forth lexer.
 | 
			
		||||
var Forth = internal.Register(MustNewLexer(
 | 
			
		||||
var Forth = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:            "Forth",
 | 
			
		||||
		Aliases:         []string{"forth"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var Forth = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes:       []string{"application/x-forth"},
 | 
			
		||||
		CaseInsensitive: true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	forthRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func forthRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
			{`\\.*?\n`, CommentSingle, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -36,5 +40,5 @@ var Forth = internal.Register(MustNewLexer(
 | 
			
		|||
		"stringdef": {
 | 
			
		||||
			{`[^"]+`, LiteralString, Pop(1)},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Fortran lexer.
 | 
			
		||||
var Fortran = internal.Register(MustNewLexer(
 | 
			
		||||
var Fortran = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:            "Fortran",
 | 
			
		||||
		Aliases:         []string{"fortran"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var Fortran = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes:       []string{"text/x-fortran"},
 | 
			
		||||
		CaseInsensitive: true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	fortranRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func fortranRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`^#.*\n`, CommentPreproc, nil},
 | 
			
		||||
			{`!.*\n`, Comment, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -43,5 +47,5 @@ var Fortran = internal.Register(MustNewLexer(
 | 
			
		|||
			{`[+-]?\d*\.\d+([ed][-+]?\d+)?(_[a-z]\w+)?`, LiteralNumberFloat, nil},
 | 
			
		||||
			{`[+-]?\d+\.\d*([ed][-+]?\d+)?(_[a-z]\w+)?`, LiteralNumberFloat, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,39 @@
 | 
			
		|||
package f
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	. "github.com/alecthomas/chroma" // nolint
 | 
			
		||||
	"github.com/alecthomas/chroma/lexers/internal"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// FortranFixed lexer.
 | 
			
		||||
var FortranFixed = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:            "FortranFixed",
 | 
			
		||||
		Aliases:         []string{"fortranfixed"},
 | 
			
		||||
		Filenames:       []string{"*.f", "*.F"},
 | 
			
		||||
		MimeTypes:       []string{"text/x-fortran"},
 | 
			
		||||
		NotMultiline:    true,
 | 
			
		||||
		CaseInsensitive: true,
 | 
			
		||||
	},
 | 
			
		||||
	func() Rules {
 | 
			
		||||
		return Rules{
 | 
			
		||||
			"root": {
 | 
			
		||||
				{`[C*].*\n`, Comment, nil},
 | 
			
		||||
				{`#.*\n`, CommentPreproc, nil},
 | 
			
		||||
				{`[\t ]*!.*\n`, Comment, nil},
 | 
			
		||||
				{`(.{5})`, NameLabel, Push("cont-char")},
 | 
			
		||||
				{`.*\n`, Using(Fortran), nil},
 | 
			
		||||
			},
 | 
			
		||||
			"cont-char": {
 | 
			
		||||
				{` `, Text, Push("code")},
 | 
			
		||||
				{`0`, Comment, Push("code")},
 | 
			
		||||
				{`.`, GenericStrong, Push("code")},
 | 
			
		||||
			},
 | 
			
		||||
			"code": {
 | 
			
		||||
				{`(.{66})(.*)(\n)`, ByGroups(Using(Fortran), Comment, Text), Push("root")},
 | 
			
		||||
				{`.*\n`, Using(Fortran), Push("root")},
 | 
			
		||||
				Default(Push("root")),
 | 
			
		||||
			},
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Fsharp lexer.
 | 
			
		||||
var Fsharp = internal.Register(MustNewLexer(
 | 
			
		||||
var Fsharp = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "FSharp",
 | 
			
		||||
		Aliases:   []string{"fsharp"},
 | 
			
		||||
		Filenames: []string{"*.fs", "*.fsi"},
 | 
			
		||||
		MimeTypes: []string{"text/x-fsharp"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	fsharpRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func fsharpRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"escape-sequence": {
 | 
			
		||||
			{`\\[\\"\'ntbrafv]`, LiteralStringEscape, nil},
 | 
			
		||||
			{`\\[0-9]{3}`, LiteralStringEscape, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -90,5 +94,5 @@ var Fsharp = internal.Register(MustNewLexer(
 | 
			
		|||
			{`"""B?`, LiteralString, Pop(1)},
 | 
			
		||||
			{`"`, LiteralString, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Gas lexer.
 | 
			
		||||
var Gas = internal.Register(MustNewLexer(
 | 
			
		||||
var Gas = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "GAS",
 | 
			
		||||
		Aliases:   []string{"gas", "asm"},
 | 
			
		||||
		Filenames: []string{"*.s", "*.S"},
 | 
			
		||||
		MimeTypes: []string{"text/x-gas"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	gasRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func gasRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			Include("whitespace"),
 | 
			
		||||
			{`(?:[a-zA-Z$_][\w$.@-]*|\.[\w$.@-]+):`, NameLabel, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -51,5 +55,5 @@ var Gas = internal.Register(MustNewLexer(
 | 
			
		|||
		"punctuation": {
 | 
			
		||||
			{`[-*,.()\[\]!:]+`, Punctuation, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// GDScript lexer.
 | 
			
		||||
var GDScript = internal.Register(MustNewLexer(
 | 
			
		||||
var GDScript = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "GDScript",
 | 
			
		||||
		Aliases:   []string{"gdscript", "gd"},
 | 
			
		||||
		Filenames: []string{"*.gd"},
 | 
			
		||||
		MimeTypes: []string{"text/x-gdscript", "application/x-gdscript"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	gdscriptRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func gdscriptRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`\n`, Text, nil},
 | 
			
		||||
			{`^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")`, ByGroups(Text, LiteralStringAffix, LiteralStringDoc), nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -120,5 +124,5 @@ var GDScript = internal.Register(MustNewLexer(
 | 
			
		|||
			Include("strings-single"),
 | 
			
		||||
			{`\n`, LiteralStringSingle, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,14 +7,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Genshi Text lexer.
 | 
			
		||||
var GenshiText = internal.Register(MustNewLexer(
 | 
			
		||||
var GenshiText = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Genshi Text",
 | 
			
		||||
		Aliases:   []string{"genshitext"},
 | 
			
		||||
		Filenames: []string{},
 | 
			
		||||
		MimeTypes: []string{"application/x-genshi-text", "text/x-genshi"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	genshiTextRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func genshiTextRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`[^#$\s]+`, Other, nil},
 | 
			
		||||
			{`^(\s*)(##.*)$`, ByGroups(Text, Comment), nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -33,11 +37,11 @@ var GenshiText = internal.Register(MustNewLexer(
 | 
			
		|||
			{`(?<!\$)(\$\{)(.+?)(\})`, ByGroups(CommentPreproc, Using(Python), CommentPreproc), nil},
 | 
			
		||||
			{`(?<!\$)(\$)([a-zA-Z_][\w.]*)`, NameVariable, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Html+Genshi lexer.
 | 
			
		||||
var GenshiHTMLTemplate = internal.Register(MustNewLexer(
 | 
			
		||||
var GenshiHTMLTemplate = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:         "Genshi HTML",
 | 
			
		||||
		Aliases:      []string{"html+genshi", "html+kid"},
 | 
			
		||||
| 
						 | 
				
			
			@ -50,7 +54,7 @@ var GenshiHTMLTemplate = internal.Register(MustNewLexer(
 | 
			
		|||
))
 | 
			
		||||
 | 
			
		||||
// Genshi lexer.
 | 
			
		||||
var Genshi = internal.Register(MustNewLexer(
 | 
			
		||||
var Genshi = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:         "Genshi",
 | 
			
		||||
		Aliases:      []string{"genshi", "kid", "xml+genshi", "xml+kid"},
 | 
			
		||||
| 
						 | 
				
			
			@ -62,7 +66,8 @@ var Genshi = internal.Register(MustNewLexer(
 | 
			
		|||
	genshiMarkupRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
var genshiMarkupRules = Rules{
 | 
			
		||||
func genshiMarkupRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`[^<$]+`, Other, nil},
 | 
			
		||||
			{`(<\?python)(.*?)(\?>)`, ByGroups(CommentPreproc, Using(Python), CommentPreproc), nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -111,4 +116,5 @@ var genshiMarkupRules = Rules{
 | 
			
		|||
			{`(?<!\$)(\$\{)(.+?)(\})`, ByGroups(CommentPreproc, Using(Python), CommentPreproc), nil},
 | 
			
		||||
			{`(?<!\$)(\$)([a-zA-Z_][\w\.]*)`, NameVariable, nil},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,23 +5,27 @@ import (
 | 
			
		|||
	"github.com/alecthomas/chroma/lexers/internal"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var stepKeywords = `^(\s*)(하지만|조건|먼저|만일|만약|단|그리고|그러면|那麼|那么|而且|當|当|前提|假設|假设|假如|假定|但是|但し|並且|并且|同時|同时|もし|ならば|ただし|しかし|かつ|و |متى |لكن |عندما |ثم |بفرض |اذاً |כאשר |וגם |בהינתן |אזי |אז |אבל |Якщо |Унда |То |Припустимо, що |Припустимо |Онда |Но |Нехай |Лекин |Когато |Када |Кад |К тому же |И |Задато |Задати |Задате |Если |Допустим |Дадено |Ва |Бирок |Аммо |Али |Але |Агар |А |І |Și |És |Zatati |Zakładając |Zadato |Zadate |Zadano |Zadani |Zadan |Youse know when youse got |Youse know like when |Yna |Ya know how |Ya gotta |Y |Wun |Wtedy |When y'all |When |Wenn |WEN |Và |Ve |Und |Un |Thì |Then y'all |Then |Tapi |Tak |Tada |Tad |Så |Stel |Soit |Siis |Si |Sed |Se |Quando |Quand |Quan |Pryd |Pokud |Pokiaľ |Però |Pero |Pak |Oraz |Onda |Ond |Oletetaan |Og |Och |O zaman |Når |När |Niin |Nhưng |N |Mutta |Men |Mas |Maka |Majd |Mais |Maar |Ma |Lorsque |Lorsqu'|Kun |Kuid |Kui |Khi |Keď |Ketika |Když |Kaj |Kai |Kada |Kad |Jeżeli |Ja |Ir |I CAN HAZ |I |Ha |Givun |Givet |Given y'all |Given |Gitt |Gegeven |Gegeben sei |Fakat |Eğer ki |Etant donné |Et |Então |Entonces |Entao |En |Eeldades |E |Duota |Dun |Donitaĵo |Donat |Donada |Do |Diyelim ki |Dengan |Den youse gotta |De |Dato |Dar |Dann |Dan |Dado |Dacă |Daca |DEN |Când |Cuando |Cho |Cept |Cand |Cal |But y'all |But |Buh |Biết |Bet |BUT |Atès |Atunci |Atesa |Anrhegedig a |Angenommen |And y'all |And |An |Ama |Als |Alors |Allora |Ali |Aleshores |Ale |Akkor |Aber |AN |A také |A |\* )`
 | 
			
		||||
 | 
			
		||||
var featureKeywords = `^(기능|機能|功能|フィーチャ|خاصية|תכונה|Функціонал|Функционалност|Функционал|Фича|Особина|Могућност|Özellik|Właściwość|Tính năng|Trajto|Savybė|Požiadavka|Požadavek|Osobina|Ominaisuus|Omadus|OH HAI|Mogućnost|Mogucnost|Jellemző|Fīča|Funzionalità|Funktionalität|Funkcionalnost|Funkcionalitāte|Funcționalitate|Functionaliteit|Functionalitate|Funcionalitat|Funcionalidade|Fonctionnalité|Fitur|Feature|Egenskap|Egenskab|Crikey|Característica|Arwedd)(:)(.*)$`
 | 
			
		||||
 | 
			
		||||
var featureElementKeywords = `^(\s*)(시나리오 개요|시나리오|배경|背景|場景大綱|場景|场景大纲|场景|劇本大綱|劇本|剧本大纲|剧本|テンプレ|シナリオテンプレート|シナリオテンプレ|シナリオアウトライン|シナリオ|سيناريو مخطط|سيناريو|الخلفية|תרחיש|תבנית תרחיש|רקע|Тарих|Сценарій|Сценарио|Сценарий структураси|Сценарий|Структура сценарію|Структура сценарија|Структура сценария|Скица|Рамка на сценарий|Пример|Предыстория|Предистория|Позадина|Передумова|Основа|Концепт|Контекст|Założenia|Wharrimean is|Tình huống|The thing of it is|Tausta|Taust|Tapausaihio|Tapaus|Szenariogrundriss|Szenario|Szablon scenariusza|Stsenaarium|Struktura scenarija|Skica|Skenario konsep|Skenario|Situācija|Senaryo taslağı|Senaryo|Scénář|Scénario|Schema dello scenario|Scenārijs pēc parauga|Scenārijs|Scenár|Scenaro|Scenariusz|Scenariul de şablon|Scenariul de sablon|Scenariu|Scenario Outline|Scenario Amlinellol|Scenario|Scenarijus|Scenarijaus šablonas|Scenarij|Scenarie|Rerefons|Raamstsenaarium|Primer|Pozadí|Pozadina|Pozadie|Plan du scénario|Plan du Scénario|Osnova scénáře|Osnova|Náčrt Scénáře|Náčrt Scenáru|Mate|MISHUN SRSLY|MISHUN|Kịch bản|Konturo de la scenaro|Kontext|Konteksts|Kontekstas|Kontekst|Koncept|Khung tình huống|Khung kịch bản|Háttér|Grundlage|Geçmiş|Forgatókönyv vázlat|Forgatókönyv|Fono|Esquema do Cenário|Esquema do Cenario|Esquema del escenario|Esquema de l'escenari|Escenario|Escenari|Dis is what went down|Dasar|Contexto|Contexte|Contesto|Condiţii|Conditii|Cenário|Cenario|Cefndir|Bối cảnh|Blokes|Bakgrunn|Bakgrund|Baggrund|Background|B4|Antecedents|Antecedentes|All y'all|Achtergrond|Abstrakt Scenario|Abstract Scenario)(:)(.*)$`
 | 
			
		||||
 | 
			
		||||
var examplesKeywords = `^(\s*)(예|例子|例|サンプル|امثلة|דוגמאות|Сценарији|Примери|Приклади|Мисоллар|Значения|Örnekler|Voorbeelden|Variantai|Tapaukset|Scenarios|Scenariji|Scenarijai|Příklady|Példák|Príklady|Przykłady|Primjeri|Primeri|Piemēri|Pavyzdžiai|Paraugs|Juhtumid|Exemplos|Exemples|Exemplele|Exempel|Examples|Esempi|Enghreifftiau|Ekzemploj|Eksempler|Ejemplos|EXAMPLZ|Dữ liệu|Contoh|Cobber|Beispiele)(:)(.*)$`
 | 
			
		||||
 | 
			
		||||
// Gherkin lexer.
 | 
			
		||||
var Gherkin = internal.Register(MustNewLexer(
 | 
			
		||||
var Gherkin = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Gherkin",
 | 
			
		||||
		Aliases:   []string{"cucumber", "Cucumber", "gherkin", "Gherkin"},
 | 
			
		||||
		Filenames: []string{"*.feature", "*.FEATURE"},
 | 
			
		||||
		MimeTypes: []string{"text/x-gherkin"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	gherkinRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func gherkinRules() Rules {
 | 
			
		||||
	stepKeywords := `^(\s*)(하지만|조건|먼저|만일|만약|단|그리고|그러면|那麼|那么|而且|當|当|前提|假設|假设|假如|假定|但是|但し|並且|并且|同時|同时|もし|ならば|ただし|しかし|かつ|و |متى |لكن |عندما |ثم |بفرض |اذاً |כאשר |וגם |בהינתן |אזי |אז |אבל |Якщо |Унда |То |Припустимо, що |Припустимо |Онда |Но |Нехай |Лекин |Когато |Када |Кад |К тому же |И |Задато |Задати |Задате |Если |Допустим |Дадено |Ва |Бирок |Аммо |Али |Але |Агар |А |І |Și |És |Zatati |Zakładając |Zadato |Zadate |Zadano |Zadani |Zadan |Youse know when youse got |Youse know like when |Yna |Ya know how |Ya gotta |Y |Wun |Wtedy |When y'all |When |Wenn |WEN |Và |Ve |Und |Un |Thì |Then y'all |Then |Tapi |Tak |Tada |Tad |Så |Stel |Soit |Siis |Si |Sed |Se |Quando |Quand |Quan |Pryd |Pokud |Pokiaľ |Però |Pero |Pak |Oraz |Onda |Ond |Oletetaan |Og |Och |O zaman |Når |När |Niin |Nhưng |N |Mutta |Men |Mas |Maka |Majd |Mais |Maar |Ma |Lorsque |Lorsqu'|Kun |Kuid |Kui |Khi |Keď |Ketika |Když |Kaj |Kai |Kada |Kad |Jeżeli |Ja |Ir |I CAN HAZ |I |Ha |Givun |Givet |Given y'all |Given |Gitt |Gegeven |Gegeben sei |Fakat |Eğer ki |Etant donné |Et |Então |Entonces |Entao |En |Eeldades |E |Duota |Dun |Donitaĵo |Donat |Donada |Do |Diyelim ki |Dengan |Den youse gotta |De |Dato |Dar |Dann |Dan |Dado |Dacă |Daca |DEN |Când |Cuando |Cho |Cept |Cand |Cal |But y'all |But |Buh |Biết |Bet |BUT |Atès |Atunci |Atesa |Anrhegedig a |Angenommen |And y'all |And |An |Ama |Als |Alors |Allora |Ali |Aleshores |Ale |Akkor |Aber |AN |A také |A |\* )`
 | 
			
		||||
 | 
			
		||||
	featureKeywords := `^(기능|機能|功能|フィーチャ|خاصية|תכונה|Функціонал|Функционалност|Функционал|Фича|Особина|Могућност|Özellik|Właściwość|Tính năng|Trajto|Savybė|Požiadavka|Požadavek|Osobina|Ominaisuus|Omadus|OH HAI|Mogućnost|Mogucnost|Jellemző|Fīča|Funzionalità|Funktionalität|Funkcionalnost|Funkcionalitāte|Funcționalitate|Functionaliteit|Functionalitate|Funcionalitat|Funcionalidade|Fonctionnalité|Fitur|Feature|Egenskap|Egenskab|Crikey|Característica|Arwedd)(:)(.*)$`
 | 
			
		||||
 | 
			
		||||
	featureElementKeywords := `^(\s*)(시나리오 개요|시나리오|배경|背景|場景大綱|場景|场景大纲|场景|劇本大綱|劇本|剧本大纲|剧本|テンプレ|シナリオテンプレート|シナリオテンプレ|シナリオアウトライン|シナリオ|سيناريو مخطط|سيناريو|الخلفية|תרחיש|תבנית תרחיש|רקע|Тарих|Сценарій|Сценарио|Сценарий структураси|Сценарий|Структура сценарію|Структура сценарија|Структура сценария|Скица|Рамка на сценарий|Пример|Предыстория|Предистория|Позадина|Передумова|Основа|Концепт|Контекст|Założenia|Wharrimean is|Tình huống|The thing of it is|Tausta|Taust|Tapausaihio|Tapaus|Szenariogrundriss|Szenario|Szablon scenariusza|Stsenaarium|Struktura scenarija|Skica|Skenario konsep|Skenario|Situācija|Senaryo taslağı|Senaryo|Scénář|Scénario|Schema dello scenario|Scenārijs pēc parauga|Scenārijs|Scenár|Scenaro|Scenariusz|Scenariul de şablon|Scenariul de sablon|Scenariu|Scenario Outline|Scenario Amlinellol|Scenario|Scenarijus|Scenarijaus šablonas|Scenarij|Scenarie|Rerefons|Raamstsenaarium|Primer|Pozadí|Pozadina|Pozadie|Plan du scénario|Plan du Scénario|Osnova scénáře|Osnova|Náčrt Scénáře|Náčrt Scenáru|Mate|MISHUN SRSLY|MISHUN|Kịch bản|Konturo de la scenaro|Kontext|Konteksts|Kontekstas|Kontekst|Koncept|Khung tình huống|Khung kịch bản|Háttér|Grundlage|Geçmiş|Forgatókönyv vázlat|Forgatókönyv|Fono|Esquema do Cenário|Esquema do Cenario|Esquema del escenario|Esquema de l'escenari|Escenario|Escenari|Dis is what went down|Dasar|Contexto|Contexte|Contesto|Condiţii|Conditii|Cenário|Cenario|Cefndir|Bối cảnh|Blokes|Bakgrunn|Bakgrund|Baggrund|Background|B4|Antecedents|Antecedentes|All y'all|Achtergrond|Abstrakt Scenario|Abstract Scenario)(:)(.*)$`
 | 
			
		||||
 | 
			
		||||
	examplesKeywords := `^(\s*)(예|例子|例|サンプル|امثلة|דוגמאות|Сценарији|Примери|Приклади|Мисоллар|Значения|Örnekler|Voorbeelden|Variantai|Tapaukset|Scenarios|Scenariji|Scenarijai|Příklady|Példák|Príklady|Przykłady|Primjeri|Primeri|Piemēri|Pavyzdžiai|Paraugs|Juhtumid|Exemplos|Exemples|Exemplele|Exempel|Examples|Esempi|Enghreifftiau|Ekzemploj|Eksempler|Ejemplos|EXAMPLZ|Dữ liệu|Contoh|Cobber|Beispiele)(:)(.*)$`
 | 
			
		||||
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"comments": {
 | 
			
		||||
			{`\s*#.*$`, Comment, nil},
 | 
			
		||||
		},
 | 
			
		||||
| 
						 | 
				
			
			@ -114,5 +118,5 @@ var Gherkin = internal.Register(MustNewLexer(
 | 
			
		|||
			{examplesKeywords, ByGroups(NameFunction, Keyword, Keyword, NameFunction), Push("examplesTable")},
 | 
			
		||||
			{`(\s|.)`, NameFunction, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// GLSL lexer.
 | 
			
		||||
var GLSL = internal.Register(MustNewLexer(
 | 
			
		||||
var GLSL = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "GLSL",
 | 
			
		||||
		Aliases:   []string{"glsl"},
 | 
			
		||||
		Filenames: []string{"*.vert", "*.frag", "*.geo"},
 | 
			
		||||
		MimeTypes: []string{"text/x-glslsrc"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	glslRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func glslRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`^#.*`, CommentPreproc, nil},
 | 
			
		||||
			{`//.*`, CommentSingle, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -33,5 +37,5 @@ var GLSL = internal.Register(MustNewLexer(
 | 
			
		|||
			{`\.`, Punctuation, nil},
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Gnuplot lexer.
 | 
			
		||||
var Gnuplot = internal.Register(MustNewLexer(
 | 
			
		||||
var Gnuplot = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Gnuplot",
 | 
			
		||||
		Aliases:   []string{"gnuplot"},
 | 
			
		||||
		Filenames: []string{"*.plot", "*.plt"},
 | 
			
		||||
		MimeTypes: []string{"text/x-gnuplot"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	gnuplotRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func gnuplotRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			Include("whitespace"),
 | 
			
		||||
			{`bind\b|bin\b|bi\b`, Keyword, Push("bind")},
 | 
			
		||||
| 
						 | 
				
			
			@ -113,5 +117,5 @@ var Gnuplot = internal.Register(MustNewLexer(
 | 
			
		|||
			{`functions\b|function\b|functio\b|functi\b|funct\b|func\b|fun\b|fu\b|f\b|set\b|se\b|s\b|terminal\b|termina\b|termin\b|termi\b|term\b|ter\b|te\b|t\b|variables\b|variable\b|variabl\b|variab\b|varia\b|vari\b|var\b|va\b|v\b`, NameBuiltin, nil},
 | 
			
		||||
			Include("genericargs"),
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,14 +9,27 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Go lexer.
 | 
			
		||||
var Go = internal.Register(MustNewLexer(
 | 
			
		||||
var Go = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Go",
 | 
			
		||||
		Aliases:   []string{"go", "golang"},
 | 
			
		||||
		Filenames: []string{"*.go"},
 | 
			
		||||
		MimeTypes: []string{"text/x-gosrc"},
 | 
			
		||||
		EnsureNL:  true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	goRules,
 | 
			
		||||
).SetAnalyser(func(text string) float32 {
 | 
			
		||||
	if strings.Contains(text, "fmt.") && strings.Contains(text, "package ") {
 | 
			
		||||
		return 0.5
 | 
			
		||||
	}
 | 
			
		||||
	if strings.Contains(text, "package ") {
 | 
			
		||||
		return 0.1
 | 
			
		||||
	}
 | 
			
		||||
	return 0.0
 | 
			
		||||
}))
 | 
			
		||||
 | 
			
		||||
func goRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`\n`, Text, nil},
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -36,8 +49,8 @@ var Go = internal.Register(MustNewLexer(
 | 
			
		|||
			{`\d+(\.\d+[eE][+\-]?\d+|\.\d*|[eE][+\-]?\d+)`, LiteralNumberFloat, nil},
 | 
			
		||||
			{`\.\d+([eE][+\-]?\d+)?`, LiteralNumberFloat, nil},
 | 
			
		||||
			{`0[0-7]+`, LiteralNumberOct, nil},
 | 
			
		||||
			{`0[xX][0-9a-fA-F]+`, LiteralNumberHex, nil},
 | 
			
		||||
			{`(0|[1-9][0-9]*)`, LiteralNumberInteger, nil},
 | 
			
		||||
			{`0[xX][0-9a-fA-F_]+`, LiteralNumberHex, nil},
 | 
			
		||||
			{`(0|[1-9][0-9_]*)`, LiteralNumberInteger, nil},
 | 
			
		||||
			{`'(\\['"\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|[^\\])'`, LiteralStringChar, nil},
 | 
			
		||||
			{"(`)([^`]*)(`)", ByGroups(LiteralString, Using(TypeRemappingLexer(GoTextTemplate, TypeMapping{{Other, LiteralString, nil}})), LiteralString), nil},
 | 
			
		||||
			{`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -46,26 +59,19 @@ var Go = internal.Register(MustNewLexer(
 | 
			
		|||
			{`[|^<>=!()\[\]{}.,;:]`, Punctuation, nil},
 | 
			
		||||
			{`[^\W\d]\w*`, NameOther, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
).SetAnalyser(func(text string) float32 {
 | 
			
		||||
	if strings.Contains(text, "fmt.") && strings.Contains(text, "package ") {
 | 
			
		||||
		return 0.5
 | 
			
		||||
	}
 | 
			
		||||
	if strings.Contains(text, "package ") {
 | 
			
		||||
		return 0.1
 | 
			
		||||
	}
 | 
			
		||||
	return 0.0
 | 
			
		||||
}))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var goTemplateRules = Rules{
 | 
			
		||||
func goTemplateRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`{{(- )?/\*(.|\n)*?\*/( -)?}}`, CommentMultiline, nil},
 | 
			
		||||
			{`{{[-]?`, CommentPreproc, Push("template")},
 | 
			
		||||
			{`[^{]+`, Other, nil},
 | 
			
		||||
			{`{`, Other, nil},
 | 
			
		||||
		},
 | 
			
		||||
		"template": {
 | 
			
		||||
			{`[-]?}}`, CommentPreproc, Pop(1)},
 | 
			
		||||
		{`/\*.*?\*/`, Comment, nil},
 | 
			
		||||
			{`(?=}})`, CommentPreproc, Pop(1)}, // Terminate the pipeline
 | 
			
		||||
			{`\(`, Operator, Push("subexpression")},
 | 
			
		||||
			{`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -79,25 +85,26 @@ var goTemplateRules = Rules{
 | 
			
		|||
			{`\s+`, Whitespace, nil},
 | 
			
		||||
			{`\(`, Operator, Push("subexpression")},
 | 
			
		||||
			{`(range|if|else|while|with|template|end|true|false|nil|and|call|html|index|js|len|not|or|print|printf|println|urlquery|eq|ne|lt|le|gt|ge)\b`, Keyword, nil},
 | 
			
		||||
		{`\||:=`, Operator, nil},
 | 
			
		||||
			{`\||:?=|,`, Operator, nil},
 | 
			
		||||
			{`[$]?[^\W\d]\w*`, NameOther, nil},
 | 
			
		||||
		{`[$]?\.(?:[^\W\d]\w*)?`, NameAttribute, nil},
 | 
			
		||||
			{`\$|[$]?\.(?:[^\W\d]\w*)?`, NameAttribute, nil},
 | 
			
		||||
			{`"(\\\\|\\"|[^"])*"`, LiteralString, nil},
 | 
			
		||||
		{`\d+i`, LiteralNumber, nil},
 | 
			
		||||
		{`\d+\.\d*([Ee][-+]\d+)?i`, LiteralNumber, nil},
 | 
			
		||||
			{`-?\d+i`, LiteralNumber, nil},
 | 
			
		||||
			{`-?\d+\.\d*([Ee][-+]\d+)?i`, LiteralNumber, nil},
 | 
			
		||||
			{`\.\d+([Ee][-+]\d+)?i`, LiteralNumber, nil},
 | 
			
		||||
		{`\d+[Ee][-+]\d+i`, LiteralNumber, nil},
 | 
			
		||||
		{`\d+(\.\d+[eE][+\-]?\d+|\.\d*|[eE][+\-]?\d+)`, LiteralNumberFloat, nil},
 | 
			
		||||
		{`\.\d+([eE][+\-]?\d+)?`, LiteralNumberFloat, nil},
 | 
			
		||||
		{`0[0-7]+`, LiteralNumberOct, nil},
 | 
			
		||||
		{`0[xX][0-9a-fA-F]+`, LiteralNumberHex, nil},
 | 
			
		||||
		{`(0|[1-9][0-9]*)`, LiteralNumberInteger, nil},
 | 
			
		||||
			{`-?\d+[Ee][-+]\d+i`, LiteralNumber, nil},
 | 
			
		||||
			{`-?\d+(\.\d+[eE][+\-]?\d+|\.\d*|[eE][+\-]?\d+)`, LiteralNumberFloat, nil},
 | 
			
		||||
			{`-?\.\d+([eE][+\-]?\d+)?`, LiteralNumberFloat, nil},
 | 
			
		||||
			{`-?0[0-7]+`, LiteralNumberOct, nil},
 | 
			
		||||
			{`-?0[xX][0-9a-fA-F]+`, LiteralNumberHex, nil},
 | 
			
		||||
			{`-?(0|[1-9][0-9]*)`, LiteralNumberInteger, nil},
 | 
			
		||||
			{`'(\\['"\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|[^\\])'`, LiteralStringChar, nil},
 | 
			
		||||
			{"`[^`]*`", LiteralString, nil},
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var GoHTMLTemplate = internal.Register(DelegatingLexer(h.HTML, MustNewLexer(
 | 
			
		||||
var GoHTMLTemplate = internal.Register(DelegatingLexer(h.HTML, MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:    "Go HTML Template",
 | 
			
		||||
		Aliases: []string{"go-html-template"},
 | 
			
		||||
| 
						 | 
				
			
			@ -105,7 +112,7 @@ var GoHTMLTemplate = internal.Register(DelegatingLexer(h.HTML, MustNewLexer(
 | 
			
		|||
	goTemplateRules,
 | 
			
		||||
)))
 | 
			
		||||
 | 
			
		||||
var GoTextTemplate = internal.Register(MustNewLexer(
 | 
			
		||||
var GoTextTemplate = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:    "Go Text Template",
 | 
			
		||||
		Aliases: []string{"go-text-template"},
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,13 +6,17 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Go lexer.
 | 
			
		||||
var Graphql = internal.Register(MustNewLexer(
 | 
			
		||||
var Graphql = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "GraphQL",
 | 
			
		||||
		Aliases:   []string{"graphql", "graphqls", "gql"},
 | 
			
		||||
		Filenames: []string{"*.graphql", "*.graphqls"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	graphqlRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func graphqlRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`(query|mutation|subscription|fragment|scalar|implements|interface|union|enum|input|type)`, KeywordDeclaration, Push("type")},
 | 
			
		||||
			{`(on|extend|schema|directive|\.\.\.)`, KeywordDeclaration, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -41,5 +45,5 @@ var Graphql = internal.Register(MustNewLexer(
 | 
			
		|||
			{`[^\W\d]\w*`, NameClass, Pop(1)},
 | 
			
		||||
			Include("root"),
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,47 @@
 | 
			
		|||
package g
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	. "github.com/alecthomas/chroma" // nolint
 | 
			
		||||
	"github.com/alecthomas/chroma/lexers/internal"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Groff lexer.
 | 
			
		||||
var Groff = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Groff",
 | 
			
		||||
		Aliases:   []string{"groff", "nroff", "man"},
 | 
			
		||||
		Filenames: []string{"*.[1-9]", "*.1p", "*.3pm", "*.man"},
 | 
			
		||||
		MimeTypes: []string{"application/x-troff", "text/troff"},
 | 
			
		||||
	},
 | 
			
		||||
	func() Rules {
 | 
			
		||||
		return Rules{
 | 
			
		||||
			"root": {
 | 
			
		||||
				{`(\.)(\w+)`, ByGroups(Text, Keyword), Push("request")},
 | 
			
		||||
				{`\.`, Punctuation, Push("request")},
 | 
			
		||||
				{`[^\\\n]+`, Text, Push("textline")},
 | 
			
		||||
				Default(Push("textline")),
 | 
			
		||||
			},
 | 
			
		||||
			"textline": {
 | 
			
		||||
				Include("escapes"),
 | 
			
		||||
				{`[^\\\n]+`, Text, nil},
 | 
			
		||||
				{`\n`, Text, Pop(1)},
 | 
			
		||||
			},
 | 
			
		||||
			"escapes": {
 | 
			
		||||
				{`\\"[^\n]*`, Comment, nil},
 | 
			
		||||
				{`\\[fn]\w`, LiteralStringEscape, nil},
 | 
			
		||||
				{`\\\(.{2}`, LiteralStringEscape, nil},
 | 
			
		||||
				{`\\.\[.*\]`, LiteralStringEscape, nil},
 | 
			
		||||
				{`\\.`, LiteralStringEscape, nil},
 | 
			
		||||
				{`\\\n`, Text, Push("request")},
 | 
			
		||||
			},
 | 
			
		||||
			"request": {
 | 
			
		||||
				{`\n`, Text, Pop(1)},
 | 
			
		||||
				Include("escapes"),
 | 
			
		||||
				{`"[^\n"]+"`, LiteralStringDouble, nil},
 | 
			
		||||
				{`\d+`, LiteralNumber, nil},
 | 
			
		||||
				{`\S+`, LiteralString, nil},
 | 
			
		||||
				{`\s+`, Text, nil},
 | 
			
		||||
			},
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Groovy lexer.
 | 
			
		||||
var Groovy = internal.Register(MustNewLexer(
 | 
			
		||||
var Groovy = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Groovy",
 | 
			
		||||
		Aliases:   []string{"groovy"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var Groovy = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes: []string{"text/x-groovy"},
 | 
			
		||||
		DotAll:    true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	groovyRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func groovyRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`#!(.*?)$`, CommentPreproc, Push("base")},
 | 
			
		||||
			Default(Push("base")),
 | 
			
		||||
| 
						 | 
				
			
			@ -54,5 +58,5 @@ var Groovy = internal.Register(MustNewLexer(
 | 
			
		|||
		"import": {
 | 
			
		||||
			{`[\w.]+\*?`, NameNamespace, Pop(1)},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Handlebars lexer.
 | 
			
		||||
var Handlebars = internal.Register(MustNewLexer(
 | 
			
		||||
var Handlebars = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Handlebars",
 | 
			
		||||
		Aliases:   []string{"handlebars"},
 | 
			
		||||
		Filenames: []string{"*.handlebars"},
 | 
			
		||||
		Aliases:   []string{"handlebars", "hbs"},
 | 
			
		||||
		Filenames: []string{"*.handlebars", "*.hbs"},
 | 
			
		||||
		MimeTypes: []string{},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	handlebarsRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func handlebarsRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`[^{]+`, Other, nil},
 | 
			
		||||
			{`\{\{!.*\}\}`, Comment, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -52,5 +56,5 @@ var Handlebars = internal.Register(MustNewLexer(
 | 
			
		|||
			{`:?'(\\\\|\\'|[^'])*'`, LiteralStringSingle, nil},
 | 
			
		||||
			{`[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?`, LiteralNumber, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Haskell lexer.
 | 
			
		||||
var Haskell = internal.Register(MustNewLexer(
 | 
			
		||||
var Haskell = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Haskell",
 | 
			
		||||
		Aliases:   []string{"haskell", "hs"},
 | 
			
		||||
		Filenames: []string{"*.hs"},
 | 
			
		||||
		MimeTypes: []string{"text/x-haskell"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	haskellRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func haskellRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
			{`--(?![!#$%&*+./<=>?@^|_~:\\]).*?$`, CommentSingle, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -95,5 +99,5 @@ var Haskell = internal.Register(MustNewLexer(
 | 
			
		|||
			{`\d+`, LiteralStringEscape, Pop(1)},
 | 
			
		||||
			{`\s+\\`, LiteralStringEscape, Pop(1)},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Haxe lexer.
 | 
			
		||||
var Haxe = internal.Register(MustNewLexer(
 | 
			
		||||
var Haxe = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Haxe",
 | 
			
		||||
		Aliases:   []string{"hx", "haxe", "hxsl"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var Haxe = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes: []string{"text/haxe", "text/x-haxe", "text/x-hx"},
 | 
			
		||||
		DotAll:    true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	haxeRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func haxeRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			Include("spaces"),
 | 
			
		||||
			Include("meta"),
 | 
			
		||||
| 
						 | 
				
			
			@ -609,8 +613,8 @@ var Haxe = internal.Register(MustNewLexer(
 | 
			
		|||
			{`\}`, Punctuation, Pop(1)},
 | 
			
		||||
			{`,`, Punctuation, Push("#pop", "object")},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func haxePreProcMutator(state *LexerState) error {
 | 
			
		||||
	stack, ok := state.Get("haxe-pre-proc").([][]string)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// HCL lexer.
 | 
			
		||||
var HCL = internal.Register(MustNewLexer(
 | 
			
		||||
var HCL = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "HCL",
 | 
			
		||||
		Aliases:   []string{"hcl"},
 | 
			
		||||
		Filenames: []string{"*.hcl"},
 | 
			
		||||
		MimeTypes: []string{"application/x-hcl"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	hclRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func hclRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			Include("string"),
 | 
			
		||||
			Include("punctuation"),
 | 
			
		||||
| 
						 | 
				
			
			@ -65,5 +69,5 @@ var HCL = internal.Register(MustNewLexer(
 | 
			
		|||
			{`\s+`, Text, nil},
 | 
			
		||||
			{`\\\n`, Text, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Hexdump lexer.
 | 
			
		||||
var Hexdump = internal.Register(MustNewLexer(
 | 
			
		||||
var Hexdump = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Hexdump",
 | 
			
		||||
		Aliases:   []string{"hexdump"},
 | 
			
		||||
		Filenames: []string{},
 | 
			
		||||
		MimeTypes: []string{},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	hexdumpRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func hexdumpRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`\n`, Text, nil},
 | 
			
		||||
			Include("offset"),
 | 
			
		||||
| 
						 | 
				
			
			@ -63,5 +67,5 @@ var Hexdump = internal.Register(MustNewLexer(
 | 
			
		|||
			{`\s`, Text, nil},
 | 
			
		||||
			{`^\*`, Punctuation, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
package lexers
 | 
			
		||||
package h
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	. "github.com/alecthomas/chroma" // nolint
 | 
			
		||||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// HLB lexer.
 | 
			
		||||
var HLB = internal.Register(MustNewLexer(
 | 
			
		||||
var HLB = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "HLB",
 | 
			
		||||
		Aliases:   []string{"hlb"},
 | 
			
		||||
		Filenames: []string{"*.hlb"},
 | 
			
		||||
		MimeTypes: []string{},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	hlbRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func hlbRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`(#.*)`, ByGroups(CommentSingle), nil},
 | 
			
		||||
			{`((\b(0(b|B|o|O|x|X)[a-fA-F0-9]+)\b)|(\b(0|[1-9][0-9]*)\b))`, ByGroups(LiteralNumber), nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -50,5 +54,5 @@ var HLB = internal.Register(MustNewLexer(
 | 
			
		|||
			{`(\n|\r|\r\n)`, Text, nil},
 | 
			
		||||
			{`.`, Text, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -8,7 +8,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// HTML lexer.
 | 
			
		||||
var HTML = internal.Register(MustNewLexer(
 | 
			
		||||
var HTML = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:            "HTML",
 | 
			
		||||
		Aliases:         []string{"html"},
 | 
			
		||||
| 
						 | 
				
			
			@ -18,7 +18,11 @@ var HTML = internal.Register(MustNewLexer(
 | 
			
		|||
		DotAll:          true,
 | 
			
		||||
		CaseInsensitive: true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	htmlRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func htmlRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`[^<&]+`, Text, nil},
 | 
			
		||||
			{`&\S*?;`, NameEntity, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -55,5 +59,5 @@ var HTML = internal.Register(MustNewLexer(
 | 
			
		|||
			{`'.*?'`, LiteralString, Pop(1)},
 | 
			
		||||
			{`[^\s>]+`, LiteralString, Pop(1)},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// HTTP lexer.
 | 
			
		||||
var HTTP = internal.Register(httpBodyContentTypeLexer(MustNewLexer(
 | 
			
		||||
var HTTP = internal.Register(httpBodyContentTypeLexer(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:         "HTTP",
 | 
			
		||||
		Aliases:      []string{"http"},
 | 
			
		||||
| 
						 | 
				
			
			@ -17,10 +17,14 @@ var HTTP = internal.Register(httpBodyContentTypeLexer(MustNewLexer(
 | 
			
		|||
		NotMultiline: true,
 | 
			
		||||
		DotAll:       true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	httpRules,
 | 
			
		||||
)))
 | 
			
		||||
 | 
			
		||||
func httpRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`(GET|POST|PUT|DELETE|HEAD|OPTIONS|TRACE|PATCH|CONNECT)( +)([^ ]+)( +)(HTTP)(/)(1\.[01])(\r?\n|\Z)`, ByGroups(NameFunction, Text, NameNamespace, Text, KeywordReserved, Operator, LiteralNumber, Text), Push("headers")},
 | 
			
		||||
			{`(HTTP)(/)(1\.[01])( +)(\d{3})( +)([^\r\n]+)(\r?\n|\Z)`, ByGroups(KeywordReserved, Operator, LiteralNumber, Text, LiteralNumber, Text, NameException, Text), Push("headers")},
 | 
			
		||||
			{`(GET|POST|PUT|DELETE|HEAD|OPTIONS|TRACE|PATCH|CONNECT)( +)([^ ]+)( +)(HTTP)(/)([12]\.[01])(\r?\n|\Z)`, ByGroups(NameFunction, Text, NameNamespace, Text, KeywordReserved, Operator, LiteralNumber, Text), Push("headers")},
 | 
			
		||||
			{`(HTTP)(/)([12]\.[01])( +)(\d{3})( +)([^\r\n]+)(\r?\n|\Z)`, ByGroups(KeywordReserved, Operator, LiteralNumber, Text, LiteralNumber, Text, NameException, Text), Push("headers")},
 | 
			
		||||
		},
 | 
			
		||||
		"headers": {
 | 
			
		||||
			{`([^\s:]+)( *)(:)( *)([^\r\n]+)(\r?\n|\Z)`, EmitterFunc(httpHeaderBlock), nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -30,17 +34,17 @@ var HTTP = internal.Register(httpBodyContentTypeLexer(MustNewLexer(
 | 
			
		|||
		"content": {
 | 
			
		||||
			{`.+`, EmitterFunc(httpContentBlock), nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
)))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func httpContentBlock(groups []string, lexer Lexer) Iterator {
 | 
			
		||||
func httpContentBlock(groups []string, state *LexerState) Iterator {
 | 
			
		||||
	tokens := []Token{
 | 
			
		||||
		{Generic, groups[0]},
 | 
			
		||||
	}
 | 
			
		||||
	return Literator(tokens...)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func httpHeaderBlock(groups []string, lexer Lexer) Iterator {
 | 
			
		||||
func httpHeaderBlock(groups []string, state *LexerState) Iterator {
 | 
			
		||||
	tokens := []Token{
 | 
			
		||||
		{Name, groups[1]},
 | 
			
		||||
		{Text, groups[2]},
 | 
			
		||||
| 
						 | 
				
			
			@ -52,7 +56,7 @@ func httpHeaderBlock(groups []string, lexer Lexer) Iterator {
 | 
			
		|||
	return Literator(tokens...)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func httpContinuousHeaderBlock(groups []string, lexer Lexer) Iterator {
 | 
			
		||||
func httpContinuousHeaderBlock(groups []string, state *LexerState) Iterator {
 | 
			
		||||
	tokens := []Token{
 | 
			
		||||
		{Text, groups[1]},
 | 
			
		||||
		{Literal, groups[2]},
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Hy lexer.
 | 
			
		||||
var Hy = internal.Register(MustNewLexer(
 | 
			
		||||
var Hy = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Hy",
 | 
			
		||||
		Aliases:   []string{"hylang"},
 | 
			
		||||
		Filenames: []string{"*.hy"},
 | 
			
		||||
		MimeTypes: []string{"text/x-hy", "application/x-hy"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	hyRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func hyRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`;.*$`, CommentSingle, nil},
 | 
			
		||||
			{`[,\s]+`, Text, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -47,5 +51,5 @@ var Hy = internal.Register(MustNewLexer(
 | 
			
		|||
			{`(?<!\.)(self|None|Ellipsis|NotImplemented|False|True|cls)\b`, NameBuiltinPseudo, nil},
 | 
			
		||||
			{Words(`(?<!\.)`, `\b`, `ArithmeticError`, `AssertionError`, `AttributeError`, `BaseException`, `DeprecationWarning`, `EOFError`, `EnvironmentError`, `Exception`, `FloatingPointError`, `FutureWarning`, `GeneratorExit`, `IOError`, `ImportError`, `ImportWarning`, `IndentationError`, `IndexError`, `KeyError`, `KeyboardInterrupt`, `LookupError`, `MemoryError`, `NameError`, `NotImplemented`, `NotImplementedError`, `OSError`, `OverflowError`, `OverflowWarning`, `PendingDeprecationWarning`, `ReferenceError`, `RuntimeError`, `RuntimeWarning`, `StandardError`, `StopIteration`, `SyntaxError`, `SyntaxWarning`, `SystemError`, `SystemExit`, `TabError`, `TypeError`, `UnboundLocalError`, `UnicodeDecodeError`, `UnicodeEncodeError`, `UnicodeError`, `UnicodeTranslateError`, `UnicodeWarning`, `UserWarning`, `ValueError`, `VMSError`, `Warning`, `WindowsError`, `ZeroDivisionError`), NameException, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Idris lexer.
 | 
			
		||||
var Idris = internal.Register(MustNewLexer(
 | 
			
		||||
var Idris = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "Idris",
 | 
			
		||||
		Aliases:   []string{"idris", "idr"},
 | 
			
		||||
		Filenames: []string{"*.idr"},
 | 
			
		||||
		MimeTypes: []string{"text/x-idris"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	idrisRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func idrisRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`^(\s*)(%lib|link|flag|include|hide|freeze|access|default|logging|dynamic|name|error_handlers|language)`, ByGroups(Text, KeywordReserved), nil},
 | 
			
		||||
			{`(\s*)(--(?![!#$%&*+./<=>?@^|_~:\\]).*?)$`, ByGroups(Text, CommentSingle), nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -76,5 +80,5 @@ var Idris = internal.Register(MustNewLexer(
 | 
			
		|||
			{`\d+`, LiteralStringEscape, Pop(1)},
 | 
			
		||||
			{`\s+\\`, LiteralStringEscape, Pop(1)},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Igor lexer.
 | 
			
		||||
var Igor = internal.Register(MustNewLexer(
 | 
			
		||||
var Igor = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:            "Igor",
 | 
			
		||||
		Aliases:         []string{"igor", "igorpro"},
 | 
			
		||||
| 
						 | 
				
			
			@ -14,7 +14,11 @@ var Igor = internal.Register(MustNewLexer(
 | 
			
		|||
		MimeTypes:       []string{"text/ipf"},
 | 
			
		||||
		CaseInsensitive: true,
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	igorRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func igorRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`//.*$`, CommentSingle, nil},
 | 
			
		||||
			{`"([^"\\]|\\.)*"`, LiteralString, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -28,5 +32,5 @@ var Igor = internal.Register(MustNewLexer(
 | 
			
		|||
			{`.`, Text, nil},
 | 
			
		||||
			{`\n|\r`, Text, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,14 +6,18 @@ import (
 | 
			
		|||
)
 | 
			
		||||
 | 
			
		||||
// Ini lexer.
 | 
			
		||||
var Ini = internal.Register(MustNewLexer(
 | 
			
		||||
var Ini = internal.Register(MustNewLazyLexer(
 | 
			
		||||
	&Config{
 | 
			
		||||
		Name:      "INI",
 | 
			
		||||
		Aliases:   []string{"ini", "cfg", "dosini"},
 | 
			
		||||
		Filenames: []string{"*.ini", "*.cfg", "*.inf", ".gitconfig"},
 | 
			
		||||
		Filenames: []string{"*.ini", "*.cfg", "*.inf", ".gitconfig", ".editorconfig"},
 | 
			
		||||
		MimeTypes: []string{"text/x-ini", "text/inf"},
 | 
			
		||||
	},
 | 
			
		||||
	Rules{
 | 
			
		||||
	iniRules,
 | 
			
		||||
))
 | 
			
		||||
 | 
			
		||||
func iniRules() Rules {
 | 
			
		||||
	return Rules{
 | 
			
		||||
		"root": {
 | 
			
		||||
			{`\s+`, Text, nil},
 | 
			
		||||
			{`[;#].*`, CommentSingle, nil},
 | 
			
		||||
| 
						 | 
				
			
			@ -21,5 +25,5 @@ var Ini = internal.Register(MustNewLexer(
 | 
			
		|||
			{`(.*?)([ \t]*)(=)([ \t]*)(.*(?:\n[ \t].+)*)`, ByGroups(NameAttribute, Text, Operator, Text, LiteralString), nil},
 | 
			
		||||
			{`(.+?)$`, NameAttribute, nil},
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
))
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
		Reference in New Issue