Skip to content

Commit

Permalink
refactor: migrate a bunch more Go-based lexers to XML
Browse files Browse the repository at this point in the history
Also rename some existing XML lexers to their canonical XML name.
  • Loading branch information
alecthomas committed Sep 9, 2023
1 parent 4dd2cbe commit 40542a6
Show file tree
Hide file tree
Showing 63 changed files with 2,963 additions and 1,343 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -22,3 +22,4 @@ _models/

_examples/
*.min.*
build/
4 changes: 2 additions & 2 deletions Bitfile
Expand Up @@ -12,10 +12,10 @@ README.md: lexers/*.go lexers/*/*.xml table.py
implicit %{1}%{2}.min.%{3}: **/*.{css,js}
build: esbuild --bundle %{IN} --minify --outfile=%{OUT}

implicit %{1}: cmd/*
implicit build/%{1}: cmd/*
cd cmd/%{1}
inputs: cmd/%{1}/**/* **/*.go
build: go build -ldflags="-X 'main.version=%{VERSION}'" -o ../../%{1} .
build: go build -ldflags="-X 'main.version=%{VERSION}'" -o ../../build/%{1} .

#upload: chromad
# build:
Expand Down
202 changes: 0 additions & 202 deletions _tools/pygments2chroma.py

This file was deleted.

1 change: 1 addition & 0 deletions bin/.watchexec-1.23.0.pkg
1 change: 1 addition & 0 deletions bin/watchexec
5 changes: 3 additions & 2 deletions cmd/chroma/main.go
Expand Up @@ -413,9 +413,10 @@ func dumpXMLLexerDefinitions(dir string) error {
// fmt.Println(name)
_, err = os.Stat(filename)
if err == nil {
return fmt.Errorf("%s already exists", filename)
fmt.Fprintf(os.Stderr, "warning: %s already exists\n", filename)
continue
}
err = ioutil.WriteFile(filename, data, 0600)
err = os.WriteFile(filename, data, 0600)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions lexer.go
Expand Up @@ -69,8 +69,8 @@ type Config struct {
// AnalyseConfig defines the list of regexes analysers.
type AnalyseConfig struct {
Regexes []RegexConfig `xml:"regex,omitempty"`
// If true, the score is returned despite other matches.
Single bool `xml:"single,attr"`
// If true, the first matching score is returned.
First bool `xml:"first,attr"`
}

// RegexConfig defines a single regex pattern and its score in case of match.
Expand Down
17 changes: 0 additions & 17 deletions lexers/bash.go

This file was deleted.

62 changes: 0 additions & 62 deletions lexers/chapel.go

This file was deleted.

39 changes: 0 additions & 39 deletions lexers/cheetah.go

This file was deleted.

0 comments on commit 40542a6

Please sign in to comment.