├── gomacs.png
├── .gitignore
├── terminal_linux.go
├── terminal.go
├── codecov.yml
├── suspend.go
├── examples
├── vi.zy
├── gofmt.zy
└── controlh.zy
├── .travis.yml
├── syntax_files
├── patch.yaml
├── conf.yaml
├── man.yaml
├── po.yaml
├── pkg-config.yaml
├── sed.yaml
├── git-config.yaml
├── yum.yaml
├── xresources.yaml
├── inputrc.yaml
├── forth.yaml
├── reST.yaml
├── sls.yaml
├── privoxy-filter.yaml
├── mpdconf.yaml
├── vue.yaml
├── xml.yaml
├── ledger.yaml
├── git-rebase-todo.yaml
├── peg.yaml
├── colortest.yaml
├── lisp.yaml
├── caddyfile.yaml
├── lfe.yaml
├── haml.yaml
├── README.md
├── kickstart.yaml
├── mail.yaml
├── ini.yaml
├── keymap.yaml
├── zygomys.yaml
├── gentoo-etc-portage.yaml
├── pov.yaml
├── vi.yaml
├── tex.yaml
├── groff.yaml
├── privoxy-config.yaml
├── json.yaml
├── dockerfile.yaml
├── git-commit.yaml
├── r.yaml
├── yaml.yaml
├── coffeescript.yaml
├── toml.yaml
├── scala.yaml
├── dot.yaml
├── vala.yaml
├── elm.yaml
├── glsl.yaml
├── java.yaml
├── clojure.yaml
├── nanorc.yaml
├── markdown.yaml
├── julia.yaml
├── cmake.yaml
├── graphql.yaml
├── ruby.yaml
├── rust.yaml
├── crontab.yaml
├── html5.yaml
├── micro.yaml
├── pony.yaml
├── makefile.yaml
├── asciidoc.yaml
├── inform6.yaml
├── html4.yaml
├── zig.yaml
├── cplusplus.yaml
├── cython.yaml
├── dart.yaml
├── puppet.yaml
├── ocaml.yaml
├── awk.yaml
├── privoxy-action.yaml
├── ada.yaml
├── perl6.yaml
├── haskell.yaml
├── solidity.yaml
├── html.yaml
├── c.yaml
├── elixir.yaml
├── typescript.yaml
├── perl.yaml
├── fsharp.yaml
├── rpmspec.yaml
├── go.yaml
├── pascal.yaml
├── z80.yaml
├── crystal.yaml
├── cpp.yaml
├── kotlin.yaml
├── sh.yaml
├── csharp.yaml
├── fish.yaml
├── tcl.yaml
├── javascript.yaml
├── zsh.yaml
├── sql.yaml
├── gentoo-ebuild.yaml
├── nim.yaml
├── vhdl.yaml
├── erb.yaml
├── gdscript.yaml
├── objc.yaml
├── twig.yaml
├── python2.yaml
├── python3.yaml
├── erlang.yaml
├── php.yaml
├── octave.yaml
├── fortran.yaml
├── arduino.yaml
├── lilypond.yaml
├── golo.yaml
├── ats.yaml
└── lua.yaml
├── .github
└── workflows
│ └── go.yml
├── suspend_posix.go
├── README_WINDOWS.txt
├── dired.go
├── go.mod
├── macro.go
├── Makefile
├── gomacs.1.in
├── LICENSE
├── region_test.go
├── paragraph.go
├── shell.go
├── undo_test.go
├── modes.go
└── mouse.go
/gomacs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/japanoise/gomacs/HEAD/gomacs.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.prof
2 | gomacs
3 | crash.log
4 | gomacs.1
5 | gomacs.1.bz2
6 | dist/
7 |
--------------------------------------------------------------------------------
/terminal_linux.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import "fmt"
4 |
5 | func terminalTitle(buf *EditorBuffer) {
6 | fmt.Printf("\033]0;%s - gomacs\a", buf.getRenderName())
7 | }
8 |
--------------------------------------------------------------------------------
/terminal.go:
--------------------------------------------------------------------------------
1 | //go:build !linux
2 | // +build !linux
3 |
4 | package main
5 |
6 | // Do nothing - no guarantee it will work outside of losenix
7 | func terminalTitle(buf *EditorBuffer) {}
8 |
--------------------------------------------------------------------------------
/codecov.yml:
--------------------------------------------------------------------------------
1 | ignore:
2 | - "bindata.go"
3 | - "dired.go"
4 | - "input.go"
5 | - "mouse.go"
6 | - "render.go"
7 | - "suspend*.go"
8 | - "terminal*.go"
9 | - "window.go"
10 |
--------------------------------------------------------------------------------
/suspend.go:
--------------------------------------------------------------------------------
1 | //go:build android || plan9 || nacl || windows
2 | // +build android plan9 nacl windows
3 |
4 | package main
5 |
6 | // do nothing, it's a posix specific feature at the moment
7 | func suspend() {}
8 |
--------------------------------------------------------------------------------
/examples/vi.zy:
--------------------------------------------------------------------------------
1 | // Example rc file - you have to press i before you can insert ;)
2 | (adddefaultmode "no-self-insert-mode")
3 | (emacsdefinecmd "vi-insert" setmode "no-self-insert-mode" false)
4 | (emacsbindkey "i" "vi-insert")
5 |
--------------------------------------------------------------------------------
/examples/gofmt.zy:
--------------------------------------------------------------------------------
1 | // Here's a useful example; automatically gofmt Go buffers.
2 | // Watch out though, as this function wipes the undos.
3 | (emacsdefinecmd "go-fmt" filterbuffer "gofmt")
4 | (bindkeymode "go" "M-m g f" "go-fmt")
5 | (addsavehook "go" "go-fmt")
6 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: go
2 |
3 | go:
4 | - 1.8
5 |
6 | before_install:
7 | - go get -t -v ./...
8 |
9 | script:
10 | - go test -coverprofile=coverage.txt -covermode=atomic
11 |
12 | after_success:
13 | - bash <(curl -s https://codecov.io/bash)
14 |
--------------------------------------------------------------------------------
/syntax_files/patch.yaml:
--------------------------------------------------------------------------------
1 | filetype: patch
2 |
3 | detect:
4 | filename: "\\.(patch|diff)$"
5 |
6 | rules:
7 | - brightgreen: "^\\+.*"
8 | - green: "^\\+\\+\\+.*"
9 | - brightblue: "^ .*"
10 | - brightred: "^-.*"
11 | - red: "^---.*"
12 | - brightyellow: "^@@.*"
13 | - magenta: "^diff.*"
14 |
--------------------------------------------------------------------------------
/syntax_files/conf.yaml:
--------------------------------------------------------------------------------
1 | filetype: conf
2 |
3 | detect:
4 | filename: "\\.c[o]?nf$"
5 |
6 | rules:
7 | - constant.string:
8 | start: "\""
9 | end: "\""
10 | skip: "\\\\."
11 | rules: []
12 |
13 | - comment:
14 | start: "#"
15 | end: "$"
16 | rules: []
17 |
18 |
--------------------------------------------------------------------------------
/syntax_files/man.yaml:
--------------------------------------------------------------------------------
1 | filetype: man
2 |
3 | detect:
4 | filename: "\\.[1-9]x?$"
5 |
6 | rules:
7 | - green: "\\.(S|T)H.*$"
8 | - brightgreen: "\\.(S|T)H|\\.TP"
9 | - brightred: "\\.(BR?|I[PR]?).*$"
10 | - brightblue: "\\.(BR?|I[PR]?|PP)"
11 | - brightwhite: "\\\\f[BIPR]"
12 | - yellow: "\\.(br|DS|RS|RE|PD)"
13 |
--------------------------------------------------------------------------------
/syntax_files/po.yaml:
--------------------------------------------------------------------------------
1 | filetype: po
2 |
3 | detect:
4 | filename: "\\.pot?$"
5 |
6 | rules:
7 | - preproc: "\\b(msgid|msgstr)\\b"
8 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
9 | - special: "\\\\.?"
10 | - comment: "(^|[[:space:]])#([^{].*)?$"
11 | - indent-char.whitespace: "[[:space:]]+$"
12 | - indent-char: " + +| + +"
13 |
--------------------------------------------------------------------------------
/examples/controlh.zy:
--------------------------------------------------------------------------------
1 | // Useful for if you use a crappy terminal that thinks C-h is backspace
2 | (emacsbindkey "f1 a" "apropos-command")
3 | (emacsbindkey "f1 c" "describe-key-briefly")
4 | (emacsbindkey "f1 m" "show-modes")
5 | (emacsbindkey "f1 b" "describe-bindings")
6 | (emacsbindkey "f1 f1" "quick-help")
7 | (emacsbindkey "C-M-h" "backward-kill-word")
8 | (emacsbindkey "C-h" "delete-backward-char")
9 |
--------------------------------------------------------------------------------
/syntax_files/pkg-config.yaml:
--------------------------------------------------------------------------------
1 | filetype: pc
2 |
3 | detect:
4 | filename: "\\.pc$"
5 |
6 | rules:
7 | - preproc: "^(Name|Description|URL|Version|Conflicts|Cflags):"
8 | - preproc: "^(Requires|Libs)(\\.private)?:"
9 | - symbol.operator: "="
10 | - identifier.var: "\\$\\{[A-Za-z_][A-Za-z0-9_]*\\}"
11 | - indent-char.whitespace: "[[:space:]]+$"
12 | - indent-char: " + +| + +"
13 |
--------------------------------------------------------------------------------
/syntax_files/sed.yaml:
--------------------------------------------------------------------------------
1 | filetype: sed
2 |
3 | detect:
4 | filename: "\\.sed$"
5 | header: "^#!.*bin/(env +)?sed( |$)"
6 |
7 | rules:
8 | - symbol.operator: "[|^$.*+]"
9 | - constant.number: "\\{[0-9]+,?[0-9]*\\}"
10 | - constant.specialChar: "\\\\."
11 | - comment: "(^|[[:space:]])#([^{].*)?$"
12 | - indent-char.whitespace: "[[:space:]]+$"
13 | - indent-char: " + +| + +"
14 |
--------------------------------------------------------------------------------
/syntax_files/git-config.yaml:
--------------------------------------------------------------------------------
1 | filetype: git-config
2 |
3 | detect:
4 | filename: "git(config|modules)$|\\.git/config$"
5 |
6 | rules:
7 | - constant: "\\<(true|false)\\>"
8 | - type.keyword: "^[[:space:]]*[^=]*="
9 | - constant: "^[[:space:]]*\\[.*\\]$"
10 | - constant: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
11 | - comment:
12 | start: "#"
13 | end: "$"
14 | rules: []
15 |
--------------------------------------------------------------------------------
/syntax_files/yum.yaml:
--------------------------------------------------------------------------------
1 | filetype: yum
2 |
3 | detect:
4 | filename: "\\.repo$|yum.*\\.conf$"
5 |
6 | rules:
7 | - identifier: "^[[:space:]]*[^=]*="
8 | - constant.specialChar: "^[[:space:]]*\\[.*\\]$"
9 | - statement: "\\$(releasever|arch|basearch|uuid|YUM[0-9])"
10 | - comment: "(^|[[:space:]])#([^{].*)?$"
11 | - indent-char.whitespace: "[[:space:]]+$"
12 | - indent-char: " + +| + +"
13 |
--------------------------------------------------------------------------------
/syntax_files/xresources.yaml:
--------------------------------------------------------------------------------
1 | filetype: xresources
2 |
3 | detect:
4 | filename: "X(defaults|resources)$"
5 |
6 | rules:
7 | - special: "^[[:alnum:]]+\\*"
8 | - identifier.var: "\\*[[:alnum:]]+\\:"
9 | - constant.number: "\\b[0-9]+\\b"
10 | - symbol.operator: "[*:=]"
11 | - constant.bool: "\\b(true|false)\\b"
12 | - comment: "(^|[[:space:]])!([^{].*)?$"
13 | - indent-char.whitespace: "[[:space:]]+$"
14 | - indent-char: " + +| + +"
15 |
--------------------------------------------------------------------------------
/syntax_files/inputrc.yaml:
--------------------------------------------------------------------------------
1 | filetype: inputrc
2 |
3 | detect:
4 | filename: "inputrc$"
5 |
6 | rules:
7 | - constant.bool.false: "\\b(off|none)\\b"
8 | - constant.bool.true: "\\bon\\b"
9 | - preproc: "\\bset|\\$include\\b"
10 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
11 | - constant.specialChar: "\\\\.?"
12 | - comment: "(^|[[:space:]])#([^{].*)?$"
13 | - indent-char.whitespace: "[[:space:]]+$"
14 | - indent-char: " + +| + +"
15 |
--------------------------------------------------------------------------------
/syntax_files/forth.yaml:
--------------------------------------------------------------------------------
1 | filetype: forth
2 |
3 | detect:
4 | filename: "\\.4th$"
5 |
6 | rules:
7 | - statement: "\\b(IF|THEN|ELSE|UNLESS)\\b"
8 |
9 | - constant.string:
10 | start: "\\b.\"\\b"
11 | end: "\""
12 |
13 | - comment:
14 | start: "\\\\"
15 | end: "$"
16 | rules:
17 | - todo: "TODO:?"
18 |
19 | - comment:
20 | start: "\\b\\(\\b"
21 | end: "\\b\\)\\b"
22 | rules:
23 | - todo: "TODO:?"
24 |
--------------------------------------------------------------------------------
/syntax_files/reST.yaml:
--------------------------------------------------------------------------------
1 | filetype: rst
2 |
3 | detect:
4 | filename: "\\.rest$|\\.rst$"
5 |
6 | rules:
7 | - statement: "\\*\\*[^*]+\\*\\*"
8 | - preproc: "::"
9 | - constant.string: "`[^`]+`_{1,2}"
10 | - constant.string: "``[^`]+``"
11 | - identifier: "^\\.\\. .*$"
12 | - identifier: "^__ .*$"
13 | - type: "^###+$"
14 | - type: "^\\*\\*\\*+$"
15 | - special: "^===+$"
16 | - special: "^---+$"
17 | - special: "^\\^\\^\\^+$"
18 | - special: "^\"\"\"+$"
19 |
--------------------------------------------------------------------------------
/syntax_files/sls.yaml:
--------------------------------------------------------------------------------
1 | filetype: salt
2 |
3 | detect:
4 | filename: "\\.sls$"
5 |
6 | rules:
7 | - identifier.var: "^[^ -].*:$"
8 | - identifier.var: ".*:"
9 | - default: "salt:"
10 | - constant.number: "/*[0-9]/*"
11 | - constant.bool: "\\b(True|False)\\b"
12 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
13 | - special: "\\b(grain|grains|compound|pcre|grain_pcre|list|pillar)\\b"
14 | - comment: "^#.*"
15 | - statement: "\\b(if|elif|else|or|not|and|endif|end)\\b"
16 |
--------------------------------------------------------------------------------
/syntax_files/privoxy-filter.yaml:
--------------------------------------------------------------------------------
1 | filetype: privoxy-filter
2 |
3 | detect:
4 | filename: "\\.filter$"
5 |
6 | rules:
7 | - statement: "^(FILTER|CLIENT-HEADER-FILTER|CLIENT-HEADER-TAGGER|SERVER-HEADER-FILTER|SERVER-HEADER-TAGGER): [a-z-]+"
8 | - identifier: "^(FILTER|CLIENT-HEADER-FILTER|CLIENT-HEADER-TAGGER|SERVER-HEADER-FILTER|SERVER-HEADER-TAGGER):"
9 | - constant.specialChar: "\\\\.?"
10 | - comment: "(^|[[:space:]])#([^{].*)?$"
11 | - indent-char.whitespace: "[[:space:]]+$"
12 | - indent-char: " + +| + +"
13 |
--------------------------------------------------------------------------------
/syntax_files/mpdconf.yaml:
--------------------------------------------------------------------------------
1 | filetype: mpd
2 |
3 | detect:
4 | filename: "mpd\\.conf$"
5 |
6 | rules:
7 | - statement: "\\b(user|group|bind_to_address|host|port|plugin|name|type)\\b"
8 | - statement: "\\b((music|playlist)_directory|(db|log|state|pid|sticker)_file)\\b"
9 | - special: "^(input|audio_output|decoder)[[:space:]]*\\{|\\}"
10 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
11 | - comment: "(^|[[:space:]])#([^{].*)?$"
12 | - indent-char.whitespace: "[[:space:]]+$"
13 | - indent-char: " + +| + +"
14 |
--------------------------------------------------------------------------------
/syntax_files/vue.yaml:
--------------------------------------------------------------------------------
1 | filetype: vue
2 |
3 | detect:
4 | filename: "\\.vue$"
5 |
6 | rules:
7 | - default:
8 | start: ""
9 | end: ""
10 | rules:
11 | - include: "html5"
12 |
13 | - default:
14 | start: ""
15 | end: ""
16 | rules:
17 | - include: "javascript"
18 |
19 | - default:
20 | start: ""
21 | end: ""
22 | rules:
23 | - include: "css"
24 |
--------------------------------------------------------------------------------
/syntax_files/xml.yaml:
--------------------------------------------------------------------------------
1 | filetype: xml
2 |
3 | detect:
4 | filename: "\\.(xml|sgml?|rng|plist|svg)$"
5 |
6 | rules:
7 | - comment:
8 | start: ""
10 | rules: []
11 | - comment:
12 | start: ""
14 | rules: []
15 | - special: "&[^;]*;"
16 | - identifier:
17 | start: "<"
18 | end: "/?>"
19 | rules:
20 | - constant.string:
21 | start: "\""
22 | end: "\""
23 | rules: []
24 |
--------------------------------------------------------------------------------
/syntax_files/ledger.yaml:
--------------------------------------------------------------------------------
1 | filetype: ledger
2 |
3 | detect:
4 | filename: "(^|\\.|/)(ledger|ldgr|beancount|bnct)$"
5 |
6 | rules:
7 | - special: "^([0-9]{4}(/|-)[0-9]{2}(/|-)[0-9]{2}|[=~]) .*"
8 | - constant: "^[0-9]{4}(/|-)[0-9]{2}(/|-)[0-9]{2}"
9 | - statement: "^~ .*"
10 | - identifier.var: "^= .*"
11 | - identifier: "^[[:space:]]+(![[:space:]]+)?\\(?[A-Za-z ]+(:[A-Za-z ]+)*\\)?"
12 | - identifier: "^[[:space:]]+(![[:space:]]+)?\\(?[A-Za-z_\\-]+(:[A-Za-z_\\-]+)*\\)?"
13 | - symbol: "[*!]"
14 | - comment: "^[[:space:]]*;.*"
15 |
--------------------------------------------------------------------------------
/syntax_files/git-rebase-todo.yaml:
--------------------------------------------------------------------------------
1 | filetype: git-rebase-todo
2 |
3 | detect:
4 | filename: "^(.*[\\/])?git\\-rebase\\-todo$"
5 |
6 | rules:
7 | # Rebase commands
8 | - statement: "^(p(ick)?|r(eword)?|e(dit)?|s(quash)?|f(ixup)?|x|exec|d(rop)?)\\b"
9 | # Commit IDs
10 | - identifier: "\\b([0-9a-f]{7,40})\\b"
11 |
12 | # Color keywords for Github (and others)
13 | - type.keyword: "\\b(?i)((fix(es|ed)?|close(s|d)?) #[0-9]+)\\b"
14 |
15 | # Comments
16 | - comment.line:
17 | start: "^#"
18 | end: "$"
19 | rules: []
20 |
--------------------------------------------------------------------------------
/syntax_files/peg.yaml:
--------------------------------------------------------------------------------
1 | filetype: peg
2 |
3 | detect:
4 | filename: "\\.l?peg$"
5 |
6 | rules:
7 | - identifier: "^[[:space:]]*[A-Za-z][A-Za-z0-9_]*[[:space:]]*<-"
8 | - constant.number: "\\^[+-]?[0-9]+"
9 | - symbol.operator: "[-+*?^/!&]|->|<-|=>"
10 | - identifier.var: "%[A-Za-z][A-Za-z0-9_]*"
11 | - special: "\\[[^]]*\\]"
12 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
13 | - comment: "(^|[[:space:]])\\-\\-.*$"
14 | - todo: "TODO:?"
15 | - indent-char.whitespace: "[[:space:]]+$"
16 | - indent-char: " + +| + +"
17 |
--------------------------------------------------------------------------------
/syntax_files/colortest.yaml:
--------------------------------------------------------------------------------
1 | filetype: colortest
2 |
3 | detect:
4 | filename: "ColorTest$"
5 |
6 | rules:
7 | - black: "\\bPLAIN\\b"
8 | - red: "\\bred\\b"
9 | - green: "\\bgreen\\b"
10 | - yellow: "\\byellow\\b"
11 | - blue: "\\bblue\\b"
12 | - magenta: "\\bmagenta\\b"
13 | - cyan: "\\bcyan\\b"
14 | - brightred: "\\bbrightred\\b"
15 | - brightgreen: "\\bbrightgreen\\b"
16 | - brightyellow: "\\bbrightyellow\\b"
17 | - brightblue: "\\bbrightblue\\b"
18 | - brightmagenta: "\\bbrightmagenta\\b"
19 | - brightcyan: "\\bbrightcyan\\b"
20 |
--------------------------------------------------------------------------------
/syntax_files/lisp.yaml:
--------------------------------------------------------------------------------
1 | filetype: lisp
2 |
3 | detect:
4 | filename: "(emacs|zile)$|\\.(el|li?sp|scm|ss)$"
5 |
6 | rules:
7 | - default: "\\([a-z-]+"
8 | - symbol: "\\(([\\-+*/<>]|<=|>=)|'"
9 | - constant.number: "\\b[0-9]+b>"
10 | - special: "\\bnil\\b"
11 | - preproc: "\\b[tT]b>"
12 | - constant.string: "\\\"(\\\\.|[^\"])*\\\""
13 | - constant.specialChar: "'[A-Za-z][A-Za-z0-9_-]+"
14 | - constant.specialChar: "\\\\.?"
15 | - comment: "(^|[[:space:]]);.*"
16 | - indent-char.whitespace: "[[:space:]]+$"
17 | - indent-char: " + +| + +"
18 |
--------------------------------------------------------------------------------
/syntax_files/caddyfile.yaml:
--------------------------------------------------------------------------------
1 | filetype: caddyfile
2 |
3 | detect:
4 | filename: "Caddyfile"
5 |
6 | rules:
7 | - identifier: "^\\s*\\S+(\\s|$)"
8 | - type: "^([\\w.:/-]+,? ?)+[,{]$"
9 | - constant.specialChar: "\\s{$"
10 | - constant.specialChar: "^\\s*}$"
11 | - constant.string:
12 | start: "\""
13 | end: "\""
14 | skip: "\\\\."
15 | rules:
16 | - constant.specialChar: "\\\\."
17 |
18 | - preproc: "\\{(\\w+|\\$\\w+|%\\w+%)\\}"
19 | - comment:
20 | start: "#"
21 | end: "$"
22 | rules: []
23 |
24 |
--------------------------------------------------------------------------------
/syntax_files/lfe.yaml:
--------------------------------------------------------------------------------
1 | filetype: lfe
2 |
3 | detect:
4 | filename: "lfe$|\\.lfe$"
5 |
6 | rules:
7 | - symbol.brackets: "\\(|\\)"
8 | - type: "defun|define-syntax|define|defmacro|defmodule|export"
9 | - constant: "\\ [A-Za-z][A-Za-z0-9_-]+\\ "
10 | - symbol.operator: "\\(([\\-+*/<>]|<=|>=)|'"
11 | - constant.number: "\\b[0-9]+\\b"
12 | - constant.string: "\\\"(\\\\.|[^\"])*\\\""
13 | - special: "['|`][A-Za-z][A-Za-z0-9_\\-]+"
14 | - constant.specialChar: "\\\\.?"
15 | - comment: "(^|[[:space:]]);.*"
16 | - indent-char.whitespace: "[[:space:]]+$"
17 | - indent-char: " + +| + +"
18 |
--------------------------------------------------------------------------------
/.github/workflows/go.yml:
--------------------------------------------------------------------------------
1 | # This workflow will build a golang project
2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
3 |
4 | name: Go
5 |
6 | on:
7 | push:
8 | branches: [ "master" ]
9 | pull_request:
10 | branches: [ "master" ]
11 |
12 | jobs:
13 |
14 | build:
15 | runs-on: ubuntu-latest
16 | steps:
17 | - uses: actions/checkout@v3
18 |
19 | - name: Set up Go
20 | uses: actions/setup-go@v4
21 | with:
22 | go-version: '1.20'
23 |
24 | - name: Build
25 | run: go build -v ./...
26 |
27 | - name: Test
28 | run: go test -v ./...
29 |
--------------------------------------------------------------------------------
/syntax_files/haml.yaml:
--------------------------------------------------------------------------------
1 | filetype: haml
2 |
3 | detect:
4 | filename: "\\.haml$"
5 |
6 | rules:
7 | - symbol: "-|="
8 | - default: "->|=>"
9 | - constant: "([ ]|^)%[0-9A-Za-z_]+>"
10 | - special: ":[0-9A-Za-z_]+>"
11 | - type: "\\.[A-Za-z_]+>"
12 | - constant.string: "\"([^\"]|(\\\\\"))*\"|%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!"
13 | - constant.string: "'([^']|(\\\\'))*'|%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!"
14 | - identifier: "#\\{[^}]*\\}"
15 | - identifier.var: "(@|@@)[0-9A-Z_a-z]+"
16 | - comment: "#[^{].*$|#$"
17 |
--------------------------------------------------------------------------------
/syntax_files/README.md:
--------------------------------------------------------------------------------
1 | # Syntax Files
2 |
3 | Here are highlights's syntax files.
4 |
5 | Each yaml file specifies how to detect the filetype based on file extension or headers (first line of the file).
6 | Then there are patterns and regions linked to highlight groups which tell micro how to highlight that filetype.
7 |
8 | Making your own syntax files is very simple. I recommend you check the file after you are finished with the
9 | [`syntax_checker.go`](./syntax_checker.go) program (located in this directory). Just place your yaml syntax
10 | file in the current directory and run `go run syntax_checker.go` and it will check every file. If there are no
11 | errors it will print `No issues!`.
12 |
--------------------------------------------------------------------------------
/suspend_posix.go:
--------------------------------------------------------------------------------
1 | //go:build linux || darwin || dragonfly || solaris || openbsd || netbsd || freebsd
2 | // +build linux darwin dragonfly solaris openbsd netbsd freebsd
3 |
4 | package main
5 |
6 | import (
7 | "syscall"
8 |
9 | "github.com/nsf/termbox-go"
10 | )
11 |
12 | func suspend() {
13 | // finalize termbox
14 | termbox.Close()
15 |
16 | // suspend the process
17 | pid := syscall.Getpid()
18 | err := syscall.Kill(pid, syscall.SIGSTOP)
19 | if err != nil {
20 | panic(err)
21 | }
22 |
23 | // reset the state so we can get back to work again
24 | err = termbox.Init()
25 | if err != nil {
26 | panic(err)
27 | }
28 | termbox.SetInputMode(termbox.InputAlt)
29 | editorRefreshScreen()
30 | }
31 |
--------------------------------------------------------------------------------
/syntax_files/kickstart.yaml:
--------------------------------------------------------------------------------
1 | filetype: kickstart
2 |
3 | detect:
4 | filename: "\\.ks$|\\.kickstart$"
5 |
6 | rules:
7 | - special: "%[a-z]+"
8 | - statement: "^[[:space:]]*(install|cdrom|text|graphical|volgroup|logvol|reboot|timezone|lang|keyboard|authconfig|firstboot|rootpw|user|firewall|selinux|repo|part|partition|clearpart|bootloader)"
9 | - constant: "--(name|mirrorlist|baseurl|utc)(=|\\>)"
10 | - statement: "\\$(releasever|basearch)\\>"
11 | - brightblack: "^@[A-Za-z][A-Za-z-]*"
12 | - brightred: "^-@[a-zA-Z0-9*-]+"
13 | - red: "^-[a-zA-Z0-9*-]+"
14 | - comment: "(^|[[:space:]])#([^{].*)?$"
15 | - indent-char.whitespace: "[[:space:]]+$"
16 | - indent-char: " + +| + +"
17 |
--------------------------------------------------------------------------------
/syntax_files/mail.yaml:
--------------------------------------------------------------------------------
1 | filetype: mail
2 |
3 | detect:
4 | filename: "(.*/mutt-.*|\\.eml)$"
5 | header: "^From .* \\d+:\\d+:\\d+ \\d+"
6 |
7 | rules:
8 | - type: "^From .*"
9 | - identifier: "^[^[:space:]]+:"
10 | - preproc: "^List-(Id|Archive|Subscribe|Unsubscribe|Post|Help):"
11 | - constant: "^(To|From):"
12 | - constant.string:
13 | start: "^Subject:.*"
14 | end: "$"
15 | rules:
16 | - constant.specialChar: "\\\\."
17 | - statement: "[^@[:space:]]+@[^[:space:]]+>?"
18 | - default:
19 | start: "^\\n\\n"
20 | end: ".*"
21 | rules: []
22 | - comment:
23 | start: "^>.*"
24 | end: "$"
25 | rules: []
26 |
--------------------------------------------------------------------------------
/syntax_files/ini.yaml:
--------------------------------------------------------------------------------
1 | filetype: ini
2 |
3 | detect:
4 | filename: "\\.(ini|desktop|lfl|override|tscn|tres)$|(mimeapps\\.list|pinforc|setup\\.cfg|project\\.godot)$|weechat/.+\\.conf$"
5 |
6 | rules:
7 | - constant.bool.true: "\\btrue\\b"
8 | - constant.bool.false: "\\bfalse\\b"
9 | - identifier: "^[[:space:]]*[^=]*="
10 | - special: "^[[:space:]]*\\[.*\\]$"
11 | - statement: "[=;]"
12 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
13 |
14 | - comment:
15 | start: "#"
16 | end: "$"
17 | rules:
18 | - todo: "(TODO|XXX|FIXME):?"
19 | - comment:
20 | start: ";"
21 | end: "$"
22 | rules:
23 | - todo: "(TODO|XXX|FIXME):?"
24 |
--------------------------------------------------------------------------------
/syntax_files/keymap.yaml:
--------------------------------------------------------------------------------
1 | filetype: keymap
2 |
3 | detect:
4 | filename: "\\.(k|key)?map$|Xmodmap$"
5 |
6 | rules:
7 | - statement: "\\b(add|clear|compose|keycode|keymaps|keysym|remove|string)\\b"
8 | - statement: "\\b(control|alt|shift)\\b"
9 | - constant.number: "\\b[0-9]+\\b"
10 | - special: "="
11 | - constant.string:
12 | start: "\""
13 | end: "\""
14 | skip: "\\\\."
15 | rules:
16 | - constant.specialChar: "\\\\."
17 | - constant.string:
18 | start: "'"
19 | end: "'"
20 | skip: "\\\\."
21 | rules:
22 | - constant.specialChar: "\\\\."
23 | - comment:
24 | start: "^!"
25 | end: "$"
26 | rules: []
27 |
28 |
--------------------------------------------------------------------------------
/syntax_files/zygomys.yaml:
--------------------------------------------------------------------------------
1 | filetype: zygomys
2 |
3 | detect:
4 | filename: "\\.zy$"
5 |
6 | rules:
7 | - default: "\\([a-z-]+"
8 | - symbol: "\\(([\\-+*/<>]|<=|>=)|'"
9 | - constant.number: "\\b[0-9]+b>"
10 | - special: "\\bnil\\b"
11 | - preproc: "\\b[tT]b>"
12 | - constant.string: "\\\"(\\\\.|[^\"])*\\\""
13 | - constant.specialChar: "'[A-Za-z][A-Za-z0-9_-]+"
14 | - constant.specialChar: "\\\\.?"
15 | - indent-char.whitespace: "[[:space:]]+$"
16 | - indent-char: " + +| + +"
17 |
18 | - comment:
19 | start: "//"
20 | end: "$"
21 | rules:
22 | - todo: "(TODO|XXX|FIXME):?"
23 |
24 | - comment:
25 | start: "/\\*"
26 | end: "\\*/"
27 | rules:
28 | - todo: "(TODO|XXX|FIXME):?"
29 |
--------------------------------------------------------------------------------
/syntax_files/gentoo-etc-portage.yaml:
--------------------------------------------------------------------------------
1 | filetype: etc-portage
2 |
3 | detect:
4 | filename: "\\.(keywords|mask|unmask|use)(/.+)?$"
5 |
6 | rules:
7 | # Use flags:
8 | - constant.bool.false: "[[:space:]]+\\+?[a-zA-Z0-9_-]+"
9 | - constant.bool.true: "[[:space:]]+-[a-zA-Z0-9_-]+"
10 | # Likely version numbers:
11 | - special: "-[[:digit:]].*([[:space:]]|$)"
12 | # Accepted arches:
13 | - identifier.class: "[~-]?\\b(alpha|amd64|arm|hppa|ia64|mips|ppc|ppc64|s390|sh|sparc|x86|x86-fbsd)\\b"
14 | - identifier.class: "[[:space:]][~-]?\\*"
15 | # Categories:
16 | - statement: "^[[:space:]]*.*/"
17 | # Masking regulators:
18 | - symbol: "^[[:space:]]*(=|~|<|<=|=<|>|>=|=>)"
19 | # Comments:
20 | - comment:
21 | start: "#"
22 | end: "$"
23 | rules: []
24 |
--------------------------------------------------------------------------------
/syntax_files/pov.yaml:
--------------------------------------------------------------------------------
1 | filetype: pov
2 |
3 | detect:
4 | filename: "\\.(pov|POV|povray|POVRAY)$"
5 |
6 | rules:
7 | - preproc: "^[[:space:]]*#[[:space:]]*(declare)"
8 | - statement: "\\b(sphere|cylinder|translate|matrix|rotate|scale)\\b"
9 | - statement: "\\b(orthographic|location|up|right|direction|clipped_by)\\b"
10 | - statement: "\\b(fog_type|fog_offset|fog_alt|rgb|distance|transform)\\b"
11 | - identifier: "^\\b(texture)\\b"
12 | - identifier: "\\b(light_source|background)\\b"
13 | - identifier: "\\b(fog|object|camera)\\b"
14 | - symbol.operator: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|!|=|&|\\|)"
15 | - special: "\\b(union|group|subgroup)\\b"
16 | - comment: "//.*"
17 | - comment:
18 | start: "/\\*"
19 | end: "\\*/"
20 | rules: []
21 |
22 |
--------------------------------------------------------------------------------
/syntax_files/vi.yaml:
--------------------------------------------------------------------------------
1 | filetype: vi
2 |
3 | detect:
4 | filename: "(^|/|\\.)(ex|vim)rc$|\\.vim"
5 |
6 | rules:
7 | - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[()]"
8 | - statement: "\\b([nvxsoilc]?(nore|un)?map|[nvlx]n|[ico]?no|[cilovx][um]|s?unm)\\b"
9 | - statement: "\\b(snor|nun|nm|set|if|endif|let|unlet)\\b"
10 | - statement: "[!&=]"
11 | - constant.number: "\\b[0-9]+\\b"
12 |
13 | - comment:
14 | start: "^[ \t]*\""
15 | end: "$"
16 | rules: []
17 |
18 | - constant.string:
19 | start: "\""
20 | end: "\""
21 | skip: "\\\\."
22 | rules:
23 | - constant.specialChar: "\\\\."
24 | - constant.string:
25 | start: "'"
26 | end: "'"
27 | skip: "\\\\."
28 | rules:
29 | - constant.specialChar: "\\\\."
30 |
--------------------------------------------------------------------------------
/syntax_files/tex.yaml:
--------------------------------------------------------------------------------
1 | filetype: tex
2 |
3 | detect:
4 | filename: "\\.tex$|\\.bib$|\\.cls$"
5 |
6 | rules:
7 | # colorize the identifiers of {} and []
8 | - identifier:
9 | start: "\\{"
10 | end: "\\}"
11 | rules: []
12 | - identifier:
13 | start: "\\["
14 | end: "\\]"
15 | rules: []
16 | # numbers
17 | - constant.number: "\\b[0-9]+(\\.[0-9]+)?([[:space:]](pt|mm|cm|in|ex|em|bp|pc|dd|cc|nd|nc|sp))?\\b"
18 | # let brackets have the default color again
19 | - default: "[{}\\[\\]]"
20 | - special: "[&\\\\]"
21 | # macros
22 | - statement: "\\\\@?[a-zA-Z_]+"
23 | # comments
24 | - comment:
25 | start: "%"
26 | end: "$"
27 | rules: []
28 | - comment:
29 | start: "\\\\begin\\{comment\\}"
30 | end: "\\\\end\\{comment\\}"
31 | rules: []
32 |
--------------------------------------------------------------------------------
/syntax_files/groff.yaml:
--------------------------------------------------------------------------------
1 | filetype: groff
2 |
3 | detect:
4 | filename: "\\.m[ems]$|\\.rof|\\.tmac$|^tmac."
5 |
6 | rules:
7 | - statement: "^\\.(ds|nr) [^[[:space:]]]*"
8 | - constant.specialChar: "\\\\."
9 | - constant.specialChar: "\\\\f.|\\\\f\\(..|\\\\s(\\+|\\-)?[0-9]"
10 | - constant: "(\\\\|\\\\\\\\)n(.|\\(..)"
11 | - constant:
12 | start: "(\\\\|\\\\\\\\)n\\["
13 | end: "]"
14 | rules: []
15 |
16 | - type: "^\\.[[:space:]]*[^[[:space:]]]*"
17 | - comment: "^\\.\\\\\".*$"
18 | - constant.string: "(\\\\|\\\\\\\\)\\*(.|\\(..)"
19 | - constant.string:
20 | start: "(\\\\|\\\\\\\\)\\*\\["
21 | end: "]"
22 | rules: []
23 |
24 | - constant.specialChar: "\\\\\\(.."
25 | - constant.specialChar:
26 | start: "\\\\\\["
27 | end: "]"
28 | rules: []
29 |
30 | - identifier.macro: "\\\\\\\\\\$[1-9]"
31 |
--------------------------------------------------------------------------------
/syntax_files/privoxy-config.yaml:
--------------------------------------------------------------------------------
1 | filetype: privoxy-config
2 |
3 | detect:
4 | filename: "privoxy/config$"
5 |
6 | rules:
7 | - statement: "(accept-intercepted-requests|actionsfile|admin-address|allow-cgi-request-crunching|buffer-limit|compression-level|confdir|connection-sharing|debug|default-server-timeout|deny-access|enable-compression|enable-edit-actions|enable-remote-http-toggle|enable-remote-toggle|enforce-blocks|filterfile|forward|forwarded-connect-retries|forward-socks4|forward-socks4a|forward-socks5|handle-as-empty-doc-returns-ok|hostname|keep-alive-timeout|listen-address|logdir|logfile|max-client-connections|permit-access|proxy-info-url|single-threaded|socket-timeout|split-large-forms|templdir|toggle|tolerate-pipelining|trustfile|trust-info-url|user-manual)[[:space:]]"
8 | - comment: "(^|[[:space:]])#([^{].*)?$"
9 | - indent-char.whitespace: "[[:space:]]+$"
10 | - indent-char: " + +| + +"
11 |
--------------------------------------------------------------------------------
/syntax_files/json.yaml:
--------------------------------------------------------------------------------
1 | filetype: json
2 |
3 | detect:
4 | filename: "\\.json$"
5 | header: "^\\{$"
6 |
7 | rules:
8 | - constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b"
9 | - constant.number: "\\b[-+]?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"
10 | - constant.number: "\\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
11 | - constant: "\\b(null)\\b"
12 | - constant: "\\b(true|false)\\b"
13 | - constant.string:
14 | start: "\""
15 | end: "\""
16 | skip: "\\\\."
17 | rules:
18 | - constant.specialChar: "\\\\."
19 | - constant.string:
20 | start: "'"
21 | end: "'"
22 | skip: "\\\\."
23 | rules:
24 | - constant.specialChar: "\\\\."
25 |
26 | - statement: "\\\"(\\\\\"|[^\"])*\\\"[[:space:]]*:\" \"'(\\'|[^'])*'[[:space:]]*:"
27 | - constant: "\\\\u[0-9a-fA-F]{4}|\\\\[bfnrt'\"/\\\\]"
28 |
--------------------------------------------------------------------------------
/syntax_files/dockerfile.yaml:
--------------------------------------------------------------------------------
1 | filetype: dockerfile
2 |
3 | detect:
4 | filename: "(Dockerfile[^/]*$|\\.dockerfile$)"
5 |
6 | rules:
7 | ## Keywords
8 | - type.keyword: "(?i)^(FROM|MAINTAINER|RUN|CMD|LABEL|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR|ONBUILD|ARG|HEALTHCHECK|STOPSIGNAL|SHELL)[[:space:]]"
9 |
10 | ## Brackets & parenthesis
11 | - statement: "(\\(|\\)|\\[|\\])"
12 |
13 | ## Double ampersand
14 | - special: "&&"
15 |
16 | ## Comments
17 | - comment:
18 | start: "#"
19 | end: "$"
20 | rules:
21 | - todo: "(TODO|XXX|FIXME):?"
22 |
23 | - constant.string:
24 | start: "\""
25 | end: "\""
26 | skip: "\\\\."
27 | rules:
28 | - constant.specialChar: "\\\\."
29 |
30 | - constant.string:
31 | start: "'"
32 | end: "'"
33 | skip: "\\\\."
34 | rules:
35 | - constant.specialChar: "\\\\."
36 |
37 |
--------------------------------------------------------------------------------
/syntax_files/git-commit.yaml:
--------------------------------------------------------------------------------
1 | filetype: git-commit
2 |
3 | detect:
4 | filename: "^(.*[\\/])?(COMMIT_EDITMSG|TAG_EDITMSG)$"
5 |
6 | rules:
7 | # File changes
8 | - type.keyword: "#[[:space:]](deleted|modified|new file|renamed):[[:space:]].*"
9 | - type.keyword: "#[[:space:]]deleted:"
10 | - type.keyword: "#[[:space:]]modified:"
11 | - type.keyword: "#[[:space:]]new file:"
12 | - type.keyword: "#[[:space:]]renamed:"
13 | - type.keyword: "^#[[:space:]]Changes.*[:]"
14 | - type.keyword: "^#[[:space:]]Your branch and '[^']+"
15 | - type.keyword: "^#[[:space:]]Your branch and '"
16 | - type.keyword: "^#[[:space:]]On branch [^ ]+"
17 | - type.keyword: "^#[[:space:]]On branch"
18 | # Color keywords for closing issues (such as on Github)
19 | - type.keyword: "\\b(?i)((fix(es|ed)?|close(s|d)?) #[0-9]+)\\b"
20 |
21 | # Comments
22 | - comment.line:
23 | start: "^#"
24 | end: "$"
25 | rules: []
26 |
--------------------------------------------------------------------------------
/syntax_files/r.yaml:
--------------------------------------------------------------------------------
1 | filetype: r
2 |
3 | detect:
4 | filename: "\\.(r|R)$"
5 |
6 | rules:
7 |
8 | - statement: "\\b(library|require|break|else|for|function|if|ifelse|in|next|names|switch|repeat|print|try|tryCatch|isTRUE|return|while)\\b"
9 | - constant: "\\b(T|TRUE|F|FALSE|NULL|Inf|NaN|NA|NA_integer_|NA_real_|NA_complex_|NA_character_)\\b"
10 | - constant.number: "(\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b)"
11 | - symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&|\\^|\\$)"
12 |
13 | - comment:
14 | start: "#"
15 | end: "$"
16 | rules:
17 | - todo: "(TODO|XXX|FIXME):?"
18 |
19 | - constant.string:
20 | start: "\""
21 | end: "\""
22 | skip: "\\\\."
23 | rules:
24 | - constant.specialChar: "\\\\."
25 |
26 | - constant.string:
27 | start: "'"
28 | end: "'"
29 | skip: "\\\\."
30 | rules:
31 | - constant.specialChar: "\\\\."
32 |
33 |
--------------------------------------------------------------------------------
/syntax_files/yaml.yaml:
--------------------------------------------------------------------------------
1 | filetype: yaml
2 |
3 | detect:
4 | filename: "\\.ya?ml$"
5 | header: "%YAML"
6 |
7 | rules:
8 | - type: "(^| )!!(binary|bool|float|int|map|null|omap|seq|set|str) "
9 | - constant: "\\b(YES|yes|Y|y|ON|on|TRUE|True|true|NO|no|N|n|OFF|off|FALSE|False|false)\\b"
10 | - statement: "(:[[:space:]]|\\[|\\]|:[[:space:]]+[|>]|^[[:space:]]*- )"
11 | - identifier: "[[:space:]][\\*&][A-Za-z0-9]+"
12 | - type: "[-.\\w]+:"
13 | - statement: ":"
14 | - special: "(^---|^\\.\\.\\.|^%YAML|^%TAG)"
15 |
16 | - constant.string:
17 | start: "(^| )\""
18 | end: "\""
19 | skip: "\\\\."
20 | rules:
21 | - constant.specialChar: "\\\\."
22 |
23 | - constant.string:
24 | start: "(^| )'"
25 | end: "'"
26 | skip: "(\\\\.)|('')"
27 | rules:
28 | - constant.specialChar: "\\\\."
29 |
30 | - comment:
31 | start: "#"
32 | end: "$"
33 | rules: []
34 |
35 |
36 |
--------------------------------------------------------------------------------
/syntax_files/coffeescript.yaml:
--------------------------------------------------------------------------------
1 | filetype: coffeescript
2 |
3 | detect:
4 | filename: "\\.coffee$"
5 |
6 | rules:
7 | - symbol.operator: "[!&|=/*+-<>]|\\b(and|or|is|isnt|not)\\b"
8 | - identifier.class: "([A-Za-z_][A-Za-z0-9_]*:[[:space:]]*(->|\\()|->)"
9 | - symbol.brackets: "[()]"
10 | - statement: "\\b(for|of|continue|break|isnt|null|unless|this|else|if|return)\\b"
11 | - statement: "\\b(try|catch|finally|throw|new|delete|typeof|in|instanceof)\\b"
12 | - statement: "\\b(debugger|switch|while|do|class|extends|super)\\b"
13 | - statement: "\\b(undefined|then|unless|until|loop|of|by|when)\\b"
14 | - constant.bool: "\\b(true|false|yes|no|on|off)\\b"
15 | - identifier: "@[A-Za-z0-9_]*"
16 |
17 | - constant.string:
18 | start: "\""
19 | end: "\""
20 | skip: "\\\\."
21 | rules:
22 | - constant.specialChar: "\\\\."
23 |
24 | - comment:
25 | start: "#"
26 | end: "$"
27 | rules:
28 | - todo: "(TODO|XXX|FIXME):?"
29 |
30 |
--------------------------------------------------------------------------------
/syntax_files/toml.yaml:
--------------------------------------------------------------------------------
1 | filetype: toml
2 |
3 | detect:
4 | filename: "\\.toml"
5 |
6 | rules:
7 | - statement: "(.*)[[:space:]]="
8 | - special: "="
9 |
10 | # Bracket thingies
11 | - special: "(\\[|\\])"
12 |
13 | # Numbers and strings
14 | - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'"
15 | - constant.number: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
16 |
17 | - constant.string:
18 | start: "\""
19 | end: "\""
20 | skip: "\\\\."
21 | rules:
22 | - constant.specialChar: "\\\\."
23 |
24 | - constant.string:
25 | start: "'"
26 | end: "'"
27 | skip: "\\\\."
28 | rules:
29 | - constant.specialChar: "\\\\."
30 |
31 | - constant.string:
32 | start: "`"
33 | end: "`"
34 | rules:
35 | - constant.specialChar: "\\\\."
36 |
37 | - comment:
38 | start: "#"
39 | end: "$"
40 | rules:
41 | - todo: "(TODO|XXX|FIXME):?"
42 |
43 |
--------------------------------------------------------------------------------
/syntax_files/scala.yaml:
--------------------------------------------------------------------------------
1 | filetype: scala
2 |
3 | detect:
4 | filename: "\\.scala$"
5 |
6 | rules:
7 | - type: "\\b(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\\b"
8 | - statement: "\\b(match|val|var|break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\\b"
9 | - statement: "\\b(def|object|case|trait|lazy|implicit|abstract|class|extends|with|final|implements|override|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile|sealed)\\b"
10 | - constant.string:
11 | start: "\""
12 | end: "\""
13 | skip: "\\\\."
14 | rules:
15 | - constant.specialChar: "\\\\."
16 | - constant: "\\b(true|false|null)\\b"
17 | - comment:
18 | start: "//"
19 | end: "$"
20 | rules: []
21 | - comment:
22 | start: "/\\*"
23 | end: "\\*/"
24 | rules: []
25 | - comment:
26 | start: "/\\*\\*"
27 | end: "\\*/"
28 | rules: []
29 |
30 |
--------------------------------------------------------------------------------
/syntax_files/dot.yaml:
--------------------------------------------------------------------------------
1 | filetype: dot
2 |
3 | detect:
4 | filename: "\\.(dot|gv)$"
5 |
6 | rules:
7 | - type: "\\b(digraph|edge|graph|node|subgraph)\\b"
8 | - statement: "\\b(arrow(head|size|tail)|(bg|fill|font)?color|center|constraint|decorateP|dir|distortion|font(name|size)|head(clip|label)|height|label(angle|distance|font(color|name|size))?|layer(s)?|margin|mclimit|minlen|name|nodesep|nslimit|ordering|orientation|page(dir)?|peripheries|port_label_distance|rank(dir|sep)?|ratio|regular|rotate|same(head|tail)|shape(file)?|sides|size|skew|style|tail(clip|label)|URL|weight|width)\\b"
9 | - symbol: "=|->|--"
10 |
11 | - constant.string:
12 | start: "\""
13 | end: "\""
14 | skip: "\\\\."
15 | rules:
16 | - constant.specialChar: "\\\\."
17 |
18 | - comment:
19 | start: "//"
20 | end: "$"
21 | rules:
22 | - todo: "(TODO|XXX|FIXME):?"
23 |
24 | - comment:
25 | start: "/\\*"
26 | end: "\\*/"
27 | rules:
28 | - todo: "(TODO|XXX|FIXME):?"
29 |
30 |
--------------------------------------------------------------------------------
/syntax_files/vala.yaml:
--------------------------------------------------------------------------------
1 | filetype: vala
2 |
3 | detect:
4 | filename: "\\.vala$"
5 |
6 | rules:
7 | - type: "\\b(float|double|bool|u?char|u?int(8|16|32|64)?|u?short|u?long|void|s?size_t|unichar)\\b"
8 | - identifier.class: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[()]"
9 | - statement: "\\b(for|if|while|do|else|case|default|switch|try|throw|catch)\\b"
10 | - statement: "\\b(inline|typedef|struct|enum|union|extern|static|const)\\b"
11 | - statement: "\\b(operator|new|delete|return|null)\\b"
12 | - statement: "\\b(class|override|private|public|signal|this|weak)\\b"
13 | - special: "\\b(goto|break|continue)\\b"
14 | - constant.bool: "\\b(true|false)\\b"
15 | - constant.number: "\\b([0-9]+)\\b"
16 | - symbol.operator: "[\\-+/*=<>?:!~%&|]|->"
17 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
18 | - comment: "(^|[[:space:]])//.*"
19 | - comment:
20 | start: "/\\*"
21 | end: "\\*/"
22 | rules: []
23 |
24 | - todo: "TODO:?"
25 | - indent-char.whitespace: "[[:space:]]+$"
26 | - indent-char: " + +| + +"
27 |
--------------------------------------------------------------------------------
/syntax_files/elm.yaml:
--------------------------------------------------------------------------------
1 | filetype: elm
2 |
3 | detect:
4 | filename: "\\.elm$"
5 |
6 | rules:
7 | - statement: "\\b(as|alias|case|else|exposing|if|import|in|let|module|of|port|then|type|)\\b"
8 | - statement: "(\\=|\\:|\\->)"
9 | - type: "\\b([A-Z][A-Za-z\\d]*)\\b"
10 | - identifier: "^([a-z][A-Za-z\\d]*)\\b"
11 | - constant.string:
12 | start: "\"\"\""
13 | end: "\"\"\""
14 | skip: "\\\\."
15 | rules:
16 | - constant.specialChar: "\\\\."
17 | - constant.string:
18 | start: "\""
19 | end: "\""
20 | skip: "\\\\."
21 | rules:
22 | - constant.specialChar: "\\\\."
23 | - constant.string:
24 | start: "'"
25 | end: "'"
26 | skip: "\\\\."
27 | rules:
28 | - constant.specialChar: "\\\\."
29 | - comment:
30 | start: "--"
31 | end: "$"
32 | rules:
33 | - todo: "(TODO|XXX|FIXME):?"
34 | - comment:
35 | start: "\\{-"
36 | end: "-\\}"
37 | rules:
38 | - todo: "(TODO|XXX|FIXME):?"
39 |
--------------------------------------------------------------------------------
/syntax_files/glsl.yaml:
--------------------------------------------------------------------------------
1 | filetype: glsl
2 |
3 | detect:
4 | filename: "\\.(frag|vert|fp|vp|glsl)$"
5 |
6 | rules:
7 | - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[()]"
8 | - type: "\\b(void|bool|bvec2|bvec3|bvec4|int|ivec2|ivec3|ivec4|float|vec2|vec3|vec4|mat2|mat3|mat4|struct|sampler1D|sampler2D|sampler3D|samplerCUBE|sampler1DShadow|sampler2DShadow)\\b"
9 | - identifier: "\\bgl_(DepthRangeParameters|PointParameters|MaterialParameters|LightSourceParameters|LightModelParameters|LightModelProducts|LightProducts|FogParameters)\\b"
10 | - statement: "\\b(const|attribute|varying|uniform|in|out|inout|if|else|return|discard|while|for|do)\\b"
11 | - statement: "\\b(break|continue)\\b"
12 | - constant.bool: "\\b(true|false)\\b"
13 | - symbol.operator: "[-+/*=<>?:!~%&|^]"
14 | - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b"
15 |
16 | - comment:
17 | start: "//"
18 | end: "$"
19 | rules:
20 | - todo: "TODO:?"
21 |
22 | - comment:
23 | start: "/\\*"
24 | end: "\\*/"
25 | rules:
26 | - todo: "TODO:?"
27 |
--------------------------------------------------------------------------------
/syntax_files/java.yaml:
--------------------------------------------------------------------------------
1 | filetype: java
2 |
3 | detect:
4 | filename: "\\.java$"
5 |
6 | rules:
7 | - type: "\\b(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\\b"
8 | - statement: "\\b(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\\b"
9 | - type: "\\b(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\\b"
10 | - constant: "\\b(true|false|null)\\b"
11 | - constant.number: "\\b[0-9]+\\b"
12 |
13 | - constant.string:
14 | start: "\""
15 | end: "\""
16 | skip: "\\\\."
17 | rules:
18 | - constant.specialChar: "\\\\."
19 |
20 | - constant.string:
21 | start: "'"
22 | end: "'"
23 | skip: "\\\\."
24 | rules:
25 | - preproc: "..+"
26 | - constant.specialChar: "\\\\."
27 |
28 | - comment:
29 | start: "//"
30 | end: "$"
31 | rules: []
32 |
33 | - comment:
34 | start: "/\\*"
35 | end: "\\*/"
36 | rules: []
37 |
38 |
--------------------------------------------------------------------------------
/syntax_files/clojure.yaml:
--------------------------------------------------------------------------------
1 | filetype: clojure
2 |
3 | detect:
4 | filename: "\\.(clj[sc]?|edn)$"
5 |
6 | rules:
7 |
8 | # Constants
9 | - constant.bool: "\\b(true|false)\\b"
10 | - constant.macro: "\\b(nil)\\b"
11 | # Valid numbers
12 | - constant.number: "[\\-]?[0-9]+?\\b"
13 | - constant.number: "0x[0-9][A-Fa-f]+?\\b"
14 | - constant.number: "[\\-]?(3[0-6]|2[0-9]|1[0-9]|[2-9])r[0-9A-Z]+?\\b"
15 | # Invalid numbers
16 | - error: "[\\-]?([4-9][0-9]|3[7-9]|1|0)r[0-9A-Z]+?\\b"
17 |
18 | # Symbols
19 | - symbol.operator: "[=>+\\-*/'?]"
20 |
21 | # Types/casting
22 | - type: "\\b(byte|short|(big)?int(eger)?|long|float|num|bigdec|rationalize)\\b"
23 |
24 | # String highlighting
25 | - constant.string:
26 | start: "\""
27 | end: "\""
28 | skip: "\\\\."
29 | rules:
30 | - constant.specialChar: "(\\\\u[0-9A-fa-f]{4,4}|\\\\newline|\\\\space|\\\\tab|\\\\formfeed|\\\\backspace|\\\\return|\\\\.)"
31 |
32 | # Comments
33 | - comment:
34 | start: ";"
35 | end: "$"
36 | rules:
37 | - todo: "(TODO|XXX|FIXME):?"
38 |
39 |
--------------------------------------------------------------------------------
/syntax_files/nanorc.yaml:
--------------------------------------------------------------------------------
1 | filetype: nanorc
2 |
3 | detect:
4 | filename: "\\.?nanorc$"
5 |
6 | rules:
7 | - default: "(?i)^[[:space:]]*((un)?set|include|syntax|i?color).*$"
8 | - type: "(?i)^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|boldtext|brackets|casesensitive|const|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|preserve|punct)\\>|^[[:space:]]*(set|unset)[[:space:]]+(quickblank|quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|undo|view|whitespace|wordbounds)\\b"
9 | - preproc: "(?i)^[[:space:]]*(set|unset|include|syntax|header)\\b"
10 | - constant.bool.true: "(?i)(set)\\b"
11 | - constant.bool.false: "(?i)(unset)\\b"
12 | - identifier: "(?i)^[[:space:]]*(i)?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\\b"
13 | - special: "(?i)^[[:space:]]*(i)?color\\b|\\b(start|end)="
14 | - constant.string: "\"(\\\\.|[^\"])*\""
15 | - comment: "^[[:space:]]*#.*$"
16 | - comment.bright: "^[[:space:]]*##.*$"
17 |
--------------------------------------------------------------------------------
/README_WINDOWS.txt:
--------------------------------------------------------------------------------
1 | Running Gomacs on Windows
2 | =========================
3 |
4 | Gomacs was primarily designed with unix-like operating systems in mind. That's
5 | not to say that it's unusable on Windows; just that Windows support isn't my
6 | primary concern.
7 |
8 | With that in mind, here's some stuff to help you run Gomacs on Windows.
9 |
10 | rc file
11 | =======
12 |
13 | The rc file lives in %APPDATA%, which is usually:
14 |
15 | C:\Users\\AppData\Roaming
16 |
17 | in recent versions of Windows. The file is inside that directory, in:
18 |
19 | japanoise\gomacs\rc.zy
20 |
21 | Terminal Title
22 | ==============
23 |
24 | Windows doesn't support setting the terminal title, so terminal-title-mode does
25 | nothing.
26 |
27 | Control-H
28 | =========
29 |
30 | Windows uses ^H for backspace. There's already a workaround in termbox-util for
31 | this, but for Gomacs it leaves us with the problem of what to do about the C-h
32 | family of commands - very useful help functions.
33 |
34 | In keeping with tradition for UI, especially on Windows, the help functions are
35 | additionally mapped to F1, so wherever you see C-h in the documentation, replace
36 | it with F1.
37 |
--------------------------------------------------------------------------------
/syntax_files/markdown.yaml:
--------------------------------------------------------------------------------
1 | filetype: markdown
2 |
3 | detect:
4 | filename: "\\.(md|mkd|mkdn|markdown)$"
5 |
6 | rules:
7 | # Tables (Github extension)
8 | - type: ".*[ :]\\|[ :].*"
9 |
10 | # quotes
11 | - statement: "^>.*"
12 |
13 | # Emphasis
14 | - type: "(^|[[:space:]])(_[^ ][^_]*_|\\*[^ ][^*]*\\*)"
15 |
16 | # Strong emphasis
17 | - type: "(^|[[:space:]])(__[^ ][^_]*__|\\*\\*[^ ][^*]*\\*\\*)"
18 |
19 | # strike-through
20 | - type: "(^|[[:space:]])~~[^ ][^~]*~~"
21 |
22 | # horizontal rules
23 | - special: "^(---+|===+|___+|\\*\\*\\*+)\\s*$"
24 |
25 | # headlines
26 | - special: "^#{1,6}.*"
27 |
28 | # lists
29 | - identifier: "^[[:space:]]*[\\*+-] |^[[:space:]]*[0-9]+\\. "
30 |
31 | # misc
32 | - preproc: "(\\(([CcRr]|[Tt][Mm])\\)|\\.{3}|(^|[[:space:]])\\-\\-($|[[:space:]]))"
33 |
34 | # links
35 | - constant: "\\[[^]]+\\]"
36 | - constant: "\\[([^][]|\\[[^]]*\\])*\\]\\([^)]+\\)"
37 |
38 | # images
39 | - underlined: "!\\[[^][]*\\](\\([^)]+\\)|\\[[^]]+\\])"
40 |
41 | # urls
42 | - underlined: "https?://[^ )>]+"
43 |
44 | - special: "^```$"
45 |
46 | - special:
47 | start: "`"
48 | end: "`"
49 | rules: []
50 |
--------------------------------------------------------------------------------
/dired.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "io/ioutil"
5 | "path/filepath"
6 |
7 | glisp "github.com/glycerine/zygomys/zygo"
8 | )
9 |
10 | func DiredMode(env *glisp.Zlisp) {
11 | dir, perr := filepath.Abs("./")
12 | if perr != nil {
13 | Global.Input = perr.Error()
14 | AddErrorMessage(perr.Error())
15 | return
16 | }
17 | done := false
18 | for !done {
19 | files, err := ioutil.ReadDir(dir)
20 | if err != nil {
21 | Global.Input = err.Error()
22 | AddErrorMessage(err.Error())
23 | return
24 | }
25 | choices := []string{"", "../"}
26 | for _, f := range files {
27 | suffix := ""
28 | if f.IsDir() {
29 | suffix += "/"
30 | }
31 | suffix += " " + f.Mode().String()
32 | choices = append(choices, f.Name()+suffix)
33 | }
34 | choice := editorChoiceIndex("Dired: "+dir, choices, 0)
35 | filechosen := choice - 2
36 | if filechosen == -2 {
37 | return
38 | } else if filechosen == -1 {
39 | dir += "/.."
40 | } else if files[filechosen].IsDir() {
41 | dir += "/" + files[filechosen].Name()
42 | } else {
43 | openFile(dir+"/"+files[filechosen].Name(), env)
44 | done = true
45 | }
46 | dir, err = filepath.Abs(dir)
47 | if err != nil {
48 | Global.Input = err.Error()
49 | AddErrorMessage(err.Error())
50 | return
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/syntax_files/julia.yaml:
--------------------------------------------------------------------------------
1 | filetype: julia
2 |
3 | detect:
4 | filename: "\\.jl$"
5 | header: "^#!.*/(env +)?julia( |$)"
6 |
7 | rules:
8 |
9 | # built-in objects
10 | - constant.bool: "\\b(true|false)\\b"
11 | # built-in attributes
12 | - constant: "__[A-Za-z0-9_]+__"
13 | # definitions
14 | - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]"
15 | # keywords
16 | - statement: "\\b(begin|break|catch|continue|function|elseif|struct|else|end|finally|for|global|local|const|if|include|import|using|require|macro|println|return|try|type|while|module)\\b"
17 | # decorators
18 | - identifier.macro: "@[A-Za-z0-9_]+"
19 | # operators
20 | - symbol.operator: "[-+*/|=%<>&~^]|\\b(and|not|or|is|in)\\b"
21 | # parentheses
22 | - symbol.brackets: "([(){}]|\\[|\\])"
23 | # numbers
24 | - constant.number: "\\b([0-9]+(_[0-9]+)*|0x[0-9a-fA-F]+(_[0-9a-fA-F]+)*|0b[01]+(_[01]+)*|0o[0-7]+(_[0-7]+)*)\\b"
25 |
26 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^']){1}'"
27 |
28 | - constant.string:
29 | start: "\"\"\""
30 | end: "\"\"\""
31 | rules: []
32 |
33 | - constant.string:
34 | start: "'''"
35 | end: "'''"
36 | rules: []
37 |
38 | - comment:
39 | start: "#"
40 | end: "$"
41 | rules: []
42 |
--------------------------------------------------------------------------------
/syntax_files/cmake.yaml:
--------------------------------------------------------------------------------
1 | filetype: cmake
2 |
3 | detect:
4 | filename: "(CMakeLists\\.txt|\\.cmake)$"
5 |
6 | rules:
7 | - identifier.var: "^[[:space:]]*[A-Z0-9_]+"
8 | - preproc: "^[[:space:]]*(include|include_directories|include_external_msproject)\\b"
9 |
10 | - statement: "^[[:space:]]*\\b((else|end)?if|else|(end)?while|(end)?foreach|break)\\b"
11 | - statement: "\\b(COPY|NOT|COMMAND|PROPERTY|POLICY|TARGET|EXISTS|IS_(DIRECTORY|ABSOLUTE)|DEFINED)\\b[[:space:]]"
12 | - statement: "[[:space:]]\\b(OR|AND|IS_NEWER_THAN|MATCHES|(STR|VERSION_)?(LESS|GREATER|EQUAL))\\b[[:space:]]"
13 |
14 | - special: "^[[:space:]]*\\b((end)?(function|macro)|return)"
15 |
16 | - constant.string:
17 | start: "\""
18 | end: "\""
19 | skip: "\\\\."
20 | rules:
21 | - constant.specialChar: "\\\\."
22 |
23 | - constant.string:
24 | start: "'"
25 | end: "'"
26 | skip: "\\\\."
27 | rules:
28 | - constant.specialChar: "\\\\."
29 |
30 | - preproc:
31 | start: "\\$(\\{|ENV\\{)"
32 | end: "\\}"
33 | rules: []
34 |
35 | - identifier.macro: "\\b(APPLE|UNIX|WIN32|CYGWIN|BORLAND|MINGW|MSVC(_IDE|60|71|80|90)?)\\b"
36 |
37 | - comment:
38 | start: "#"
39 | end: "$"
40 | rules:
41 | - todo: "(TODO|XXX|FIXME):?"
42 |
43 |
--------------------------------------------------------------------------------
/syntax_files/graphql.yaml:
--------------------------------------------------------------------------------
1 | filetype: graphql
2 |
3 | detect:
4 | filename: "\\.(gql|graphql)$"
5 |
6 | rules:
7 | - type: "\\b(?:(query|mutation|subscription|type|fragment|schema|union|on|extends?))\\b"
8 |
9 | # scalar types
10 | - statement: "\\b(ID|Int|Float|Boolean|String|Datetime|Null)\\b"
11 |
12 | # introspection types
13 | - statement: "(__\\w+)"
14 |
15 | # parameters
16 | - statement: "((\\w+)(?:\\:([\\s]*)?)(?:\\$))"
17 |
18 | # directive locations
19 | - statement: "\\b(QUERY|MUTATION|SUBSCRIPTION|FIELD|FRAGMENT_DEFINITION|FRAGMENT_SPREAD|INLINE_FRAGMENT|SCHEMA|SCALAR|OBJECT|FIELD_DEFINITION|ARGUMENT_DEFINITION|INTERFACE|UNION|ENUM|ENUM_VALUE|INPUT_OBJECT|INPUT_FIELD_DEFINITION)\\b"
20 |
21 | # directives
22 | - constant: "(@\\w+)"
23 |
24 | # root types
25 | - constant: "\\b(Query|Mutation|Subscription|Schema|Root)\\b"
26 |
27 | # variables
28 | - special: "(\\$\\w+)"
29 |
30 | # required symbol
31 | - special: "(!)"
32 |
33 | - symbol: "(:|=|\\||\\(|\\)|\\{|\\}|\\[|\\])"
34 |
35 | - constant.bool: "\\b(true|false)\\b"
36 |
37 | - constant.string:
38 | start: "\""
39 | end: "\""
40 | skip: "\\\\."
41 | rules:
42 | - constant.specialChar: "\\\\."
43 |
44 | - comment:
45 | start: "#"
46 | end: "$"
47 | rules: []
--------------------------------------------------------------------------------
/syntax_files/ruby.yaml:
--------------------------------------------------------------------------------
1 | filetype: ruby
2 |
3 | detect:
4 | filename: "\\.rb$|\\.gemspec$|Gemfile|config.ru|Rakefile|Capfile|Vagrantfile"
5 | header: "^#!.*/(env +)?ruby( |$)"
6 |
7 | rules:
8 | - statement: "\\b(BEGIN|END|alias|and|begin|break|case|class|def|defined\\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\\b"
9 | - constant: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*"
10 | - constant.number: "\\b[0-9]+\\b"
11 | - constant: "(i?)([ ]|^):[0-9A-Z_]+\\b"
12 | - constant: "\\b(__FILE__|__LINE__)\\b"
13 | - constant: "/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*"
14 | - constant.string: "`[^`]*`|%x\\{[^}]*\\}"
15 | - constant.string: "\"([^\"]|(\\\\\"))*\"|%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\[[^]]*\\]|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!"
16 | - special: "#\\{[^}]*\\}"
17 | - constant.string: "'([^']|(\\\\'))*'|%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!"
18 | - comment: "#[^{].*$|#$"
19 | - comment.bright: "##[^{].*$|##$"
20 | - constant.macro:
21 | start: "<<-?'?EOT'?"
22 | end: "^EOT"
23 | rules: []
24 |
25 | - todo: "(XXX|TODO|FIXME|\\?\\?\\?)"
26 | - preproc.shebang: "^#!.+?( |$)"
27 |
--------------------------------------------------------------------------------
/syntax_files/rust.yaml:
--------------------------------------------------------------------------------
1 | filetype: rust
2 |
3 | detect:
4 | filename: "\\.rs$"
5 |
6 | rules:
7 | # function definition
8 | - identifier: "fn [a-z0-9_]+"
9 | # Reserved words
10 | - statement: "\\b(abstract|alignof|as|become|box|break|const|continue|crate|do|else|enum|extern|false|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|offsetof|override|priv|pub|pure|ref|return|sizeof|static|self|struct|super|true|trait|type|typeof|unsafe|unsized|use|virtual|where|while|yield)\\b"
11 | # macros
12 | - special: "[a-z_]+!"
13 | # Constants
14 | - constant: "[A-Z][A-Z_]+"
15 | # Numbers
16 | - constant.number: "\\b[0-9]+\\b"
17 | # Traits/Enums/Structs/Types/etc.
18 | - type: "[A-Z][a-z]+"
19 |
20 | - constant.string:
21 | start: "\""
22 | end: "\""
23 | skip: "\\\\."
24 | rules:
25 | - constant.specialChar: "\\\\."
26 |
27 | - constant.string:
28 | start: "r#+\""
29 | end: "\"#+"
30 | rules: []
31 |
32 | - comment:
33 | start: "//"
34 | end: "$"
35 | rules:
36 | - todo: "(TODO|XXX|FIXME):?"
37 |
38 | - comment:
39 | start: "/\\*"
40 | end: "\\*/"
41 | rules:
42 | - todo: "(TODO|XXX|FIXME):?"
43 |
44 | - special:
45 | start: "#!\\["
46 | end: "\\]"
47 | rules: []
48 |
49 |
--------------------------------------------------------------------------------
/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/japanoise/gomacs
2 |
3 | go 1.17
4 |
5 | require (
6 | github.com/glycerine/zygomys v5.1.2+incompatible
7 | github.com/japanoise/termbox-util v0.0.0-20190108154252-ed9f503f539b
8 | github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
9 | github.com/mattn/go-runewidth v0.0.13
10 | github.com/mitchellh/go-homedir v1.1.0
11 | github.com/nsf/termbox-go v1.1.1
12 | github.com/uinta-labs/configdir v0.0.0-20210210044545-77a3d24c2768
13 | github.com/zyedidia/highlight v0.0.0-20200217010119-291680feaca1
14 | )
15 |
16 | require (
17 | github.com/glycerine/blake2b v0.0.0-20151022103502-3c8c640cd7be // indirect
18 | github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31 // indirect
19 | github.com/glycerine/greenpack v5.1.1+incompatible // indirect
20 | github.com/glycerine/liner v0.0.0-20160121172638-72909af234e0 // indirect
21 | github.com/gopherjs/gopherjs v0.0.0-20220221023154-0b2280d3ff96 // indirect
22 | github.com/jtolds/gls v4.20.0+incompatible // indirect
23 | github.com/philhofer/fwd v1.1.1 // indirect
24 | github.com/rivo/uniseg v0.2.0 // indirect
25 | github.com/shurcooL/go v0.0.0-20200502201357-93f07166e636 // indirect
26 | github.com/shurcooL/go-goon v0.0.0-20210110234559-7585751d9a17 // indirect
27 | github.com/tinylib/msgp v1.1.6 // indirect
28 | github.com/ugorji/go/codec v1.2.6 // indirect
29 | gopkg.in/yaml.v2 v2.4.0 // indirect
30 | )
31 |
--------------------------------------------------------------------------------
/syntax_files/crontab.yaml:
--------------------------------------------------------------------------------
1 | filetype: crontab
2 |
3 | detect:
4 | filename: "crontab$"
5 | header: "^#.*?/etc/crontab"
6 |
7 | rules:
8 | # The time and date fields are:
9 | # field allowed values
10 | # ----- --------------
11 | # minute 0-59
12 | # hour 0-23
13 | # day of month 0-31
14 | # month 0-12 (or names, see below)
15 | # day of week 0-7 (0 or 7 is Sun, or use names)
16 |
17 | - statement: "^([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+(.*)$\\n?"
18 | - constant: "^([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)\\s+([\\*0-9,\\-\\/]+)"
19 |
20 | # Shell Values
21 | - type: "^[A-Z]+\\="
22 |
23 | # Months and weekday keywords
24 | - type: "jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec"
25 | - constant: "sun|mon|tue|wed|thu|fri|sat"
26 | - type: "\\@(reboot|yearly|annually|monthly|weekly|daily|midnight|hourly)"
27 |
28 | # Conditionals
29 | - special: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|^|!|=|&|\\|)"
30 |
31 | - comment:
32 | start: "#"
33 | end: "$"
34 | rules:
35 | - todo: "(TODO|XXX|FIXME):?"
36 |
37 |
--------------------------------------------------------------------------------
/syntax_files/html5.yaml:
--------------------------------------------------------------------------------
1 | filetype: html5
2 |
3 | detect:
4 | filename: "\\.htm[l]?5$"
5 | header: ""
6 |
7 | rules:
8 | - error: "<[^!].*?>"
9 | - symbol.tag: "(?i)<[/]?(a|a(bbr|ddress|rea|rticle|side|udio)|b|b(ase|d(i|o)|lockquote|r|utton)|ca(nvas|ption)|center|cite|co(de|l|lgroup)|d(ata|atalist|d|el|etails|fn|ialog|l|t)|em|embed|fieldset|fig(caption|ure)|form|iframe|h[1-6]|hr|i|img|in(put|s)|kbd|keygen|label|legend|li|link|ma(in|p|rk)|menu|menuitem|met(a|er)|nav|noscript|o(bject|l|pt(group|ion)|utput)|p|param|picture|pre|progress|q|r(p|t|uby)|s|samp|se(ction|lect)|small|source|span|strong|su(b|p|mmary)|textarea|time|track|u|ul|var|video|wbr)( .*)*?>"
10 | - symbol.tag.extended: "(?i)<[/]?(body|div|html|head(er)?|footer|title|table|t(body|d|h(ead)?|r|foot))( .*)*?>"
11 | - preproc: "(?i)<[/]?(script|style)( .*)*?>"
12 | - special: "&[^;[[:space:]]]*;"
13 | - symbol: "[:=]"
14 | - identifier: "(alt|bgcolor|height|href|id|label|longdesc|name|on(click|focus|load|mouseover)|size|span|src|style|target|type|value|width)="
15 | - constant.string: "\"[^\"]*\""
16 | - constant.number: "(?i)#[0-9A-F]{6,6}"
17 | - default:
18 | start: ">"
19 | end: "<"
20 | rules: []
21 |
22 | - symbol.tag: "<|>"
23 | - constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+"
24 | - comment: ""
25 | - preproc: ""
26 |
--------------------------------------------------------------------------------
/syntax_files/micro.yaml:
--------------------------------------------------------------------------------
1 | filetype: micro
2 |
3 | detect:
4 | filename: "\\.(micro)$"
5 |
6 | rules:
7 | - statement: "\\b(syntax|color(-link)?)\\b"
8 | - statement: "\\b(start=|end=)\\b"
9 | # Simple one-liners
10 | - identifier: "\\b(default|number|statement|underlined|error|todo|statusline|indent-char|cursor\\-line|color\\-column|ignore|divider|tabbar)\\b"
11 | # Separate identifiers to keep "complex" regex clean
12 | - identifier: "\\b(special(Char)?)\\b"
13 | - identifier: "\\b((current\\-)?line\\-number)\\b"
14 | - identifier: "\\b(gutter\\-(info|error|warning){1})\\b"
15 | - identifier: "\\b(comment(\\.bright)?)\\b"
16 | - identifier: "\\b(symbol(\\.(brackets|operator|tag))?)\\b"
17 | - identifier: "\\b(identifier(\\.(class|macro|var))?)\\b"
18 | - identifier: "\\b(constant(\\.(bool(\\.(true|false){1})?|number|specialChar|string(\\.url)?){1})?)\\b"
19 | - identifier: "\\b(preproc(\\.shebang)?)\\b"
20 | - identifier: "\\b(type(\\.keyword)?)\\b"
21 | - constant.number: "\\b(|h|A|0x)+[0-9]+(|h|A)+\\b"
22 | - constant.number: "\\b0x[0-9 a-f A-F]+\\b"
23 | - comment:
24 | start: "#"
25 | end: "$"
26 | rules:
27 | - todo: "(FIXME|TODO|NOTE):?"
28 | - constant.string:
29 | start: "\""
30 | end: "\""
31 | skip: "\\\\."
32 | rules:
33 | - constant.specialChar: "\\\\."
34 | - constant.number: "#[0-9 A-F a-f]+"
35 |
--------------------------------------------------------------------------------
/syntax_files/pony.yaml:
--------------------------------------------------------------------------------
1 | filetype: pony
2 |
3 | detect:
4 | filename: "\\.pony$"
5 |
6 | rules:
7 | - statement: "\\b(type|interface|trait|primitive|class|struct|actor)\\b"
8 | - statement: "\\b(compiler_intrinsic)\\b"
9 | - statement: "\\b(use)\\b"
10 | - statement: "\\b(var|let|embed)\\b"
11 | - statement: "\\b(new|be|fun)\\b"
12 | - statement: "\\b(iso|trn|ref|val|box|tag|consume)\\b"
13 | - statement: "\\b(break|continue|return|error)\\b"
14 | - statement: "\\b(if|then|elseif|else|end|match|where|try|with|as|recover|object|lambda|as|digestof|ifdef)\\b"
15 | - statement: "\\b(while|do|repeat|until|for|in)\\b"
16 | - statement: "(\\?|=>)"
17 | - statement: "(\\||\\&|\\,|\\^)"
18 | - symbol.operator: "(\\-|\\+|\\*|/|\\!|%|<<|>>)"
19 | - symbol.operator: "(==|!=|<=|>=|<|>)"
20 | - statement: "\\b(is|isnt|not|and|or|xor)\\b"
21 | - type: "\\b(_*[A-Z][_a-zA-Z0-9\\']*)\\b"
22 | - constant: "\\b(this)\\b"
23 | - constant.bool: "\\b(true|false)\\b"
24 | - constant.number: "\\b((0b[0-1_]*)|(0o[0-7_]*)|(0x[0-9a-fA-F_]*)|([0-9_]+(\\.[0-9_]+)?((e|E)(\\\\+|-)?[0-9_]+)?))\\b"
25 | - constant.string: "\"(\\\\.|[^\"])*\""
26 | - comment:
27 | start: "\"\"\"[^\"]*"
28 | end: "\"\"\""
29 | rules: []
30 |
31 | - comment: "(^|[[:space:]])//.*"
32 | - comment:
33 | start: "/\\*"
34 | end: "\\*/"
35 | rules: []
36 |
37 | - todo: "TODO:?"
38 |
--------------------------------------------------------------------------------
/syntax_files/makefile.yaml:
--------------------------------------------------------------------------------
1 | filetype: makefile
2 |
3 | detect:
4 | filename: "([Mm]akefile|\\.ma?k)$"
5 | header: "^#!.*/(env +)?[bg]?make( |$)"
6 |
7 | rules:
8 | - preproc: "\\<(ifeq|ifdef|ifneq|ifndef|else|endif)\\>"
9 | - statement: "^(export|include|override)\\>"
10 | - symbol.operator: "^[^:= ]+:"
11 | - symbol.operator: "([=,%]|\\+=|\\?=|:=|&&|\\|\\|)"
12 | - statement: "\\$\\((abspath|addprefix|addsuffix|and|basename|call|dir)[[:space:]]"
13 | - statement: "\\$\\((error|eval|filter|filter-out|findstring|firstword)[[:space:]]"
14 | - statement: "\\$\\((flavor|foreach|if|info|join|lastword|notdir|or)[[:space:]]"
15 | - statement: "\\$\\((origin|patsubst|realpath|shell|sort|strip|suffix)[[:space:]]"
16 | - statement: "\\$\\((value|warning|wildcard|word|wordlist|words)[[:space:]]"
17 | - identifier: "^.+:"
18 | - identifier: "[()$]"
19 | - constant.string:
20 | start: "\""
21 | end: "\""
22 | skip: "\\\\."
23 | rules:
24 | - constant.specialChar: "\\\\."
25 | - constant.string:
26 | start: "'"
27 | end: "'"
28 | skip: "\\\\."
29 | rules:
30 | - constant.specialChar: "\\\\."
31 | - identifier: "\\$+(\\{[^} ]+\\}|\\([^) ]+\\))"
32 | - identifier: "\\$[@^<*?%|+]|\\$\\([@^<*?%+-][DF]\\)"
33 | - identifier: "\\$\\$|\\\\.?"
34 | - comment:
35 | start: "#"
36 | end: "$"
37 | rules: []
38 |
39 |
--------------------------------------------------------------------------------
/syntax_files/asciidoc.yaml:
--------------------------------------------------------------------------------
1 | filetype: asciidoc
2 |
3 | detect:
4 | filename: "\\.(asc|asciidoc|adoc)$"
5 |
6 | rules:
7 | # main header
8 | - preproc: "^====+$"
9 | # h1
10 | - statement: "^==[[:space:]].*$"
11 | - statement: "^----+$"
12 | # h2
13 | - symbol: "^===[[:space:]].*$"
14 | - symbol: "^~~~~+$"
15 | # h4
16 | - type: "^====[[:space:]].*$"
17 | - type: "^\\^\\^\\^\\^+$"
18 | # h5
19 | - constant: "^=====[[:space:]].*$"
20 | - constant: "^\\+\\+\\+\\++$"
21 |
22 | # attributes
23 | - type.keyword: ":.*:"
24 | - identifier.macro: "\\{[a-z0-9]*\\}"
25 | - identifier: "\\\\\\{[a-z0-9]*\\}"
26 | - identifier: "\\+\\+\\+\\{[a-z0-9]*\\}\\+\\+\\+"
27 |
28 | # Paragraph Title
29 | - statement: "^\\..*$"
30 |
31 | # source
32 | - identifier: "^\\[(source,.+|NOTE|TIP|IMPORTANT|WARNING|CAUTION)\\]"
33 |
34 | # Other markup
35 | - constant.string: ".*[[:space:]]\\+$"
36 | - constant.string: "_[^_]+_"
37 | - constant.string: "\\*[^\\*]+\\*"
38 | - constant.string: "\\+[^\\+]+\\+"
39 | - constant.string: "`[^`]+`"
40 | - constant.string: "\\^[^\\^]+\\^"
41 | - constant.string: "~[^~]+~"
42 | - constant.string: "'[^']+'"
43 |
44 | - constant: "`{1,2}[^']+'{1,2}"
45 |
46 | # bullets
47 | - symbol: "^[[:space:]]*[\\*\\.-]{1,5}[[:space:]]"
48 |
49 | # anchors
50 | - "bold default": "\\[\\[.*\\]\\]"
51 | - "bold default": "<<.*>>"
52 |
--------------------------------------------------------------------------------
/syntax_files/inform6.yaml:
--------------------------------------------------------------------------------
1 | filetype: inform6
2 |
3 | detect:
4 | filename: "\\.inf$"
5 |
6 | rules:
7 | - statement: "\\b(box|break|continue|do|else|font(\\s+)(on|off)|for|give|if|jump|new_line|objectloop|print|print_ret|remove|return|rfalse|rtrue|spaces|string|style(\\s+)(roman|bold|underline|reverse|fixed)|switch|until|while|has|hasnt|in|notin|ofclass|provides|or)\\b"
8 | - preproc: "^[[:space:]]*#[[:space:]]*(Abbreviate|Array|Attribute|Class|Constant|Default|End|Endif|Extend|Global|Ifdef|Ifndef|Ifnot|Iftrue|Iffalse|Import|Include|Link|Lowstring|Message|Object|Property|Release|Replace|Serial|Switches|Statusline(\\s+)(score|time)|System_file|Verb|Zcharacter)"
9 | - constant: "'([^'\\\\]|(\\\\[\"'abfnrtv\\\\]))'"
10 | - constant: "\\b(true|false)\\b"
11 | - constant: "\\b(nothing)\\b"
12 | - symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)"
13 | - symbol.brackets: "[(){}]|\\[|\\]"
14 | - constant.number: "(\\b[0-9]+|\\$[0-9A-Fa-f]+\\b|\\$\\$[01]+)"
15 |
16 | - constant.string:
17 | start: "\""
18 | end: "\""
19 | skip: "\\\\."
20 | rules:
21 | - constant.specialChar: "[^@]\\\\."
22 | - constant.specialChar: "[~]"
23 | - constant.specialChar: "\\^"
24 | - constant.specialChar: "@(@[0-9]+|['`:c\\\\~o]|ss|oe|ae|OE|AE|th|et|LL|!!|\\?\\?|<<|>>|{[0-9a-fA-F]+})"
25 |
26 | - comment:
27 | start: "!"
28 | end: "$"
29 | rules:
30 | - todo: "(TODO|XXX|FIXME):?"
31 |
32 |
--------------------------------------------------------------------------------
/syntax_files/html4.yaml:
--------------------------------------------------------------------------------
1 | filetype: html4
2 |
3 | detect:
4 | filename: "\\.htm[l]?4$"
5 | header: ""
6 |
7 | rules:
8 | - error: "<[^!].*?>"
9 | - symbol.tag: "(?i)<[/]?(a(bbr|cronym|ddress|pplet|rea|rticle|side|udio)?|b(ase(font)?|d(i|o)|ig|lockquote|r)?|ca(nvas|ption)|center|cite|co(de|l|lgroup)|d(ata(list)?|d|el|etails|fn|ialog|ir|l|t)|em(bed)?|fieldset|fig(caption|ure)|font|form|(i)?frame|frameset|h[1-6]|hr|i|img|in(put|s)|kbd|keygen|label|legend|li(nk)?|ma(in|p|rk)|menu(item)?|met(a|er)|nav|no(frames|script)|o(l|pt(group|ion)|utput)|p(aram|icture|re|rogress)?|q|r(p|t|uby)|s(trike)?|samp|se(ction|lect)|small|source|span|strong|su(b|p|mmary)|textarea|time|track|u(l)?|var|video|wbr)( .*|>)*?>"
10 | - symbol.tag.extended: "(?i)<[/]?(body|div|html|head(er)?|footer|title|table|t(body|d|h(ead)?|r|foot))( .*)*?>"
11 | - preproc: "(?i)<[/]?(script|style)( .*)*?>"
12 | - special: "&[^;[[:space:]]]*;"
13 | - symbol: "[:=]"
14 | - identifier: "(alt|bgcolor|height|href|id|label|longdesc|name|on(click|focus|load|mouseover)|size|span|src|style|target|type|value|width)="
15 | - constant.string: "\"[^\"]*\""
16 | - constant.number: "(?i)#[0-9A-F]{6,6}"
17 | - default:
18 | start: ">"
19 | end: "<"
20 | rules: []
21 |
22 | - symbol.tag: "<|>"
23 | - constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+"
24 | - comment: ""
25 | - preproc: ""
26 |
--------------------------------------------------------------------------------
/syntax_files/zig.yaml:
--------------------------------------------------------------------------------
1 | filetype: zig
2 |
3 | detect:
4 | filename: "\\.zig$"
5 |
6 | rules:
7 | # function definition
8 | - identifier: "fn [a-z0-9_]+"
9 | # Reserved words
10 | - statement: "\\b(align|and|allowzero|anyerror|asm|async|await|break|cancel|catch|comptime|const|continue|defer|else|enum|errdefer|error|export|extern|false|fn|for|if|inline|nakedcc|noalias|null|or|orelse|packed|promise|pub|resume|return|linksection|stdcallcc|struct|suspend|switch|test|threadlocal|true|try|undefined|union|unreachable|use|var|volatile|while)\\b"
11 | # builtin functions
12 | - special: "@+[a-z_]+"
13 | # Constants
14 | - constant: "[A-Z][A-Z_]+([0-9]+)?"
15 | # Numbers (hexadecimal + decimal)
16 | - constant.number: "\\b(0x[A-F0-9]+|[0-9]+)\\b"
17 | # Primitive Types / Derived Data Types
18 | - type: "([A-Z][a-z]+|(i8|u8|i16|u16|i32|u32|i64|u64|i128|u128|isize|usize|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|c_longlong|c_ulonglong|c_longdouble|c_void|f16|f32|f64|f128|bool|void|noreturn|type|anyerror|comptime_int|comptime_float))"
19 |
20 | - constant.string:
21 | start: "\""
22 | end: "\""
23 | skip: "\\\\."
24 | rules:
25 | - constant.specialChar: "\\\\."
26 |
27 | - comment:
28 | start: "//"
29 | end: "$"
30 | rules:
31 | - todo: "(TODO|XXX|FIXME):?"
32 |
33 | - comment:
34 | start: "/\\*"
35 | end: "\\*/"
36 | rules:
37 | - todo: "(TODO|XXX|FIXME):?"
38 |
--------------------------------------------------------------------------------
/syntax_files/cplusplus.yaml:
--------------------------------------------------------------------------------
1 | filetype: c++
2 |
3 | detect:
4 | filename: "\\.c(c|pp|xx)$|\\.h(h|pp|xx)$|\\.ii?$|\\.(def)$"
5 |
6 | rules:
7 | - identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
8 | - type: "\\b(auto|float|double|bool|char|int|short|long|sizeof|enum|void|static|const|constexpr|struct|union|typedef|extern|(un)?signed|inline)\\b"
9 | - type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
10 | - statement: "\\b(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\\b"
11 | - statement: "\\b(for|if|while|do|else|case|default|switch)\\b"
12 | - statement: "\\b(try|throw|catch|operator|new|delete)\\b"
13 | - special: "\\b(goto|continue|break|return)\\b"
14 | - preproc: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
15 | - constant: "'([^'\\\\]|(\\\\[\"'abfnrtv\\\\]))'|'\\\\(([0-3]?[0-7]{1,2}))'|'\\\\x[0-9A-Fa-f]{1,2}'"
16 | - statement: "__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
17 | - symbol.operator: "[.:;,+*|=!\\%]|<|>|/|-|&"
18 | - symbol.brackets: "[(){}]|\\[|\\]"
19 | - constant.number: "\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b"
20 | - constant.bool: "\\b(true|false)\\b|NULL"
21 | - constant.string: "\"(\\\\.|[^\"])*\""
22 | - comment: "//.*"
23 | - comment:
24 | start: "/\\*"
25 | end: "\\*/"
26 | rules: []
27 |
28 | - indent-char.whitespace: "[[:space:]]+$"
29 |
--------------------------------------------------------------------------------
/macro.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import glisp "github.com/glycerine/zygomys/zygo"
4 |
5 | type EditorAction struct {
6 | HasUniversal bool
7 | Universal int
8 | Command *CommandFunc
9 | }
10 |
11 | type EditorMacro []*EditorAction
12 |
13 | var macro EditorMacro
14 | var macrorec bool = false
15 |
16 | func runMacroOnce(env *glisp.Zlisp, m []*EditorAction) {
17 | if m == nil || len(m) <= 0 {
18 | Global.Input = "Zero length or unset macro"
19 | return
20 | }
21 | for _, act := range m {
22 | if act != nil && act.Command != nil && act.Command.Com != nil {
23 | Global.Universal = act.Universal
24 | Global.SetUniversal = act.HasUniversal
25 | act.Command.Com(env)
26 | Global.SetUniversal = false
27 | }
28 | }
29 | }
30 |
31 | func micromode(repeatkey string, msg string, env *glisp.Zlisp, f func(*glisp.Zlisp)) {
32 | f(env)
33 | Global.Input = msg
34 | editorRefreshScreen()
35 | key := editorGetKey()
36 | for key == repeatkey {
37 | f(env)
38 | editorRefreshScreen()
39 | key = editorGetKey()
40 | }
41 | Global.SetUniversal = false
42 | RunCommandForKey(key, env)
43 | editorRefreshScreen()
44 | }
45 |
46 | func doRunMacro(env *glisp.Zlisp) {
47 | stopRecMacro()
48 | micromode("e", "Press e to run macro again", env, func(e *glisp.Zlisp) {
49 | runMacroOnce(e, macro)
50 | })
51 | }
52 |
53 | func recMacro() {
54 | macrorec = true
55 | macro = EditorMacro{}
56 | Global.Input = "Recording macro..."
57 | }
58 |
59 | func stopRecMacro() {
60 | macrorec = false
61 | Global.Input = "Stopped recording"
62 | }
63 |
--------------------------------------------------------------------------------
/syntax_files/cython.yaml:
--------------------------------------------------------------------------------
1 | filetype: cython
2 |
3 | detect:
4 | filename: "\\.pyx$|\\.pxd$|\\.pyi$"
5 |
6 | rules:
7 | # Python Keyword Color
8 | - statement: "\\b(and|as|assert|class|def|DEF|del|elif|ELIF|else|ELSE|except|exec|finally|for|from|global|if|IF|import|in|is|lambda|map|not|or|pass|print|raise|try|while|with|yield)\\b"
9 | - special: "\\b(continue|break|return)\\b"
10 |
11 | # Cython Keyword Color
12 | - identifier.macro: "\\b(cdef|cimport|cpdef|cppclass|ctypedef|extern|include|namespace|property|struct)\\b"
13 | - type: "\\b(bint|char|double|int|public|void|unsigned)\\b"
14 |
15 | # Operator Color
16 | - symbol: "[.:;,+*|=!\\%]|<|>|/|-|&"
17 |
18 | # Parenthetical Color
19 | - symbol.brackets: "[(){}]|\\[|\\]"
20 |
21 | - constant.string:
22 | start: "\"\"\""
23 | end: "\"\"\""
24 | rules:
25 | - constant.specialChar: "\\\\."
26 |
27 | - constant.string:
28 | start: "'''"
29 | end: "'''"
30 | rules:
31 | - constant.specialChar: "\\\\."
32 |
33 | - constant.string:
34 | start: "\""
35 | end: "\""
36 | skip: "\\\\."
37 | rules:
38 | - constant.specialChar: "\\\\."
39 |
40 | - constant.string:
41 | start: "'"
42 | end: "'"
43 | skip: "\\\\."
44 | rules:
45 | - constant.specialChar: "\\\\."
46 |
47 | - comment:
48 | start: "#"
49 | end: "$"
50 | rules:
51 | - todo: "(TODO|XXX|FIXME):?"
52 |
53 |
--------------------------------------------------------------------------------
/syntax_files/dart.yaml:
--------------------------------------------------------------------------------
1 | filetype: dart
2 |
3 | detect:
4 | filename: "\\.dart$"
5 |
6 | rules:
7 | - constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b"
8 | - constant.number: "\\b[-+]?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"
9 | - constant.number: "\\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
10 | - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]"
11 | - statement: "\\b(break|case|catch|continue|default|else|finally)\\b"
12 | - statement: "\\b(for|function|get|if|in|as|is|new|return|set|switch|final|await|async|sync)\\b"
13 | - statement: "\\b(switch|this|throw|try|var|void|while|with|import|library|part|const|export)\\b"
14 | - constant: "\\b(true|false|null)\\b"
15 | - type: "\\b(List|String)\\b"
16 | - type: "\\b(int|num|double|bool)\\b"
17 | - statement: "[-+/*=<>!~%?:&|]"
18 | - constant: "/[^*]([^/]|(\\\\/))*[^\\\\]/[gim]*"
19 | - constant: "\\\\[0-7][0-7]?[0-7]?|\\\\x[0-9a-fA-F]+|\\\\[bfnrt'\"\\?\\\\]"
20 |
21 | - comment:
22 | start: "//"
23 | end: "$"
24 | rules:
25 | - todo: "TODO:?"
26 |
27 | - comment:
28 | start: "/\\*"
29 | end: "\\*/"
30 | rules:
31 | - todo: "TODO:?"
32 |
33 | - constant.string:
34 | start: "\""
35 | end: "\""
36 | skip: "\\\\."
37 | rules:
38 | - constant.specialChar: "\\\\."
39 |
40 | - constant.string:
41 | start: "'"
42 | end: "'"
43 | skip: "\\\\."
44 | rules:
45 | - constant.specialChar: "\\\\."
46 |
47 |
--------------------------------------------------------------------------------
/syntax_files/puppet.yaml:
--------------------------------------------------------------------------------
1 | filetype: puppet
2 |
3 | detect:
4 | filename: "\\.pp$"
5 |
6 | rules:
7 | - default: "^[[:space:]]([a-z][a-z0-9_]+)"
8 | - identifier.var: "\\$[a-z:][a-z0-9_:]+"
9 | - type: "\\b(augeas|computer|cron|exec|file|filebucket|group|host|interface|k5login|macauthorization|mailalias|maillist|mcx|mount|nagios_command|nagios_contact|nagios_contactgroup|nagios_host|nagios_hostdependency|nagios_hostescalation|nagios_hostextinfo|nagios_hostgroup|nagios_service|nagios_servicedependency|nagios_serviceescalation|nagios_serviceextinfo|nagios_servicegroup|nagios_timeperiod|notify|package|resources|router|schedule|scheduled_task|selboolean|selmodule|service|ssh_authorized_key|sshkey|stage|tidy|user|vlan|yumrepo|zfs|zone|zpool|anchor)\\b"
10 | - statement: "\\b(class|define|if|else|undef|inherits)\\b"
11 | - symbol: "(=|-|~|>)"
12 | - identifier.var: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*"
13 | - symbol: "([ ]|^):[0-9A-Z_]+\\b"
14 | - constant: "/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*"
15 | - constant.string: "`[^`]*`|%x\\{[^}]*\\}"
16 | - constant.string: "\"([^\"]|(\\\\\"))*\"|%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\[[^]]*\\]|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!"
17 | - special: "\\$\\{[^}]*\\}"
18 | - constant.string: "'([^']|(\\\\'))*'|%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!"
19 | - comment: "#[^{].*$|#$"
20 | - comment.bright: "##[^{].*$|##$"
21 | - todo: "(XXX|TODO|FIXME|\\?\\?\\?)"
22 | - indent-char.whitespace: "[[:space:]]+$"
23 |
--------------------------------------------------------------------------------
/syntax_files/ocaml.yaml:
--------------------------------------------------------------------------------
1 | filetype: ocaml
2 |
3 | detect:
4 | filename: "\\.mli?$"
5 |
6 | rules:
7 | - identifier: "\\b[A-Z][0-9a-z_]{2,}\\b"
8 | #declarations
9 | - statement: "\\b(let|val|method|in|and|rec|private|virtual|constraint)\\b"
10 | #structure items
11 | - type: "\\b(type|open|class|module|exception|external)\\b"
12 | #patterns
13 | - statement: "\\b(fun|function|functor|match|try|with)\\b"
14 | #patterns-modifiers
15 | - statement: "\\b(as|when|of)\\b"
16 | #conditions
17 | - statement: "\\b(if|then|else)\\b"
18 | #blocs
19 | - type: "\\b(begin|end|object|struct|sig|for|while|do|done|to|downto)\\b"
20 | #constantes
21 | - constant.bool: "\\b(true|false)\\b"
22 | #modules/classes
23 | - special: "\\b(include|inherit|initializer)\\b"
24 | #expr modifiers
25 | - special: "\\b(new|ref|mutable|lazy|assert|raise)\\b"
26 | - constant.string:
27 | start: "'"
28 | end: "'"
29 | skip: "\\\\."
30 | rules:
31 | - constant.specialChar: "%."
32 | - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
33 | - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
34 | - constant.string:
35 | start: "\""
36 | end: "\""
37 | skip: "\\\\."
38 | rules:
39 | - constant.specialChar: "%."
40 | - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
41 | - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
42 | - comment:
43 | start: "\\(\\*"
44 | end: "\\*\\)"
45 | rules: []
46 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | PREFIX?=/usr/local
2 | DESTDIR?=${PREFIX}
3 | BINDIR?=bin
4 | MANDIR?=/usr/share/man/man1
5 | BZ2?=bzip2
6 | GO?=go
7 | INSTALL_PROGRAM?=install -m 0755
8 | INSTALL_FILE?=install -m 0644
9 | VERSION?=git
10 | ARCH?=$(shell arch)
11 |
12 | .PHONY: all dist install install-em uninstall uninstall-em clean
13 |
14 | all: gomacs gomacs.1.bz2
15 |
16 | gomacs:
17 | ${GO} get -u -v
18 | ${GO} build -v -o gomacs
19 |
20 | gomacs.1.bz2: gomacs.1
21 | ${BZ2} -f -k gomacs.1
22 |
23 | gomacs.1: gomacs
24 | sed -n -e '1,/^<>$$/p' gomacs.1.in | sed -e '$$ d' > gomacs.1
25 | ./gomacs -D | sed -e "s/^ \(.*\) - \(.*\)/.It \1\n\2/" -e's/\\/\\e/g' -e 's/)/\\\&)/g' >> gomacs.1
26 | sed -e '1,/^<>$$/d' gomacs.1.in >> gomacs.1
27 |
28 | install: gomacs gomacs.1.bz2
29 | ${INSTALL_PROGRAM} gomacs ${DESTDIR}/${BINDIR}/gomacs
30 | ${INSTALL_FILE} gomacs.1.bz2 ${MANDIR}/gomacs.1.bz2
31 |
32 | install-em: gomacs gomacs.1.bz2
33 | ${INSTALL_PROGRAM} gomacs ${DESTDIR}/${BINDIR}/em
34 | ${INSTALL_FILE} gomacs.1.bz2 ${MANDIR}/em.1.bz2
35 |
36 | uninstall:
37 | rm -rf ${DESTDIR}/${BINDIR}/gomacs
38 | rm -rf ${MANDIR}/gomacs.1.bz2
39 |
40 | uninstall-em:
41 | rm -rf ${DESTDIR}/${BINDIR}/em
42 | rm -rf ${MANDIR}/em.1.bz2
43 |
44 | clean:
45 | rm -rf gomacs
46 | rm -rf gomacs.1.bz2
47 | rm -rf dist
48 |
49 | .ONESHELL:
50 | dist: gomacs gomacs.1.bz2
51 | mkdir -pv dist/gomacs_${ARCH}-${VERSION}
52 | cd dist/gomacs_${ARCH}-${VERSION}
53 | cp ../../gomacs ../../gomacs.1.bz2 ../../gomacs.png ../../LICENSE \
54 | ../../README.md ../../CHANGELOG ./
55 | cp --recursive ../../examples ./
56 | cd ../
57 | tar cvzf gomacs_${ARCH}-${VERSION}.tgz gomacs_${ARCH}-${VERSION}
58 |
--------------------------------------------------------------------------------
/syntax_files/awk.yaml:
--------------------------------------------------------------------------------
1 | filetype: awk
2 |
3 | detect:
4 | filename: "\\.awk$"
5 | header: "^#!.*bin/(env +)?awk( |$)"
6 |
7 | rules:
8 | - preproc: "\\$[A-Za-z0-9_!@#$*?\\-]+"
9 | - preproc: "\\b(ARGC|ARGIND|ARGV|BINMODE|CONVFMT|ENVIRON|ERRNO|FIELDWIDTHS)\\b"
10 | - preproc: "\\b(FILENAME|FNR|FS|IGNORECASE|LINT|NF|NR|OFMT|OFS|ORS)\\b"
11 | - preproc: "\\b(PROCINFO|RS|RT|RSTART|RLENGTH|SUBSEP|TEXTDOMAIN)\\b"
12 | - identifier.class: "\\b(function|extension|BEGIN|END)\\b"
13 | - symbol.operator: "[\\-+*/%^|!=&<>?;:]|\\\\|\\[|\\]"
14 | - statement: "\\b(for|if|while|do|else|in|delete|exit)\\b"
15 | - special: "\\b(break|continue|return)\\b"
16 | - statement: "\\b(close|getline|next|nextfile|print|printf|system|fflush)\\b"
17 | - statement: "\\b(atan2|cos|exp|int|log|rand|sin|sqrt|srand)\\b"
18 | - statement: "\\b(asort|asorti|gensub|gsub|index|length|match)\\b"
19 | - statement: "\\b(split|sprintf|strtonum|sub|substr|tolower|toupper)\\b"
20 | - statement: "\\b(mktime|strftime|systime)\\b"
21 | - statement: "\\b(and|compl|lshift|or|rshift|xor)\\b"
22 | - statement: "\\b(bindtextdomain|dcgettext|dcngettext)\\b"
23 | - special: "/.*[^\\\\]/"
24 |
25 | - constant.string:
26 | start: "\""
27 | end: "\""
28 | skip: "\\\\."
29 | rules:
30 | - constant.specialChar: "\\\\."
31 |
32 | - constant.string:
33 | start: "'"
34 | end: "'"
35 | skip: "\\\\."
36 | rules:
37 | - constant.specialChar: "\\\\."
38 |
39 | - comment:
40 | start: "#"
41 | end: "$"
42 | rules:
43 | - todo: "(TODO|XXX|FIXME):?"
44 |
45 |
--------------------------------------------------------------------------------
/syntax_files/privoxy-action.yaml:
--------------------------------------------------------------------------------
1 | filetype: privoxy-action
2 |
3 | detect:
4 | filename: "\\.action$"
5 |
6 | rules:
7 | - constant.bool.false: "[{[:space:]]\\-block([[:space:]{}]|$)"
8 | - constant.bool.true: "[{[:space:]]\\+block([[:space:]{}]|$)"
9 | - constant.bool.false: "-(add-header|change-x-forwarded-for|client-header-filter|client-header-tagger|content-type-overwrite|crunch-client-header|crunch-if-none-match|crunch-incoming-cookies|crunch-outgoing-cookies|crunch-server-header|deanimate-gifs|downgrade-http-version|fast-redirects|filter|force-text-mode|forward-override|handle-as-empty-document|handle-as-image|hide-accept-language|hide-content-disposition|hide-from-header|hide-if-modified-since|hide-referrer|hide-user-agent|limit-connect|overwrite-last-modified|prevent-compression|redirect|server-header-filter|server-header-tagger|session-cookies-only|set-image-blocker)"
10 | - constant.bool.true: "\\+(add-header|change-x-forwarded-for|client-header-filter|client-header-tagger|content-type-overwrite|crunch-client-header|crunch-if-none-match|crunch-incoming-cookies|crunch-outgoing-cookies|crunch-server-header|deanimate-gifs|downgrade-http-version|fast-redirects|filter|force-text-mode|forward-override|handle-as-empty-document|handle-as-image|hide-accept-language|hide-content-disposition|hide-from-header|hide-if-modified-since|hide-referrer|hide-user-agent|limit-connect|overwrite-last-modified|prevent-compression|redirect|server-header-filter|server-header-tagger|session-cookies-only|set-image-blocker)"
11 | - constant.specialChar: "\\\\.?"
12 | - comment: "(^|[[:space:]])#([^{].*)?$"
13 | - indent-char.whitespace: "[[:space:]]+$"
14 | - indent-char: " + +| + +"
15 |
--------------------------------------------------------------------------------
/syntax_files/ada.yaml:
--------------------------------------------------------------------------------
1 | filetype: ada
2 |
3 | detect:
4 | filename: "(\\.ads$|\\.adb$|\\.ada$)"
5 |
6 | rules:
7 | # Operators
8 | - symbol.operator: ([.:;,+*|=!?\\%]|<|>|/|-|&)
9 | - symbol.brackets: "[(){}]|\\[|\\]"
10 | # keyword.reserved
11 | - statement.reserved: \b(abort|abs|abstract|accept|access|aliased|all|and|array|at|begin|body|case)\b
12 | - statement.reserved: \b(constant|declare|delay|delta|digits|do|else|elsif|end|entry|exception|exit|for|function)\b
13 | - statement.reserved: \b(generic|goto|if|in|interface|is|limited|loop|mod|new|not|null|of|or|others|out|overriding)\b
14 | - statement.reserved: \b(package|pragma|private|procedure|protected|raise|range|record|rem|renames|return|requeue)\b
15 | - statement.reserved: \b(reverse|select|separate|some|subtype|synchronized|tagged|task|terminate|then|type|until)\b
16 | - statement.reserved: \b(use|when|while|with|xor)\b
17 |
18 | # Constant
19 | - constant.bool: \b(TRUE|FALSE)
20 | - constant.number: ([0-9]+)
21 |
22 | # Storage Types
23 | - type.storage: \b(INTEGER|NATURAL|POSITIVE|FLOAT|CHARACTER|STRING)\b
24 | - type.storage: \b(LONG_INTEGER|SHORT_INTEGER|LONG_FLOAT|SHORT_FLOAT)\b
25 |
26 | #Character
27 | - constant.string.char: \'.\'
28 |
29 | # String
30 | - constant.string:
31 | start: \"
32 | end: \"
33 | skip: \\.
34 | rules:
35 | - constant.specialChar: (\\0|\\\\|\\t|\\n|\\r|\\"|\\')
36 | - constant.interpolation: \\\([[:graph:]]*\)
37 | - constant.unicode: \\u\{[[:xdigit:]]+}
38 |
39 |
40 | # Line Comment
41 | - comment.line: "--.*"
42 |
43 | # Todo
44 | - todo: "(TODO|XXX|FIXME):?"
45 |
--------------------------------------------------------------------------------
/syntax_files/perl6.yaml:
--------------------------------------------------------------------------------
1 | filetype: perl6
2 |
3 | detect:
4 | filename: "(\\.p6$|\\.pl6$|\\.pm6$)"
5 |
6 | rules:
7 | - type: "\\b(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork)|get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join|keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek|seekdir|se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr|y|truncate|umask|un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\\b"
8 | - statement: "\\b(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\\b"
9 | - special: "\\b(has|is|class|role|given|when|BUILD|multi|returns|method|submethod|slurp|say|sub)\\b"
10 | - identifier:
11 | start: "[$@%]"
12 | end: "( |\\\\W|-)"
13 | rules: []
14 |
15 | - constant.string: "\".*\"|qq\\|.*\\|"
16 | - default: "[sm]/.*/"
17 | - preproc:
18 | start: "(^use| = new)"
19 | end: ";"
20 | rules: []
21 |
22 | - comment: "#.*"
23 | - identifier.macro:
24 | start: "<|<=|>=)"
17 |
18 | # Various symbols
19 | - special: "(->|<-)"
20 | - symbol: "\\.|\\$"
21 |
22 | # Data constructors
23 | - constant.bool: "\\b(True|False)\\b"
24 | - constant: "(Nothing|Just|Left|Right|LT|EQ|GT)"
25 |
26 | # Data classes
27 | - identifier.class: "[ ](Read|Show|Enum|Eq|Ord|Data|Bounded|Typeable|Num|Real|Fractional|Integral|RealFrac|Floating|RealFloat|Monad|MonadPlus|Functor)"
28 |
29 | # Strings
30 | - constant.string:
31 | start: "\""
32 | end: "\""
33 | skip: "\\\\."
34 | rules:
35 | - constant.specialChar: "\\\\."
36 |
37 | # Comments
38 | - comment:
39 | start: "--"
40 | end: "$"
41 | rules:
42 | - todo: "(TODO|XXX|FIXME):?"
43 |
44 | - comment:
45 | start: "\\{-"
46 | end: "-\\}"
47 | rules:
48 | - todo: "(TODO|XXX|FIXME):?"
49 |
50 | - identifier.micro: "undefined"
51 |
--------------------------------------------------------------------------------
/syntax_files/solidity.yaml:
--------------------------------------------------------------------------------
1 | filetype: solidity
2 |
3 | detect:
4 | filename: "\\.sol$"
5 |
6 | rules:
7 | - preproc: "\\b(contract|library|pragma)\\b"
8 | - constant.number: "\\b[-]?([0-9]+|0x[0-9a-fA-F]+)\\b"
9 | - identifier: "[a-zA-Z][_a-zA-Z0-9]*[[:space:]]*"
10 | - statement: "\\b(assembly|break|continue|do|for|function|if|else|new|return|returns|while)\\b"
11 | - special: "\\b(\\.send|throw)\\b" # make sure they are very visible
12 | - type.keyword: "\\b(anonymous|constant|indexed|payable|public|private|external|internal)\\b"
13 | - constant: "\\b(block(\\.(blockhash|coinbase|difficulty|gaslimit|number|timestamp))?|msg(\\.(data|gas|sender|value))?|now|tx(\\.(gasprice|origin))?)\\b"
14 | - constant: "\\b(keccak256|sha3|sha256|ripemd160|ecrecover|addmod|mulmod|this|super|selfdestruct|\\.balance)\\b"
15 | - constant: "\\b(true|false)\\b"
16 | - constant: "\\b(wei|szabo|finney|ether|seconds|minutes|hours|days|weeks|years)\\b"
17 | - type: "\\b(address|bool|mapping|string|var|int(\\d*)|uint(\\d*)|byte(\\d*)|fixed(\\d*)|ufixed(\\d*))\\b"
18 | - error: "\\b(abstract|after|case|catch|default|final|in|inline|interface|let|match|null|of|pure|relocatable|static|switch|try|type|typeof|view)\\b"
19 | - operator: "[-+/*=<>!~%?:&|]"
20 | - comment:
21 | start: "//"
22 | end: "$"
23 | rules: []
24 | - comment:
25 | start: "/\\*"
26 | end: "\\*/"
27 | rules: []
28 | - todo: "TODO:?"
29 | - constant.string:
30 | start: "\""
31 | end: "\""
32 | skip: "\\\\."
33 | rules:
34 | - constant.specialChar: "\\\\."
35 | - constant.string:
36 | start: "'"
37 | end: "'"
38 | skip: "\\\\."
39 | rules:
40 | - constant.specialChar: "\\\\."
41 |
42 |
--------------------------------------------------------------------------------
/syntax_files/html.yaml:
--------------------------------------------------------------------------------
1 | filetype: html
2 |
3 | detect:
4 | filename: "\\.htm[l]?$"
5 |
6 | rules:
7 | - error: "<[^!].*?>"
8 | - symbol.tag: "(?i)<[/]?(a(bbr|cronym|ddress|pplet|rea|rticle|side|udio)?|b(ase(font)?|d(i|o)|ig|lockquote|r)?|ca(nvas|ption)|center|cite|co(de|l|lgroup)|d(ata(list)?|d|el|etails|fn|ialog|ir|l|t)|em(bed)?|fieldset|fig(caption|ure)|font|form|(i)?frame|frameset|h[1-6]|hr|i|img|in(put|s)|kbd|keygen|label|legend|li(nk)?|ma(in|p|rk)|menu(item)?|met(a|er)|nav|no(frames|script)|o(l|pt(group|ion)|utput)|p(aram|icture|re|rogress)?|q|r(p|t|uby)|s(trike)?|samp|se(ction|lect)|small|source|span|strong|su(b|p|mmary)|textarea|time|track|u(l)?|var|video|wbr)( .*|>)*?>"
9 | - symbol.tag.extended: "(?i)<[/]?(body|div|html|head(er)?|footer|title|table|t(body|d|h(ead)?|r|foot))( .*)*?>"
10 | - special: "&[^;[[:space:]]]*;"
11 | - symbol: "[:=]"
12 | - identifier: "(alt|bgcolor|height|href|id|label|longdesc|name|on(click|focus|load|mouseover)|size|span|src|target|type|value|width)="
13 | - constant.number: "(?i)#[0-9A-F]{6,6}"
14 | # - default:
15 | # start: ">"
16 | # end: "<"
17 | # rules: []
18 |
19 | - symbol.tag: "<|>"
20 | - constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+"
21 | - comment: ""
22 | - preproc: ""
23 |
24 | - constant.string:
25 | start: "\""
26 | end: "\""
27 | skip: "\\\\."
28 | rules:
29 | - constant.specialChar: "\\\\."
30 |
31 | - default:
32 | start: ""
33 | end: ""
34 | limit-group: symbol.tag
35 | rules:
36 | - include: "javascript"
37 |
38 | - default:
39 | start: ""
40 | end: ""
41 | limit-group: symbol.tag
42 | rules:
43 | - include: "css"
44 |
45 |
--------------------------------------------------------------------------------
/syntax_files/c.yaml:
--------------------------------------------------------------------------------
1 | filetype: c
2 |
3 | detect:
4 | filename: "(\\.(c|C)$|\\.(h|H)$|\\.ii?$|\\.(def)$)"
5 |
6 | rules:
7 | - identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
8 | - type: "\\b(float|double|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline)\\b"
9 | - type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
10 | - type.extended: "\\b(bool)\\b"
11 | - statement: "\\b(volatile|register)\\b"
12 | - statement: "\\b(for|if|while|do|else|case|default|switch)\\b"
13 | - statement: "\\b(goto|continue|break|return)\\b"
14 | - preproc: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
15 | - constant: "'([^'\\\\]|(\\\\[\"'abfnrtv\\\\]))'"
16 | - constant: "'\\\\(([0-3]?[0-7]{1,2}))'"
17 | - constant: "'\\\\x[0-9A-Fa-f]{1,2}'"
18 | # GCC builtins
19 | - statement: "__attribute__[[:space:]]*\\(\\([^)]*\\)\\)"
20 | - statement: "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
21 | # Operator Color
22 | - symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)"
23 | - symbol.brackets: "[(){}]|\\[|\\]"
24 | - constant.number: "(\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b)"
25 | - constant.number: "NULL"
26 |
27 | - constant.string:
28 | start: "\""
29 | end: "\""
30 | skip: "\\\\."
31 | rules:
32 | - constant.specialChar: "\\\\."
33 |
34 | - constant.string:
35 | start: "'"
36 | end: "'"
37 | skip: "\\\\."
38 | rules:
39 | - preproc: "..+"
40 | - constant.specialChar: "\\\\."
41 |
42 | - comment:
43 | start: "//"
44 | end: "$"
45 | rules:
46 | - todo: "(TODO|XXX|FIXME):?"
47 |
48 | - comment:
49 | start: "/\\*"
50 | end: "\\*/"
51 | rules:
52 | - todo: "(TODO|XXX|FIXME):?"
53 |
--------------------------------------------------------------------------------
/syntax_files/elixir.yaml:
--------------------------------------------------------------------------------
1 | filetype: elixir
2 |
3 | detect:
4 | filename: "\\.ex$|\\.exs$"
5 |
6 | rules:
7 | - statement: "\\b(abs|trunc|rem|div|round|max|min|and|or|not|throw|raise|reraise|hd|tl|in|length|elem|put_elem|destructure|to_(string|charlist)|is_(atom|binary|bitstring|boolean|float|function|integer|list|map|nil|number|pid|port|reference|tuple)|(bit|byte|map|tuple)_size|binary_part|def(delegate|exception|guard|guardp|impl|macro|macrop|module|overridable|p|protocol|struct)?|sigil_[crswCRSWDNT]|if|else|unless|cond|binding|node|self|spawn|spawn_link|spawn_monitor|send|exit|struct|get_and_update_in|get_in|put_in|pop_in|update_in|apply|inspect|make_ref|use|do|end)\\b"
8 | - statement: "\\b(alias|import|require|case|fn|receive|after|try|catch|rescue|super|quote|unquote|unquote_splicing|for|with)\\b"
9 |
10 | - constant: "\\b\\[A-Z]+\\b"
11 | - constant.number: "\\b[0-9]+\\b"
12 |
13 | - constant.string: "`[^`]*`|%x\\{[^}]*\\}"
14 | - constant.string: "\"([^\"]|(\\\\\"))*\"|%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\[[^]]*\\]|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!"
15 | - constant.string: "'([^']|(\\\\'))*'|%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!"
16 |
17 | - symbol.brackets: "\\{|\\}|\\[|\\]|\\(|\\)"
18 |
19 | - comment: "#[^{].*$|#$"
20 | - comment.bright: "##[^{].*$|##$"
21 |
22 | - type.keyword: "\\:[a-zA-Z][a-zA-Z0-9_]*"
23 | - type.keyword: "\\b(describe|test)"
24 | - statement: "\\b(expected|assert|assert_raise|assert_in_delta|assert_received|catch_error|catch_throw|flunk|refute|refute_in_delta|refute_received)\\b"
25 | - symbol.tag: "^\\s*\\@[a-zA-Z][a-zA-Z0-9_]*\\b"
26 |
27 | - identifier.macro: "\\b(__CALLER__|__DIR__|__ENV__|__MODULE__|__aliases__|__block__|defmacro)\\b"
28 |
29 | - todo: "(XXX|TODO|FIXME|\\?\\?\\?)"
30 | - preproc.shebang: "\\W*#!.+?( |$)"
31 |
--------------------------------------------------------------------------------
/syntax_files/typescript.yaml:
--------------------------------------------------------------------------------
1 | filetype: typescript
2 |
3 | detect:
4 | filename: "\\.ts$"
5 |
6 | rules:
7 | - constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b"
8 | - constant.number: "\\b[-+]?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"
9 | - constant.number: "\\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
10 | - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]"
11 | - statement: "\\b(abstract|as|async|await|break|case|catch|class|const|constructor|continue)\\b"
12 | - statement: "\\b(debugger|declare|default|delete|do|else|enum|export|extends|finally|for|from)\\b"
13 | - statement: "\\b(function|get|if|implements|import|in|instanceof|interface|is|let|module|namespace)\\b"
14 | - statement: "\\b(new|of|package|private|protected|public|require|return|set|static|super|switch)\\b"
15 | - statement: "\\b(this|throw|try|type|typeof|var|void|while|with|yield)\\b"
16 | - constant: "\\b(false|true|null|undefined|NaN)\\b"
17 | - type: "\\b(Array|Boolean|Date|Enumerator|Error|Function|Math)\\b"
18 | - type: "\\b(Number|Object|RegExp|String|Symbol)\\b"
19 | - type: "\\b(any|boolean|never|number|string|symbol)\\b"
20 | - statement: "[-+/*=<>!~%?:&|]"
21 | - constant: "/[^*]([^/]|(\\\\/))*[^\\\\]/[gim]*"
22 | - constant: "\\\\[0-7][0-7]?[0-7]?|\\\\x[0-9a-fA-F]+|\\\\[bfnrt'\"\\?\\\\]"
23 | - comment:
24 | start: "//"
25 | end: "$"
26 | rules: []
27 | - comment:
28 | start: "/\\*"
29 | end: "\\*/"
30 | rules:
31 | - todo: "TODO:?"
32 | - constant.string:
33 | start: "\""
34 | end: "\""
35 | skip: "\\\\."
36 | rules:
37 | - constant.specialChar: "\\\\."
38 | - constant.string:
39 | start: "'"
40 | end: "'"
41 | skip: "\\\\."
42 | rules:
43 | - constant.specialChar: "\\\\."
44 |
45 |
--------------------------------------------------------------------------------
/syntax_files/perl.yaml:
--------------------------------------------------------------------------------
1 | filetype: perl
2 |
3 | detect:
4 | filename: "\\.p[lm]$"
5 | header: "^#!.*/(env +)?perl( |$)"
6 |
7 | rules:
8 | - type: "\\b(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\\b|\\b(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\\b|\\b(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\\b|\\b(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\\b|\\b(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\\b"
9 | - statement: "\\b(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\\b"
10 |
11 | - special: "\\-\\>"
12 | - symbol: "(,|\\.)"
13 |
14 | - identifier:
15 | start: "[\\$@%]"
16 | end: "\\W"
17 | rules: []
18 |
19 | - constant.string: "\"\\(.*\\)\"|qq?\\|.*\\||qq?\\{.*\\}|qq?\\/.*\\/"
20 | - default: "[sm]/.*/"
21 | - preproc:
22 | start: "(^use| = new)"
23 | end: ";"
24 | rules: []
25 |
26 | - comment:
27 | start: "#"
28 | end: "$"
29 | rules: []
30 |
31 | - comment:
32 | start: "^="
33 | end: "^=cut"
34 | rules: []
35 |
36 | - identifier.macro:
37 | start: "<< 'STOP'"
38 | end: "STOP"
39 | rules: []
40 |
--------------------------------------------------------------------------------
/syntax_files/fsharp.yaml:
--------------------------------------------------------------------------------
1 | filetype: fsharp
2 |
3 | detect:
4 | filename: "\\.fs?$"
5 |
6 | rules:
7 | - identifier: "\\b[A-Z][0-9a-z_]{2,}\\b"
8 | #declarations
9 | - statement: "\\b(let|val|method|in|and|rec|private|virtual|constraint)\\b"
10 | #structure items
11 | - type: "\\b(type|open|class|module|exception|external)\\b"
12 | #patterns
13 | - statement: "\\b(fun|function|functor|match|try|with)\\b"
14 | #patterns-modifiers
15 | - statement: "\\b(as|when|of)\\b"
16 | #conditions
17 | - statement: "\\b(if|then|else)\\b"
18 | #blocs
19 | - type: "\\b(begin|end|object|struct|sig|for|while|do|done|to|downto)\\b"
20 | #constantes
21 | - constant.bool: "\\b(true|false)\\b"
22 | #modules/classes
23 | - special: "\\b(include|inherit|initializer)\\b"
24 | #expr modifiers
25 | - special: "\\b(new|ref|mutable|lazy|assert|raise)\\b"
26 | #keywords which don't exist in ocaml
27 | - type: "\\b(base|delegate|downcast|extern|finally|fixed|global|inline|interface|internal|let!|member|namespace|null|override|private|public)\\b"
28 | - type: "\\b(return|return!|select|static|upcast|use|use!|void|yield|yield!)\\b"
29 | - constant.string:
30 | start: "'"
31 | end: "'"
32 | skip: "\\\\."
33 | rules:
34 | - constant.specialChar: "%."
35 | - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
36 | - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
37 | - constant.string:
38 | start: "\""
39 | end: "\""
40 | skip: "\\\\."
41 | rules:
42 | - constant.specialChar: "%."
43 | - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
44 | - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
45 | - comment:
46 | start: "\\(\\*"
47 | end: "\\*\\)"
48 | rules: []
49 |
--------------------------------------------------------------------------------
/syntax_files/rpmspec.yaml:
--------------------------------------------------------------------------------
1 | filetype: rpmspec
2 |
3 | detect:
4 | filename: "\\.spec$|\\.rpmspec$"
5 |
6 | rules:
7 | - preproc: "\\b(Icon|ExclusiveOs|ExcludeOs):"
8 | - preproc: "\\b(BuildArch|BuildArchitectures|ExclusiveArch|ExcludeArch):"
9 | - preproc: "\\b(Conflicts|Obsoletes|Provides|Requires|Requires\\(.*\\)|Enhances|Suggests|BuildConflicts|BuildRequires|Recommends|PreReq|Supplements):"
10 | - preproc: "\\b(Epoch|Serial|Nosource|Nopatch):"
11 | - preproc: "\\b(AutoReq|AutoProv|AutoReqProv):"
12 | - preproc: "\\b(Copyright|License|Summary|Summary\\(.*\\)|Distribution|Vendor|Packager|Group|Source[0-9]*|Patch[0-9]*|BuildRoot|Prefix):"
13 | - preproc: "\\b(Name|Version|Release|Url|URL):"
14 | - preproc:
15 | start: "^(Source|Patch)"
16 | end: ":"
17 | rules: []
18 |
19 | - preproc: "(i386|i486|i586|i686|athlon|ia64|alpha|alphaev5|alphaev56|alphapca56|alphaev6|alphaev67|sparc|sparcv9|sparc64armv3l|armv4b|armv4lm|ips|mipsel|ppc|ppc|iseries|ppcpseries|ppc64|m68k|m68kmint|Sgi|rs6000|i370|s390x|s390|noarch)"
20 | - preproc: "(ifarch|ifnarch|ifos|ifnos)"
21 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
22 | - statement: "%(if|else|endif|define|global|undefine)"
23 | - statement: "%_?([A-Z_a-z_0-9_]*)"
24 | - statement:
25 | start: "%\\{"
26 | end: "\\}"
27 | rules: []
28 |
29 | - statement:
30 | start: "%\\{__"
31 | end: "\\}"
32 | rules: []
33 |
34 | - statement: "\\$(RPM_BUILD_ROOT)\\>"
35 | - special: "^%(build$|changelog|check$|clean$|description)"
36 | - special: "^%(files|install$|package|prep$)"
37 | - special: "^%(pre|preun|pretrans|post|postun|posttrans)"
38 | - special: "^%(trigger|triggerin|triggerpostun|triggerun|verifyscript)"
39 | - comment: "(^|[[:space:]])#([^{].*)?$"
40 | - constant: "^\\*.*$"
41 | - indent-char.whitespace: "[[:space:]]+$"
42 | - indent-char: " + +| + +"
43 | - todo: "TODO:?"
44 |
--------------------------------------------------------------------------------
/syntax_files/go.yaml:
--------------------------------------------------------------------------------
1 | filetype: go
2 |
3 | detect:
4 | filename: "\\.go$"
5 |
6 | rules:
7 | # Conditionals and control flow
8 | - special: "\\b(break|case|continue|default|go|goto|range|return)\\b"
9 | - statement: "\\b(else|for|if|switch)\\b"
10 | - preproc: "\\b(package|import|const|var|type|struct|func|go|defer|iota)\\b"
11 | - symbol.operator: "[-+/*=<>!~%&|^]|:="
12 |
13 | # Types
14 | - symbol: "(,|\\.)"
15 | - type: "\\b(u?int(8|16|32|64)?|float(32|64)|complex(64|128))\\b"
16 | - type: "\\b(uintptr|byte|rune|string|interface|bool|map|chan|error)\\b"
17 | - type.keyword: "\\b(struct)\\b"
18 | - constant.bool: "\\b(true|false|nil)\\b"
19 |
20 | # Brackets
21 | - symbol.brackets: "(\\{|\\})"
22 | - symbol.brackets: "(\\(|\\))"
23 | - symbol.brackets: "(\\[|\\])"
24 |
25 | # Numbers and strings
26 | - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'"
27 |
28 | - constant.string:
29 | start: "\""
30 | end: "\""
31 | skip: "\\\\."
32 | rules:
33 | - constant.specialChar: "%."
34 | - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
35 | - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
36 |
37 | - constant.string:
38 | start: "'"
39 | end: "'"
40 | skip: "\\\\."
41 | rules:
42 | - error: "..+"
43 | - constant.specialChar: "%."
44 | - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
45 | - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
46 |
47 | - constant.string:
48 | start: "`"
49 | end: "`"
50 | rules: []
51 |
52 | - comment:
53 | start: "//"
54 | end: "$"
55 | rules:
56 | - todo: "(TODO|XXX|FIXME):?"
57 |
58 | - comment:
59 | start: "/\\*"
60 | end: "\\*/"
61 | rules:
62 | - todo: "(TODO|XXX|FIXME):?"
63 |
--------------------------------------------------------------------------------
/syntax_files/pascal.yaml:
--------------------------------------------------------------------------------
1 | filetype: pascal
2 |
3 | detect:
4 | filename: "\\.pas$"
5 |
6 | rules:
7 | - type: "\\b(?i:(string|ansistring|widestring|shortstring|char|ansichar|widechar|boolean|byte|shortint|word|smallint|longword|cardinal|longint|integer|int64|single|currency|double|extended))\\b"
8 | - statement: "\\b(?i:(and|asm|array|begin|break|case|const|constructor|continue|destructor|div|do|downto|else|end|file|for|function|goto|if|implementation|in|inline|interface|label|mod|not|object|of|on|operator|or|packed|procedure|program|record|repeat|resourcestring|set|shl|shr|then|to|type|unit|until|uses|var|while|with|xor))\\b"
9 | - statement: "\\b(?i:(as|class|dispose|except|exit|exports|finalization|finally|inherited|initialization|is|library|new|on|out|property|raise|self|threadvar|try))\\b"
10 | - statement: "\\b(?i:(absolute|abstract|alias|assembler|cdecl|cppdecl|default|export|external|forward|generic|index|local|name|nostackframe|oldfpccall|override|pascal|private|protected|public|published|read|register|reintroduce|safecall|softfloat|specialize|stdcall|virtual|write))\\b"
11 | - constant: "\\b(?i:(false|true|nil))\\b"
12 | - special:
13 | start: "asm"
14 | end: "end"
15 | rules: []
16 | - constant.number: "\\$[0-9A-Fa-f]+"
17 | - constant.number: "\\b[+-]?[0-9]+([.]?[0-9]+)?(?i:e[+-]?[0-9]+)?"
18 | - constant.string:
19 | start: "#[0-9]{1,}"
20 | end: "$"
21 | rules:
22 | - constant.specialChar: "\\\\."
23 | - constant.string:
24 | start: "'"
25 | end: "'"
26 | skip: "\\\\."
27 | rules:
28 | - constant.specialChar: "\\\\."
29 | - preproc:
30 | start: "{\\$"
31 | end: "}"
32 | rules: []
33 | - comment:
34 | start: "//"
35 | end: "$"
36 | rules: []
37 | - comment:
38 | start: "\\(\\*"
39 | end: "\\*\\)"
40 | rules: []
41 | - comment:
42 | start: "({)(?:[^$])"
43 | end: "}"
44 | rules: []
45 |
46 |
--------------------------------------------------------------------------------
/syntax_files/z80.yaml:
--------------------------------------------------------------------------------
1 | filetype: gbz80
2 |
3 | detect:
4 | filename: "\\.(z80|gbz80)$"
5 |
6 | rules:
7 | ## Based on rgbasm(5) and gbz80(7) man pages
8 | ## Instructions
9 | # Arithmetic & logic
10 | - statement: "\\b(?i)(adc|add|and|cp|dec|inc|or|sbc|sub|xor)(?-i)\\b"
11 | # Bits
12 | - statement: "\\b(?i)(bit|res|rl|rlc|rr|rrc|set|sla|sra|srl|swap)(?-i)\\b"
13 | # Jumps and subroutines
14 | - statement: "\\b(?i)(call|jp|jr|ret|rst)(?-i)\\b"
15 | # Stack operations (and ld because it doesn't fit anywhere else)
16 | - statement: "\\b(?i)(ld|pop|push)(?-i)\\b"
17 | # Misc
18 | - statement: "\\b(?i)(ccf|cpl|daa|di|ei|halt|nop|scf|stop)(?-i)\\b"
19 |
20 | ## Registers
21 | # 8-bit
22 | - identifier: "\\b(?i)(a|b|c|d|e|h|l)(?-i)\\b"
23 | # 16-bit
24 | - identifier: "\\b(?i)(af|bc|de|hl|sp)(?-i)\\b"
25 |
26 | ## Constants
27 | # Number
28 | - constant.number: "\\b($|&|%|`)?[0-9A-Fa-f]+\\b"
29 | # Label
30 | - identifier: "[a-zA-Z0-9._]+:"
31 |
32 | - constant.string:
33 | start: "\""
34 | end: "\""
35 | skip: "\\\\."
36 | rules:
37 | - constant.specialChar: "\\\\."
38 |
39 | - constant.string:
40 | start: "'"
41 | end: "'"
42 | skip: "\\\\."
43 | rules:
44 | - constant.specialChar: "\\\\."
45 |
46 | ## Preprocessor
47 | # Ball of tar that contains everything except a few functions
48 | - preproc: "\\b(?i)(db|dw|ds|section|equ|equs|set|pops|pushs|macro|endm|rsset|rsreset|rb|rw|shift|export|global|purge|incbin|union|nextu|endu|printt|printi|printv|printf|rept|endr|fail|warn|include|if|elif|else|endc|charmap)(?-i)\\b"
49 |
50 | ## Comments
51 | # Classic asm ;-style
52 | - comment:
53 | start: ";"
54 | end: "$"
55 | rules:
56 | - todo: "(TODO|XXX|FIXME):?"
57 | # rgbasm *-style
58 | - comment:
59 | start: "^\\*"
60 | end: "$"
61 | rules:
62 | - todo: "(TODO|XXX|FIXME):?"
63 |
64 |
--------------------------------------------------------------------------------
/syntax_files/crystal.yaml:
--------------------------------------------------------------------------------
1 | filetype: crystal
2 |
3 | detect:
4 | filename: "\\.cr$"
5 |
6 | rules:
7 | # Asciibetical list of reserved words
8 | - statement: "\\b(BEGIN|END|abstract|alias|and|begin|break|case|class|def|defined\\?|do|else|elsif|end|ensure|enum|false|for|fun|if|in|include|lib|loop|macro|module|next|nil|not|of|or|pointerof|private|protected|raise|redo|require|rescue|retry|return|self|sizeof|spawn|struct|super|then|true|type|undef|union|uninitialized|unless|until|when|while|yield)\\b"
9 | # Constants
10 | - constant: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*"
11 | - constant.number: "\\b[0-9]+\\b"
12 | # Crystal "symbols"
13 | - constant: "([ ]|^):[0-9A-Z_]+\\b"
14 | # Some unique things we want to stand out
15 | - constant: "\\b(__FILE__|__LINE__)\\b"
16 | # Regular expressions
17 | - constant: "/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*"
18 |
19 | # Shell command expansion is in `backticks` or like %x{this}. These are
20 | # "double-quotish" (to use a perlism).
21 | - constant.string: "`[^`]*`|%x\\{[^}]*\\}"
22 |
23 | - constant.string:
24 | start: "`"
25 | end: "`"
26 | rules: []
27 |
28 | - constant.string:
29 | start: "%x\\{"
30 | end: "\\}"
31 | rules: []
32 |
33 | - constant.string:
34 | start: "\""
35 | end: "\""
36 | skip: "\\\\."
37 | rules:
38 | - constant.specialChar: "\\\\."
39 | - special: "#\\{[^}]*\\}"
40 |
41 | - constant.string:
42 | start: "'"
43 | end: "'"
44 | skip: "\\\\."
45 | rules:
46 | - constant.specialChar: "\\\\."
47 |
48 | - comment:
49 | start: "#"
50 | end: "$"
51 | rules:
52 | - todo: "(TODO|XXX|FIXME):?"
53 |
54 | - comment.bright:
55 | start: "##"
56 | end: "$"
57 | rules:
58 | - todo: "(TODO|XXX|FIXME):?"
59 |
60 | - constant:
61 | start: "<<-?'?EOT'?"
62 | end: "^EOT"
63 | rules: []
64 |
65 |
--------------------------------------------------------------------------------
/syntax_files/cpp.yaml:
--------------------------------------------------------------------------------
1 | filetype: c++
2 |
3 | detect:
4 | filename: "(\\.c(c|pp|xx)$|\\.h(h|pp|xx)$|\\.ii?$|\\.(def)$)"
5 |
6 | rules:
7 |
8 | - identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
9 | - type: "\\b(auto|float|double|bool|char|int|short|long|sizeof|enum|void|static|const|constexpr|struct|union|typedef|extern|(un)?signed|inline)\\b"
10 | - type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
11 | - statement: "\\b(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\\b"
12 | - statement: "\\b(for|if|while|do|else|case|default|switch)\\b"
13 | - statement: "\\b(try|throw|catch|operator|new|delete)\\b"
14 | - statement: "\\b(goto|continue|break|return)\\b"
15 | - preproc: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
16 | - constant: "('([^'\\\\]|(\\\\[\"'abfnrtv\\\\]))'|'\\\\(([0-3]?[0-7]{1,2}))'|'\\\\x[0-9A-Fa-f]{1,2}')"
17 |
18 | # GCC builtins
19 | - statement: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__)"
20 |
21 | # Operator Color
22 | - symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)"
23 | # Parenthetical Color
24 | - symbol.brackets: "[(){}]|\\[|\\]"
25 |
26 | - constant.number: "(\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b)"
27 | - constant.bool: "(\\b(true|false)\\b|NULL)"
28 |
29 | - constant.string:
30 | start: "\""
31 | end: "\""
32 | skip: "\\\\."
33 | rules:
34 | - constant.specialChar: "\\\\."
35 |
36 | - constant.string:
37 | start: "'"
38 | end: "'"
39 | skip: "\\\\."
40 | rules:
41 | - preproc: "..+"
42 | - constant.specialChar: "\\\\."
43 |
44 | - comment:
45 | start: "//"
46 | end: "$"
47 | rules:
48 | - todo: "(TODO|XXX|FIXME):?"
49 |
50 | - comment:
51 | start: "/\\*"
52 | end: "\\*/"
53 | rules:
54 | - todo: "(TODO|XXX|FIXME):?"
55 |
56 |
--------------------------------------------------------------------------------
/syntax_files/kotlin.yaml:
--------------------------------------------------------------------------------
1 | filetype: kotlin
2 |
3 | detect:
4 | filename: "\\.kt$"
5 |
6 | rules:
7 |
8 | # Operators
9 | - symbol.operator: ([.:;,+*|=!?\\%]|<|>|/|-|&)
10 |
11 | # Statements Keywords
12 | - statement: \b(as|by|class|constructor|companion|fun|import|in|infix|interface|inline|is|out|operator|package|return|suspend|super|this|when|val|var)\b
13 | - statement.properties: \b(get|set)\b
14 | - statement.control: \b(break|continue|else|do|if|try|catch|finally|for|while)\b
15 | - statement.class: \b(abstract|annotation|data|enum|final|open|sealed)\b
16 | - statement.member: \b(override|lateinit|init)\b
17 | - statement.access: \b(internal|private|protected|public)\b
18 | - statement.parameter: \b(crossinline|noinline|reified|vararg)\b
19 |
20 | # Expression and types
21 | - type: \b(dynamic|object|throw|typealias|typeof)\b
22 |
23 | # Meta
24 | - statement.meta: \@(\bfile|delegate|field|get|property|receiver|set|setparam|param|)\b
25 |
26 | # Constant
27 | - constant: \b(true|false|null)
28 | - constant.number: ([0-9]+)
29 |
30 | # Storage Types
31 | - type.storage: \b(Byte|Char|Double|Float|Int|Long|Short|Boolean|Unit|Nothing)\b
32 |
33 | # Collections
34 | - type.collections: \b(Array)\b
35 |
36 | # String
37 | - constant.string:
38 | start: \"
39 | end: \"
40 | skip: \\.
41 | rules:
42 | - constant.specialChar: (\\0|\\\\|\\t|\\n|\\r|\\"|\\')
43 | - constant.unicode: \\u\{[[:xdigit:]]+}
44 |
45 | # Shebang Line
46 | - comment.shebang: ^(#!).*
47 |
48 | # Line Comment
49 | - comment.line: "//.*"
50 |
51 | # Block Comment
52 | - comment.block:
53 | start: "/\\*"
54 | end: "\\*/"
55 | rules:
56 | - todo: "(TODO|XXX|FIXME):?"
57 |
58 | # Doc Block Comment
59 | - comment.block:
60 | start: "/\\*\\*"
61 | end: "\\*/"
62 | rules:
63 | - todo: "(TODO|XXX|FIXME):?"
64 |
65 | # Todo
66 | - todo: "(TODO|XXX|FIXME):?"
--------------------------------------------------------------------------------
/syntax_files/sh.yaml:
--------------------------------------------------------------------------------
1 | filetype: shell
2 |
3 | detect:
4 | filename: "(\\.sh$|\\.bash|\\.ash|\\.bashrc|bashrc|\\.bash_aliases|bash_aliases|\\.bash_functions|bash_functions|\\.bash_profile|bash_profile|\\.profile|profile|Pkgfile|pkgmk.conf|profile|rc.conf|PKGBUILD|.ebuild\\$|APKBUILD)"
5 | header: "^#!.*/(env +)?(ba)?(a)?sh( |$)"
6 |
7 | rules:
8 | # Numbers
9 | - constant.number: "\\b[0-9]+\\b"
10 | # Conditionals and control flow
11 | - statement: "\\b(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\\b"
12 | - special: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|!|=|&|\\|)"
13 | # Shell commands
14 | - type: "\\b(cd|echo|export|let|set|umask|unset)\\b"
15 | # Common linux commands
16 | - type: "\\b((g|ig)?awk|bash|dash|find|\\w{0,4}grep|kill|killall|\\w{0,4}less|make|pkill|sed|sh|tar)\\b"
17 | # Coreutils commands
18 | - type: "\\b(base64|basename|cat|chcon|chgrp|chmod|chown|chroot|cksum|comm|cp|csplit|cut|date|dd|df|dir|dircolors|dirname|du|env|expand|expr|factor|false|fmt|fold|head|hostid|id|install|join|link|ln|logname|ls|md5sum|mkdir|mkfifo|mknod|mktemp|mv|nice|nl|nohup|nproc|numfmt|od|paste|pathchk|pinky|pr|printenv|printf|ptx|pwd|readlink|realpath|rm|rmdir|runcon|seq|(sha1|sha224|sha256|sha384|sha512)sum|shred|shuf|sleep|sort|split|stat|stdbuf|stty|sum|sync|tac|tail|tee|test|time|timeout|touch|tr|true|truncate|tsort|tty|uname|unexpand|uniq|unlink|users|vdir|wc|who|whoami|yes)\\b"
19 | # Conditional flags
20 | - statement: "--[a-z-]+"
21 | - statement: "\\ -[a-z]+"
22 |
23 | - identifier: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?"
24 | - identifier: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?"
25 |
26 | - constant.string:
27 | start: "\""
28 | end: "\""
29 | skip: "\\\\."
30 | rules:
31 | - constant.specialChar: "\\\\."
32 |
33 | - constant.string:
34 | start: "'"
35 | end: "'"
36 | rules: []
37 |
38 | - comment:
39 | start: "(^|\\s)#"
40 | end: "$"
41 | rules:
42 | - todo: "(TODO|XXX|FIXME):?"
43 |
44 |
--------------------------------------------------------------------------------
/syntax_files/csharp.yaml:
--------------------------------------------------------------------------------
1 | filetype: csharp
2 |
3 | detect:
4 | filename: "\\.cs$"
5 |
6 | rules:
7 | # Class
8 | - identifier.class: "class +[A-Za-z0-9]+ *((:) +[A-Za-z0-9.]+)?"
9 |
10 | # Annotation
11 | - identifier.var: "@[A-Za-z]+"
12 |
13 | - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[()]"
14 | - type: "\\b(bool|byte|sbyte|char|decimal|double|float|IntPtr|int|uint|long|ulong|object|short|ushort|string|base|this|var|void)\\b"
15 | - statement: "\\b(alias|as|case|catch|checked|default|do|dynamic|else|finally|fixed|for|foreach|goto|if|is|lock|new|null|return|switch|throw|try|unchecked|while)\\b"
16 | - statement: "\\b(abstract|async|class|const|delegate|enum|event|explicit|extern|get|implicit|in|internal|interface|namespace|operator|out|override|params|partial|private|protected|public|readonly|ref|sealed|set|sizeof|stackalloc|static|struct|typeof|unsafe|using|value|virtual|volatile|yield)\\b"
17 | # LINQ-only keywords (ones that cannot be used outside of a LINQ query - lots others can)
18 | - statement: "\\b(from|where|select|group|info|orderby|join|let|in|on|equals|by|ascending|descending)\\b"
19 | - special: "\\b(break|continue)\\b"
20 | - constant.bool: "\\b(true|false)\\b"
21 | - symbol.operator: "[\\-+/*=<>?:!~%&|]"
22 | - constant.number: "\\b([0-9._]+|0x[A-Fa-f0-9_]+|0b[0-1_]+)[FL]?\\b"
23 |
24 | - constant.string:
25 | start: "\""
26 | end: "\""
27 | skip: "\\\\."
28 | rules:
29 | - constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
30 | - constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
31 |
32 | - constant.string:
33 | start: "'"
34 | end: "'"
35 | skip: "\\\\."
36 | rules:
37 | - constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
38 | - constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
39 |
40 | - comment:
41 | start: "//"
42 | end: "$"
43 | rules:
44 | - todo: "(TODO|XXX|FIXME):?"
45 |
46 | - comment:
47 | start: "/\\*"
48 | end: "\\*/"
49 | rules:
50 | - todo: "(TODO|XXX|FIXME):?"
51 |
52 |
--------------------------------------------------------------------------------
/gomacs.1.in:
--------------------------------------------------------------------------------
1 | .\" https://linux.die.net/man/7/groff_mdoc
2 | .Dd $Mdocdate: July 10 2017 $
3 | .Dt GOMACS 1
4 | .Os
5 | .Sh NAME
6 | .Nm gomacs
7 | .Nd emacs-like text editor
8 | .Sh SYNOPSIS
9 | .Nm
10 | .Op Fl dDs
11 | .Op Fl cpuprofile Ns = Ns Ar file
12 | .Op Ar
13 | .Sh DESCRIPTION
14 | .Nm
15 | is an emacs-like text editor. It accepts most of the standard emacs bindings,
16 | and supports a good subset of GNU Emacs commands. The reasoning behind its
17 | creation is a recognition of how emacsen generally do not conform to the
18 | vim-philosophy of leaning on the shell with short editor sessions broken up by
19 | lots of shell editing. In the design and implementation of
20 | .Nm
21 | much care has been taken towards making an editor that performs well in the
22 | terminal while using emacs bindings, having usable defaults, and being as
23 | intuitive as possible.
24 | .Sh OPTIONS
25 | .Pp
26 | .Bl -tag -width xx
27 | .It Fl s
28 | Disable syntax highlighting. Syntax files are still loaded, for major mode
29 | support.
30 | .It Fl d
31 | Enable dumping of crash logs.
32 | .It Fl D
33 | Dump default keybindings to stdout and exit immediately.
34 | .It Fl cpuprofile Ns = Ns Ar file
35 | Write a cpu profile out to given file.
36 | .Sh KEYBINDINGS
37 | These are the default keybindings; they can be overridden (see the
38 | .Sx FILES
39 | section below)
40 | .Pp
41 | .Bl -tag -width xxxxxxxxxxxx -offset indent -compact
42 | <>
43 | .El
44 | .Pp
45 | .Sh FILES
46 | .Bl -tag -width ~/.config/japanoise/gomacs/rc.zy -compact
47 | .It Pa ~/.config/japanoise/gomacs/rc.zy
48 | rc file.
49 | .Nm
50 | will execute all lisp code in this file on startup. If XDG_CONFIG_HOME is set,
51 | .Nm
52 | will look there instead of ~/.config for the rc file.
53 | .El
54 | .Sh BUGS
55 | Please report all bugs to me at the upstream repository:
56 | https://github.com/japanoise/gomacs
57 | .Sh AUTHOR
58 | .Nm
59 | by japanoise/chameleon and ixtenu, with a lot of indirect help from Zachary
60 | Yedidia et al (the authors of Micro and highlight) and nsf, the author of
61 | termbox and godit.
62 | .Sh COPYRIGHT
63 | .Nm
64 | is Copyright © 2017-2022 japanoise/chameleon, Copyright 2022 ixtenu, licensed
65 | under the MIT license.
66 |
--------------------------------------------------------------------------------
/syntax_files/fish.yaml:
--------------------------------------------------------------------------------
1 | filetype: fish
2 |
3 | detect:
4 | filename: "\\.fish$"
5 | header: "^#!.*/(env +)?fish( |$)"
6 |
7 | rules:
8 | # Numbers
9 | - constant: "\\b[0-9]+\\b"
10 |
11 | # Conditionals and control flow
12 | - statement: "\\b(and|begin|break|case|continue|else|end|for|function|if|in|not|or|return|select|shift|switch|while)\\b"
13 | - special: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|^|!|=|&|\\|)"
14 |
15 | # Fish commands
16 | - type: "\\b(bg|bind|block|breakpoint|builtin|cd|count|command|commandline|complete|dirh|dirs|echo|emit|eval|exec|exit|fg|fish|fish_config|fish_ident|fish_pager|fish_prompt|fish_right_prompt|fish_update_completions|fishd|funced|funcsave|functions|help|history|jobs|math|mimedb|nextd|open|popd|prevd|psub|pushd|pwd|random|read|set|set_color|source|status|string|trap|type|ulimit|umask|vared)\\b"
17 |
18 | # Common linux commands
19 | - type: "\\b((g|ig)?awk|bash|dash|find|\\w{0,4}grep|kill|killall|\\w{0,4}less|make|pkill|sed|sh|tar)\\b"
20 |
21 | # Coreutils commands
22 | - type: "\\b(base64|basename|cat|chcon|chgrp|chmod|chown|chroot|cksum|comm|cp|csplit|cut|date|dd|df|dir|dircolors|dirname|du|env|expand|expr|factor|false|fmt|fold|head|hostid|id|install|join|link|ln|logname|ls|md5sum|mkdir|mkfifo|mknod|mktemp|mv|nice|nl|nohup|nproc|numfmt|od|paste|pathchk|pinky|pr|printenv|printf|ptx|pwd|readlink|realpath|rm|rmdir|runcon|seq|(sha1|sha224|sha256|sha384|sha512)sum|shred|shuf|sleep|sort|split|stat|stdbuf|stty|sum|sync|tac|tail|tee|test|time|timeout|touch|tr|true|truncate|tsort|tty|uname|unexpand|uniq|unlink|users|vdir|wc|who|whoami|yes)\\b"
23 |
24 | # Conditional flags
25 | - statement: "--[a-z-]+"
26 | - statement: "\\ -[a-z]+"
27 |
28 | - identifier: "(?i)\\$\\{?[0-9A-Z_!@#$*?-]+\\}?"
29 |
30 | - constant.string:
31 | start: "\""
32 | end: "\""
33 | skip: "\\\\."
34 | rules:
35 | - constant.specialChar: "\\\\."
36 |
37 | - constant.string:
38 | start: "'"
39 | end: "'"
40 | skip: "\\\\."
41 | rules: []
42 |
43 | - comment:
44 | start: "#"
45 | end: "$"
46 | rules:
47 | - todo: "(TODO|XXX|FIXME):?"
48 |
49 |
--------------------------------------------------------------------------------
/syntax_files/tcl.yaml:
--------------------------------------------------------------------------------
1 | filetype: tcl
2 |
3 | detect:
4 | filename: "\\.tcl$"
5 | header: "^#!.*/(env +)?tclsh( |$)"
6 |
7 | rules:
8 | - statement: "\\b(after|append|array|auto_execok|auto_import|auto_load|auto_load_index|auto_qualify|binary|break|case|catch|cd|clock|close|concat|continue|else|elseif|encoding|eof|error|eval|exec|exit|expr|fblocked|fconfigure|fcopy|file|fileevent|flush|for|foreach|format|gets|glob|global|history|if|incr|info|interp|join|lappend|lindex|linsert|list|llength|load|lrange|lreplace|lsearch|lset|lsort|namespace|open|package|pid|puts|pwd|read|regexp|regsub|rename|return|scan|seek|set|socket|source|split|string|subst|switch|tclLog|tell|time|trace|unknown|unset|update|uplevel|upvar|variable|vwait|while)\\b"
9 | - statement: "\\b(array anymore|array donesearch|array exists|array get|array names|array nextelement|array set|array size|array startsearch|array statistics|array unset)\\b"
10 | - statement: "\\b(string bytelength|string compare|string equal|string first|string index|string is|string last|string length|string map|string match|string range|string repeat|string replace|string to|string tolower|string totitle|string toupper|string trim|string trimleft|string trimright|string will|string wordend|string wordstart)\\b"
11 | - statement: "\\b(alarm|auto_load_pkg|bsearch|catclose|catgets|catopen|ccollate|cconcat|cequal|chgrp|chmod|chown|chroot|cindex|clength|cmdtrace|commandloop|crange|csubstr|ctoken|ctype|dup|echo|execl|fcntl|flock|fork|fstat|ftruncate|funlock|host_info|id|infox|keyldel|keylget|keylkeys|keylset|kill|lassign|lcontain|lempty|lgets|link|lmatch|loadlibindex|loop|lvarcat|lvarpop|lvarpush|max|min|nice|pipe|profile|random|readdir|replicate|scancontext|scanfile|scanmatch|select|server_accept|server_create|signal|sleep|sync|system|tclx_findinit|tclx_fork|tclx_load_tndxs|tclx_sleep|tclx_system|tclx_wait|times|translit|try_eval|umask|wait)\\b"
12 | - identifier.class: "proc[[:space:]]|(\\{|\\})"
13 | - symbol.operator: "(\\(|\\)|\\;|`|\\\\|\\$|<|>|!|=|&|\\|)"
14 | - constant.number: "\\b[0-9]+(\\.[0-9]+)?\\b"
15 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
16 | - identifier.var: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?"
17 | - comment: "(^|;)[[:space:]]*#.*"
18 | - indent-char.whitespace: "[[:space:]]+$"
19 |
--------------------------------------------------------------------------------
/syntax_files/javascript.yaml:
--------------------------------------------------------------------------------
1 | filetype: javascript
2 |
3 | detect:
4 | filename: "(\\.js$|\\.es[5678]?$|\\.mjs$)"
5 | header: "^#!.*/(env +)?node( |$)"
6 |
7 | rules:
8 | - constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b"
9 | - constant.number: "\\b[-+]?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"
10 | - constant.number: "\\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
11 | - identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]"
12 | - symbol.brackets: "(\\{|\\})"
13 | - symbol.brackets: "(\\(|\\))"
14 | - symbol.brackets: "(\\[|\\])"
15 | - symbol.brackets: "(\\{|\\})"
16 | - symbol.brackets: "(\\(|\\))"
17 | - symbol.brackets: "(\\[|\\])"
18 | - symbol.operator: "[-+/*=<>!~%?:&|]"
19 | - statement: "\\b(async|await|break|case|catch|const|continue|debugger|default|delete|do|else|export|finally)\\b"
20 | - statement: "\\b(for|function|class|extends|get|if|import|from|in|of|instanceof|let|new|return|set)\\b"
21 | - statement: "\\b(super|switch|this|throw|try|typeof|var|void|while|with|yield)\\b"
22 | # reserved but unassigned
23 | - error: "\\b(enum|implements|interface|package|private|protected|public|TODO)"
24 | - constant: "\\b(null|undefined|NaN)\\b"
25 | - constant: "\\b(true|false)\\b"
26 | - type: "\\b(Array|Boolean|Date|Enumerator|Error|Function|Math)\\b"
27 | - type: "\\b(Number|Object|RegExp|String)\\b"
28 | # - constant: "/[^*]([^/]|(\\\\/))*[^\\\\]/[gim]*"
29 | - constant: "\\\\[0-7][0-7]?[0-7]?|\\\\x[0-9a-fA-F]+|\\\\[bfnrt'\"\\?\\\\]"
30 | - comment: "^#!.*/(env +)?node( |$)"
31 |
32 |
33 | - constant.string:
34 | start: "\""
35 | end: "\""
36 | skip: "\\\\."
37 | rules:
38 | - constant.specialChar: "\\\\."
39 |
40 | - constant.string:
41 | start: "'"
42 | end: "'"
43 | skip: "\\\\."
44 | rules:
45 | - constant.specialChar: "\\\\."
46 |
47 | - constant.string:
48 | start: "`"
49 | end: "`"
50 | rules:
51 | - constant.specialChar: "\\\\."
52 |
53 | - comment:
54 | start: "//"
55 | end: "$"
56 | rules: []
57 |
58 | - comment:
59 | start: "/\\*"
60 | end: "\\*/"
61 | rules: []
62 |
63 |
--------------------------------------------------------------------------------
/syntax_files/zsh.yaml:
--------------------------------------------------------------------------------
1 | filetype: zsh
2 |
3 | detect:
4 | filename: "(\\.zsh$|\\.?(zshenv|zprofile|zshrc|zlogin|zlogout)$)"
5 | header: "^#!.*/(env +)?zsh( |$)"
6 |
7 | rules:
8 | ## Numbers
9 | - constant.number: "\\b[0-9]+\\b"
10 |
11 | ## Conditionals and control flow
12 | - statement: "\\b(always|break|bye|case|continue|disown|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\\b"
13 |
14 | - statement: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|!|=|&|\\|)"
15 | ## Conditional flags
16 | - special: "-[Ldefgruwx]\\b"
17 | - special: "-(eq|ne|gt|lt|ge|le|s|n|z)\\b"
18 |
19 | ## Bash-inherited
20 | - statement: "\\b((un)?alias|bindkey|builtin|cd|declare|eval|exec|export|jobs|let|popd|pushd|set|source|typeset|umask|unset)\\b"
21 | ## ZSH-specific
22 | - type: "\\b(add-zsh-hook|autoload|chdir|compinit|dirs|(dis|en)able|echotc|emulate|print|prompt(init)?|(un)?setopt|zle|zmodload|zstyle|whence)\\b"
23 |
24 | ## Common linux commands
25 | - statement: "\\b((g|ig)?awk|find|\\w{0,4}grep|kill|killall|\\w{0,4}less|make|pkill|sed|tar)\\b"
26 |
27 | ## Coreutils commands
28 | - statement: "\\b(base64|basename|cat|chcon|chgrp|chmod|chown|chroot|cksum|comm|cp|csplit|cut|date|dd|df|dir|dircolors|dirname|du|echo|env|expand|expr|factor|false|fmt|fold|head|hostid|id|install|join|link|ln|logname|ls|md5sum|mkdir|mkfifo|mknod|mktemp|mv|nice|nl|nohup|nproc|numfmt|od|paste|pathchk|pinky|pr|printenv|printf|ptx|pwd|readlink|realpath|rm|rmdir|runcon|seq|(sha1|sha224|sha256|sha384|sha512)sum|shred|shuf|sleep|sort|split|stat|stdbuf|stty|sum|sync|tac|tail|tee|test|timeout|touch|tr|true|truncate|tsort|tty|uname|unexpand|uniq|unlink|users|vdir|wc|who|whoami|yes)\\b"
29 |
30 | ## Function definition
31 | - identifier: "^\\s+(function\\s+)[0-9A-Z_]+\\s+\\(\\)" # (i)
32 |
33 | ## Variables
34 | - identifier: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?" #(i)
35 |
36 | - constant.string:
37 | start: "\""
38 | end: "\""
39 | skip: "\\\\."
40 | rules:
41 | - constant.specialChar: "\\\\."
42 |
43 | - constant.string:
44 | start: "'"
45 | end: "'"
46 | rules: []
47 |
48 | - comment:
49 | start: "#"
50 | end: "$"
51 | rules: []
52 |
53 |
--------------------------------------------------------------------------------
/syntax_files/sql.yaml:
--------------------------------------------------------------------------------
1 | filetype: sql
2 |
3 | detect:
4 | filename: "\\.sql$|sqliterc$"
5 |
6 | rules:
7 | - statement: "(?i)\\b(ALL|ASC|AS|ALTER|AND|ADD|AUTO_INCREMENT)\\b"
8 | - statement: "(?i)\\b(BETWEEN|BINARY|BOTH|BY|BOOLEAN)\\b"
9 | - statement: "(?i)\\b(CHANGE|CHECK|COLUMNS|COLUMN|CROSS|CREATE)\\b"
10 | - statement: "(?i)\\b(DATABASES|DATABASE|DATA|DELAYED|DESCRIBE|DESC|DISTINCT|DELETE|DROP|DEFAULT)\\b"
11 | - statement: "(?i)\\b(ENCLOSED|ESCAPED|EXISTS|EXPLAIN)\\b"
12 | - statement: "(?i)\\b(FIELDS|FIELD|FLUSH|FOR|FOREIGN|FUNCTION|FROM)\\b"
13 | - statement: "(?i)\\b(GROUP|GRANT|HAVING)\\b"
14 | - statement: "(?i)\\b(IGNORE|INDEX|INFILE|INSERT|INNER|INTO|IDENTIFIED|IN|IS|IF)\\b"
15 | - statement: "(?i)\\b(JOIN|KEYS|KILL|KEY)\\b"
16 | - statement: "(?i)\\b(LEADING|LIKE|LIMIT|LINES|LOAD|LOCAL|LOCK|LOW_PRIORITY|LEFT|LANGUAGE)\\b"
17 | - statement: "(?i)\\b(MODIFY|NATURAL|NOT|NULL|NEXTVAL)\\b"
18 | - statement: "(?i)\\b(OPTIMIZE|OPTION|OPTIONALLY|ORDER|OUTFILE|OR|OUTER|ON)\\b"
19 | - statement: "(?i)\\b(PROCEDURE|PROCEDURAL|PRIMARY)\\b"
20 | - statement: "(?i)\\b(READ|REFERENCES|REGEXP|RENAME|REPLACE|RETURN|REVOKE|RLIKE|RIGHT)\\b"
21 | - statement: "(?i)\\b(SHOW|SONAME|STATUS|STRAIGHT_JOIN|SELECT|SETVAL|SET)\\b"
22 | - statement: "(?i)\\b(TABLES|TERMINATED|TO|TRAILING|TRUNCATE|TABLE|TEMPORARY|TRIGGER|TRUSTED)\\b"
23 | - statement: "(?i)\\b(UNIQUE|UNLOCK|USE|USING|UPDATE|VALUES|VARIABLES|VIEW)\\b"
24 | - statement: "(?i)\\b(WITH|WRITE|WHERE|ZEROFILL|TYPE|XOR)\\b"
25 | - type: "(?i)\\b(VARCHAR|TINYINT|TEXT|DATE|SMALLINT|MEDIUMINT|INT|INTEGER|BIGINT|FLOAT|DOUBLE|DECIMAL|DATETIME|TIMESTAMP|TIME|YEAR|UNSIGNED|CHAR|TINYBLOB|TINYTEXT|BLOB|MEDIUMBLOB|MEDIUMTEXT|LONGBLOB|LONGTEXT|ENUM|BOOL|BINARY|VARBINARY)\\b"
26 | - preproc: "(?i)\\.\\b(databases|dump|echo|exit|explain|header(s)?|help)\\b"
27 | - preproc: "(?i)\\.\\b(import|indices|mode|nullvalue|output|prompt|quit|read)\\b"
28 | - preproc: "(?i)\\.\\b(schema|separator|show|tables|timeout|width)\\b"
29 | - constant.bool: "\\b(ON|OFF)\\b"
30 | - constant.number: "\\b([0-9]+)\\b"
31 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
32 | - constant.string: "`(\\\\.|[^\\\\`])*`"
33 | - comment: "\\-\\-.*$"
34 | - indent-char.whitespace: "[[:space:]]+$"
35 | - indent-char: " + +| + +"
36 |
--------------------------------------------------------------------------------
/syntax_files/gentoo-ebuild.yaml:
--------------------------------------------------------------------------------
1 | filetype: ebuild
2 |
3 | detect:
4 | filename: "\\.e(build|class)$"
5 |
6 | rules:
7 | # All the standard portage functions
8 | - identifier: "^src_(unpack|compile|install|test)|^pkg_(config|nofetch|setup|(pre|post)(inst|rm))"
9 | # Highlight bash related syntax
10 | - statement: "\\b(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while|continue|break)\\b"
11 | - statement: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|!|=|&|\\|)"
12 | - statement: "-(e|d|f|r|g|u|w|x|L)\\b"
13 | - statement: "-(eq|ne|gt|lt|ge|le|s|n|z)\\b"
14 | # Highlight variables ... official portage ones in red, all others in bright red
15 | - preproc: "\\$\\{?[a-zA-Z_0-9]+\\}?"
16 | - special: "\\b(ARCH|HOMEPAGE|DESCRIPTION|IUSE|SRC_URI|LICENSE|SLOT|KEYWORDS|FILESDIR|WORKDIR|(P|R)?DEPEND|PROVIDE|DISTDIR|RESTRICT|USERLAND)\\b"
17 | - special: "\\b(S|D|T|PV|PF|P|PN|A)\\b|\\bC(XX)?FLAGS\\b|\\bLDFLAGS\\b|\\bC(HOST|TARGET|BUILD)\\b"
18 | # Highlight portage commands
19 | - identifier: "\\buse(_(with|enable))?\\b [!a-zA-Z0-9_+ -]*|inherit.*"
20 | - statement: "\\be(begin|end|conf|install|make|warn|infon?|error|log|patch|new(group|user))\\b"
21 | - statement: "\\bdie\\b|\\buse(_(with|enable))?\\b|\\binherit\\b|\\bhas\\b|\\b(has|best)_version\\b|\\bunpack\\b"
22 | - statement: "\\b(do|new)(ins|s?bin|doc|lib(\\.so|\\.a)|man|info|exe|initd|confd|envd|pam|menu|icon)\\b"
23 | - statement: "\\bdo(python|sed|dir|hard|sym|html|jar|mo)\\b|\\bkeepdir\\b"
24 | - statement: "prepall(docs|info|man|strip)|prep(info|lib|lib\\.(so|a)|man|strip)"
25 | - statement: "\\b(doc|ins|exe)into\\b|\\bf(owners|perms)\\b|\\b(exe|ins|dir)opts\\b"
26 | # Highlight common commands used in ebuilds
27 | - type: "\\bmake\\b|\\b(cat|cd|chmod|chown|cp|echo|env|export|grep|let|ln|mkdir|mv|rm|sed|set|tar|touch|unset)\\b"
28 |
29 | - constant.string:
30 | start: "\""
31 | end: "\""
32 | skip: "\\\\."
33 | rules:
34 | - constant.specialChar: "\\\\."
35 |
36 | - constant.string:
37 | start: "'"
38 | end: "'"
39 | skip: "\\\\."
40 | rules:
41 | - constant.specialChar: "\\\\."
42 |
43 | - comment:
44 | start: "#"
45 | end: "$"
46 | rules:
47 | - todo: "(TODO|XXX|FIXME):?"
48 |
49 |
--------------------------------------------------------------------------------
/syntax_files/nim.yaml:
--------------------------------------------------------------------------------
1 | filetype: nim
2 |
3 | detect:
4 | filename: "\\.nim$|\\.nims$|nim.cfg"
5 |
6 | rules:
7 | - preproc: "[\\{\\|]\\b(atom|lit|sym|ident|call|lvalue|sideeffect|nosideeffect|param|genericparam|module|type|let|var|const|result|proc|method|iterator|converter|macro|template|field|enumfield|forvar|label|nk[a-zA-Z]+|alias|noalias)\\b[\\}\\|]"
8 | - statement: "\\b(addr|and|as|asm|atomic|bind|block|break|case|cast|concept|const|continue|converter|defer|discard|distinct|div|do|elif|else|end|enum|except|export|finally|for|from|func|generic|if|import|in|include|interface|is|isnot|iterator|let|macro|method|mixin|mod|nil|not|notin|object|of|or|out|proc|ptr|raise|ref|return|shl|shr|static|template|try|tuple|type|using|var|when|while|with|without|xor|yield)\\b"
9 | - statement: "\\b(deprecated|noSideEffect|constructor|destructor|override|procvar|compileTime|noReturn|acyclic|final|shallow|pure|asmNoStackFrame|error|fatal|warning|hint|line|linearScanEnd|computedGoto|unroll|immediate|checks|boundsChecks|overflowChecks|nilChecks|assertations|warnings|hints|optimization|patterns|callconv|push|pop|global|pragma|experimental|bitsize|volatile|noDecl|header|incompleteStruct|compile|link|passC|passL|emit|importc|importcpp|importobjc|codegenDecl|injectStmt|intdefine|strdefine|varargs|exportc|extern|bycopy|byref|union|packed|unchecked|dynlib|cdecl|thread|gcsafe|threadvar|guard|locks|compileTime)\\b"
10 | - symbol.operator: "[=\\+\\-\\*/<>@\\$~&%\\|!\\?\\^\\.:\\\\]+"
11 | - special: "\\{\\.|\\.\\}|\\[\\.|\\.\\]|\\(\\.|\\.\\)|;|,|`"
12 | - statement: "\\.\\."
13 | - type: "\\b(int|cint|int8|int16|int32|int64|uint|uint8|uint16|uint32|uint64|float|float32|float64|bool|char|enum|string|cstring|array|openarray|seq|varargs|tuple|object|set|void|auto|cshort|range|nil|T|untyped|typedesc)\\b"
14 | - type: "'[iI](8|16|32|64)?\\b|'[uU](8|16|32|64)?\\b|'[fF](32|64|128)?\\b|'[dD]\\b"
15 | - constant.number: "\\b[0-9]+\\b"
16 | - constant.number: "\\b0[xX][0-9A-Fa-f][0-9_A-Fa-f]+\\b"
17 | - constant.number: "\\b0[ocC][0-7][0-7_]+\\b"
18 | - constant.number: "\\b0[bB][01][01_]+\\b"
19 | - constant.number: "\\b[0-9_]((\\.?)[0-9_]+)?[eE][+\\-][0-9][0-9_]+\\b"
20 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
21 | - comment: "[[:space:]]*#.*$"
22 | - comment:
23 | start: "\\#\\["
24 | end: "\\]\\#"
25 | rules: []
26 |
27 | - todo: "(TODO|FIXME|XXX):?"
28 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017-2022 chameleon
4 | Copyright (c) 2022 ixtenu
5 | Copyright (C) 2012 nsf
6 |
7 | Permission is hereby granted, free of charge, to any person obtaining a copy
8 | of this software and associated documentation files (the "Software"), to deal
9 | in the Software without restriction, including without limitation the rights
10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 | copies of the Software, and to permit persons to whom the Software is
12 | furnished to do so, subject to the following conditions:
13 |
14 | The above copyright notice and this permission notice shall be included in all
15 | copies or substantial portions of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 | SOFTWARE.
24 |
25 | --------
26 |
27 | Micro's syntax files are licensed under the MIT "Expat" License:
28 |
29 | Copyright (c) 2016: Zachary Yedidia, Collin Warren, et al.
30 |
31 | Permission is hereby granted, free of charge, to any person obtaining
32 | a copy of this software and associated documentation files (the
33 | "Software"), to deal in the Software without restriction, including
34 | without limitation the rights to use, copy, modify, merge, publish,
35 | distribute, sublicense, and/or sell copies of the Software, and to
36 | permit persons to whom the Software is furnished to do so, subject to
37 | the following conditions:
38 |
39 | The above copyright notice and this permission notice shall be
40 | included in all copies or substantial portions of the Software.
41 |
42 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
43 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
49 |
--------------------------------------------------------------------------------
/syntax_files/vhdl.yaml:
--------------------------------------------------------------------------------
1 | filetype: vhdl
2 |
3 | detect:
4 | filename: "\\.vhdl?$"
5 |
6 | rules:
7 | - type: "(i)\\b(string|integer|natural|positive|(un)?signed|std_u?logic(_vector)?|bit(_vector)?|boolean|u?x01z?|array|range)\\b"
8 | - identifier: "(?i)library[[:space:]]+[a-zA-Z_0-9]+"
9 | - identifier: "(?i)use[[:space:]]+[a-zA-Z_0-9\\.]+"
10 | - identifier: "(?i)component[[:space:]]+[a-zA-Z_0-9]+"
11 | - identifier: "(?i)(architecture|configuration)[[:space:]]+[a-zA-Z_0-9]+[[:space:]]+of[[:space:]]+[a-zA-Z_0-9]+"
12 | - identifier: "(?i)(entity|package)[[:space:]]+[a-zA-Z_0-9]+[[:space:]]+is"
13 | - identifier: "(?i)end[[:space:]]+((architecture|entity|component|process|package|generate)[[:space:]]+)?[a-zA-Z_0-9]+"
14 | - statement: "(?i)\\b(abs|access|after|alias|all|and|architecture|assert|attribute)\\b"
15 | - statement: "(?i)\\b(begin|block|body|buffer|bus|case|component|configuration|constant)\\b"
16 | - statement: "(?i)\\b(disconnect|downto|else|elsif|end|entity|exit)\\b"
17 | - statement: "(?i)\\b(file|for|function|generate|generic|guarded)\\b"
18 | - statement: "(?i)\\b(if|impure|in|inertial|inout|is)\\b"
19 | - statement: "(?i)\\b(label|library|linkage|literal|loop|map|mod)\\b"
20 | - statement: "(?i)\\b(nand|new|next|nor|not|null|of|on|open|or|others|out)\\b"
21 | - statement: "(?i)\\b(package|port|postponed|procedure|process|pure)\\b"
22 | - statement: "(?i)\\b(range|record|register|reject|rem|report|return|rol|ror)\\b"
23 | - statement: "(?i)\\b(select|severity|shared|signal|sla|sll|sra|srl|subtype)\\b"
24 | - statement: "(?i)\\b(then|to|transport|type|unaffected|units|until|use)\\b"
25 | - statement: "(?i)\\b(variable|wait|when|while|with|xnor|xor)\\b"
26 | - statement: "(?i)'(base|left|right|high|low|pos|val|succ|pred|leftof|rightof|image|(last_)?value)"
27 | - statement: "(?i)'((reverse_)?range|length|ascending|event|stable)"
28 | - statement: "(?i)'(simple|path|instance)_name"
29 | - statement: "(?i)\\b(std_match|(rising|falling)_edge|is_x)\\b"
30 | - statement: "(?i)\\bto_(unsigned|signed|integer|u?x01z?|stdu?logic(vector)?)\\b"
31 | - symbol.operator: "(\\+|-|\\*|/|&|<|>|=|\\.|:)"
32 | - constant.number: "(?i)'([0-1]|u|x|z|w|l|h|-)'|[box]?\"([0-1a-fA-F]|u|x|z|w|l|h|-)+\""
33 | - constant.number: "(?i)\\b[0-9\\._]+(e[\\-]?[0-9]+)?( ?[fpnum]?s)?\\b"
34 | - constant.bool: "(?i)\\b(true|false)\\b"
35 | - constant: "(?i)\\b(note|warning|error|failure)\\b"
36 | - constant.string: "\"[^\"]*\""
37 | - comment: "--.*"
38 |
--------------------------------------------------------------------------------
/syntax_files/erb.yaml:
--------------------------------------------------------------------------------
1 | filetype: erb
2 |
3 | detect:
4 | filename: "\\.erb$|\\.rhtml$"
5 |
6 | rules:
7 | - error: "<[^!].*?>"
8 | - symbol.tag: "(?i)<[/]?(a(bbr|cronym|ddress|pplet|rea|rticle|side|udio)?|b(ase(font)?|d(i|o)|ig|lockquote|r)?|ca(nvas|ption)|center|cite|co(de|l|lgroup)|d(ata(list)?|d|el|etails|fn|ialog|ir|l|t)|em(bed)?|fieldset|fig(caption|ure)|font|form|(i)?frame|frameset|h[1-6]|hr|i|img|in(put|s)|kbd|keygen|label|legend|li(nk)?|ma(in|p|rk)|menu(item)?|met(a|er)|nav|no(frames|script)|o(l|pt(group|ion)|utput)|p(aram|icture|re|rogress)?|q|r(p|t|uby)|s(trike)?|samp|se(ction|lect)|small|source|span|strong|su(b|p|mmary)|textarea|time|track|u(l)?|var|video|wbr)( .*|>)*?>"
9 | - symbol.tag.extended: "(?i)<[/]?(body|div|html|head(er)?|footer|title|table|t(body|d|h(ead)?|r|foot))( .*|>)*?>"
10 | - preproc: "(?i)<[/]?(script|style)( .*|>)*?>"
11 | - special: "&[^;[[:space:]]]*;"
12 | - symbol: "[:=]"
13 | - identifier: "(alt|bgcolor|height|href|id|label|longdesc|name|onclick|onfocus|onload|onmouseover|size|span|src|style|target|type|value|width)="
14 | - constant.string: "\"[^\"]*\""
15 | - constant.number: "(?i)#[0-9A-F]{6,6}"
16 | - constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+"
17 | - comment: ""
18 | - preproc: ""
19 | - default:
20 | start: "<%"
21 | end: "%>"
22 | rules: []
23 |
24 | - preproc: "<%|%>"
25 | - red: "&[^;[[:space:]]]*;"
26 | - statement: "\\b(BEGIN|END|alias|and|begin|break|case|class|def|defined\\?|do|else|elsif|end|ensure|false|for|if|in|module|next|nil|not|or|redo|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield)\\b"
27 | - identifier.var: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*"
28 | - magenta: "(?i)([ ]|^):[0-9A-Z_]+\\b"
29 | - identifier.macro: "\\b(__FILE__|__LINE__)\\b"
30 | - brightmagenta: "!/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*"
31 | - brightblue: "`[^`]*`|%x\\{[^}]*\\}"
32 | - constant.string: "\"([^\"]|(\\\\\"))*\"|%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\[[^]]*\\]|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!"
33 | - brightgreen: "#\\{[^}]*\\}"
34 | - green: "'([^']|(\\\\'))*'|%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!"
35 | - comment: "#[^{].*$|#$"
36 | - comment.bright: "##[^{].*$|##$"
37 | - identifier.macro:
38 | start: "<<-?'?EOT'?"
39 | end: "^EOT"
40 | rules: []
41 |
42 | - todo: "(XXX|TODO|FIXME|\\?\\?\\?)"
43 |
--------------------------------------------------------------------------------
/syntax_files/gdscript.yaml:
--------------------------------------------------------------------------------
1 | filetype: gdscript
2 |
3 | detect:
4 | filename: "\\.gd$"
5 |
6 | rules:
7 | # Built-in constants
8 | - constant: "\\b(INF|NAN|PI|TAU)\\b"
9 | - constant.bool: "\\b(null|true|false)\\b"
10 | # Built-in functions
11 | - identifier: "\\b(abs|acos|asin|atan|atan2|ceil|clamp|convert|cos|cosh|db2linear|decimals|deg2rad|ease|exp|float|floor|fmod|fposmod|hash|int|isinf|isnan|lerp|linear2db|load|log|max|min|nearest_po2|pow|preload|print|printerr|printraw|prints|printt|rad2deg|rand_range|rand_seed|randomize|randi|randf|range|round|seed|sin|slerp|sqrt|str|str2var|tan|typeof|var2str|weakref)\\b"
12 | # Built-in node names
13 | - identifier: "\\b(AnimationPlayer|AnimationTreePlayer|Button|Control|Engine|HTTPClient|HTTPRequest|Input|InputEvent|MainLoop|Node|Node2D|OS|SceneTree|Spatial|StreamPeer|PacketPeer|PacketPeerUDP|Timer|Tween)\\b"
14 | # Types
15 | - type: "\\b(AABB|Array|Basis|Color|Dictionary|NodePath|Object|Plane|PoolByteArray|PoolColorArray|PoolIntArray|PoolRealArray|PoolVector2Array|PoolVector3Array|Quat|Rect2|RID|String|Transform|Transform2D|Vector2|Vector3)\\b"
16 | # Definitions
17 | - identifier: "func [a-zA-Z_0-9]+"
18 | # Keywords
19 | - statement: "\\b(and|as|assert|break|breakpoint|class|const|continue|elif|else|enum|export|extends|for|func|if|in|is|map|master|mastersync|match|not|onready|or|pass|remote|remotesync|return|self|setget|slave|slavesync|signal|sync|tool|var|while|yield)\\b"
20 |
21 | # Operators
22 | - statement: "[.:;,+*|=!\\%@]|<|>|/|-|&"
23 |
24 | # Parentheses
25 | - statement: "[(){}]|\\[|\\]"
26 |
27 | # Numbers
28 | - constant: "\\b[0-9]+\\b"
29 | - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'"
30 |
31 | - comment:
32 | start: "\"\"\""
33 | end: "\"\"\""
34 | rules:
35 | - todo: "(TODO|XXX|FIXME):?"
36 |
37 | - comment:
38 | start: "'''"
39 | end: "'''"
40 | rules:
41 | - todo: "(TODO|XXX|FIXME):?"
42 |
43 | - constant.string:
44 | start: "\""
45 | end: "\""
46 | skip: "\\\\."
47 | rules:
48 | - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
49 |
50 | - constant.string:
51 | start: "'"
52 | end: "'"
53 | skip: "\\\\."
54 | rules:
55 | - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
56 |
57 | - comment:
58 | start: "#"
59 | end: "$"
60 | rules:
61 | - todo: "(TODO|XXX|FIXME):?"
62 |
--------------------------------------------------------------------------------
/syntax_files/objc.yaml:
--------------------------------------------------------------------------------
1 | filetype: objective-c
2 |
3 | detect:
4 | filename: "\\.(m|mm|h)$"
5 |
6 | rules:
7 | - type: "\\b(float|double|CGFloat|id|bool|BOOL|Boolean|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline|Class|SEL|IMP|NS(U)?Integer)\\b"
8 | - type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
9 | - type: "\\b[A-Z][A-Z][[:alnum:]]*\\b"
10 | - type: "\\b[A-Za-z0-9_]*_t\\b"
11 | - type: "\\bdispatch_[a-zA-Z0-9_]*_t\\b"
12 |
13 | - statement: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__|__unused|_Nonnull|_Nullable|__block|__builtin.*)"
14 | - statement: "\\b(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\\b"
15 | - statement: "\\b(for|if|while|do|else|case|default|switch)\\b"
16 | - statement: "\\b(try|throw|catch|operator|new|delete)\\b"
17 | - statement: "\\b(goto|continue|break|return)\\b"
18 | - statement: "\\b(nonatomic|atomic|readonly|readwrite|strong|weak|assign)\\b"
19 | - statement: "@(encode|end|interface|implementation|class|selector|protocol|synchronized|try|catch|finally|property|optional|required|import|autoreleasepool)"
20 |
21 | - preproc: "^[[:space:]]*#[[:space:]]*(define|include|import|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma).*$"
22 | - preproc: "__[A-Z0-9_]*__"
23 |
24 | - special: "^[[:space:]]*[#|@][[:space:]]*(import|include)[[:space:]]*[\"|<].*\\/?[>|\"][[:space:]]*$"
25 |
26 | - statement: "([.:;,+*|=!\\%\\[\\]]|<|>|/|-|&)"
27 |
28 | - constant.number: "(\\b(-?)?[0-9]+\\b|\\b\\[0-9]+\\.[0-9]+\\b|\\b0x[0-9A-F]+\\b)"
29 | - constant: "(@\\[(\\\\.|[^\\]])*\\]|@\\{(\\\\.|[^\\}])*\\}|@\\((\\\\.|[^\\)])*\\))"
30 | - constant: "\\b<(\\\\.[^\\>])*\\>\\b"
31 | - constant: "\\b(nil|NULL|YES|NO|TRUE|true|FALSE|false|self)\\b"
32 | - constant: "\\bk[[:alnum]]*\\b"
33 | - constant.string: "'.'"
34 |
35 | - constant.string:
36 | start: "@\""
37 | end: "\""
38 | skip: "\\\\."
39 | rules:
40 | - constant.specialChar: "\\\\."
41 |
42 | - constant.string:
43 | start: "\""
44 | end: "\""
45 | skip: "\\\\."
46 | rules:
47 | - constant.specialChar: "\\\\."
48 |
49 | - comment:
50 | start: "//"
51 | end: "$"
52 | rules:
53 | - todo: "(TODO|XXX|FIXME):?"
54 |
55 | - comment:
56 | start: "/\\*"
57 | end: "\\*/"
58 | rules:
59 | - todo: "(TODO|XXX|FIXME):?"
60 |
61 |
--------------------------------------------------------------------------------
/syntax_files/twig.yaml:
--------------------------------------------------------------------------------
1 | filetype: twig
2 |
3 | detect:
4 | filename: "\\.twig$"
5 |
6 | rules:
7 | - include: "html"
8 | - symbol.tag:
9 | start: "\\{\\{[[:space:]]"
10 | end: "[[:space:]]\\}\\}"
11 | rules:
12 | - identifier: "\\b(abs|batch|capitalize|convert|encoding|date(_modify)?|default|escape|first|format|join|json_encode|keys|last|length|lower|merge|nl2br|number_format|raw|replace|reverse|round|slice|sort|split|striptags|title|trim|upper|url_encode)\\b"
13 | - identifier.class: "\\b(attribute|block|constant|cycle|date|dump|include|max|min|parent|random|range|source|template_from_string)\\b"
14 | - type.keyword: "\\b(and|as|constant|defined|divisibleby|empty|even|false|in|is|iterable|not|null|odd|or|same(as)?|true|with)\\b"
15 | - symbol.operator: "[.:;,+*?|=!\\%]|<|>|/|-|&"
16 | - symbol.brackets: "[(){}]|\\[|\\]"
17 | - constant.number: "\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b"
18 | - constant.string:
19 | start: "\""
20 | end: "\""
21 | skip: "\\\\"
22 | rules:
23 | - constant.specialChar: "\\\\."
24 | - constant.string:
25 | start: "'"
26 | end: "'"
27 | skip: "\\\\"
28 | rules:
29 | - constant.specialChar: "\\\\."
30 | - symbol.tag:
31 | start: "\\{%[[:space:]]"
32 | end: "[[:space:]]%\\}"
33 | rules:
34 | - identifier: "\\b(abs|batch|capitalize|convert|encoding|date(_modify)?|default|escape|first|format|join|json_encode|keys|last|length|lower|merge|nl2br|number_format|raw|replace|reverse|round|slice|sort|split|striptags|title|trim|upper|url_encode)\\b"
35 | - identifier.class: "\\b(attribute|block|constant|cycle|date|dump|include|max|min|parent|random|range|source|template_from_string)\\b"
36 | - type.keyword: "\\b(and|as|constant|defined|divisibleby|empty|even|false|in|is|iterable|not|null|odd|or|same(as)?|true|with)\\b"
37 | - symbol.operator: "[.:;,+*?|=!\\%]|<|>|/|-|&"
38 | - symbol.brackets: "[(){}]|\\[|\\]"
39 | - constant.number: "\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b"
40 | - constant.string:
41 | start: "\""
42 | end: "\""
43 | skip: "\\\\"
44 | rules:
45 | - constant.specialChar: "\\\\."
46 | - constant.string:
47 | start: "'"
48 | end: "'"
49 | skip: "\\\\"
50 | rules:
51 | - constant.specialChar: "\\\\."
52 | - comment:
53 | start: "\\{#"
54 | end: "#\\}"
55 | rules: []
56 |
--------------------------------------------------------------------------------
/syntax_files/python2.yaml:
--------------------------------------------------------------------------------
1 | filetype: python
2 |
3 | detect:
4 | filename: "\\.py$"
5 | header: "^#!.*/(env +)?python( |$)"
6 |
7 | rules:
8 |
9 | # built-in objects
10 | - constant: "\\b(None|self|True|False)\\b"
11 | # built-in attributes
12 | - constant: "\\b(__bases__|__builtin__|__class__|__debug__|__dict__|__doc__|__file__|__members__|__methods__|__name__|__self__)\\b"
13 | # built-in functions
14 | - identifier: "\\b(abs|apply|callable|chr|cmp|compile|delattr|dir|divmod|eval|exec|execfile|filter|format|getattr|globals|hasattr|hash|help|hex|id|input|intern|isinstance|issubclass|len|locals|max|min|next|oct|open|ord|pow|range|raw_input|reduce|reload|repr|round|setattr|unichr|vars|zip|__import__)\\b"
15 | # special method names
16 | - identifier: "\\b(__abs__|__add__|__and__|__call__|__cmp__|__coerce__|__complex__|__concat__|__contains__|__del__|__delattr__|__delitem__|__dict__|__delslice__|__div__|__divmod__|__float__|__getattr__|__getitem__|__getslice__|__hash__|__hex__|__init__|__int__|__inv__|__invert__|__len__|__long__|__lshift__|__mod__|__mul__|__neg__|__nonzero__|__oct__|__or__|__pos__|__pow__|__radd__|__rand__|__rcmp__|__rdiv__|__rdivmod__|__repeat__|__repr__|__rlshift__|__rmod__|__rmul__|__ror__|__rpow__|__rrshift__|__rshift__|__rsub__|__rxor__|__setattr__|__setitem__|__setslice__|__str__|__sub__|__xor__)\\b"
17 | # types
18 | - type: "\\b(basestring|bool|buffer|bytearray|bytes|classmethod|complex|dict|enumerate|file|float|frozenset|int|list|long|map|memoryview|object|property|reversed|set|slice|staticmethod|str|super|tuple|type|unicode|xrange)\\b"
19 | # definitions
20 | - identifier: "def [a-zA-Z_0-9]+"
21 | # keywords
22 | - statement: "\\b(and|as|assert|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield)\\b"
23 | # decorators
24 | - brightgreen: "@.*[(]"
25 | # operators
26 | - symbol.operator: "([.:;,+*|=!\\%@]|<|>|/|-|&)"
27 | # parentheses
28 | - symbol.brackets: "([(){}]|\\[|\\])"
29 | # numbers
30 | - constant.number: "\\b[0-9]+\\b"
31 |
32 | - constant.string:
33 | start: "\"\"\""
34 | end: "\"\"\""
35 | rules: []
36 |
37 | - comment:
38 | start: "'''"
39 | end: "'''"
40 | rules: []
41 |
42 | - constant.string:
43 | start: "\""
44 | end: "\""
45 | skip: "\\\\."
46 | rules:
47 | - constant.specialChar: "\\\\."
48 |
49 | - constant.string:
50 | start: "'"
51 | end: "'"
52 | skip: "\\\\."
53 | rules:
54 | - constant.specialChar: "\\\\."
55 |
56 | - comment:
57 | start: "#"
58 | end: "$"
59 | rules: []
60 |
61 |
--------------------------------------------------------------------------------
/syntax_files/python3.yaml:
--------------------------------------------------------------------------------
1 | filename: python3
2 |
3 | detect:
4 | filename: "\\.py3$"
5 | header: "^#!.*/(env +)?python3$"
6 |
7 | rules:
8 | # built-in objects
9 | - constant: "\\b(Ellipsis|None|self|True|False)\\b"
10 | # built-in attributes
11 | - constant: "\\b(__bases__|__builtin__|__class__|__debug__|__dict__|__doc__|__file__|__members__|__methods__|__name__|__self__)\\b"
12 | # built-in functions
13 | - identifier: "\\b(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dir|divmod|eval|exec|format|getattr|globals|hasattr|hash|help|hex|id|input|isinstance|issubclass|iter|len|locals|max|min|next|nonlocal|oct|open|ord|pow|print|repr|round|setattr|sorted|sum|vars|__import__)\\b"
14 | # special method names
15 | - identifier: "\\b(__abs__|__add__|__and__|__call__|__cmp__|__coerce__|__complex__|__concat__|__contains__|__del__|__delattr__|__delitem__|__delslice__|__div__|__divmod__|__float__|__getattr__|__getitem__|__getslice__|__hash__|__hex__|__init__|__int__|__inv__|__invert__|__len__|__dict__|__long__|__lshift__|__mod__|__mul__|__neg__|__next__|__nonzero__|__oct__|__or__|__pos__|__pow__|__radd__|__rand__|__rcmp__|__rdiv__|__rdivmod__|__repeat__|__repr__|__rlshift__|__rmod__|__rmul__|__ror__|__rpow__|__rrshift__|__rshift__|__rsub__|__rxor__|__setattr__|__setitem__|__setslice__|__str__|__sub__|__xor__)\\b"
16 | # types
17 | - type: "\\b(bool|bytearray|bytes|classmethod|complex|dict|enumerate|filter|float|frozenset|int|list|map|memoryview|object|property|range|reversed|set|slice|staticmethod|str|super|tuple|type|zip)\\b"
18 | # definitions
19 | - identifier: "def [a-zA-Z_0-9]+"
20 | # keywords
21 | - statement: "\\b(and|as|assert|await|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|raise|return|try|while|with|yield)\\b"
22 | # decorators
23 | - brightgreen: "@.*[(]"
24 | # operators
25 | - symbol.operator: "([.:;,+*|=!\\%@]|<|>|/|-|&)"
26 | # parentheses
27 | - symbol.brackets: "([(){}]|\\[|\\])"
28 | # numbers
29 | - constant.number: "\\b[0-9]+\\b"
30 |
31 | - constant.string:
32 | start: "\"\"\""
33 | end: "\"\"\""
34 | rules: []
35 |
36 | - comment:
37 | start: "'''"
38 | end: "'''"
39 | rules: []
40 |
41 | - constant.string:
42 | start: "\""
43 | end: "\""
44 | skip: "\\\\."
45 | rules:
46 | - constant.specialChar: "\\\\."
47 |
48 | - constant.string:
49 | start: "'"
50 | end: "'"
51 | skip: "\\\\."
52 | rules:
53 | - constant.specialChar: "\\\\."
54 |
55 | - comment:
56 | start: "#"
57 | end: "$"
58 | rules: []
59 |
60 |
--------------------------------------------------------------------------------
/syntax_files/erlang.yaml:
--------------------------------------------------------------------------------
1 | filetype: erlang
2 |
3 | detect:
4 | filename: "\\.erl$"
5 |
6 | rules:
7 | - identifier: "\\b[A-Z][0-9a-z_]*\\b"
8 | # See: http://erlang.org/doc/reference_manual/data_types.html
9 | - constant.number: "\\b[0-9]+(\\.[0-9]+)?(e-?[0-9]+)?\\b"
10 | - constant.number: "\\b[0-9]{1,2}\\#[a-zA-Z0-9]+\\b"
11 | - constant.bool: "\\b(true|false)\\b"
12 | - constant.number: "\\$\\\\?\\S{1}"
13 | # See: http://erlang.org/doc/reference_manual/introduction.html
14 | - statement: "\\b(after|and|andalso|band|begin|bnot|bor|bsl|bsr|bxor|case|catch|cond|div|end|fun|if|let|not|of|or|orelse|receive|rem|try|when|xor)\\b"
15 | # See: http://erlang.org/doc/reference_manual/macros.html
16 | - preproc: "\\-(module|export|record|include|include_lib|define|undef|ifdef|ifndef|else|endif|if|elif|error|warning)\\b"
17 | - identifier.macro: "\\?[A-Z0-9_]+\\b"
18 | # See: http://erlang.org/doc/man/erlang.html
19 | - special: "\\b(ext_binary|binary|iovec|message_queue_data|time(_unit|stamp)|abs|apply|atom(_to_binary|_to_list)|binary_(part|to_atom|to_existing_atom|to_float|to_integer|to_list|to_term)|bit(_size|string_to_list)|byte_size|ceil|check_(old_code|process_code)|date|delete_module|demonitor|disconnect_node|element|erase|error|exit|float(_to_binary|_to_list)?|floor|garbage_collect|get|group_leader|halt|integer(_to_binary|to_list)|iolist_(size|to_binary)|is_(alive|atom|binary|bitstring|boolean|float|function|integer|list|map|map_key|number|pid|port|process_alive|record|reference|tuple|length)|link|list_to_(atom|binary|bitstring|existing_atom|float|integer|pid|port|ref|tuple)|load_module|make_ref|map_(get|size)|max|min|module_loaded|monitor(_node)?|nodes?|now|open_port|pid_to_list|port(_close|command|connect|control|to_list)|pre_loaded|process(_flag|_info|es)|purge_module|put|register(ed)?|round|self|setelement|size|spawn(_link|_monitor|_opt|_binary)?|statistics|trunc|tuple_(size|to_list)|unlink|unregister|whereis)\\b"
20 | # See: http://erlang.org/doc/reference_manual/data_types.html#atom
21 | - symbol:
22 | start: "'"
23 | end: "'"
24 | skip: "\\\\."
25 | rules: []
26 | # - constant.specialChar: "%."
27 | # - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
28 | # - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
29 | - constant.string:
30 | start: "\""
31 | end: "\""
32 | skip: "\\\\."
33 | rules:
34 | - constant.specialChar: "%."
35 | - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
36 | - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
37 | - comment:
38 | start: "\\(\\*"
39 | end: "\\*\\)"
40 | rules:
41 | - todo: "(TODO|FIXME|WONTFIX|NOTE|HACK):?"
--------------------------------------------------------------------------------
/syntax_files/php.yaml:
--------------------------------------------------------------------------------
1 | filetype: php
2 |
3 | detect:
4 | filename: "\\.php[2345s~]?$"
5 |
6 | rules:
7 | - symbol.operator: "<|>"
8 | - error: "<[^!].*?>"
9 | - symbol.tag: "(?i)<[/]?(a(bbr|cronym|ddress|pplet|rea|rticle|side|udio)?|b(ase(font)?|d(i|o)|ig|lockquote|r)?|ca(nvas|ption)|center|cite|co(de|l|lgroup)|d(ata(list)?|d|el|etails|fn|ialog|ir|l|t)|em(bed)?|fieldset|fig(caption|ure)|font|form|(i)?frame|frameset|h[1-6]|hr|i|img|in(put|s)|kbd|keygen|label|legend|li(nk)?|ma(in|p|rk)|menu(item)?|met(a|er)|nav|no(frames|script)|o(l|pt(group|ion)|utput)|p(aram|icture|re|rogress)?|q|r(p|t|uby)|s(trike)?|samp|se(ction|lect)|small|source|span|strong|su(b|p|mmary)|textarea|time|track|u(l)?|var|video|wbr)( .*|>)*?>"
10 | - symbol.tag.extended: "(?i)<[/]?(body|div|html|head(er)?|footer|title|table|t(body|d|h(ead)?|r|foot))( .*|>)*?>"
11 | - preproc: "(?i)<[/]?(script|style)( .*|>)*?>"
12 | - special: "&[^;[[:space:]]]*;"
13 | - symbol: "[:=]"
14 | - identifier: "(alt|bgcolor|height|href|label|longdesc|name|onclick|onfocus|onload|onmouseover|size|span|src|style|target|type|value|width)="
15 | - constant.string: "\"[^\"]*\""
16 | - constant.number: "(?i)#[0-9A-F]{6,6}"
17 | - constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+"
18 | - comment: ""
19 | - default: "<\\?(php|=)\" end=\"\\?>"
20 | - identifier.class: "([a-zA-Z0-9_-]+)\\("
21 | - preproc: "\\b(require|include)(_once)?\\b"
22 | - type: "\\b(var|class|extends|function|echo|case|default|exit|switch|extends|as|define|do|declare|in|trait|interface|[E|e]xception|array|int|string|bool|iterable|void)\\b"
23 | - identifier.class: "[a-zA-Z\\\\]+::"
24 | - identifier: "\\b([A-Z][a-zA-Z0-9_]+)\\b"
25 | - identifier: "([A-Z0-9_]+)[;|\\s|\\)|,]"
26 | - type.keyword: "(global|public|private|protected|static|const)"
27 | - statement: "(implements|abstract|instanceof|if|else(if)?|endif|namespace|use|as|new|throw|catch|try|while|print|(end)?(foreach)?)\\b"
28 | - identifier: "new\\s([a-zA-Z0-9\\\\]+)"
29 | - special: "(break|continue|goto|return)"
30 | - constant.bool: "(true|false|null|TRUE|FALSE|NULL)"
31 | - constant: "[\\s|=|\\s|\\(|/|+|-|\\*|\\[]"
32 | - constant.number: "[0-9]"
33 | - identifier: "(\\$this|parent|self|\\$this->)"
34 | - symbol.operator: "(=>|===|!==|==|!=|&&|\\|\\||::|=|->|\\!)"
35 | - identifier.var: "(\\$[a-zA-Z0-9\\-_]+)"
36 | - symbol.operator: "[\\(|\\)|/|+|\\-|\\*|\\[|.|,|;]"
37 | - constant.string: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
38 | - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
39 | - symbol.brackets: "(\\[|\\]|\\{|\\}|[()])"
40 | - comment: "(^|[[:space:]])//.*"
41 | - comment: "(^|[[:space:]])#.*"
42 | - comment:
43 | start: "/\\*"
44 | end: "\\*/"
45 | rules: []
46 |
47 | - preproc: "<\\?(php|=)?"
48 | - preproc: "\\?>"
49 | - preproc: ""
50 |
--------------------------------------------------------------------------------
/syntax_files/octave.yaml:
--------------------------------------------------------------------------------
1 | # References
2 | # https://github.com/zyedidia/micro/blob/master/runtime/syntax/go.yaml
3 | # https://github.com/vim-scripts/octave.vim--/blob/master/syntax/octave.vim
4 | #
5 | # TODO
6 | # include only needed operators
7 | # ... highlighting
8 | # built-in function highlighting?
9 | # highlight eps/pi/e etc. as functions when followed by ()
10 | # what are skip and error fields in strings?
11 | # multiline comments not working
12 |
13 | filetype: octave
14 |
15 | detect:
16 | filename: "\\.m$"
17 |
18 | rules:
19 | # Statements https://www.gnu.org/software/octave/doc/v4.0.0/Statements.html
20 | - statement: "\\b(function|endfunction|return|end|global|persistent)\\b"
21 | - statement: "\\b(if|elseif|else|endif|switch|case|otherwise|endswitch)\\b"
22 | - statement: "\\b(while|endwhile|do|until|for|endfor|parfor|endparfor|break|continue)\\b"
23 | - statement: "\\b(unwind_protect|unwind_protect_cleanup|end_unwind_protect|try|catch|end_try_catch)\\b"
24 |
25 | # Operators
26 | - symbol.operator: "[-+/*=<>!~%&|^]|:="
27 |
28 | # Brackets
29 | - symbol.brackets: "(\\{|\\})"
30 | - symbol.brackets: "(\\(|\\))"
31 | - symbol.brackets: "(\\[|\\])"
32 |
33 | # Commas
34 | - symbol: ","
35 |
36 | # Numbers https://www.gnu.org/software/octave/doc/v4.0.1/Mathematical-Constants.html
37 | - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'"
38 | - constant.number: "\\b(pi|e|I|Inf|NaN|eps|realmax|realmin)\\b|"
39 |
40 | # Boolean
41 | - constant.bool: "\\b(true|false)\\b"
42 |
43 | # Strings https://www.gnu.org/software/octave/doc/v4.0.1/Strings.html
44 | - constant.string:
45 | start: "\""
46 | end: "\""
47 | skip: "\\\\."
48 | rules:
49 | - constant.specialChar: "%"
50 | - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
51 | - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
52 |
53 | - constant.string:
54 | start: "'"
55 | end: "'"
56 | skip: "\\\\."
57 | rules:
58 | - error: "..+"
59 | - constant.specialChar: "%"
60 | - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
61 | - constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
62 |
63 | # Comments https://www.gnu.org/software/octave/doc/v4.2.1/Comments.html
64 | - comment:
65 | start: "%"
66 | end: "$"
67 | rules:
68 | - todo: "(TODO|XXX|FIXME):?"
69 | - comment:
70 | start: "#"
71 | end: "$"
72 | rules:
73 | - todo: "(TODO|XXX|FIXME):?"
74 | - comment:
75 | start: "%{"
76 | end: "%}"
77 | rules:
78 | - todo: "(TODO|XXX|FIXME):?"
79 | - comment:
80 | start: "#{"
81 | end: "#}"
82 | rules:
83 | - todo: "(TODO|XXX|FIXME):?"
84 |
--------------------------------------------------------------------------------
/syntax_files/fortran.yaml:
--------------------------------------------------------------------------------
1 | filetype: fortran
2 |
3 | detect:
4 | filename: "\\.([Ff]|[Ff]90|[Ff]95|[Ff][Oo][Rr])$"
5 |
6 | rules:
7 | - type: "(?i)\\b(action|advance|all|allocatable|allocated|any|apostrophe)\\b"
8 | - type: "(?i)\\b(append|asis|assign|assignment|associated|character|common)\\b"
9 | - type: "(?i)\\b(complex|data|default|delim|dimension|double precision)\\b"
10 | - type: "(?i)\\b(elemental|epsilon|external|file|fmt|form|format|huge)\\b"
11 | - type: "(?i)\\b(implicit|include|index|inquire|integer|intent|interface)\\b"
12 | - type: "(?i)\\b(intrinsic|iostat|kind|logical|module|none|null|only)\\\\b"
13 | - type: "(?i)\\b(operator|optional|pack|parameter|pointer|position|private)\\b"
14 | - type: "(?i)\\b(program|public|real|recl|recursive|selected_int_kind)\\b"
15 | - type: "(?i)\\b(selected_real_kind|subroutine|status)\\b"
16 |
17 | - constant: "(?i)\\b(abs|achar|adjustl|adjustr|allocate|bit_size|call|char)\\b"
18 | - constant: "(?i)\\b(close|contains|count|cpu_time|cshift|date_and_time)\\b"
19 | - constant: "(?i)\\b(deallocate|digits|dot_product|eor|eoshift|function|iachar)\\b"
20 | - constant: "(?i)\\b(iand|ibclr|ibits|ibset|ichar|ieor|iolength|ior|ishft|ishftc)\\b"
21 | - constant: "(?i)\\b(lbound|len|len_trim|matmul|maxexponent|maxloc|maxval|merge)\\b"
22 | - constant: "(?i)\\b(minexponent|minloc|minval|mvbits|namelist|nearest|nullify)\\b"
23 | - constant: "(?i)\\b(open|pad|present|print|product|pure|quote|radix)\\b"
24 | - constant: "(?i)\\b(random_number|random_seed|range|read|readwrite|replace)\\b"
25 | - constant: "(?i)\\b(reshape|rewind|save|scan|sequence|shape|sign|size|spacing)\\b"
26 | - constant: "(?i)\\b(spread|sum|system_clock|target|transfer|transpose|trim)\\b"
27 | - constant: "(?i)\\b(ubound|unpack|verify|write|tiny|type|use|yes)\\b"
28 |
29 | - statement: "(?i)\\b(.and.|case|do|else|else?if|else?where|end|end?do|end?if)\\b"
30 | - statement: "(?i)\\b(end?select|.eqv.|forall|if|lge|lgt|lle|llt|.neqv.|.not.)\\b"
31 | - statement: "(?i)\\b(.or.|repeat|select case|then|where|while)\\b"
32 |
33 | - special: "(?i)\\b(continue|cycle|exit|go?to|result|return)\\b"
34 |
35 | #Operator Color
36 | - symbol.operator: "[.:;,+*|=!\\%]|/|-|&"
37 |
38 | #Parenthetical Color
39 | - symbol.bracket: "[(){}]|\\[|\\]"
40 |
41 | # Add preprocessor commands.
42 | - preproc: "^[[:space:]]*#[[:space:]]*(define|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
43 |
44 | - constant.string:
45 | start: "\""
46 | end: "\""
47 | skip: "\\\\."
48 | rules:
49 | - constant.specialChar: "\\\\."
50 |
51 | - constant.string:
52 | start: "'"
53 | end: "'"
54 | skip: "\\\\."
55 | rules:
56 | - constant.specialChar: "\\\\."
57 |
58 | - comment:
59 | start: "!"
60 | end: "$"
61 | rules:
62 | - todo: "(TODO|XXX|FIXME):?"
63 |
64 |
--------------------------------------------------------------------------------
/syntax_files/arduino.yaml:
--------------------------------------------------------------------------------
1 | filetype: ino
2 |
3 | detect:
4 | filename: "\\.?ino$"
5 |
6 | rules:
7 | - identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
8 |
9 | ##
10 | - type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
11 |
12 | ## Constants
13 | - constant: "(?i)\\b(HIGH|LOW|INPUT|OUTPUT)\\b"
14 |
15 | ## Serial Print
16 | - constant: "(?i)\\b(DEC|BIN|HEX|OCT|BYTE)\\b"
17 |
18 | ## PI Constants
19 | - constant: "(?i)\\b(PI|HALF_PI|TWO_PI)\\b"
20 |
21 | ## ShiftOut
22 | - constant: "(?i)\\b(LSBFIRST|MSBFIRST)\\b"
23 |
24 | ## Attach Interrupt
25 | - constant: "(?i)\\b(CHANGE|FALLING|RISING)\\b"
26 |
27 | ## Analog Reference
28 | - constant: "(?i)\\b(DEFAULT|EXTERNAL|INTERNAL|INTERNAL1V1|INTERNAL2V56)\\b"
29 |
30 | ## === FUNCTIONS === ##
31 |
32 | ## Data Types
33 | - type: "\\b(boolean|byte|char|float|int|long|word)\\b"
34 |
35 | ## Control Structions
36 | - statement: "\\b(case|class|default|do|double|else|false|for|if|new|null|private|protected|public|short|signed|static|String|switch|this|throw|try|true|unsigned|void|while)\\b"
37 | - statement: "\\b(goto|continue|break|return)\\b"
38 |
39 | ## Math
40 | - identifier: "\\b(abs|acos|asin|atan|atan2|ceil|constrain|cos|degrees|exp|floor|log|map|max|min|radians|random|randomSeed|round|sin|sq|sqrt|tan)\\b"
41 |
42 | ## Bits & Bytes
43 | - identifier: "\\b(bitRead|bitWrite|bitSet|bitClear|bit|highByte|lowByte)\\b"
44 |
45 | ## Analog I/O
46 | - identifier: "\\b(analogReference|analogRead|analogWrite)\\b"
47 |
48 | ## External Interrupts
49 | - identifier: "\\b(attachInterrupt|detachInterrupt)\\b"
50 |
51 | ## Time
52 | - identifier: "\\b(delay|delayMicroseconds|millis|micros)\\b"
53 |
54 | ## Digital I/O
55 | - identifier: "\\b(pinMode|digitalWrite|digitalRead)\\b"
56 |
57 | ## Interrupts
58 | - identifier: "\\b(interrupts|noInterrupts)\\b"
59 |
60 | ## Advanced I/O
61 | - identifier: "\\b(noTone|pulseIn|shiftIn|shiftOut|tone)\\b"
62 |
63 | ## Serial
64 | - identifier: "\\b(Serial|Serial1|Serial2|Serial3|begin|end|peek|read|print|println|available|flush)\\b"
65 |
66 | ## Structure
67 | - identifier: "\\b(setup|loop)\\b"
68 |
69 | ##
70 | - statement: "^[[:space:]]*#[[:space:]]*(define|include(_next)?|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma)"
71 |
72 | ## GCC builtins
73 | - constant: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__)"
74 |
75 | - constant.string:
76 | start: "\""
77 | end: "\""
78 | skip: "\\\\."
79 | rules:
80 | - constant.specialChar: "\\\\."
81 |
82 | - constant.string:
83 | start: "'"
84 | end: "'"
85 | skip: "\\\\."
86 | rules:
87 | - preproc: "..+"
88 | - constant.specialChar: "\\\\."
89 |
90 | - comment:
91 | start: "//"
92 | end: "$"
93 | rules:
94 | - todo: "(TODO|XXX|FIXME):?"
95 |
96 | - comment:
97 | start: "/\\*"
98 | end: "\\*/"
99 | rules:
100 | - todo: "(TODO|XXX|FIXME):?"
101 |
102 |
--------------------------------------------------------------------------------
/region_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "testing"
5 | )
6 |
7 | func selectTestRegion() {
8 | InitEditor()
9 | editorInsertStr("Test")
10 | editorInsertNewline(false)
11 | editorInsertStr("test2")
12 | setMark(Global.CurrentB)
13 | Global.CurrentB.cx = 0
14 | Global.CurrentB.cy = 0
15 | }
16 |
17 | func TestCopyRegion(t *testing.T) {
18 | selectTestRegion()
19 | doCopyRegion()
20 | if Global.Clipboard != "Test\ntest2" {
21 | t.Error("Clipboard contents was:", Global.Clipboard)
22 | }
23 | }
24 |
25 | func TestKillRegion(t *testing.T) {
26 | selectTestRegion()
27 | doKillRegion()
28 | if Global.Clipboard != "Test\ntest2" {
29 | t.Error("Clipboard contents was:", Global.Clipboard)
30 | }
31 | Global.CurrentB.FailIfBufferNe([]string{}, t)
32 | }
33 |
34 | func TestYankRegion(t *testing.T) {
35 | InitEditor()
36 | Global.Clipboard = "Test\ntest2"
37 | doYankRegion()
38 | Global.CurrentB.FailIfBufferNe([]string{"Test", "test2"}, t)
39 | }
40 |
41 | func TestToggleRegion(t *testing.T) {
42 | InitEditor()
43 | editorInsertStr("test")
44 | editorInsertNewline(false)
45 | editorInsertStr("test2")
46 | setMark(Global.CurrentB)
47 | setMark(Global.CurrentB)
48 | if Global.Input != "Mark deactivated." {
49 | t.Error("Mark was not deactivated")
50 | }
51 | setMark(Global.CurrentB)
52 | if Global.Input != "Mark activated." {
53 | t.Error("Mark was not activated")
54 | }
55 | }
56 |
57 | func TestUCRegion(t *testing.T) {
58 | selectTestRegion()
59 | doUCRegion()
60 | Global.CurrentB.FailIfBufferNe([]string{"TEST", "TEST2"}, t)
61 | }
62 |
63 | func TestLCRegion(t *testing.T) {
64 | selectTestRegion()
65 | doLCRegion()
66 | Global.CurrentB.FailIfBufferNe([]string{"test", "test2"}, t)
67 | }
68 |
69 | func TestFillRegion(t *testing.T) {
70 | InitEditor()
71 | Global.Fillcolumn = 80
72 | // It's cap'n jazz, dad, cap'n fucking jazz
73 | editorInsertStr("Burritos, Inspiration Point, Fork Balloon Sports, Cards in the Spokes, Automatic Biographies, Kites, Kung Fu, Trophies, Banana Peels We've Slipped On and Egg Shells We've Tippy Toed Over")
74 | doFillRegion()
75 | Global.CurrentB.FailIfBufferNe([]string{
76 | "Burritos, Inspiration Point, Fork Balloon Sports, Cards in the Spokes, Automatic",
77 | "Biographies, Kites, Kung Fu, Trophies, Banana Peels We've Slipped On and Egg",
78 | "Shells We've Tippy Toed Over",
79 | }, t)
80 | }
81 |
82 | func TestTabifyRegion(t *testing.T) {
83 | InitEditor()
84 | Global.Tabsize = 2
85 | setMark(Global.CurrentB)
86 | editorInsertStr("Python code")
87 | editorInsertNewline(false)
88 | editorInsertStr(" Indented by two spaces")
89 | editorInsertNewline(false)
90 | editorInsertStr(" bottom text")
91 | doTabifyRegion()
92 | Global.CurrentB.FailIfBufferNe([]string{
93 | "Python code",
94 | "\tIndented by two spaces",
95 | "\t\tbottom text",
96 | }, t)
97 | }
98 |
99 | func TestUntabifyRegion(t *testing.T) {
100 | InitEditor()
101 | Global.Tabsize = 2
102 | setMark(Global.CurrentB)
103 | editorInsertStr("Python code")
104 | editorInsertNewline(false)
105 | editorInsertStr("\tIndented by two spaces")
106 | editorInsertNewline(false)
107 | editorInsertStr("\t\tbottom text")
108 | doUntabifyRegion()
109 | Global.CurrentB.FailIfBufferNe([]string{
110 | "Python code",
111 | " Indented by two spaces",
112 | " bottom text",
113 | }, t)
114 | }
115 |
--------------------------------------------------------------------------------
/syntax_files/lilypond.yaml:
--------------------------------------------------------------------------------
1 | filetype: lilypond
2 |
3 | detect:
4 | filename: "\\.ly$|\\.ily$|\\.lly$"
5 |
6 | rules:
7 | - constant.number: "\\d+"
8 | - identifier: "\\b(staff|spacing|signature|routine|notes|handler|corrected|beams|arpeggios|Volta_engraver|Voice|Vertical_align_engraver|Vaticana_ligature_engraver|VaticanaVoice|VaticanaStaff|Tweak_engraver|Tuplet_engraver|Trill_spanner_engraver|Timing_translator|Time_signature_performer|Time_signature_engraver|Tie_performer|Tie_engraver|Text_spanner_engraver|Text_engraver|Tempo_performer|Tab_tie_follow_engraver|Tab_staff_symbol_engraver|Tab_note_heads_engraver|TabVoice|TabStaff|System_start_delimiter_engraver|Stem_engraver|Stanza_number_engraver|Stanza_number_align_engraver|Staff_symbol_engraver|Staff_performer|Staff_collecting_engraver|StaffGroup|Staff|Spanner_break_forbid_engraver|Span_bar_stub_engraver|Span_bar_engraver|Span_arpeggio_engraver|Spacing_engraver|Slur_performer|Slur_engraver|Slash_repeat_engraver|Separating_line_group_engraver|Script_row_engraver|Script_engraver|Script_column_engraver|Score|Rhythmic_column_engraver|RhythmicStaff|Rest_engraver|Rest_collision_engraver|Repeat_tie_engraver|Repeat_acknowledge_engraver|Pure_from_neighbor_engraver|Pitched_trill_engraver|Pitch_squash_engraver|Piano_pedal_performer|Piano_pedal_engraver|Piano_pedal_align_engraver|PianoStaff|Phrasing_slur_engraver|PetrucciVoice|PetrucciStaff|Percent_repeat_engraver|Part_combine_engraver|Parenthesis_engraver|Paper_column_engraver|Output_property_engraver|Ottava_spanner_engraver|OneStaff|NullVoice|Note_spacing_engraver|Note_performer|Note_name_engraver|Note_heads_engraver|Note_head_line_engraver|NoteName\\|NoteHead|New_fingering_engraver|Multi_measure_rest_engraver|Midi_control_function_performer|Metronome_mark_engraver|Mensural_ligature_engraver|MensuralVoice|MensuralStaff|Mark_engraver|Lyrics|Lyric_performer|Lyric_engraver|Ligature_bracket_engraver|Ledger_line_engraver|Laissez_vibrer_engraver|Kievan_ligature_engraver|KievanVoice|KievanStaff|Key_performer|Key_engraver|Keep_alive_together_engraver|Instrument_switch_engraver|Instrument_name_engraver|Hyphen_engraver|Grob_pq_engraver|GregorianTranscriptionVoice|GregorianTranscriptionStaff|GrandStaff|Grace_spacing_engraver|Grace_engraver|Grace_beam_engraver|Grace_auto_beam_engraver|Global|Glissando_engraver|Fretboard_engraver|FretBoards|Forbid_line_break_engraver|Footnote_engraver|Font_size_engraver|Fingering_engraver|Fingering_column_engraver|Figured_bass_position_engraver|Figured_bass_engraver|FiguredBass|Extender_engraver|Episema_engraver|Dynamics|Dynamic_performer|Dynamic_engraver|Dynamic_align_engraver|Drum_notes_engraver|Drum_note_performer|DrumVoice|DrumStaff|Double_percent_repeat_engraver|Dots_engraver|Dot_column_engraver|Devnull|Default_bar_line_engraver|Custos_engraver|Cue_clef_engraver|CueVoice|Control_track_performer|Concurrent_hairpin_engraver|Collision_engraver|Cluster_spanner_engraver|Clef_engraver|Chord_tremolo_engraver|Chord_name_engraver|ChordNames|ChoirStaff|Breathing_sign_engraver|Break_align_engraver|Bend_engraver|Beam_performer|Beam_engraver|Beam_collision_engraver|Bar_number_engraver|Bar_engraver|Axis_group_engraver|Auto_beam_engraver|Arpeggio_engraver|Accidental_engraver|Score)\\b"
9 | - statement: "[-_^]?\\\\[-A-Za-z_]+"
10 | - preproc: "\\b(((gisis|gis|geses|ges|g|fisis|fis|feses|fes|f|eisis|eis|eeses|ees|e|disis|dis|deses|des|d|cisis|cis|ceses|ces|c|bisis|bis|beses|bes|b|aisis|ais|aeses|aes|a)[,']*[?!]?)|s|r|R|q)(128|64|32|16|8|4|2|1|\\\\breve|\\\\longa|\\\\maxima)?([^\\\\\\w]|_|\\b)"
11 | - special: "[(){}<>]|\\[|\\]"
12 | - constant.string:
13 | start: "\""
14 | end: "\""
15 | skip: "\\\\."
16 | rules:
17 | - constant.specialChar: "\\\\."
18 | - comment:
19 | start: "%\\{"
20 | end: "%\\}"
21 | rules: []
22 | - comment:
23 | start: "%"
24 | end: "$"
25 | rules: []
26 |
27 |
--------------------------------------------------------------------------------
/paragraph.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import "unicode/utf8"
4 |
5 | func indexPreviousBlankLine() int {
6 | if Global.CurrentB.cy == 0 {
7 | Global.Input = "Beginning of buffer"
8 | return 0
9 | }
10 | for i := Global.CurrentB.cy - 1; 0 < i; i-- {
11 | if Global.CurrentB.Rows[i].Size == 0 {
12 | return i
13 | }
14 | }
15 | return 0
16 | }
17 |
18 | func indexNextBlankLine() int {
19 | if Global.CurrentB.cy == Global.CurrentB.NumRows {
20 | Global.Input = "End of buffer"
21 | return Global.CurrentB.NumRows
22 | } else if Global.CurrentB.cy == Global.CurrentB.NumRows-1 {
23 | return Global.CurrentB.NumRows
24 | }
25 | for i := Global.CurrentB.cy + 1; i < Global.CurrentB.NumRows; i++ {
26 | if Global.CurrentB.Rows[i].Size == 0 {
27 | return i
28 | }
29 | }
30 | return Global.CurrentB.NumRows
31 | }
32 |
33 | func backwardParagraph() {
34 | times := getRepeatTimes()
35 | for i := 0; i < times; i++ {
36 | cy := indexPreviousBlankLine()
37 | Global.CurrentB.cy = cy
38 | Global.CurrentB.cx = 0
39 | }
40 | }
41 |
42 | func forwardParagraph() {
43 | times := getRepeatTimes()
44 | for i := 0; i < times; i++ {
45 | cy := indexNextBlankLine()
46 | Global.CurrentB.cy = cy
47 | Global.CurrentB.cx = 0
48 | }
49 | }
50 |
51 | func doAutoFillParagraph() {
52 | buf := Global.CurrentB
53 | if buf.NumRows == 0 {
54 | return
55 | }
56 | row := buf.Rows[buf.cy]
57 | if buf.hasMode("aggressive-fill-mode") && row.RenderSize >= Global.Fillcolumn {
58 | doFillParagraph()
59 | } else if buf.hasMode("auto-fill-mode") && editorRowCxToRx(row) >= Global.Fillcolumn {
60 | startl := buf.cy
61 | endl := startl
62 | runeidx, space := savePointBeforeFill(startl, endl)
63 | doFillLines(startl, endl)
64 | restorePointAfterFill(startl, buf.cy, runeidx, space)
65 | }
66 | }
67 |
68 | func doFillParagraph() {
69 | if Global.CurrentB.NumRows == 0 {
70 | return
71 | }
72 | startl := indexPreviousBlankLine()
73 | endl := indexNextBlankLine() - 1
74 | runeidx, space := savePointBeforeFill(startl, endl)
75 | doFillLines(startl, endl)
76 | restorePointAfterFill(indexPreviousBlankLine(), Global.CurrentB.cy, runeidx, space)
77 | }
78 |
79 | func doFillLines(startl, endl int) {
80 | transposeRegion(Global.CurrentB, 0, Global.CurrentB.Rows[endl].Size, startl, endl, FillString)
81 | }
82 |
83 | func savePointBeforeFill(startl, endl int) (int, bool) {
84 | buf := Global.CurrentB
85 | runeidx := 0
86 | space := false
87 | rowloop:
88 | for cy := startl; cy <= endl; cy++ {
89 | for cx, rv := range buf.Rows[cy].Data {
90 | // Spaces excluded from the count because they can be added or
91 | // removed by the fill.
92 | if rv != ' ' {
93 | runeidx++
94 | }
95 | if cy == buf.cy && cx == buf.cx {
96 | // Need to know if point is on a space so that it can be put
97 | // back there. However, spaces before first non-spaces don't
98 | // count because they are deleted.
99 | space = rv == ' ' && runeidx > 0
100 | break rowloop
101 | }
102 | }
103 | if cy == buf.cy {
104 | // Handle edge case where cx wasn't reached because point is at end
105 | // of line. This is treated as a virtual space.
106 | space = true
107 | break
108 | }
109 | }
110 | return runeidx, space
111 | }
112 |
113 | func restorePointAfterFill(startl, endl, runeidx int, space bool) {
114 | buf := Global.CurrentB
115 | cur_runeidx := 0
116 | for cy := startl; cy <= endl; cy++ {
117 | for cx, rv := range buf.Rows[cy].Data {
118 | if rv != ' ' {
119 | cur_runeidx++
120 | }
121 | // '>=' not '==' to handle edge case where the original paragraph
122 | // started with a space that was deleted.
123 | if cur_runeidx >= runeidx {
124 | buf.cy = cy
125 | buf.cx = cx
126 | if space {
127 | buf.cx += utf8.RuneLen(rv)
128 | }
129 | return
130 | }
131 | }
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/shell.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "io"
5 | "os/exec"
6 | "strings"
7 |
8 | glisp "github.com/glycerine/zygomys/zygo"
9 | "github.com/kballard/go-shellquote"
10 | )
11 |
12 | func shellCmd(com string, args []string) (string, error) {
13 | cmd := exec.Command(com, args...)
14 | out, err := cmd.CombinedOutput()
15 | // Gomacs doesn't like trailing newlines; strip 'em
16 | if len(out) > 0 && out[len(out)-1] == '\n' {
17 | out = out[:len(out)-1]
18 | }
19 | return string(out), err
20 | }
21 |
22 | func shellCmdAction(com string, args []string) {
23 | result, err := shellCmd(com, args)
24 | if err == nil {
25 | if Global.SetUniversal {
26 | spitRegion(Global.CurrentB.cx, Global.CurrentB.cy, result)
27 | } else {
28 | showMessages(result)
29 | }
30 | } else {
31 | if Global.SetUniversal {
32 | spitRegion(Global.CurrentB.cx, Global.CurrentB.cy, err.Error()+"\n"+result)
33 | } else {
34 | showMessages(err.Error() + "\n" + result)
35 | }
36 | AddErrorMessage(err.Error())
37 | }
38 | }
39 |
40 | func doShellCmd() {
41 | var words []string
42 | var err error
43 | for len(words) == 0 {
44 | words, err = shellquote.Split(editorPrompt("Shell command", nil))
45 | if err != nil {
46 | Global.Input = err.Error()
47 | return
48 | }
49 | }
50 | shellCmdAction(words[0], words[1:])
51 | }
52 |
53 | func shellCmdWithInput(input, com string, args []string) (string, error) {
54 | cmd := exec.Command(com, args...)
55 | stdin, err := cmd.StdinPipe()
56 | if err != nil {
57 | return "", err
58 | }
59 |
60 | go func() {
61 | defer stdin.Close()
62 | io.WriteString(stdin, input)
63 | }()
64 | out, err := cmd.CombinedOutput()
65 | if out[len(out)-1] == '\n' {
66 | out = out[:len(out)-1]
67 | }
68 | return string(out), err
69 | }
70 |
71 | func shellCmdRegion(com string, args []string) {
72 | if Global.SetUniversal {
73 | transposeRegionCmd(func(input string) string {
74 | result, err := shellCmdWithInput(input, com, args)
75 | if err == nil {
76 | return result
77 | } else {
78 | return err.Error() + "\n" + result
79 | }
80 | })
81 | } else {
82 | regionCmd(func(buf *EditorBuffer, startc, endc, startl, endl int) string {
83 | result, err := shellCmdWithInput(getRegionText(buf, startc, endc, startl, endl), com, args)
84 | if err == nil {
85 | showMessages(result)
86 | } else {
87 | showMessages(err.Error() + "\n" + result)
88 | }
89 | return ""
90 | })
91 | }
92 | }
93 |
94 | func doShellCmdRegion() {
95 | var words []string
96 | var err error
97 | for len(words) == 0 {
98 | words, err = shellquote.Split(editorPrompt("Shell command", nil))
99 | if err != nil {
100 | Global.Input = err.Error()
101 | return
102 | }
103 | }
104 | shellCmdRegion(words[0], words[1:])
105 | }
106 |
107 | func replaceBufferWithShellCommand(buf *EditorBuffer, com string, args []string, env *glisp.Zlisp) {
108 | if buf.NumRows == 0 {
109 | return
110 | }
111 | output, err := shellCmdWithInput(getRegionText(buf, 0, buf.Rows[buf.NumRows-1].Size, 0, buf.NumRows-1), com, args)
112 | if err != nil {
113 | showMessages(err.Error(), output)
114 | return
115 | }
116 | lines := strings.Split(output, "\n")
117 | ll := len(lines)
118 | buf.Rows = make([]*EditorRow, ll)
119 | buf.NumRows = ll
120 | for i, line := range lines {
121 | newrow := &EditorRow{}
122 | newrow.Data = line
123 | newrow.idx = i
124 | newrow.Size = len(line)
125 | rowUpdateRender(newrow)
126 | buf.Rows[i] = newrow
127 | }
128 | if buf.Highlighter != nil {
129 | buf.Highlight()
130 | }
131 | buf.Undo = nil
132 | buf.Redo = nil
133 | if buf.cy >= buf.NumRows {
134 | buf.cy = buf.NumRows - 1
135 | }
136 | if buf.cx >= buf.Rows[buf.cy].Size {
137 | buf.cx = buf.Rows[buf.cy].Size
138 | }
139 | editorRowCxToRx(buf.Rows[buf.cy])
140 | editorBufSave(buf, env)
141 | }
142 |
--------------------------------------------------------------------------------
/undo_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "bytes"
5 | "strconv"
6 | "testing"
7 | )
8 |
9 | func (b *EditorBuffer) FailIfBufferNe(lines []string, t *testing.T) {
10 | if !b.TestIs(lines) {
11 | t.Error("Expected buffer", lines, "but was actually:\n", b.PrintBuf())
12 | }
13 | }
14 |
15 | func (b *EditorBuffer) PrintBuf() string {
16 | buf := bytes.Buffer{}
17 | for i, row := range b.Rows {
18 | buf.WriteString(strconv.Itoa(i))
19 | buf.WriteString(": ")
20 | buf.WriteString(row.Data)
21 | buf.WriteRune('\n')
22 | }
23 | return buf.String()
24 | }
25 |
26 | func (b *EditorBuffer) TestIs(lines []string) bool {
27 | // Special case - one empty line is functionally equivalent to an empty buffer
28 | if len(lines) == 0 && (b.LinesNum() == 1 && b.Rows[0].Data == "") {
29 | return true
30 | }
31 | if len(lines) != len(b.Rows) {
32 | return false
33 | }
34 | for i, line := range lines {
35 | if b.Rows[i].Data != line {
36 | return false
37 | }
38 | }
39 | return true
40 | }
41 |
42 | func TestAppendUndo(t *testing.T) {
43 | InitEditor()
44 | editorInsertStr("test")
45 | editorUndoAction()
46 | Global.CurrentB.FailIfBufferNe([]string{}, t)
47 | }
48 |
49 | func TestDeleteUndo(t *testing.T) {
50 | InitEditor()
51 | editorInsertStr("test")
52 | editorDelChar()
53 | editorUndoAction()
54 | Global.CurrentB.FailIfBufferNe([]string{"test"}, t)
55 | }
56 |
57 | func TestMultilineInsertUndo(t *testing.T) {
58 | InitEditor()
59 | editorInsertStr("test1")
60 | editorInsertNewline(false)
61 | editorInsertStr("test2")
62 | editorInsertNewline(false)
63 | editorInsertStr("test3")
64 | editorInsertNewline(false)
65 | editorUndoAction()
66 | Global.CurrentB.FailIfBufferNe([]string{}, t)
67 | }
68 |
69 | func TestMultilineDeleteUndo(t *testing.T) {
70 | InitEditor()
71 | editorInsertStr("test1")
72 | editorInsertNewline(false)
73 | editorInsertStr("test2")
74 | editorInsertNewline(false)
75 | editorInsertStr("test3")
76 | setMark(Global.CurrentB)
77 | Global.CurrentB.cx = 0
78 | Global.CurrentB.cy = 0
79 | doKillRegion()
80 | editorUndoAction()
81 | Global.CurrentB.FailIfBufferNe([]string{"test1", "test2", "test3"}, t)
82 | }
83 |
84 | func TestDoUndoWithNothing(t *testing.T) {
85 | InitEditor()
86 | editorUndoAction() // If this doesn't crash, then test for a message
87 | if Global.Input == "" {
88 | t.Error("No message to the user was printed")
89 | }
90 | }
91 |
92 | func TestDoRedoWithNothing(t *testing.T) {
93 | InitEditor()
94 | doOneRedo(nil) // If this doesn't crash, then test for a message
95 | if Global.Input == "" {
96 | t.Error("No message to the user was printed")
97 | }
98 | }
99 |
100 | func TestAppendRedo(t *testing.T) {
101 | InitEditor()
102 | editorInsertStr("test")
103 | editorUndoAction()
104 | doOneRedo(nil)
105 | Global.CurrentB.FailIfBufferNe([]string{"test"}, t)
106 | }
107 |
108 | func TestDeleteRedo(t *testing.T) {
109 | InitEditor()
110 | editorInsertStr("test")
111 | editorDelChar()
112 | editorUndoAction()
113 | doOneRedo(nil)
114 | Global.CurrentB.FailIfBufferNe([]string{"tes"}, t)
115 | }
116 |
117 | func TestMultilineInsertRedo(t *testing.T) {
118 | InitEditor()
119 | editorInsertStr("test1")
120 | editorInsertNewline(false)
121 | editorInsertStr("test2")
122 | editorInsertNewline(false)
123 | editorInsertStr("test3")
124 | editorUndoAction()
125 | doOneRedo(nil)
126 | Global.CurrentB.FailIfBufferNe([]string{"test1", "test2", "test3"}, t)
127 | }
128 |
129 | func TestMultilineDeleteRedo(t *testing.T) {
130 | InitEditor()
131 | editorInsertStr("test1")
132 | editorInsertNewline(false)
133 | editorInsertStr("test2")
134 | editorInsertNewline(false)
135 | editorInsertStr("test3")
136 | setMark(Global.CurrentB)
137 | Global.CurrentB.cx = 0
138 | Global.CurrentB.cy = 0
139 | doKillRegion()
140 | editorUndoAction()
141 | doOneRedo(nil)
142 | Global.CurrentB.FailIfBufferNe([]string{}, t)
143 | }
144 |
--------------------------------------------------------------------------------
/modes.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 |
6 | glisp "github.com/glycerine/zygomys/zygo"
7 | )
8 |
9 | // Minor Modes
10 | type ModeList map[string]bool
11 |
12 | func (e *EditorBuffer) hasMode(mode string) bool {
13 | if e.Modes == nil {
14 | e.AddDefaultModes()
15 | }
16 | return e.Modes[mode]
17 | }
18 |
19 | func (e *EditorBuffer) AddDefaultModes() {
20 | e.Modes = make(map[string]bool)
21 | for mode, enabled := range Global.DefaultModes {
22 | e.Modes[mode] = enabled
23 | }
24 | }
25 |
26 | func (e *EditorBuffer) toggleMode(mode string) (bool, error) {
27 | if e.Modes == nil {
28 | e.Modes = make(ModeList)
29 | }
30 | return e.setMode(mode, !e.hasMode(mode))
31 | }
32 |
33 | func defMode(mode string) {
34 | Global.MinorModes[mode] = true
35 | }
36 |
37 | func (e *EditorBuffer) setMode(mode string, enabled bool) (bool, error) {
38 | if e.Modes == nil {
39 | e.Modes = make(ModeList)
40 | }
41 | if Global.MinorModes[mode] {
42 | e.Modes[mode] = enabled
43 | return e.Modes[mode], nil
44 | }
45 | return e.Modes[mode], fmt.Errorf("%s is not a defined minor mode", mode)
46 | }
47 |
48 | func doToggleMode(mode string) {
49 | enabled, err := Global.CurrentB.toggleMode(mode)
50 | if err != nil {
51 | Global.Input = err.Error()
52 | return
53 | }
54 | if enabled {
55 | Global.Input = mode + " enabled"
56 | } else {
57 | Global.Input = mode + " disabled"
58 | }
59 | }
60 |
61 | func (e *EditorBuffer) getEnabledModes() []string {
62 | enmodes := []string{}
63 | for mode, enabled := range Global.CurrentB.Modes {
64 | if enabled {
65 | enmodes = append(enmodes, mode)
66 | }
67 | }
68 | return enmodes
69 | }
70 |
71 | func showModes() {
72 | modes := Global.CurrentB.getEnabledModes()
73 | if len(modes) == 0 {
74 | Global.Input = "Current buffer has no modes enabled."
75 | } else {
76 | showMessages(append([]string{"Modes for " +
77 | Global.CurrentB.getFilename(), ""}, modes...)...)
78 | }
79 | }
80 |
81 | func addDefaultMode(mode string) {
82 | Global.DefaultModes[mode] = true
83 | }
84 |
85 | func remDefaultMode(mode string) {
86 | Global.DefaultModes[mode] = false
87 | }
88 |
89 | // Major Modes
90 | type Hooks struct {
91 | GoHooks []func()
92 | LispHooks []glisp.SexpFunction
93 | }
94 |
95 | type HookList map[string]*Hooks
96 |
97 | func loadDefaultHooks() HookList {
98 | ret := make(HookList)
99 | return ret
100 | }
101 |
102 | func ExecHooksForMode(env *glisp.Zlisp, mode string) {
103 | hooks := Global.MajorHooks[mode]
104 | if hooks != nil {
105 | for _, hook := range hooks.GoHooks {
106 | hook()
107 | }
108 | for _, hook := range hooks.LispHooks {
109 | env.Apply(&hook, []glisp.Sexp{})
110 | }
111 | }
112 | }
113 |
114 | func RegisterGoHookForMode(mode string, hook func()) {
115 | hooks := Global.MajorHooks[mode]
116 | if hooks == nil {
117 | gohooks := make([]func(), 1)
118 | gohooks[0] = hook
119 | Global.MajorHooks[mode] = &Hooks{gohooks, []glisp.SexpFunction{}}
120 | } else {
121 | hooks.GoHooks = append(hooks.GoHooks, hook)
122 | }
123 | }
124 |
125 | func RegisterLispHookForMode(mode string, hook glisp.SexpFunction) {
126 | hooks := Global.MajorHooks[mode]
127 | if hooks == nil {
128 | gohooks := make([]func(), 0)
129 | lisphooks := make([]glisp.SexpFunction, 1)
130 | lisphooks[0] = hook
131 | Global.MajorHooks[mode] = &Hooks{gohooks, lisphooks}
132 | } else {
133 | hooks.LispHooks = append(hooks.LispHooks, hook)
134 | }
135 | }
136 |
137 | func RegisterGoSaveHookForMode(mode string, hook func()) {
138 | RegisterGoHookForMode(mode+"-save", hook)
139 | }
140 |
141 | func RegisterLispSaveHookForMode(mode string, hook glisp.SexpFunction) {
142 | RegisterLispHookForMode(mode+"-save", hook)
143 | }
144 |
145 | func ExecSaveHooksForMode(env *glisp.Zlisp, mode string) {
146 | ExecHooksForMode(env, mode+"-save")
147 | }
148 |
149 | func BindKeyMajorMode(mode, key string, cmd *CommandFunc) {
150 | AddErrorMessage(mode + key + cmd.Name)
151 | if Global.MajorBindings[mode] == nil {
152 | Global.MajorBindings[mode] = new(CommandList)
153 | Global.MajorBindings[mode].Parent = true
154 | }
155 | Global.MajorBindings[mode].PutCommand(key, cmd)
156 | }
157 |
--------------------------------------------------------------------------------
/syntax_files/golo.yaml:
--------------------------------------------------------------------------------
1 | filetype: golo
2 |
3 | detect:
4 | filename: "\\.golo$"
5 |
6 | rules:
7 | - type: "\\b(function|fun|)\\b"
8 | - type: "\\b(struct|DynamicObject|union|AdapterFabric|Adapter|DynamicVariable|Observable)\\b"
9 | - type: "\\b(list|set|array|vector|tuple|map)\\b"
10 | - type: "\\b(Ok|Error|Empty|None|Some|Option|Result|Result.ok|Result.fail|Result.error|Result.empty|Optional.empty|Optional.of)\\b"
11 |
12 | - identifier.class: "\\b(augment|pimp)\\b"
13 | - identifier.class: "\\b(interfaces|implements|extends|overrides|maker|newInstance)\\b"
14 | - identifier.class: "\\b(isEmpty|isNone|isPresent|isSome|iterator|flattened|toList|flatMap|`and|orElseGet|`or|toResult|apply|either)\\b"
15 | - identifier.class: "\\b(result|option|trying|raising|nullify|catching)\\b"
16 | - identifier.class: "\\b(promise|setFuture|failedFuture|all|any)\\b"
17 | - identifier.class: "\\b(initialize|initializeWithinThread|start|future|fallbackTo|onSet|onFail|cancel|enqueue)\\b"
18 | - identifier.class: "\\b(println|print|raise|readln|readPassword|secureReadPassword|requireNotNull|require|newTypedArray|range|reversedRange|mapEntry|asInterfaceInstance|asFunctionalInterface|isClosure|fileToText|textToFile|fileExists|currentDir|sleep|uuid|isArray|arrayTypeOf|charValue|intValue|longValue|doubleValue|floatValue|removeByIndex|box)\\b"
19 | - identifier.class: "\\b(likelySupported|reset|bold|underscore|blink|reverse_video|concealed|fg_black|fg_red|fg_green|fg_yellow|fg_blue|fg_magenta|fg_cyan|fg_white|bg_black|bg_red|bg_green|bg_yellow|bg_blue|bg_magenta|bg_cyan|bg_white|cursor_position|cursor_save_position|cursor_restore_position|cursor_up|cursor_down|cursor_forward|cursor_backward|erase_display|erase_line)\\b"
20 | - identifier.class: "\\b(emptyList|cons|lazyList|fromIter|generator|repeat|iterate)\\b"
21 | - identifier.class: "\\b(asLazyList|foldl|foldr|take|takeWhile|drop|dropWhile|subList)\\b"
22 | - identifier.class: "\\b(import)\\b"
23 | - identifier.class: "\\b(module)\\b"
24 | - identifier.class: "\\b(JSON)\\b"
25 | - identifier.class: "\\b(stringify|parse|toJSON|toDynamicObject|updateFromJSON)\\b"
26 | - identifier.class: "\\b(newInstance|define|getKey|getValue|properties|fallback)\\b"
27 | - identifier.class: "\\b(times|upTo|downTo)\\b"
28 | - identifier.class: "\\b(format|toInt|toInteger|toDouble|toFloat|toLong)\\b"
29 | - identifier.class: "\\b(head|tail|isEmpty|reduce|each|count|exists)\\b"
30 | - identifier.class: "\\b(newWithSameType|destruct|append|add|addIfAbsent|prepend|insert|last|unmodifiableView|find|filter|map|join|reverse|reversed|order|ordered|removeAt|include|exclude|remove|delete|has|contains|getOrElse|toArray)\\b"
31 | - identifier.class: "\\b(add|addTo|succ|pred|mul|neg|sub|rsub|div|rdiv|mod|rmod|pow|rpow|str|lt|gt|eq|ne|ge|le|`and|`or|`not|xor|even|odd|contains|isEmpty|`is|`isnt|`oftype|`orIfNull|fst|snd|getitem|setitem|getter|id|const|False|True|Null|curry|uncurry|unary|spreader|varargs|swapArgs|swapCurry|swapCouple|swap|invokeWith|pipe|compose|io|andThen|until|recur|cond)\\b"
32 | - identifier.class: "\\b(toUpperCase|equals|startsWith)\\b"
33 |
34 | - statement: "\\b(if|else|then|when|case|match|otherwise)\\b"
35 | - special: "\\b(with|break|continue|return)\\b"
36 | - error: "\\b(try|catch|finally|throw)\\b"
37 | - identifier: "\\b(super|this|let|var|local)\\b"
38 | - symbol.brackets: "[(){}]|\\[|\\]"
39 | - statement: "\\b(for|while|foreach|in)\\b"
40 | - constant: "\\b(and|in|is|not|or|isnt|orIfNull)\\b"
41 |
42 | - constant.bool: "\\b(true|false)\\b"
43 | - constant: "\\b(null|undefined)\\b"
44 |
45 | - symbol.operator: "[\\-+/*=<>!~%&|^]|:="
46 | - constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'"
47 |
48 | - constant.string:
49 | start: "\""
50 | end: "\""
51 | skip: "\\\\."
52 | rules:
53 | - constant.specialChar: "\\\\."
54 |
55 | - constant.string:
56 | start: "'"
57 | end: "'"
58 | skip: "\\\\."
59 | rules:
60 | - constant.specialChar: "\\\\."
61 |
62 | - comment:
63 | start: "#"
64 | end: "$"
65 | rules:
66 | - todo: "(TODO|XXX|FIXME):?"
67 |
68 | - comment:
69 | start: "----"
70 | end: "----"
71 | rules:
72 | - todo: "(TODO|XXX|FIXME):?"
73 |
74 |
--------------------------------------------------------------------------------
/mouse.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "os/exec"
5 |
6 | termbox "github.com/nsf/termbox-go"
7 | )
8 |
9 | const (
10 | GomacsMouseNone byte = iota
11 | GomacsMouseDragging
12 | )
13 |
14 | func (t *winTree) mouseInBuffer(x, y, wx, wy, mx, my int) (int, int, *EditorBuffer) {
15 | if !(x <= mx && mx <= x+wx && y <= my && my <= y+wx) {
16 | // Do nothing
17 | return 0, 0, nil
18 | } else if t.split {
19 | if t.hor {
20 | rx, ry, rbuf := t.childLT.mouseInBuffer(x, y, wx/2, wy, mx, my)
21 |
22 | if rbuf != nil {
23 | return rx, ry, rbuf
24 | }
25 |
26 | return t.childRB.mouseInBuffer(x+(wx/2)+1, y, (wx / 2),
27 | wy, mx, my)
28 | }
29 | rx, ry, rbuf := t.childLT.mouseInBuffer(x, y, wx, wy/2, mx, my)
30 |
31 | if rbuf != nil {
32 | return rx, ry, rbuf
33 | }
34 |
35 | return t.childRB.mouseInBuffer(x, y+1+(wy/2), wx, (wy/2)-1, mx, my)
36 | }
37 |
38 | cy := t.buf.rowoff + my%wy
39 |
40 | if cy >= Global.CurrentB.NumRows {
41 | return 0, cy, t.buf
42 | }
43 |
44 | row := Global.CurrentB.Rows[cy]
45 | gut := 0
46 | if Global.CurrentB.hasMode("line-number-mode") {
47 | gut = GetGutterWidth(Global.CurrentB.NumRows)
48 | }
49 | rx := mx - x - gut + row.coloff
50 |
51 | Global.WindowTree.mapTree(func(wt *winTree) { wt.focused = false })
52 | t.setFocus()
53 |
54 | return editorRowRxToCx(row, rx), cy, t.buf
55 | }
56 |
57 | func getMousePoint(mx, my int) (int, int, *EditorBuffer) {
58 | sx, sy := termbox.Size()
59 | return Global.WindowTree.mouseInBuffer(0, 0, sx, sy-2, mx, my)
60 | }
61 |
62 | func JumpToMousePoint() {
63 | if Global.CurrentB.NumRows <= 0 {
64 | return
65 | }
66 | var cx, cy int
67 | cx, cy, Global.CurrentB = getMousePoint(Global.MouseX, Global.MouseY)
68 | if cy >= Global.CurrentB.NumRows {
69 | Global.CurrentB.cy = Global.CurrentB.NumRows - 1
70 | Global.CurrentB.cx = Global.CurrentB.Rows[Global.CurrentB.cy].Size
71 | } else {
72 | Global.CurrentB.cy = cy
73 | Global.CurrentB.cx = cx
74 | Global.CurrentB.prefcx = cx
75 | }
76 | }
77 |
78 | var mousestate byte = GomacsMouseNone
79 |
80 | func MouseDragRegion() {
81 | buf := Global.CurrentB
82 | if buf.NumRows <= 0 {
83 | return
84 | }
85 | cachedcx, cachedcy := buf.cx, buf.cy
86 | JumpToMousePoint()
87 | if mousestate == GomacsMouseDragging && buf == Global.CurrentB && (cachedcx != buf.cx || cachedcy != buf.cy) {
88 | if !buf.regionActive {
89 | buf.MarkX = cachedcx
90 | buf.MarkY = cachedcy
91 | buf.regionActive = true
92 | }
93 | buf.recalcRegion()
94 | }
95 | mousestate = GomacsMouseDragging
96 | }
97 |
98 | func MouseScrollUp() {
99 | _, _, Global.CurrentB = getMousePoint(Global.MouseX, Global.MouseY)
100 | if Global.CurrentB.rowoff > 0 {
101 | Global.CurrentB.rowoff--
102 | } else {
103 | Global.Input = "Beginning of buffer"
104 | }
105 | if Global.CurrentB.cy >= Global.CurrentB.rowoff+Global.CurrentBHeight-1 {
106 | Global.CurrentB.MoveCursorUp()
107 | }
108 | }
109 |
110 | func MouseScrollDown() {
111 | _, _, Global.CurrentB = getMousePoint(Global.MouseX, Global.MouseY)
112 | if Global.CurrentB.rowoff < Global.CurrentB.NumRows {
113 | Global.CurrentB.rowoff++
114 | } else {
115 | Global.Input = "End of buffer"
116 | }
117 | if Global.CurrentB.cy < Global.CurrentB.rowoff {
118 | Global.CurrentB.MoveCursorDown()
119 | }
120 | }
121 |
122 | func MouseRelease() {
123 | Global.Input = ""
124 | mousestate = GomacsMouseNone
125 | }
126 |
127 | func MouseYankXsel() {
128 | prog, args, err := getXsel()
129 | if err != nil {
130 | Global.Input = "Can't find xsel or xclip in your PATH"
131 | AddErrorMessage(Global.Input)
132 | return
133 | }
134 | var out string
135 | out, err = shellCmd(prog, args)
136 | if err != nil {
137 | Global.Input = err.Error()
138 | AddErrorMessage(Global.Input)
139 | return
140 | }
141 | Global.Clipboard = out
142 | if Global.CurrentB.hasMode("xsel-jump-to-cursor-mode") {
143 | JumpToMousePoint()
144 | }
145 | doYankRegion()
146 | Global.Input = "Yanked X selection."
147 | }
148 |
149 | func getXsel() (string, []string, error) {
150 | args := []string{}
151 | ret, err := exec.LookPath("xsel")
152 | if err != nil {
153 | ret, err = exec.LookPath("xclip")
154 | if err == nil {
155 | args = []string{"-o", "-selection", "primary"}
156 | }
157 | }
158 | return ret, args, err
159 | }
160 |
--------------------------------------------------------------------------------
/syntax_files/ats.yaml:
--------------------------------------------------------------------------------
1 | filetype: ATS
2 |
3 | detect:
4 | filename: "\\.(d|h|s)ats$"
5 |
6 | rules:
7 | - default: \b[[:alnum:]]+[^0-9A-Za-z]
8 |
9 | # Operators
10 | - symbol.operator: "[.:;+`|~<>?='\\&]|/|%|-|,|!|\\*|@|\\#"
11 | - symbol.operator: \^
12 |
13 | # Types, abstract types and some predefined sorts
14 | - type: \b(addr|age?z|bool|char|cls|schar|uchar|double|ldouble|eff|exn|float|int(ptr)?|lincloptr|uint)\b
15 | - type: \b(lint|ulint|llint|ullint|nat|ptr|real|ref|size_t|ssize_t|sint|usint|string|tkind|viewt|v?t0p|vt|void)\b
16 | - type: \b(prop|t[@0]ype|type|viewt[@0]ype|viewtype|vt[@0]ype|vtype|view)\b
17 | - type: \b(prop[+-]|t[@0]ype[+-]|type[+-]|viewt[@0]ype[+-]|viewtype[+-]|vt[@0]ype[+-]|vtype[+-]|view[+-])
18 |
19 | # Statements
20 | - statement: \b(abstype|abst|absprop|absviewt|absvt(ype)?|absview|and|andalso|as|(re)?assume|begin|(pr)?case|s?case)\b
21 | - statement: \b(classdec|dataprop|data(v|view)?type|dataview|datasort|do|dynload|else|end|exception|extype|extva(r|l)|s?if)\b
22 | - statement: \b(ifcase|import|for|in|infix(l|r)?|let|local|macrodef|macdef|not|of|op|or|orelse|overload|(pre|post|non)fix)\b
23 | - statement: \b(propdef|rec|sortdef|stacst|stadef|staload|stavar|sta(tic)?|symelim|symintr|tkindef|then|try|viewdef|v?typedef)\b
24 | - statement: \b(viewtypedef|(pr)?va(l|r)|when|where|while|with|withtype|withprop|withv(iew)?type|withview)\b
25 | - statement: \b(abst[@0]ype|absviewt[@0]?ype|absvt[@0]ype|abstbox|abstflat|absvtbox|absvtflat|absimpl|absreimpl|abs)\b
26 | - statement: \b(case[+-]|(pr)?va(l|r)[+-]|for\*|while\*)
27 |
28 | # Numbers
29 | - constant.number: \b[0-9.]+([eE][+-]?[0-9]+)?[fFlL]?\b
30 | - constant.number: \b0[xX][0-9A-Fa-f]*(\.[0-9A-Fa-f]*)?[pP][+-]?[0-9]+[fFlL]?\b
31 | - constant.number: \b([0-9]+|0[xX][0-9A-Fa-f]+)[lLuU]*\b
32 |
33 | # Function-related keywords, special functions and namespaces. Not really identifiers
34 | - identifier: \b(fix|(pr)?fu?n|fnx|castfn|praxi|extern|lam|llam|(pr)?implement|(pr)?implmnt)\b
35 | - identifier: \b(fix@|fold@|free@|lam@|llam@|addr@|view@|ref@|fn\*)
36 | - identifier: \$\w*\b
37 |
38 | # Other keywords, function effects...
39 | - special: (\$(arrpsz|arrptrsize|break|continue|d2ctype|delay|effmask_(ntm|exn|ref|wrt|all)))\b
40 | - special: (\$(effmask|extern|extype_struct|extype|extkind|extval|extfcall|extmcall|ldelay|literal))\b
41 | - special: (\$(li?st_vt|li?st_t|li?st|myfilename|myfunction|mylocation|raise|rec(ord)?_vt))\b
42 | - special: (\$(rec(ord)?_t|rec(ord)?|showtype|solver_assert|solver_verify|tempenver))\b
43 | - special: (\$(tup(le)?_vt|tup(le)?_t|tup(le)?|tyrep|vararg|vcopyenv_vt|vcopyenv_v))\b
44 | - special: \!(wrt|exnref|exnwrt|exn|refwrt|ref|all|ntm|laz)\b
45 | - special: \b(fun(0|1)|(lin)?cloptr(0|1)?|cloref(0|1)?|clo(0|1)?|lin|prf)\b
46 | - special: \b(f?print(ln)?!|prerr(ln)?!|tupz!)
47 |
48 | # Some C macros and other ATS macros
49 | - preproc: ^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error|assert)\b
50 | - preproc: ^[[:space:]]*#[[:space:]]*(codegen2|codegen3|elifdef|elifndef|prerr|print|require|then|staload|dynload)\b
51 |
52 | # Boolean values
53 | - constant.bool: \b(true|false|null)\b
54 |
55 |
56 | # The "%{ ... %}" block inserts foreign code into ATS at compile-time
57 | # Code inside of it is generally C or JavaScript
58 | - default:
59 | start: "%{[#^$]?"
60 | end: "%}"
61 | skip: "\\."
62 | limit-group: symbol.operator
63 | rules:
64 | - include: "c"
65 | - include: "javascript"
66 |
67 |
68 | # Strings and chars
69 | - constant.string: \"[^"]*\"
70 | - constant.string: \'[^']*\'
71 |
72 |
73 | # Comments
74 | # "////" comments everything until it reaches EOF
75 | - comment.block:
76 | start: ////
77 | end: $a
78 | rules:
79 | - todo: (TODO|XXX|FIXME)
80 |
81 | - comment.line:
82 | start: //
83 | end: $
84 | rules:
85 | - todo: (TODO|XXX|FIXME)
86 |
87 | # ML-like block comment
88 | - comment.block:
89 | start: \(\*
90 | end: \*\)
91 | rules:
92 | - todo: (TODO|XXX|FIXME)
93 |
94 | # C-like block comment
95 | - comment.block:
96 | start: /\*
97 | end: \*\/
98 | rules:
99 | - todo: (TODO|XXX|FIXME)
100 |
--------------------------------------------------------------------------------
/syntax_files/lua.yaml:
--------------------------------------------------------------------------------
1 | filetype: lua
2 |
3 | detect:
4 | filename: "\\.lua$"
5 |
6 | rules:
7 | - statement: "\\b(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return)\\b"
8 | - statement: "\\b(not|and|or)\\b"
9 | - statement: "\\b(debug|string|math|table|io|coroutine|os|utf8|bit32)\\b\\."
10 | - statement: "\\b(_ENV|_G|_VERSION|assert|collectgarbage|dofile|error|getfenv|getmetatable|ipairs|load|loadfile|module|next|pairs|pcall|print|rawequal|rawget|rawlen|rawset|require|select|setfenv|setmetatable|tonumber|tostring|type|unpack|xpcall)\\s*\\("
11 | - identifier: "io\\.\\b(close|flush|input|lines|open|output|popen|read|tmpfile|type|write)\\b"
12 | - identifier: "math\\.\\b(abs|acos|asin|atan2|atan|ceil|cosh|cos|deg|exp|floor|fmod|frexp|huge|ldexp|log10|log|max|maxinteger|min|mininteger|modf|pi|pow|rad|random|randomseed|sinh|sqrt|tan|tointeger|type|ult)\\b"
13 | - identifier: "os\\.\\b(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)\\b"
14 | - identifier: "package\\.\\b(config|cpath|loaded|loadlib|path|preload|seeall|searchers|searchpath)\\b"
15 | - identifier: "string\\.\\b(byte|char|dump|find|format|gmatch|gsub|len|lower|match|pack|packsize|rep|reverse|sub|unpack|upper)\\b"
16 | - identifier: "table\\.\\b(concat|insert|maxn|move|pack|remove|sort|unpack)\\b"
17 | - identifier: "utf8\\.\\b(char|charpattern|codes|codepoint|len|offset)\\b"
18 | - identifier: "coroutine\\.\\b(create|isyieldable|resume|running|status|wrap|yield)\\b"
19 | - identifier: "debug\\.\\b(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue|getuservalue|setfenv|sethook|setlocal|setmetatable|setupvalue|setuservalue|traceback|upvalueid|upvaluejoin)\\b"
20 | - identifier: "bit32\\.\\b(arshift|band|bnot|bor|btest|bxor|extract|replace|lrotate|lshift|rrotate|rshift)\\b"
21 | - identifier: "\\:\\b(close|flush|lines|read|seek|setvbuf|write|byte|char|dump|find|format|gmatch|gsub|len|lower|match|pack|packsize|rep|reverse|sub|unpack|upper)\\b"
22 | - identifier: "\\b(self|arg)\\b"
23 | - constant: "\\b(false|nil|true)\\b"
24 | - statement: "(\\b(dofile|require|include)|%q|%!|%Q|%r|%x)\\b"
25 | - constant.number: "\\b([0-9]+)\\b"
26 | - symbol.brackets: "[(){}\\[\\]]"
27 | - symbol: "(\\*|//|/|%|\\+|-|\\^|>|>=|<|<=|~=|=|[\\.]{2,3}|#)"
28 |
29 | - constant.string:
30 | start: "\""
31 | end: "\""
32 | skip: "\\\\."
33 | rules:
34 | - constant.specialChar: "\\\\."
35 |
36 | - constant.string:
37 | start: "'"
38 | end: "'"
39 | skip: "\\\\."
40 | rules:
41 | - constant.specialChar: "\\\\."
42 |
43 | - constant.string:
44 | start: "\\[\\["
45 | end: "\\]\\]"
46 | rules:
47 | - constant.specialChar: "\\\\."
48 |
49 | # support first few lengths of "long brackets" explicitly
50 | # brackets longer than that will give false positives
51 |
52 | - constant.string:
53 | start: "\\[=\\["
54 | end: "\\]=\\]"
55 | rules:
56 | - constant.specialChar: "\\\\."
57 |
58 | - constant.string:
59 | start: "\\[==\\["
60 | end: "\\]==\\]"
61 | rules:
62 | - constant.specialChar: "\\\\."
63 |
64 | - constant.string:
65 | start: "\\[===\\["
66 | end: "\\]===\\]"
67 | rules:
68 | - constant.specialChar: "\\\\."
69 |
70 | - constant.string:
71 | start: "\\[====+\\["
72 | end: "\\]====+\\]"
73 | rules:
74 | - constant.specialChar: "\\\\."
75 |
76 | - special: "\\\\[0-7][0-7][0-7]|\\\\x[0-9a-fA-F][0-9a-fA-F]|\\\\[abefnrs]|(\\\\c|\\\\C-|\\\\M-|\\\\M-\\\\C-)."
77 |
78 | - comment.block:
79 | start: "\\-\\-\\[\\["
80 | end: "\\]\\]"
81 | rules:
82 | - todo: "(TODO|NOTE|FIXME):?"
83 |
84 | # support long brackets, same as with multiline strings
85 |
86 | - comment.block:
87 | start: "\\-\\-\\[=\\["
88 | end: "\\]=\\]"
89 | rules:
90 | - todo: "(TODO|NOTE|FIXME):?"
91 |
92 | - comment.block:
93 | start: "\\-\\-\\[==\\["
94 | end: "\\]==\\]"
95 | rules:
96 | - todo: "(TODO|NOTE|FIXME):?"
97 |
98 | - comment.block:
99 | start: "\\-\\-\\[===\\["
100 | end: "\\]===\\]"
101 | rules:
102 | - todo: "(TODO|NOTE|FIXME):?"
103 |
104 | - comment.block:
105 | start: "\\-\\-\\[====+\\["
106 | end: "\\]====+\\]"
107 | rules:
108 | - todo: "(TODO|NOTE|FIXME):?"
109 |
110 | # this has to go after block comment or block comment does not work
111 |
112 | - comment:
113 | start: "\\-\\-"
114 | end: "$"
115 | rules:
116 | - todo: "(TODO|NOTE|FIXME):?"
117 |
--------------------------------------------------------------------------------