mirror of
https://github.com/Hopiu/micro.git
synced 2026-03-28 20:00:24 +00:00
Merge branch 'view-refactor'
This commit is contained in:
commit
2e6cbcb362
232 changed files with 6153 additions and 4542 deletions
2
LICENSE
2
LICENSE
|
|
@ -1,6 +1,6 @@
|
|||
Micro is licensed under the MIT "Expat" License:
|
||||
|
||||
Copyright (c) 2016: Zachary Yedidia.
|
||||
Copyright (c) 2016: Zachary Yedidia, et al.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
|
|
|||
|
|
@ -1421,7 +1421,6 @@ func (v *View) Quit(usePlugin bool) bool {
|
|||
}
|
||||
if curTab == 0 {
|
||||
CurView().ToggleTabbar()
|
||||
CurView().matches = Match(CurView())
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1457,7 +1456,6 @@ func (v *View) QuitAll(usePlugin bool) bool {
|
|||
|
||||
if closeAll {
|
||||
// only quit if all of the buffers can be closed and the user confirms that they actually want to quit everything
|
||||
|
||||
shouldQuit, _ := messenger.YesNoPrompt("Do you want to quit micro (all open files will be closed)?")
|
||||
|
||||
if shouldQuit {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import (
|
|||
"unicode/utf8"
|
||||
|
||||
"github.com/mitchellh/go-homedir"
|
||||
"github.com/zyedidia/micro/cmd/micro/highlight"
|
||||
)
|
||||
|
||||
// Buffer stores the text for files that are loaded into the text editor
|
||||
|
|
@ -44,8 +45,8 @@ type Buffer struct {
|
|||
|
||||
NumLines int
|
||||
|
||||
// Syntax highlighting rules
|
||||
rules []SyntaxRule
|
||||
syntaxDef *highlight.Def
|
||||
highlighter *highlight.Highlighter
|
||||
|
||||
// Buffer local settings
|
||||
Settings map[string]interface{}
|
||||
|
|
@ -96,7 +97,6 @@ func NewBuffer(reader io.Reader, path string) *Buffer {
|
|||
b.EventHandler = NewEventHandler(b)
|
||||
|
||||
b.Update()
|
||||
b.FindFileType()
|
||||
b.UpdateRules()
|
||||
|
||||
if _, err := os.Stat(configDir + "/buffers/"); os.IsNotExist(err) {
|
||||
|
|
@ -185,12 +185,14 @@ func (b *Buffer) GetName() string {
|
|||
// UpdateRules updates the syntax rules and filetype for this buffer
|
||||
// This is called when the colorscheme changes
|
||||
func (b *Buffer) UpdateRules() {
|
||||
b.rules = GetRules(b)
|
||||
}
|
||||
|
||||
// FindFileType identifies this buffer's filetype based on the extension or header
|
||||
func (b *Buffer) FindFileType() {
|
||||
b.Settings["filetype"] = FindFileType(b)
|
||||
b.syntaxDef = highlight.DetectFiletype(syntaxDefs, b.Path, []byte(b.Line(0)))
|
||||
if b.highlighter == nil || b.Settings["filetype"].(string) != b.syntaxDef.FileType {
|
||||
b.Settings["filetype"] = b.syntaxDef.FileType
|
||||
b.highlighter = highlight.NewHighlighter(b.syntaxDef)
|
||||
if b.Settings["syntax"].(bool) {
|
||||
b.highlighter.HighlightStates(b)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FileType returns the buffer's filetype
|
||||
|
|
@ -280,7 +282,6 @@ func (b *Buffer) Serialize() error {
|
|||
|
||||
// SaveAs saves the buffer to a specified path (filename), creating the file if it does not exist
|
||||
func (b *Buffer) SaveAs(filename string) error {
|
||||
b.FindFileType()
|
||||
b.UpdateRules()
|
||||
dir, _ := homedir.Dir()
|
||||
b.Path = strings.Replace(filename, "~", dir, 1)
|
||||
|
|
@ -317,7 +318,6 @@ func (b *Buffer) SaveAs(filename string) error {
|
|||
// SaveAsWithSudo is the same as SaveAs except it uses a neat trick
|
||||
// with tee to use sudo so the user doesn't have to reopen micro with sudo
|
||||
func (b *Buffer) SaveAsWithSudo(filename string) error {
|
||||
b.FindFileType()
|
||||
b.UpdateRules()
|
||||
b.Path = filename
|
||||
|
||||
|
|
@ -388,7 +388,7 @@ func (b *Buffer) Start() Loc {
|
|||
|
||||
// End returns the location of the last character in the buffer
|
||||
func (b *Buffer) End() Loc {
|
||||
return Loc{utf8.RuneCount(b.lines[b.NumLines-1]), b.NumLines - 1}
|
||||
return Loc{utf8.RuneCount(b.lines[b.NumLines-1].data), b.NumLines - 1}
|
||||
}
|
||||
|
||||
// RuneAt returns the rune at a given location in the buffer
|
||||
|
|
@ -405,7 +405,11 @@ func (b *Buffer) Line(n int) string {
|
|||
if n >= len(b.lines) {
|
||||
return ""
|
||||
}
|
||||
return string(b.lines[n])
|
||||
return string(b.lines[n].data)
|
||||
}
|
||||
|
||||
func (b *Buffer) LinesNum() int {
|
||||
return len(b.lines)
|
||||
}
|
||||
|
||||
// Lines returns an array of strings containing the lines from start to end
|
||||
|
|
@ -413,7 +417,7 @@ func (b *Buffer) Lines(start, end int) []string {
|
|||
lines := b.lines[start:end]
|
||||
var slice []string
|
||||
for _, line := range lines {
|
||||
slice = append(slice, string(line))
|
||||
slice = append(slice, string(line.data))
|
||||
}
|
||||
return slice
|
||||
}
|
||||
|
|
@ -432,7 +436,7 @@ func (b *Buffer) MoveLinesUp(start int, end int) {
|
|||
if end == len(b.lines) {
|
||||
b.Insert(
|
||||
Loc{
|
||||
utf8.RuneCount(b.lines[end-1]),
|
||||
utf8.RuneCount(b.lines[end-1].data),
|
||||
end - 1,
|
||||
},
|
||||
"\n"+b.Line(start-1),
|
||||
|
|
@ -467,3 +471,11 @@ func (b *Buffer) MoveLinesDown(start int, end int) {
|
|||
Loc{0, end + 1},
|
||||
)
|
||||
}
|
||||
|
||||
// ClearMatches clears all of the syntax highlighting for this buffer
|
||||
func (b *Buffer) ClearMatches() {
|
||||
for i := range b.lines {
|
||||
b.SetMatch(i, nil)
|
||||
b.SetState(i, nil)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
196
cmd/micro/cellview.go
Normal file
196
cmd/micro/cellview.go
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/mattn/go-runewidth"
|
||||
"github.com/zyedidia/micro/cmd/micro/highlight"
|
||||
"github.com/zyedidia/tcell"
|
||||
)
|
||||
|
||||
func min(a, b int) int {
|
||||
if a <= b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func visualToCharPos(visualIndex int, lineN int, str string, buf *Buffer, tabsize int) (int, int, *tcell.Style) {
|
||||
charPos := 0
|
||||
var lineIdx int
|
||||
var lastWidth int
|
||||
var style *tcell.Style
|
||||
var width int
|
||||
var rw int
|
||||
for i, c := range str {
|
||||
// width := StringWidth(str[:i], tabsize)
|
||||
|
||||
if group, ok := buf.Match(lineN)[charPos]; ok {
|
||||
s := GetColor(highlight.GetGroup(group))
|
||||
style = &s
|
||||
}
|
||||
|
||||
if width >= visualIndex {
|
||||
return charPos, visualIndex - lastWidth, style
|
||||
}
|
||||
|
||||
if i != 0 {
|
||||
charPos++
|
||||
lineIdx += rw
|
||||
}
|
||||
lastWidth = width
|
||||
rw = 0
|
||||
if c == '\t' {
|
||||
rw := tabsize - (lineIdx % tabsize)
|
||||
width += rw
|
||||
} else {
|
||||
rw = runewidth.RuneWidth(c)
|
||||
width += rw
|
||||
}
|
||||
}
|
||||
|
||||
return -1, -1, style
|
||||
}
|
||||
|
||||
type Char struct {
|
||||
visualLoc Loc
|
||||
realLoc Loc
|
||||
char rune
|
||||
// The actual character that is drawn
|
||||
// This is only different from char if it's for example hidden character
|
||||
drawChar rune
|
||||
style tcell.Style
|
||||
width int
|
||||
}
|
||||
|
||||
type CellView struct {
|
||||
lines [][]*Char
|
||||
}
|
||||
|
||||
func (c *CellView) Draw(buf *Buffer, top, height, left, width int) {
|
||||
tabsize := int(buf.Settings["tabsize"].(float64))
|
||||
softwrap := buf.Settings["softwrap"].(bool)
|
||||
indentchar := []rune(buf.Settings["indentchar"].(string))[0]
|
||||
|
||||
start := buf.Cursor.Y
|
||||
if buf.Settings["syntax"].(bool) {
|
||||
if start > 0 && buf.lines[start-1].rehighlight {
|
||||
buf.highlighter.ReHighlightLine(buf, start-1)
|
||||
buf.lines[start-1].rehighlight = false
|
||||
}
|
||||
|
||||
buf.highlighter.ReHighlightStates(buf, start)
|
||||
|
||||
buf.highlighter.HighlightMatches(buf, top, top+height)
|
||||
}
|
||||
|
||||
c.lines = make([][]*Char, 0)
|
||||
|
||||
viewLine := 0
|
||||
lineN := top
|
||||
|
||||
curStyle := defStyle
|
||||
for viewLine < height {
|
||||
if lineN >= len(buf.lines) {
|
||||
break
|
||||
}
|
||||
|
||||
lineStr := buf.Line(lineN)
|
||||
line := []rune(lineStr)
|
||||
|
||||
colN, startOffset, startStyle := visualToCharPos(left, lineN, lineStr, buf, tabsize)
|
||||
if colN < 0 {
|
||||
colN = len(line)
|
||||
}
|
||||
viewCol := -startOffset
|
||||
if startStyle != nil {
|
||||
curStyle = *startStyle
|
||||
}
|
||||
|
||||
// We'll either draw the length of the line, or the width of the screen
|
||||
// whichever is smaller
|
||||
lineLength := min(StringWidth(lineStr, tabsize), width)
|
||||
c.lines = append(c.lines, make([]*Char, lineLength))
|
||||
|
||||
wrap := false
|
||||
// We only need to wrap if the length of the line is greater than the width of the terminal screen
|
||||
if softwrap && StringWidth(lineStr, tabsize) > width {
|
||||
wrap = true
|
||||
// We're going to draw the entire line now
|
||||
lineLength = StringWidth(lineStr, tabsize)
|
||||
}
|
||||
|
||||
for viewCol < lineLength {
|
||||
if colN >= len(line) {
|
||||
break
|
||||
}
|
||||
if group, ok := buf.Match(lineN)[colN]; ok {
|
||||
curStyle = GetColor(highlight.GetGroup(group))
|
||||
}
|
||||
|
||||
char := line[colN]
|
||||
|
||||
if viewCol >= 0 {
|
||||
c.lines[viewLine][viewCol] = &Char{Loc{viewCol, viewLine}, Loc{colN, lineN}, char, char, curStyle, 1}
|
||||
}
|
||||
if char == '\t' {
|
||||
width := tabsize - (viewCol+left)%tabsize
|
||||
if viewCol >= 0 {
|
||||
c.lines[viewLine][viewCol].drawChar = indentchar
|
||||
c.lines[viewLine][viewCol].width = width
|
||||
}
|
||||
|
||||
for i := 1; i < width; i++ {
|
||||
viewCol++
|
||||
if viewCol >= 0 {
|
||||
c.lines[viewLine][viewCol] = &Char{Loc{viewCol, viewLine}, Loc{colN, lineN}, char, ' ', curStyle, 1}
|
||||
}
|
||||
}
|
||||
viewCol++
|
||||
} else if runewidth.RuneWidth(char) > 1 {
|
||||
width := runewidth.RuneWidth(char)
|
||||
if viewCol >= 0 {
|
||||
c.lines[viewLine][viewCol].width = width
|
||||
}
|
||||
for i := 1; i < width; i++ {
|
||||
viewCol++
|
||||
if viewCol >= 0 {
|
||||
c.lines[viewLine][viewCol] = &Char{Loc{viewCol, viewLine}, Loc{colN, lineN}, char, ' ', curStyle, 1}
|
||||
}
|
||||
}
|
||||
viewCol++
|
||||
} else {
|
||||
viewCol++
|
||||
}
|
||||
colN++
|
||||
|
||||
if wrap && viewCol >= width {
|
||||
viewLine++
|
||||
|
||||
// If we go too far soft wrapping we have to cut off
|
||||
if viewLine >= height {
|
||||
break
|
||||
}
|
||||
|
||||
nextLine := line[colN:]
|
||||
lineLength := min(StringWidth(string(nextLine), tabsize), width)
|
||||
c.lines = append(c.lines, make([]*Char, lineLength))
|
||||
|
||||
viewCol = 0
|
||||
}
|
||||
|
||||
}
|
||||
if group, ok := buf.Match(lineN)[len(line)]; ok {
|
||||
curStyle = GetColor(highlight.GetGroup(group))
|
||||
}
|
||||
|
||||
// newline
|
||||
viewLine++
|
||||
lineN++
|
||||
}
|
||||
|
||||
for i := top; i < top+height; i++ {
|
||||
if i >= buf.NumLines {
|
||||
break
|
||||
}
|
||||
buf.SetMatch(i, nil)
|
||||
}
|
||||
}
|
||||
|
|
@ -15,6 +15,33 @@ type Colorscheme map[string]tcell.Style
|
|||
// The current colorscheme
|
||||
var colorscheme Colorscheme
|
||||
|
||||
// This takes in a syntax group and returns the colorscheme's style for that group
|
||||
func GetColor(color string) tcell.Style {
|
||||
st := defStyle
|
||||
if color == "" {
|
||||
return st
|
||||
}
|
||||
groups := strings.Split(color, ".")
|
||||
if len(groups) > 1 {
|
||||
curGroup := ""
|
||||
for i, g := range groups {
|
||||
if i != 0 {
|
||||
curGroup += "."
|
||||
}
|
||||
curGroup += g
|
||||
if style, ok := colorscheme[curGroup]; ok {
|
||||
st = style
|
||||
}
|
||||
}
|
||||
} else if style, ok := colorscheme[color]; ok {
|
||||
st = style
|
||||
} else {
|
||||
st = StringToStyle(color)
|
||||
}
|
||||
|
||||
return st
|
||||
}
|
||||
|
||||
// ColorschemeExists checks if a given colorscheme exists
|
||||
func ColorschemeExists(colorschemeName string) bool {
|
||||
return FindRuntimeFile(RTColorscheme, colorschemeName) != nil
|
||||
|
|
@ -23,10 +50,11 @@ func ColorschemeExists(colorschemeName string) bool {
|
|||
// InitColorscheme picks and initializes the colorscheme when micro starts
|
||||
func InitColorscheme() {
|
||||
colorscheme = make(Colorscheme)
|
||||
defStyle = tcell.StyleDefault.
|
||||
Foreground(tcell.ColorDefault).
|
||||
Background(tcell.ColorDefault)
|
||||
if screen != nil {
|
||||
screen.SetStyle(tcell.StyleDefault.
|
||||
Foreground(tcell.ColorDefault).
|
||||
Background(tcell.ColorDefault))
|
||||
screen.SetStyle(defStyle)
|
||||
}
|
||||
|
||||
LoadDefaultColorscheme()
|
||||
|
|
@ -47,20 +75,6 @@ func LoadColorscheme(colorschemeName string) {
|
|||
TermMessage("Error loading colorscheme:", err)
|
||||
} else {
|
||||
colorscheme = ParseColorscheme(string(data))
|
||||
|
||||
// Default style
|
||||
defStyle = tcell.StyleDefault.
|
||||
Foreground(tcell.ColorDefault).
|
||||
Background(tcell.ColorDefault)
|
||||
|
||||
// There may be another default style defined in the colorscheme
|
||||
// In that case we should use that one
|
||||
if style, ok := colorscheme["default"]; ok {
|
||||
defStyle = style
|
||||
}
|
||||
if screen != nil {
|
||||
screen.SetStyle(defStyle)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -94,6 +108,9 @@ func ParseColorscheme(text string) Colorscheme {
|
|||
if link == "default" {
|
||||
defStyle = style
|
||||
}
|
||||
if screen != nil {
|
||||
screen.SetStyle(defStyle)
|
||||
}
|
||||
} else {
|
||||
fmt.Println("Color-link statement is not valid:", line)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,17 +9,21 @@ import (
|
|||
"os/signal"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
humanize "github.com/dustin/go-humanize"
|
||||
"github.com/mitchellh/go-homedir"
|
||||
)
|
||||
|
||||
// A Command contains a action (a function to call) as well as information about how to autocomplete the command
|
||||
type Command struct {
|
||||
action func([]string)
|
||||
completions []Completion
|
||||
}
|
||||
|
||||
// A StrCommand is similar to a command but keeps the name of the action
|
||||
type StrCommand struct {
|
||||
action string
|
||||
completions []Completion
|
||||
|
|
@ -51,6 +55,7 @@ func init() {
|
|||
"Pwd": Pwd,
|
||||
"Open": Open,
|
||||
"TabSwitch": TabSwitch,
|
||||
"MemUsage": MemUsage,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -104,6 +109,7 @@ func DefaultCommands() map[string]StrCommand {
|
|||
"pwd": {"Pwd", []Completion{NoCompletion}},
|
||||
"open": {"Open", []Completion{FileCompletion}},
|
||||
"tabswitch": {"TabSwitch", []Completion{NoCompletion}},
|
||||
"memusage": {"MemUsage", []Completion{NoCompletion}},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -190,6 +196,7 @@ func PluginCmd(args []string) {
|
|||
}
|
||||
}
|
||||
|
||||
// TabSwitch switches to a given tab either by name or by number
|
||||
func TabSwitch(args []string) {
|
||||
if len(args) > 0 {
|
||||
num, err := strconv.Atoi(args[0])
|
||||
|
|
@ -218,6 +225,7 @@ func TabSwitch(args []string) {
|
|||
}
|
||||
}
|
||||
|
||||
// Cd changes the current working directory
|
||||
func Cd(args []string) {
|
||||
if len(args) > 0 {
|
||||
home, _ := homedir.Dir()
|
||||
|
|
@ -235,6 +243,21 @@ func Cd(args []string) {
|
|||
}
|
||||
}
|
||||
|
||||
// MemUsage prints micro's memory usage
|
||||
// Alloc shows how many bytes are currently in use
|
||||
// Sys shows how many bytes have been requested from the operating system
|
||||
// NumGC shows how many times the GC has been run
|
||||
// Note that Go commonly reserves more memory from the OS than is currently in-use/required
|
||||
// Additionally, even if Go returns memory to the OS, the OS does not always claim it because
|
||||
// there may be plenty of memory to spare
|
||||
func MemUsage(args []string) {
|
||||
var mem runtime.MemStats
|
||||
runtime.ReadMemStats(&mem)
|
||||
|
||||
messenger.Message(fmt.Sprintf("Alloc: %v, Sys: %v, NumGC: %v", humanize.Bytes(mem.Alloc), humanize.Bytes(mem.Sys), mem.NumGC))
|
||||
}
|
||||
|
||||
// Pwd prints the current working directory
|
||||
func Pwd(args []string) {
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
|
|
@ -244,6 +267,7 @@ func Pwd(args []string) {
|
|||
}
|
||||
}
|
||||
|
||||
// Open opens a new buffer with a given filename
|
||||
func Open(args []string) {
|
||||
if len(args) > 0 {
|
||||
filename := args[0]
|
||||
|
|
@ -256,6 +280,7 @@ func Open(args []string) {
|
|||
}
|
||||
}
|
||||
|
||||
// ToggleLog toggles the log view
|
||||
func ToggleLog(args []string) {
|
||||
buffer := messenger.getBuffer()
|
||||
if CurView().Type != vtLog {
|
||||
|
|
@ -271,6 +296,7 @@ func ToggleLog(args []string) {
|
|||
}
|
||||
}
|
||||
|
||||
// Reload reloads all files (syntax files, colorschemes...)
|
||||
func Reload(args []string) {
|
||||
LoadAll()
|
||||
}
|
||||
|
|
@ -513,9 +539,6 @@ func Replace(args []string) {
|
|||
break
|
||||
}
|
||||
view.Relocate()
|
||||
if view.Buf.Settings["syntax"].(bool) {
|
||||
view.matches = Match(view)
|
||||
}
|
||||
RedrawAll()
|
||||
choice, canceled := messenger.YesNoPrompt("Perform replacement? (y,n)")
|
||||
if canceled {
|
||||
|
|
|
|||
19
cmd/micro/highlight/ftdetect.go
Normal file
19
cmd/micro/highlight/ftdetect.go
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package highlight
|
||||
|
||||
func DetectFiletype(defs []*Def, filename string, firstLine []byte) *Def {
|
||||
for _, d := range defs {
|
||||
if d.ftdetect[0].MatchString(filename) {
|
||||
return d
|
||||
}
|
||||
if len(d.ftdetect) > 1 {
|
||||
if d.ftdetect[1].MatchString(string(firstLine)) {
|
||||
return d
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
emptyDef := new(Def)
|
||||
emptyDef.FileType = "Unknown"
|
||||
emptyDef.rules = new(Rules)
|
||||
return emptyDef
|
||||
}
|
||||
343
cmd/micro/highlight/highlighter.go
Normal file
343
cmd/micro/highlight/highlighter.go
Normal file
|
|
@ -0,0 +1,343 @@
|
|||
package highlight
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/dlclark/regexp2"
|
||||
)
|
||||
|
||||
func combineLineMatch(src, dst LineMatch) LineMatch {
|
||||
for k, v := range src {
|
||||
if g, ok := dst[k]; ok {
|
||||
if g == 0 {
|
||||
dst[k] = v
|
||||
}
|
||||
} else {
|
||||
dst[k] = v
|
||||
}
|
||||
}
|
||||
return dst
|
||||
}
|
||||
|
||||
// A State represents the region at the end of a line
|
||||
type State *Region
|
||||
|
||||
// LineStates is an interface for a buffer-like object which can also store the states and matches for every line
|
||||
type LineStates interface {
|
||||
Line(n int) string
|
||||
LinesNum() int
|
||||
State(lineN int) State
|
||||
SetState(lineN int, s State)
|
||||
SetMatch(lineN int, m LineMatch)
|
||||
}
|
||||
|
||||
// A Highlighter contains the information needed to highlight a string
|
||||
type Highlighter struct {
|
||||
lastRegion *Region
|
||||
def *Def
|
||||
}
|
||||
|
||||
// NewHighlighter returns a new highlighter from the given syntax definition
|
||||
func NewHighlighter(def *Def) *Highlighter {
|
||||
h := new(Highlighter)
|
||||
h.def = def
|
||||
return h
|
||||
}
|
||||
|
||||
// LineMatch represents the syntax highlighting matches for one line. Each index where the coloring is changed is marked with that
|
||||
// color's group (represented as one byte)
|
||||
type LineMatch map[int]uint8
|
||||
|
||||
func findIndex(regex *regexp2.Regexp, str []rune, canMatchStart, canMatchEnd bool) []int {
|
||||
regexStr := regex.String()
|
||||
if strings.Contains(regexStr, "^") {
|
||||
if !canMatchStart {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
if strings.Contains(regexStr, "$") {
|
||||
if !canMatchEnd {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
match, _ := regex.FindStringMatch(string(str))
|
||||
if match == nil {
|
||||
return nil
|
||||
}
|
||||
return []int{match.Index, match.Index + match.Length}
|
||||
}
|
||||
|
||||
func findAllIndex(regex *regexp.Regexp, str []rune, canMatchStart, canMatchEnd bool) [][]int {
|
||||
regexStr := regex.String()
|
||||
if strings.Contains(regexStr, "^") {
|
||||
if !canMatchStart {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
if strings.Contains(regexStr, "$") {
|
||||
if !canMatchEnd {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return regex.FindAllIndex([]byte(string(str)), -1)
|
||||
}
|
||||
|
||||
func (h *Highlighter) highlightRegion(highlights LineMatch, start int, canMatchEnd bool, lineNum int, line []rune, region *Region, statesOnly bool) LineMatch {
|
||||
// highlights := make(LineMatch)
|
||||
|
||||
if start == 0 {
|
||||
if !statesOnly {
|
||||
highlights[0] = region.group
|
||||
}
|
||||
}
|
||||
|
||||
loc := findIndex(region.end, line, start == 0, canMatchEnd)
|
||||
if loc != nil {
|
||||
if !statesOnly {
|
||||
highlights[start+loc[1]-1] = region.group
|
||||
}
|
||||
if region.parent == nil {
|
||||
if !statesOnly {
|
||||
highlights[start+loc[1]] = 0
|
||||
h.highlightRegion(highlights, start, false, lineNum, line[:loc[0]], region, statesOnly)
|
||||
}
|
||||
h.highlightEmptyRegion(highlights, start+loc[1], canMatchEnd, lineNum, line[loc[1]:], statesOnly)
|
||||
return highlights
|
||||
}
|
||||
if !statesOnly {
|
||||
highlights[start+loc[1]] = region.parent.group
|
||||
h.highlightRegion(highlights, start, false, lineNum, line[:loc[0]], region, statesOnly)
|
||||
}
|
||||
h.highlightRegion(highlights, start+loc[1], canMatchEnd, lineNum, line[loc[1]:], region.parent, statesOnly)
|
||||
return highlights
|
||||
}
|
||||
|
||||
if len(line) == 0 || statesOnly {
|
||||
if canMatchEnd {
|
||||
h.lastRegion = region
|
||||
}
|
||||
|
||||
return highlights
|
||||
}
|
||||
|
||||
firstLoc := []int{len(line), 0}
|
||||
var firstRegion *Region
|
||||
for _, r := range region.rules.regions {
|
||||
loc := findIndex(r.start, line, start == 0, canMatchEnd)
|
||||
if loc != nil {
|
||||
if loc[0] < firstLoc[0] {
|
||||
firstLoc = loc
|
||||
firstRegion = r
|
||||
}
|
||||
}
|
||||
}
|
||||
if firstLoc[0] != len(line) {
|
||||
highlights[start+firstLoc[0]] = firstRegion.group
|
||||
h.highlightRegion(highlights, start, false, lineNum, line[:firstLoc[0]], region, statesOnly)
|
||||
h.highlightRegion(highlights, start+firstLoc[1], canMatchEnd, lineNum, line[firstLoc[1]:], firstRegion, statesOnly)
|
||||
return highlights
|
||||
}
|
||||
|
||||
fullHighlights := make([]uint8, len([]rune(string(line))))
|
||||
for i := 0; i < len(fullHighlights); i++ {
|
||||
fullHighlights[i] = region.group
|
||||
}
|
||||
|
||||
for _, p := range region.rules.patterns {
|
||||
matches := findAllIndex(p.regex, line, start == 0, canMatchEnd)
|
||||
for _, m := range matches {
|
||||
for i := m[0]; i < m[1]; i++ {
|
||||
fullHighlights[i] = p.group
|
||||
}
|
||||
}
|
||||
}
|
||||
for i, h := range fullHighlights {
|
||||
if i == 0 || h != fullHighlights[i-1] {
|
||||
if _, ok := highlights[start+i]; !ok {
|
||||
highlights[start+i] = h
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if canMatchEnd {
|
||||
h.lastRegion = region
|
||||
}
|
||||
|
||||
return highlights
|
||||
}
|
||||
|
||||
func (h *Highlighter) highlightEmptyRegion(highlights LineMatch, start int, canMatchEnd bool, lineNum int, line []rune, statesOnly bool) LineMatch {
|
||||
if len(line) == 0 {
|
||||
if canMatchEnd {
|
||||
h.lastRegion = nil
|
||||
}
|
||||
return highlights
|
||||
}
|
||||
|
||||
firstLoc := []int{len(line), 0}
|
||||
var firstRegion *Region
|
||||
for _, r := range h.def.rules.regions {
|
||||
loc := findIndex(r.start, line, start == 0, canMatchEnd)
|
||||
if loc != nil {
|
||||
if loc[0] < firstLoc[0] {
|
||||
firstLoc = loc
|
||||
firstRegion = r
|
||||
}
|
||||
}
|
||||
}
|
||||
if firstLoc[0] != len(line) {
|
||||
if !statesOnly {
|
||||
highlights[start+firstLoc[0]] = firstRegion.group
|
||||
}
|
||||
h.highlightEmptyRegion(highlights, start, false, lineNum, line[:firstLoc[0]], statesOnly)
|
||||
h.highlightRegion(highlights, start+firstLoc[1], canMatchEnd, lineNum, line[firstLoc[1]:], firstRegion, statesOnly)
|
||||
return highlights
|
||||
}
|
||||
|
||||
if statesOnly {
|
||||
if canMatchEnd {
|
||||
h.lastRegion = nil
|
||||
}
|
||||
|
||||
return highlights
|
||||
}
|
||||
|
||||
fullHighlights := make([]uint8, len(line))
|
||||
for _, p := range h.def.rules.patterns {
|
||||
matches := findAllIndex(p.regex, line, start == 0, canMatchEnd)
|
||||
for _, m := range matches {
|
||||
for i := m[0]; i < m[1]; i++ {
|
||||
fullHighlights[i] = p.group
|
||||
}
|
||||
}
|
||||
}
|
||||
for i, h := range fullHighlights {
|
||||
if i == 0 || h != fullHighlights[i-1] {
|
||||
if _, ok := highlights[start+i]; !ok {
|
||||
highlights[start+i] = h
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if canMatchEnd {
|
||||
h.lastRegion = nil
|
||||
}
|
||||
|
||||
return highlights
|
||||
}
|
||||
|
||||
// HighlightString syntax highlights a string
|
||||
// Use this function for simple syntax highlighting and use the other functions for
|
||||
// more advanced syntax highlighting. They are optimized for quick rehighlighting of the same
|
||||
// text with minor changes made
|
||||
func (h *Highlighter) HighlightString(input string) []LineMatch {
|
||||
lines := strings.Split(input, "\n")
|
||||
var lineMatches []LineMatch
|
||||
|
||||
for i := 0; i < len(lines); i++ {
|
||||
line := []rune(lines[i])
|
||||
highlights := make(LineMatch)
|
||||
|
||||
if i == 0 || h.lastRegion == nil {
|
||||
lineMatches = append(lineMatches, h.highlightEmptyRegion(highlights, 0, true, i, line, false))
|
||||
} else {
|
||||
lineMatches = append(lineMatches, h.highlightRegion(highlights, 0, true, i, line, h.lastRegion, false))
|
||||
}
|
||||
}
|
||||
|
||||
return lineMatches
|
||||
}
|
||||
|
||||
// HighlightStates correctly sets all states for the buffer
|
||||
func (h *Highlighter) HighlightStates(input LineStates) {
|
||||
for i := 0; i < input.LinesNum(); i++ {
|
||||
line := []rune(input.Line(i))
|
||||
// highlights := make(LineMatch)
|
||||
|
||||
if i == 0 || h.lastRegion == nil {
|
||||
h.highlightEmptyRegion(nil, 0, true, i, line, true)
|
||||
} else {
|
||||
h.highlightRegion(nil, 0, true, i, line, h.lastRegion, true)
|
||||
}
|
||||
|
||||
curState := h.lastRegion
|
||||
|
||||
input.SetState(i, curState)
|
||||
}
|
||||
}
|
||||
|
||||
// HighlightMatches sets the matches for each line in between startline and endline
|
||||
// It sets all other matches in the buffer to nil to conserve memory
|
||||
// This assumes that all the states are set correctly
|
||||
func (h *Highlighter) HighlightMatches(input LineStates, startline, endline int) {
|
||||
for i := startline; i < endline; i++ {
|
||||
if i >= input.LinesNum() {
|
||||
break
|
||||
}
|
||||
|
||||
line := []rune(input.Line(i))
|
||||
highlights := make(LineMatch)
|
||||
|
||||
var match LineMatch
|
||||
if i == 0 || input.State(i-1) == nil {
|
||||
match = h.highlightEmptyRegion(highlights, 0, true, i, line, false)
|
||||
} else {
|
||||
match = h.highlightRegion(highlights, 0, true, i, line, input.State(i-1), false)
|
||||
}
|
||||
|
||||
input.SetMatch(i, match)
|
||||
}
|
||||
}
|
||||
|
||||
// ReHighlightStates will scan down from `startline` and set the appropriate end of line state
|
||||
// for each line until it comes across the same state in two consecutive lines
|
||||
func (h *Highlighter) ReHighlightStates(input LineStates, startline int) {
|
||||
// lines := input.LineData()
|
||||
|
||||
h.lastRegion = nil
|
||||
if startline > 0 {
|
||||
h.lastRegion = input.State(startline - 1)
|
||||
}
|
||||
for i := startline; i < input.LinesNum(); i++ {
|
||||
line := []rune(input.Line(i))
|
||||
// highlights := make(LineMatch)
|
||||
|
||||
// var match LineMatch
|
||||
if i == 0 || h.lastRegion == nil {
|
||||
h.highlightEmptyRegion(nil, 0, true, i, line, true)
|
||||
} else {
|
||||
h.highlightRegion(nil, 0, true, i, line, h.lastRegion, true)
|
||||
}
|
||||
curState := h.lastRegion
|
||||
lastState := input.State(i)
|
||||
|
||||
input.SetState(i, curState)
|
||||
|
||||
if curState == lastState {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ReHighlightLine will rehighlight the state and match for a single line
|
||||
func (h *Highlighter) ReHighlightLine(input LineStates, lineN int) {
|
||||
line := []rune(input.Line(lineN))
|
||||
highlights := make(LineMatch)
|
||||
|
||||
h.lastRegion = nil
|
||||
if lineN > 0 {
|
||||
h.lastRegion = input.State(lineN - 1)
|
||||
}
|
||||
|
||||
var match LineMatch
|
||||
if lineN == 0 || h.lastRegion == nil {
|
||||
match = h.highlightEmptyRegion(highlights, 0, true, lineN, line, false)
|
||||
} else {
|
||||
match = h.highlightRegion(highlights, 0, true, lineN, line, h.lastRegion, false)
|
||||
}
|
||||
curState := h.lastRegion
|
||||
|
||||
input.SetMatch(lineN, match)
|
||||
input.SetState(lineN, curState)
|
||||
}
|
||||
231
cmd/micro/highlight/parser.go
Normal file
231
cmd/micro/highlight/parser.go
Normal file
|
|
@ -0,0 +1,231 @@
|
|||
package highlight
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
|
||||
"github.com/dlclark/regexp2"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
var Groups map[string]uint8
|
||||
var numGroups uint8
|
||||
|
||||
func GetGroup(n uint8) string {
|
||||
for k, v := range Groups {
|
||||
if v == n {
|
||||
return k
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// A Def is a full syntax definition for a language
|
||||
// It has a filetype, information about how to detect the filetype based
|
||||
// on filename or header (the first line of the file)
|
||||
// Then it has the rules which define how to highlight the file
|
||||
type Def struct {
|
||||
FileType string
|
||||
ftdetect []*regexp.Regexp
|
||||
rules *Rules
|
||||
}
|
||||
|
||||
// A Pattern is one simple syntax rule
|
||||
// It has a group that the rule belongs to, as well as
|
||||
// the regular expression to match the pattern
|
||||
type Pattern struct {
|
||||
group uint8
|
||||
regex *regexp.Regexp
|
||||
}
|
||||
|
||||
// Rules defines which patterns and regions can be used to highlight
|
||||
// a filetype
|
||||
type Rules struct {
|
||||
regions []*Region
|
||||
patterns []*Pattern
|
||||
includes []string
|
||||
}
|
||||
|
||||
// A Region is a highlighted region (such as a multiline comment, or a string)
|
||||
// It belongs to a group, and has start and end regular expressions
|
||||
// A Region also has rules of its own that only apply when matching inside the
|
||||
// region and also rules from the above region do not match inside this region
|
||||
// Note that a region may contain more regions
|
||||
type Region struct {
|
||||
group uint8
|
||||
parent *Region
|
||||
start *regexp2.Regexp
|
||||
end *regexp2.Regexp
|
||||
rules *Rules
|
||||
}
|
||||
|
||||
func init() {
|
||||
Groups = make(map[string]uint8)
|
||||
}
|
||||
|
||||
// ParseDef parses an input syntax file into a highlight Def
|
||||
func ParseDef(input []byte) (s *Def, err error) {
|
||||
// This is just so if we have an error, we can exit cleanly and return the parse error to the user
|
||||
defer func() {
|
||||
if e := recover(); e != nil {
|
||||
err = e.(error)
|
||||
}
|
||||
}()
|
||||
|
||||
var rules map[interface{}]interface{}
|
||||
if err = yaml.Unmarshal(input, &rules); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
s = new(Def)
|
||||
|
||||
for k, v := range rules {
|
||||
if k == "filetype" {
|
||||
filetype := v.(string)
|
||||
|
||||
s.FileType = filetype
|
||||
} else if k == "detect" {
|
||||
ftdetect := v.(map[interface{}]interface{})
|
||||
if len(ftdetect) >= 1 {
|
||||
syntax, err := regexp.Compile(ftdetect["filename"].(string))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
s.ftdetect = append(s.ftdetect, syntax)
|
||||
}
|
||||
if len(ftdetect) >= 2 {
|
||||
header, err := regexp.Compile(ftdetect["header"].(string))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
s.ftdetect = append(s.ftdetect, header)
|
||||
}
|
||||
} else if k == "rules" {
|
||||
inputRules := v.([]interface{})
|
||||
|
||||
rules, err := parseRules(inputRules, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
s.rules = rules
|
||||
}
|
||||
}
|
||||
|
||||
return s, err
|
||||
}
|
||||
|
||||
func ResolveIncludes(defs []*Def) {
|
||||
for _, d := range defs {
|
||||
resolveIncludesInDef(defs, d)
|
||||
}
|
||||
}
|
||||
|
||||
func resolveIncludesInDef(defs []*Def, d *Def) {
|
||||
for _, lang := range d.rules.includes {
|
||||
for _, searchDef := range defs {
|
||||
if lang == searchDef.FileType {
|
||||
d.rules.patterns = append(d.rules.patterns, searchDef.rules.patterns...)
|
||||
d.rules.regions = append(d.rules.regions, searchDef.rules.regions...)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, r := range d.rules.regions {
|
||||
resolveIncludesInRegion(defs, r)
|
||||
r.parent = nil
|
||||
}
|
||||
}
|
||||
|
||||
func resolveIncludesInRegion(defs []*Def, region *Region) {
|
||||
for _, lang := range region.rules.includes {
|
||||
for _, searchDef := range defs {
|
||||
if lang == searchDef.FileType {
|
||||
region.rules.patterns = append(region.rules.patterns, searchDef.rules.patterns...)
|
||||
region.rules.regions = append(region.rules.regions, searchDef.rules.regions...)
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, r := range region.rules.regions {
|
||||
resolveIncludesInRegion(defs, r)
|
||||
r.parent = region
|
||||
}
|
||||
}
|
||||
|
||||
func parseRules(input []interface{}, curRegion *Region) (*Rules, error) {
|
||||
rules := new(Rules)
|
||||
|
||||
for _, v := range input {
|
||||
rule := v.(map[interface{}]interface{})
|
||||
for k, val := range rule {
|
||||
group := k
|
||||
|
||||
switch object := val.(type) {
|
||||
case string:
|
||||
if k == "include" {
|
||||
rules.includes = append(rules.includes, object)
|
||||
} else {
|
||||
// Pattern
|
||||
r, err := regexp.Compile(object)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
groupStr := group.(string)
|
||||
if _, ok := Groups[groupStr]; !ok {
|
||||
numGroups++
|
||||
Groups[groupStr] = numGroups
|
||||
}
|
||||
groupNum := Groups[groupStr]
|
||||
rules.patterns = append(rules.patterns, &Pattern{groupNum, r})
|
||||
}
|
||||
case map[interface{}]interface{}:
|
||||
// Region
|
||||
region, err := parseRegion(group.(string), object, curRegion)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rules.regions = append(rules.regions, region)
|
||||
default:
|
||||
return nil, fmt.Errorf("Bad type %T", object)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rules, nil
|
||||
}
|
||||
|
||||
func parseRegion(group string, regionInfo map[interface{}]interface{}, prevRegion *Region) (*Region, error) {
|
||||
var err error
|
||||
|
||||
region := new(Region)
|
||||
if _, ok := Groups[group]; !ok {
|
||||
numGroups++
|
||||
Groups[group] = numGroups
|
||||
}
|
||||
groupNum := Groups[group]
|
||||
region.group = groupNum
|
||||
region.parent = prevRegion
|
||||
|
||||
region.start, err = regexp2.Compile(regionInfo["start"].(string), 0)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
region.end, err = regexp2.Compile(regionInfo["end"].(string), 0)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
region.rules, err = parseRules(regionInfo["rules"].([]interface{}), region)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return region, nil
|
||||
}
|
||||
|
|
@ -1,368 +1,30 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
import "github.com/zyedidia/micro/cmd/micro/highlight"
|
||||
|
||||
"github.com/zyedidia/tcell"
|
||||
)
|
||||
var syntaxDefs []*highlight.Def
|
||||
|
||||
// FileTypeRules represents a complete set of syntax rules for a filetype
|
||||
type FileTypeRules struct {
|
||||
filetype string
|
||||
filename string
|
||||
text string
|
||||
}
|
||||
|
||||
// SyntaxRule represents a regex to highlight in a certain style
|
||||
type SyntaxRule struct {
|
||||
// What to highlight
|
||||
regex *regexp.Regexp
|
||||
// Any flags
|
||||
flags string
|
||||
// Whether this regex is a start=... end=... regex
|
||||
startend bool
|
||||
// How to highlight it
|
||||
style tcell.Style
|
||||
}
|
||||
|
||||
var syntaxKeys [][2]*regexp.Regexp
|
||||
var syntaxFiles map[[2]*regexp.Regexp]FileTypeRules
|
||||
|
||||
// LoadSyntaxFiles loads the syntax files from the default directory (configDir)
|
||||
func LoadSyntaxFiles() {
|
||||
InitColorscheme()
|
||||
syntaxFiles = make(map[[2]*regexp.Regexp]FileTypeRules)
|
||||
for _, f := range ListRuntimeFiles(RTSyntax) {
|
||||
data, err := f.Data()
|
||||
if err != nil {
|
||||
TermMessage("Error loading syntax file " + f.Name() + ": " + err.Error())
|
||||
} else {
|
||||
LoadSyntaxFile(string(data), f.Name())
|
||||
LoadSyntaxFile(data, f.Name())
|
||||
}
|
||||
}
|
||||
|
||||
highlight.ResolveIncludes(syntaxDefs)
|
||||
}
|
||||
|
||||
// JoinRule takes a syntax rule (which can be multiple regular expressions)
|
||||
// and joins it into one regular expression by ORing everything together
|
||||
func JoinRule(rule string) string {
|
||||
split := strings.Split(rule, `" "`)
|
||||
joined := strings.Join(split, ")|(")
|
||||
joined = "(" + joined + ")"
|
||||
return joined
|
||||
}
|
||||
|
||||
// LoadSyntaxFile simply gets the filetype of a the syntax file and the source for the
|
||||
// file and creates FileTypeRules out of it. If this filetype is the one opened by the user
|
||||
// the rules will be loaded and compiled later
|
||||
// In this function we are only concerned with loading the syntax and header regexes
|
||||
func LoadSyntaxFile(text, filename string) {
|
||||
var err error
|
||||
lines := strings.Split(string(text), "\n")
|
||||
|
||||
// Regex for parsing syntax statements
|
||||
syntaxParser := regexp.MustCompile(`syntax "(.*?)"\s+"(.*)"+`)
|
||||
// Regex for parsing header statements
|
||||
headerParser := regexp.MustCompile(`header "(.*)"`)
|
||||
|
||||
// Is there a syntax definition in this file?
|
||||
hasSyntax := syntaxParser.MatchString(text)
|
||||
// Is there a header definition in this file?
|
||||
hasHeader := headerParser.MatchString(text)
|
||||
|
||||
var syntaxRegex *regexp.Regexp
|
||||
var headerRegex *regexp.Regexp
|
||||
var filetype string
|
||||
for lineNum, line := range lines {
|
||||
if (hasSyntax == (syntaxRegex != nil)) && (hasHeader == (headerRegex != nil)) {
|
||||
// We found what we we're supposed to find
|
||||
break
|
||||
}
|
||||
|
||||
if strings.TrimSpace(line) == "" ||
|
||||
strings.TrimSpace(line)[0] == '#' {
|
||||
// Ignore this line
|
||||
continue
|
||||
}
|
||||
|
||||
if strings.HasPrefix(line, "syntax") {
|
||||
// Syntax statement
|
||||
syntaxMatches := syntaxParser.FindSubmatch([]byte(line))
|
||||
if len(syntaxMatches) == 3 {
|
||||
if syntaxRegex != nil {
|
||||
TermError(filename, lineNum, "Syntax statement redeclaration")
|
||||
}
|
||||
|
||||
filetype = string(syntaxMatches[1])
|
||||
extensions := JoinRule(string(syntaxMatches[2]))
|
||||
|
||||
syntaxRegex, err = regexp.Compile(extensions)
|
||||
if err != nil {
|
||||
TermError(filename, lineNum, err.Error())
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
TermError(filename, lineNum, "Syntax statement is not valid: "+line)
|
||||
continue
|
||||
}
|
||||
} else if strings.HasPrefix(line, "header") {
|
||||
// Header statement
|
||||
headerMatches := headerParser.FindSubmatch([]byte(line))
|
||||
if len(headerMatches) == 2 {
|
||||
header := JoinRule(string(headerMatches[1]))
|
||||
|
||||
headerRegex, err = regexp.Compile(header)
|
||||
if err != nil {
|
||||
TermError(filename, lineNum, "Regex error: "+err.Error())
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
TermError(filename, lineNum, "Header statement is not valid: "+line)
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
if syntaxRegex != nil {
|
||||
// Add the current rules to the syntaxFiles variable
|
||||
regexes := [2]*regexp.Regexp{syntaxRegex, headerRegex}
|
||||
syntaxKeys = append(syntaxKeys, regexes)
|
||||
syntaxFiles[regexes] = FileTypeRules{filetype, filename, text}
|
||||
}
|
||||
}
|
||||
|
||||
// LoadRulesFromFile loads just the syntax rules from a given file
|
||||
// Only the necessary rules are loaded when the buffer is opened.
|
||||
// If we load all the rules for every filetype when micro starts, there's a bit of lag
|
||||
// A rule just explains how to color certain regular expressions
|
||||
// Example: color comment "//.*"
|
||||
// This would color all strings that match the regex "//.*" in the comment color defined
|
||||
// by the colorscheme
|
||||
func LoadRulesFromFile(text, filename string) []SyntaxRule {
|
||||
lines := strings.Split(string(text), "\n")
|
||||
|
||||
// Regex for parsing standard syntax rules
|
||||
ruleParser := regexp.MustCompile(`color (.*?)\s+(?:\((.*?)\)\s+)?"(.*)"`)
|
||||
// Regex for parsing syntax rules with start="..." end="..."
|
||||
ruleStartEndParser := regexp.MustCompile(`color (.*?)\s+(?:\((.*?)\)\s+)?start="(.*)"\s+end="(.*)"`)
|
||||
|
||||
var rules []SyntaxRule
|
||||
for lineNum, line := range lines {
|
||||
if strings.TrimSpace(line) == "" ||
|
||||
strings.TrimSpace(line)[0] == '#' ||
|
||||
strings.HasPrefix(line, "syntax") ||
|
||||
strings.HasPrefix(line, "header") {
|
||||
// Ignore this line
|
||||
continue
|
||||
}
|
||||
|
||||
// Syntax rule, but it could be standard or start-end
|
||||
if ruleParser.MatchString(line) {
|
||||
// Standard syntax rule
|
||||
// Parse the line
|
||||
submatch := ruleParser.FindSubmatch([]byte(line))
|
||||
var color string
|
||||
var regexStr string
|
||||
var flags string
|
||||
if len(submatch) == 4 {
|
||||
// If len is 4 then the user specified some additional flags to use
|
||||
color = string(submatch[1])
|
||||
flags = string(submatch[2])
|
||||
regexStr = "(?" + flags + ")" + JoinRule(string(submatch[3]))
|
||||
} else if len(submatch) == 3 {
|
||||
// If len is 3, no additional flags were given
|
||||
color = string(submatch[1])
|
||||
regexStr = JoinRule(string(submatch[2]))
|
||||
} else {
|
||||
// If len is not 3 or 4 there is a problem
|
||||
TermError(filename, lineNum, "Invalid statement: "+line)
|
||||
continue
|
||||
}
|
||||
// Compile the regex
|
||||
regex, err := regexp.Compile(regexStr)
|
||||
if err != nil {
|
||||
TermError(filename, lineNum, err.Error())
|
||||
continue
|
||||
}
|
||||
|
||||
// Get the style
|
||||
// The user could give us a "color" that is really a part of the colorscheme
|
||||
// in which case we should look that up in the colorscheme
|
||||
// They can also just give us a straight up color
|
||||
st := defStyle
|
||||
groups := strings.Split(color, ".")
|
||||
if len(groups) > 1 {
|
||||
curGroup := ""
|
||||
for i, g := range groups {
|
||||
if i != 0 {
|
||||
curGroup += "."
|
||||
}
|
||||
curGroup += g
|
||||
if style, ok := colorscheme[curGroup]; ok {
|
||||
st = style
|
||||
}
|
||||
}
|
||||
} else if style, ok := colorscheme[color]; ok {
|
||||
st = style
|
||||
} else {
|
||||
st = StringToStyle(color)
|
||||
}
|
||||
// Add the regex, flags, and style
|
||||
// False because this is not start-end
|
||||
rules = append(rules, SyntaxRule{regex, flags, false, st})
|
||||
} else if ruleStartEndParser.MatchString(line) {
|
||||
// Start-end syntax rule
|
||||
submatch := ruleStartEndParser.FindSubmatch([]byte(line))
|
||||
var color string
|
||||
var start string
|
||||
var end string
|
||||
// Use m and s flags by default
|
||||
flags := "ms"
|
||||
if len(submatch) == 5 {
|
||||
// If len is 5 the user provided some additional flags
|
||||
color = string(submatch[1])
|
||||
flags += string(submatch[2])
|
||||
start = string(submatch[3])
|
||||
end = string(submatch[4])
|
||||
} else if len(submatch) == 4 {
|
||||
// If len is 4 the user did not provide additional flags
|
||||
color = string(submatch[1])
|
||||
start = string(submatch[2])
|
||||
end = string(submatch[3])
|
||||
} else {
|
||||
// If len is not 4 or 5 there is a problem
|
||||
TermError(filename, lineNum, "Invalid statement: "+line)
|
||||
continue
|
||||
}
|
||||
|
||||
// Compile the regex
|
||||
regex, err := regexp.Compile("(?" + flags + ")" + "(" + start + ").*?(" + end + ")")
|
||||
if err != nil {
|
||||
TermError(filename, lineNum, err.Error())
|
||||
continue
|
||||
}
|
||||
|
||||
// Get the style
|
||||
// The user could give us a "color" that is really a part of the colorscheme
|
||||
// in which case we should look that up in the colorscheme
|
||||
// They can also just give us a straight up color
|
||||
st := defStyle
|
||||
if _, ok := colorscheme[color]; ok {
|
||||
st = colorscheme[color]
|
||||
} else {
|
||||
st = StringToStyle(color)
|
||||
}
|
||||
// Add the regex, flags, and style
|
||||
// True because this is start-end
|
||||
rules = append(rules, SyntaxRule{regex, flags, true, st})
|
||||
}
|
||||
}
|
||||
return rules
|
||||
}
|
||||
|
||||
// FindFileType finds the filetype for the given buffer
|
||||
func FindFileType(buf *Buffer) string {
|
||||
for _, r := range syntaxKeys {
|
||||
if r[1] != nil && r[1].MatchString(buf.Line(0)) {
|
||||
// The header statement matches the first line
|
||||
return syntaxFiles[r].filetype
|
||||
}
|
||||
}
|
||||
for _, r := range syntaxKeys {
|
||||
if r[0] != nil && r[0].MatchString(buf.Path) {
|
||||
// The syntax statement matches the extension
|
||||
return syntaxFiles[r].filetype
|
||||
}
|
||||
}
|
||||
return "Unknown"
|
||||
}
|
||||
|
||||
// GetRules finds the syntax rules that should be used for the buffer
|
||||
// and returns them. It also returns the filetype of the file
|
||||
func GetRules(buf *Buffer) []SyntaxRule {
|
||||
for _, r := range syntaxKeys {
|
||||
if syntaxFiles[r].filetype == buf.FileType() {
|
||||
return LoadRulesFromFile(syntaxFiles[r].text, syntaxFiles[r].filename)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// SyntaxMatches is an alias to a map from character numbers to styles,
|
||||
// so map[3] represents the style of the third character
|
||||
type SyntaxMatches [][]tcell.Style
|
||||
|
||||
// Match takes a buffer and returns the syntax matches: a 2d array specifying how it should be syntax highlighted
|
||||
// We match the rules from up `synLinesUp` lines and down `synLinesDown` lines
|
||||
func Match(v *View) SyntaxMatches {
|
||||
buf := v.Buf
|
||||
rules := v.Buf.rules
|
||||
|
||||
viewStart := v.Topline
|
||||
viewEnd := v.Topline + v.Height
|
||||
if viewEnd > buf.NumLines {
|
||||
viewEnd = buf.NumLines
|
||||
}
|
||||
|
||||
lines := buf.Lines(viewStart, viewEnd)
|
||||
matches := make(SyntaxMatches, len(lines))
|
||||
|
||||
for i, line := range lines {
|
||||
matches[i] = make([]tcell.Style, len(line)+1)
|
||||
for j := range matches[i] {
|
||||
matches[i][j] = defStyle
|
||||
}
|
||||
}
|
||||
|
||||
// We don't actually check the entire buffer, just from synLinesUp to synLinesDown
|
||||
totalStart := v.Topline - synLinesUp
|
||||
totalEnd := v.Topline + v.Height + synLinesDown
|
||||
if totalStart < 0 {
|
||||
totalStart = 0
|
||||
}
|
||||
if totalEnd > buf.NumLines {
|
||||
totalEnd = buf.NumLines
|
||||
}
|
||||
|
||||
str := strings.Join(buf.Lines(totalStart, totalEnd), "\n")
|
||||
startNum := ToCharPos(Loc{0, totalStart}, v.Buf)
|
||||
|
||||
for _, rule := range rules {
|
||||
if rule.startend {
|
||||
if indicies := rule.regex.FindAllStringIndex(str, -1); indicies != nil {
|
||||
for _, value := range indicies {
|
||||
value[0] = runePos(value[0], str) + startNum
|
||||
value[1] = runePos(value[1], str) + startNum
|
||||
startLoc := FromCharPos(value[0], buf)
|
||||
endLoc := FromCharPos(value[1], buf)
|
||||
for curLoc := startLoc; curLoc.LessThan(endLoc); curLoc = curLoc.Move(1, buf) {
|
||||
if curLoc.Y < v.Topline {
|
||||
continue
|
||||
}
|
||||
colNum, lineNum := curLoc.X, curLoc.Y
|
||||
if lineNum == -1 || colNum == -1 {
|
||||
continue
|
||||
}
|
||||
lineNum -= viewStart
|
||||
if lineNum >= 0 && lineNum < v.Height {
|
||||
matches[lineNum][colNum] = rule.style
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for lineN, line := range lines {
|
||||
if indicies := rule.regex.FindAllStringIndex(line, -1); indicies != nil {
|
||||
for _, value := range indicies {
|
||||
start := runePos(value[0], line)
|
||||
end := runePos(value[1], line)
|
||||
for i := start; i < end; i++ {
|
||||
matches[lineN][i] = rule.style
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return matches
|
||||
func LoadSyntaxFile(text []byte, filename string) {
|
||||
def, err := highlight.ParseDef(text)
|
||||
|
||||
if err != nil {
|
||||
TermMessage("Syntax file error: " + filename + ": " + err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
syntaxDefs = append(syntaxDefs, def)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,29 @@ import (
|
|||
"bytes"
|
||||
"io"
|
||||
"unicode/utf8"
|
||||
|
||||
"github.com/zyedidia/micro/cmd/micro/highlight"
|
||||
)
|
||||
|
||||
func lineCounter(r io.Reader) (int, error) {
|
||||
buf := make([]byte, 32*1024)
|
||||
count := 0
|
||||
lineSep := []byte{'\n'}
|
||||
|
||||
for {
|
||||
c, err := r.Read(buf)
|
||||
count += bytes.Count(buf[:c], lineSep)
|
||||
|
||||
switch {
|
||||
case err == io.EOF:
|
||||
return count, nil
|
||||
|
||||
case err != nil:
|
||||
return count, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func runeToByteIndex(n int, txt []byte) int {
|
||||
if n == 0 {
|
||||
return 0
|
||||
|
|
@ -28,30 +49,48 @@ func runeToByteIndex(n int, txt []byte) int {
|
|||
return count
|
||||
}
|
||||
|
||||
type Line struct {
|
||||
data []byte
|
||||
|
||||
state highlight.State
|
||||
match highlight.LineMatch
|
||||
rehighlight bool
|
||||
}
|
||||
|
||||
// A LineArray simply stores and array of lines and makes it easy to insert
|
||||
// and delete in it
|
||||
type LineArray struct {
|
||||
lines [][]byte
|
||||
lines []Line
|
||||
}
|
||||
|
||||
// NewLineArray returns a new line array from an array of bytes
|
||||
func NewLineArray(reader io.Reader) *LineArray {
|
||||
la := new(LineArray)
|
||||
br := bufio.NewReader(reader)
|
||||
|
||||
i := 0
|
||||
for {
|
||||
var buf bytes.Buffer
|
||||
tee := io.TeeReader(reader, &buf)
|
||||
numlines, _ := lineCounter(tee)
|
||||
if numlines == 0 {
|
||||
numlines = 1
|
||||
}
|
||||
|
||||
la.lines = make([]Line, numlines)
|
||||
|
||||
br := bufio.NewReader(&buf)
|
||||
|
||||
for i := 0; i < numlines; i++ {
|
||||
data, err := br.ReadBytes('\n')
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
la.lines = append(la.lines, data[:])
|
||||
// la.lines[i] = Line{data[:len(data)], nil, nil, false}
|
||||
la.lines[i].data = data
|
||||
}
|
||||
// Last line was read
|
||||
break
|
||||
} else {
|
||||
la.lines = append(la.lines, data[:len(data)-1])
|
||||
la.lines[i].data = data[:len(data)-1]
|
||||
// la.lines[i] = Line{data[:len(data)-1], nil, nil, false}
|
||||
}
|
||||
i++
|
||||
}
|
||||
|
||||
return la
|
||||
|
|
@ -59,19 +98,26 @@ func NewLineArray(reader io.Reader) *LineArray {
|
|||
|
||||
// Returns the String representation of the LineArray
|
||||
func (la *LineArray) String() string {
|
||||
return string(bytes.Join(la.lines, []byte("\n")))
|
||||
str := ""
|
||||
for i, l := range la.lines {
|
||||
str += string(l.data)
|
||||
if i != len(la.lines)-1 {
|
||||
str += "\n"
|
||||
}
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
// NewlineBelow adds a newline below the given line number
|
||||
func (la *LineArray) NewlineBelow(y int) {
|
||||
la.lines = append(la.lines, []byte(" "))
|
||||
la.lines = append(la.lines, Line{[]byte(" "), nil, nil, false})
|
||||
copy(la.lines[y+2:], la.lines[y+1:])
|
||||
la.lines[y+1] = []byte("")
|
||||
la.lines[y+1] = Line{[]byte(""), la.lines[y].state, nil, false}
|
||||
}
|
||||
|
||||
// inserts a byte array at a given location
|
||||
func (la *LineArray) insert(pos Loc, value []byte) {
|
||||
x, y := runeToByteIndex(pos.X, la.lines[pos.Y]), pos.Y
|
||||
x, y := runeToByteIndex(pos.X, la.lines[pos.Y].data), pos.Y
|
||||
// x, y := pos.x, pos.y
|
||||
for i := 0; i < len(value); i++ {
|
||||
if value[i] == '\n' {
|
||||
|
|
@ -87,31 +133,36 @@ func (la *LineArray) insert(pos Loc, value []byte) {
|
|||
|
||||
// inserts a byte at a given location
|
||||
func (la *LineArray) insertByte(pos Loc, value byte) {
|
||||
la.lines[pos.Y] = append(la.lines[pos.Y], 0)
|
||||
copy(la.lines[pos.Y][pos.X+1:], la.lines[pos.Y][pos.X:])
|
||||
la.lines[pos.Y][pos.X] = value
|
||||
la.lines[pos.Y].data = append(la.lines[pos.Y].data, 0)
|
||||
copy(la.lines[pos.Y].data[pos.X+1:], la.lines[pos.Y].data[pos.X:])
|
||||
la.lines[pos.Y].data[pos.X] = value
|
||||
}
|
||||
|
||||
// JoinLines joins the two lines a and b
|
||||
func (la *LineArray) JoinLines(a, b int) {
|
||||
la.insert(Loc{len(la.lines[a]), a}, la.lines[b])
|
||||
la.insert(Loc{len(la.lines[a].data), a}, la.lines[b].data)
|
||||
la.DeleteLine(b)
|
||||
}
|
||||
|
||||
// Split splits a line at a given position
|
||||
func (la *LineArray) Split(pos Loc) {
|
||||
la.NewlineBelow(pos.Y)
|
||||
la.insert(Loc{0, pos.Y + 1}, la.lines[pos.Y][pos.X:])
|
||||
la.insert(Loc{0, pos.Y + 1}, la.lines[pos.Y].data[pos.X:])
|
||||
la.lines[pos.Y+1].state = la.lines[pos.Y].state
|
||||
la.lines[pos.Y].state = nil
|
||||
la.lines[pos.Y].match = nil
|
||||
la.lines[pos.Y+1].match = nil
|
||||
la.lines[pos.Y].rehighlight = true
|
||||
la.DeleteToEnd(Loc{pos.X, pos.Y})
|
||||
}
|
||||
|
||||
// removes from start to end
|
||||
func (la *LineArray) remove(start, end Loc) string {
|
||||
sub := la.Substr(start, end)
|
||||
startX := runeToByteIndex(start.X, la.lines[start.Y])
|
||||
endX := runeToByteIndex(end.X, la.lines[end.Y])
|
||||
startX := runeToByteIndex(start.X, la.lines[start.Y].data)
|
||||
endX := runeToByteIndex(end.X, la.lines[end.Y].data)
|
||||
if start.Y == end.Y {
|
||||
la.lines[start.Y] = append(la.lines[start.Y][:startX], la.lines[start.Y][endX:]...)
|
||||
la.lines[start.Y].data = append(la.lines[start.Y].data[:startX], la.lines[start.Y].data[endX:]...)
|
||||
} else {
|
||||
for i := start.Y + 1; i <= end.Y-1; i++ {
|
||||
la.DeleteLine(start.Y + 1)
|
||||
|
|
@ -125,12 +176,12 @@ func (la *LineArray) remove(start, end Loc) string {
|
|||
|
||||
// DeleteToEnd deletes from the end of a line to the position
|
||||
func (la *LineArray) DeleteToEnd(pos Loc) {
|
||||
la.lines[pos.Y] = la.lines[pos.Y][:pos.X]
|
||||
la.lines[pos.Y].data = la.lines[pos.Y].data[:pos.X]
|
||||
}
|
||||
|
||||
// DeleteFromStart deletes from the start of a line to the position
|
||||
func (la *LineArray) DeleteFromStart(pos Loc) {
|
||||
la.lines[pos.Y] = la.lines[pos.Y][pos.X+1:]
|
||||
la.lines[pos.Y].data = la.lines[pos.Y].data[pos.X+1:]
|
||||
}
|
||||
|
||||
// DeleteLine deletes the line number
|
||||
|
|
@ -140,21 +191,37 @@ func (la *LineArray) DeleteLine(y int) {
|
|||
|
||||
// DeleteByte deletes the byte at a position
|
||||
func (la *LineArray) DeleteByte(pos Loc) {
|
||||
la.lines[pos.Y] = la.lines[pos.Y][:pos.X+copy(la.lines[pos.Y][pos.X:], la.lines[pos.Y][pos.X+1:])]
|
||||
la.lines[pos.Y].data = la.lines[pos.Y].data[:pos.X+copy(la.lines[pos.Y].data[pos.X:], la.lines[pos.Y].data[pos.X+1:])]
|
||||
}
|
||||
|
||||
// Substr returns the string representation between two locations
|
||||
func (la *LineArray) Substr(start, end Loc) string {
|
||||
startX := runeToByteIndex(start.X, la.lines[start.Y])
|
||||
endX := runeToByteIndex(end.X, la.lines[end.Y])
|
||||
startX := runeToByteIndex(start.X, la.lines[start.Y].data)
|
||||
endX := runeToByteIndex(end.X, la.lines[end.Y].data)
|
||||
if start.Y == end.Y {
|
||||
return string(la.lines[start.Y][startX:endX])
|
||||
return string(la.lines[start.Y].data[startX:endX])
|
||||
}
|
||||
var str string
|
||||
str += string(la.lines[start.Y][startX:]) + "\n"
|
||||
str += string(la.lines[start.Y].data[startX:]) + "\n"
|
||||
for i := start.Y + 1; i <= end.Y-1; i++ {
|
||||
str += string(la.lines[i]) + "\n"
|
||||
str += string(la.lines[i].data) + "\n"
|
||||
}
|
||||
str += string(la.lines[end.Y][:endX])
|
||||
str += string(la.lines[end.Y].data[:endX])
|
||||
return str
|
||||
}
|
||||
|
||||
func (la *LineArray) State(lineN int) highlight.State {
|
||||
return la.lines[lineN].state
|
||||
}
|
||||
|
||||
func (la *LineArray) SetState(lineN int, s highlight.State) {
|
||||
la.lines[lineN].state = s
|
||||
}
|
||||
|
||||
func (la *LineArray) SetMatch(lineN int, m highlight.LineMatch) {
|
||||
la.lines[lineN].match = m
|
||||
}
|
||||
|
||||
func (la *LineArray) Match(lineN int) highlight.LineMatch {
|
||||
return la.lines[lineN].match
|
||||
}
|
||||
|
|
|
|||
|
|
@ -201,6 +201,7 @@ func InitScreen() {
|
|||
// RedrawAll redraws everything -- all the views and the messenger
|
||||
func RedrawAll() {
|
||||
messenger.Clear()
|
||||
screen.Clear()
|
||||
for _, v := range tabs[curTab].views {
|
||||
v.Display()
|
||||
}
|
||||
|
|
@ -227,9 +228,6 @@ func LoadAll() {
|
|||
for _, tab := range tabs {
|
||||
for _, v := range tab.views {
|
||||
v.Buf.UpdateRules()
|
||||
if v.Buf.Settings["syntax"].(bool) {
|
||||
v.matches = Match(v)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -383,7 +381,6 @@ func main() {
|
|||
|
||||
for _, t := range tabs {
|
||||
for _, v := range t.views {
|
||||
v.Buf.FindFileType()
|
||||
v.Buf.UpdateRules()
|
||||
for pl := range loadedPlugins {
|
||||
_, err := Call(pl+".onViewOpen", v)
|
||||
|
|
@ -392,9 +389,6 @@ func main() {
|
|||
continue
|
||||
}
|
||||
}
|
||||
if v.Buf.Settings["syntax"].(bool) {
|
||||
v.matches = Match(v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ func InitRuntimeFiles() {
|
|||
}
|
||||
|
||||
add(RTColorscheme, "colorschemes", "*.micro")
|
||||
add(RTSyntax, "syntax", "*.micro")
|
||||
add(RTSyntax, "syntax", "*.yaml")
|
||||
add(RTHelp, "help", "*.md")
|
||||
|
||||
// Search configDir for plugin-scripts
|
||||
|
|
|
|||
2206
cmd/micro/runtime.go
2206
cmd/micro/runtime.go
File diff suppressed because one or more lines are too long
|
|
@ -144,8 +144,5 @@ func Search(searchStr string, v *View, down bool) {
|
|||
v.Cursor.SetSelectionStart(FromCharPos(charPos+runePos(match[0], str), v.Buf))
|
||||
v.Cursor.SetSelectionEnd(FromCharPos(charPos+runePos(match[1], str), v.Buf))
|
||||
v.Cursor.Loc = v.Cursor.CurSelection[1]
|
||||
if v.Relocate() {
|
||||
v.matches = Match(v)
|
||||
}
|
||||
lastSearch = searchStr
|
||||
}
|
||||
|
|
|
|||
|
|
@ -281,9 +281,6 @@ func SetOption(option, value string) error {
|
|||
for _, tab := range tabs {
|
||||
for _, view := range tab.views {
|
||||
view.Buf.UpdateRules()
|
||||
if view.Buf.Settings["syntax"].(bool) {
|
||||
view.matches = Match(view)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -341,16 +338,18 @@ func SetLocalOption(option, value string, view *View) error {
|
|||
|
||||
if option == "statusline" {
|
||||
view.ToggleStatusLine()
|
||||
if buf.Settings["syntax"].(bool) {
|
||||
view.matches = Match(view)
|
||||
}
|
||||
}
|
||||
|
||||
if option == "filetype" {
|
||||
LoadSyntaxFiles()
|
||||
buf.UpdateRules()
|
||||
if buf.Settings["syntax"].(bool) {
|
||||
view.matches = Match(view)
|
||||
}
|
||||
|
||||
if option == "syntax" {
|
||||
if !nativeValue.(bool) {
|
||||
buf.ClearMatches()
|
||||
} else {
|
||||
buf.highlighter.HighlightStates(buf)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -255,7 +255,6 @@ func (s *SplitTree) ResizeSplits() {
|
|||
}
|
||||
|
||||
n.view.ToggleTabbar()
|
||||
n.view.matches = Match(n.view)
|
||||
} else if n, ok := node.(*SplitTree); ok {
|
||||
if s.kind == VerticalSplit {
|
||||
if !n.lockWidth {
|
||||
|
|
|
|||
|
|
@ -6,17 +6,20 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/mattn/go-runewidth"
|
||||
"github.com/mitchellh/go-homedir"
|
||||
"github.com/zyedidia/tcell"
|
||||
)
|
||||
|
||||
type ViewType int
|
||||
type ViewType struct {
|
||||
readonly bool // The file cannot be edited
|
||||
scratch bool // The file cannot be saved
|
||||
}
|
||||
|
||||
const (
|
||||
vtDefault ViewType = iota
|
||||
vtHelp
|
||||
vtLog
|
||||
var (
|
||||
vtDefault = ViewType{false, false}
|
||||
vtHelp = ViewType{true, true}
|
||||
vtLog = ViewType{true, true}
|
||||
vtScratch = ViewType{false, true}
|
||||
)
|
||||
|
||||
// The View struct stores information about a view into a buffer.
|
||||
|
|
@ -84,8 +87,7 @@ type View struct {
|
|||
// Same here, just to keep track for mouse move events
|
||||
tripleClick bool
|
||||
|
||||
// Syntax highlighting matches
|
||||
matches SyntaxMatches
|
||||
cellview *CellView
|
||||
|
||||
splitNode *LeafNode
|
||||
}
|
||||
|
|
@ -105,6 +107,7 @@ func NewViewWidthHeight(buf *Buffer, w, h int) *View {
|
|||
|
||||
v.Width = w
|
||||
v.Height = h
|
||||
v.cellview = new(CellView)
|
||||
|
||||
v.ToggleTabbar()
|
||||
|
||||
|
|
@ -183,9 +186,9 @@ func (v *View) ScrollUp(n int) {
|
|||
// ScrollDown scrolls the view down n lines (if possible)
|
||||
func (v *View) ScrollDown(n int) {
|
||||
// Try to scroll by n but if it would overflow, scroll by 1
|
||||
if v.Topline+n <= v.Buf.NumLines-v.Height {
|
||||
if v.Topline+n <= v.Buf.NumLines {
|
||||
v.Topline += n
|
||||
} else if v.Topline < v.Buf.NumLines-v.Height {
|
||||
} else if v.Topline < v.Buf.NumLines-1 {
|
||||
v.Topline++
|
||||
}
|
||||
}
|
||||
|
|
@ -230,8 +233,6 @@ func (v *View) OpenBuffer(buf *Buffer) {
|
|||
v.Center(false)
|
||||
v.messages = make(map[string][]GutterMessage)
|
||||
|
||||
v.matches = Match(v)
|
||||
|
||||
// Set mouseReleased to true because we assume the mouse is not being pressed when
|
||||
// the editor is opened
|
||||
v.mouseReleased = true
|
||||
|
|
@ -276,7 +277,6 @@ func (v *View) ReOpen() {
|
|||
screen.Clear()
|
||||
v.Buf.ReOpen()
|
||||
v.Relocate()
|
||||
v.matches = Match(v)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -603,6 +603,12 @@ func (v *View) HandleEvent(event tcell.Event) {
|
|||
|
||||
if relocate {
|
||||
v.Relocate()
|
||||
// We run relocate again because there's a bug with relocating with softwrap
|
||||
// when for example you jump to the bottom of the buffer and it tries to
|
||||
// calculate where to put the topline so that the bottom line is at the bottom
|
||||
// of the terminal and it runs into problems with visual lines vs real lines.
|
||||
// This is (hopefully) a temporary solution
|
||||
v.Relocate()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -654,34 +660,19 @@ func (v *View) openHelp(helpPage string) {
|
|||
}
|
||||
}
|
||||
|
||||
func (v *View) drawCell(x, y int, ch rune, combc []rune, style tcell.Style) {
|
||||
if x >= v.x && x < v.x+v.Width && y >= v.y && y < v.y+v.Height {
|
||||
screen.SetContent(x, y, ch, combc, style)
|
||||
}
|
||||
}
|
||||
|
||||
// DisplayView renders the view to the screen
|
||||
func (v *View) DisplayView() {
|
||||
if v.Type == vtLog {
|
||||
// Log views should always follow the cursor...
|
||||
v.Relocate()
|
||||
}
|
||||
|
||||
if v.Buf.Settings["syntax"].(bool) {
|
||||
v.matches = Match(v)
|
||||
}
|
||||
|
||||
// The charNum we are currently displaying
|
||||
// starts at the start of the viewport
|
||||
charNum := Loc{0, v.Topline}
|
||||
|
||||
// Convert the length of buffer to a string, and get the length of the string
|
||||
// We are going to have to offset by that amount
|
||||
maxLineLength := len(strconv.Itoa(v.Buf.NumLines))
|
||||
// We need to know the string length of the largest line number
|
||||
// so we can pad appropriately when displaying line numbers
|
||||
maxLineNumLength := len(strconv.Itoa(v.Buf.NumLines))
|
||||
|
||||
if v.Buf.Settings["ruler"] == true {
|
||||
// + 1 for the little space after the line number
|
||||
v.lineNumOffset = maxLineLength + 1
|
||||
v.lineNumOffset = maxLineNumLength + 1
|
||||
} else {
|
||||
v.lineNumOffset = 0
|
||||
}
|
||||
|
|
@ -702,51 +693,45 @@ func (v *View) DisplayView() {
|
|||
v.lineNumOffset++
|
||||
}
|
||||
|
||||
// These represent the current screen coordinates
|
||||
screenX, screenY := v.x, v.y-1
|
||||
xOffset := v.x + v.lineNumOffset
|
||||
yOffset := v.y
|
||||
|
||||
highlightStyle := defStyle
|
||||
curLineN := 0
|
||||
height := v.Height
|
||||
width := v.Width
|
||||
left := v.leftCol
|
||||
top := v.Topline
|
||||
|
||||
v.cellview.Draw(v.Buf, top, height, left, width-v.lineNumOffset)
|
||||
|
||||
screenX := v.x
|
||||
realLineN := top - 1
|
||||
visualLineN := 0
|
||||
var line []*Char
|
||||
for visualLineN, line = range v.cellview.lines {
|
||||
var firstChar *Char
|
||||
if len(line) > 0 {
|
||||
firstChar = line[0]
|
||||
}
|
||||
|
||||
var softwrapped bool
|
||||
if firstChar != nil {
|
||||
if firstChar.realLoc.Y == realLineN {
|
||||
softwrapped = true
|
||||
}
|
||||
realLineN = firstChar.realLoc.Y
|
||||
} else {
|
||||
realLineN++
|
||||
}
|
||||
|
||||
// ViewLine is the current line from the top of the viewport
|
||||
for viewLine := 0; viewLine < v.Height; viewLine++ {
|
||||
screenY++
|
||||
screenX = v.x
|
||||
|
||||
// This is the current line number of the buffer that we are drawing
|
||||
curLineN = viewLine + v.Topline
|
||||
|
||||
if screenY-v.y >= v.Height {
|
||||
break
|
||||
}
|
||||
|
||||
if v.x != 0 {
|
||||
dividerStyle := defStyle.Reverse(true)
|
||||
if style, ok := colorscheme["divider"]; ok {
|
||||
dividerStyle = style
|
||||
}
|
||||
// Draw the split divider
|
||||
v.drawCell(screenX, screenY, tcell.RuneVLine, nil, dividerStyle)
|
||||
screenX++
|
||||
}
|
||||
|
||||
// If the buffer is smaller than the view height we have to clear all this space
|
||||
if curLineN >= v.Buf.NumLines {
|
||||
for i := screenX; i < v.x+v.Width; i++ {
|
||||
v.drawCell(i, screenY, ' ', nil, defStyle)
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
line := v.Buf.Line(curLineN)
|
||||
|
||||
// If there are gutter messages we need to display the '>>' symbol here
|
||||
if hasGutterMessages {
|
||||
// msgOnLine stores whether or not there is a gutter message on this line in particular
|
||||
msgOnLine := false
|
||||
for k := range v.messages {
|
||||
for _, msg := range v.messages[k] {
|
||||
if msg.lineNum == curLineN {
|
||||
if msg.lineNum == realLineN {
|
||||
msgOnLine = true
|
||||
gutterStyle := defStyle
|
||||
switch msg.kind {
|
||||
|
|
@ -763,11 +748,11 @@ func (v *View) DisplayView() {
|
|||
gutterStyle = style
|
||||
}
|
||||
}
|
||||
v.drawCell(screenX, screenY, '>', nil, gutterStyle)
|
||||
screen.SetContent(screenX, yOffset+visualLineN, '>', nil, gutterStyle)
|
||||
screenX++
|
||||
v.drawCell(screenX, screenY, '>', nil, gutterStyle)
|
||||
screen.SetContent(screenX, yOffset+visualLineN, '>', nil, gutterStyle)
|
||||
screenX++
|
||||
if v.Cursor.Y == curLineN && !messenger.hasPrompt {
|
||||
if v.Cursor.Y == realLineN && !messenger.hasPrompt {
|
||||
messenger.Message(msg.msg)
|
||||
messenger.gutterMessage = true
|
||||
}
|
||||
|
|
@ -776,11 +761,11 @@ func (v *View) DisplayView() {
|
|||
}
|
||||
// If there is no message on this line we just display an empty offset
|
||||
if !msgOnLine {
|
||||
v.drawCell(screenX, screenY, ' ', nil, defStyle)
|
||||
screen.SetContent(screenX, yOffset+visualLineN, ' ', nil, defStyle)
|
||||
screenX++
|
||||
v.drawCell(screenX, screenY, ' ', nil, defStyle)
|
||||
screen.SetContent(screenX, yOffset+visualLineN, ' ', nil, defStyle)
|
||||
screenX++
|
||||
if v.Cursor.Y == curLineN && messenger.gutterMessage {
|
||||
if v.Cursor.Y == realLineN && messenger.gutterMessage {
|
||||
messenger.Reset()
|
||||
messenger.gutterMessage = false
|
||||
}
|
||||
|
|
@ -794,187 +779,125 @@ func (v *View) DisplayView() {
|
|||
lineNumStyle = style
|
||||
}
|
||||
if style, ok := colorscheme["current-line-number"]; ok {
|
||||
if curLineN == v.Cursor.Y && tabs[curTab].CurView == v.Num && !v.Cursor.HasSelection() {
|
||||
if realLineN == v.Cursor.Y && tabs[curTab].CurView == v.Num && !v.Cursor.HasSelection() {
|
||||
lineNumStyle = style
|
||||
}
|
||||
}
|
||||
|
||||
lineNum := strconv.Itoa(curLineN + 1)
|
||||
lineNum := strconv.Itoa(realLineN + 1)
|
||||
|
||||
// Write the spaces before the line number if necessary
|
||||
for i := 0; i < maxLineLength-len(lineNum); i++ {
|
||||
v.drawCell(screenX, screenY, ' ', nil, lineNumStyle)
|
||||
for i := 0; i < maxLineNumLength-len(lineNum); i++ {
|
||||
screen.SetContent(screenX, yOffset+visualLineN, ' ', nil, lineNumStyle)
|
||||
screenX++
|
||||
}
|
||||
// Write the actual line number
|
||||
for _, ch := range lineNum {
|
||||
v.drawCell(screenX, screenY, ch, nil, lineNumStyle)
|
||||
screenX++
|
||||
if softwrapped && visualLineN != 0 {
|
||||
// Pad without the line number because it was written on the visual line before
|
||||
for range lineNum {
|
||||
screen.SetContent(screenX, yOffset+visualLineN, ' ', nil, lineNumStyle)
|
||||
screenX++
|
||||
}
|
||||
} else {
|
||||
// Write the actual line number
|
||||
for _, ch := range lineNum {
|
||||
screen.SetContent(screenX, yOffset+visualLineN, ch, nil, lineNumStyle)
|
||||
screenX++
|
||||
}
|
||||
}
|
||||
|
||||
// Write the extra space
|
||||
v.drawCell(screenX, screenY, ' ', nil, lineNumStyle)
|
||||
screen.SetContent(screenX, yOffset+visualLineN, ' ', nil, lineNumStyle)
|
||||
screenX++
|
||||
}
|
||||
|
||||
// Now we actually draw the line
|
||||
colN := 0
|
||||
strWidth := 0
|
||||
tabSize := int(v.Buf.Settings["tabsize"].(float64))
|
||||
for _, ch := range line {
|
||||
if v.Buf.Settings["softwrap"].(bool) {
|
||||
if screenX-v.x >= v.Width {
|
||||
screenY++
|
||||
var lastChar *Char
|
||||
cursorSet := false
|
||||
for _, char := range line {
|
||||
if char != nil {
|
||||
lineStyle := char.style
|
||||
|
||||
x := 0
|
||||
if hasGutterMessages {
|
||||
v.drawCell(v.x+x, screenY, ' ', nil, defStyle)
|
||||
x++
|
||||
v.drawCell(v.x+x, screenY, ' ', nil, defStyle)
|
||||
x++
|
||||
charLoc := char.realLoc
|
||||
if v.Cursor.HasSelection() &&
|
||||
(charLoc.GreaterEqual(v.Cursor.CurSelection[0]) && charLoc.LessThan(v.Cursor.CurSelection[1]) ||
|
||||
charLoc.LessThan(v.Cursor.CurSelection[0]) && charLoc.GreaterEqual(v.Cursor.CurSelection[1])) {
|
||||
// The current character is selected
|
||||
lineStyle = defStyle.Reverse(true)
|
||||
|
||||
if style, ok := colorscheme["selection"]; ok {
|
||||
lineStyle = style
|
||||
}
|
||||
for i := 0; i < v.lineNumOffset; i++ {
|
||||
screen.SetContent(v.x+i+x, screenY, ' ', nil, lineNumStyle)
|
||||
}
|
||||
screenX = v.x + v.lineNumOffset
|
||||
}
|
||||
}
|
||||
|
||||
if tabs[curTab].CurView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == curLineN && colN == v.Cursor.X {
|
||||
v.DisplayCursor(screenX-v.leftCol, screenY)
|
||||
}
|
||||
|
||||
lineStyle := defStyle
|
||||
|
||||
if v.Buf.Settings["syntax"].(bool) {
|
||||
// Syntax highlighting is enabled
|
||||
highlightStyle = v.matches[viewLine][colN]
|
||||
}
|
||||
|
||||
if v.Cursor.HasSelection() &&
|
||||
(charNum.GreaterEqual(v.Cursor.CurSelection[0]) && charNum.LessThan(v.Cursor.CurSelection[1]) ||
|
||||
charNum.LessThan(v.Cursor.CurSelection[0]) && charNum.GreaterEqual(v.Cursor.CurSelection[1])) {
|
||||
// The current character is selected
|
||||
lineStyle = defStyle.Reverse(true)
|
||||
|
||||
if style, ok := colorscheme["selection"]; ok {
|
||||
lineStyle = style
|
||||
if tabs[curTab].CurView == v.Num && !v.Cursor.HasSelection() &&
|
||||
v.Cursor.Y == char.realLoc.Y && v.Cursor.X == char.realLoc.X && !cursorSet {
|
||||
screen.ShowCursor(xOffset+char.visualLoc.X, yOffset+char.visualLoc.Y)
|
||||
cursorSet = true
|
||||
}
|
||||
} else {
|
||||
lineStyle = highlightStyle
|
||||
}
|
||||
|
||||
// We need to display the background of the linestyle with the correct color if cursorline is enabled
|
||||
// and this is the current view and there is no selection on this line and the cursor is on this line
|
||||
if v.Buf.Settings["cursorline"].(bool) && tabs[curTab].CurView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == curLineN {
|
||||
if style, ok := colorscheme["cursor-line"]; ok {
|
||||
if v.Buf.Settings["cursorline"].(bool) && tabs[curTab].CurView == v.Num &&
|
||||
!v.Cursor.HasSelection() && v.Cursor.Y == realLineN {
|
||||
style := GetColor("cursor-line")
|
||||
fg, _, _ := style.Decompose()
|
||||
lineStyle = lineStyle.Background(fg)
|
||||
}
|
||||
|
||||
screen.SetContent(xOffset+char.visualLoc.X, yOffset+char.visualLoc.Y, char.drawChar, nil, lineStyle)
|
||||
|
||||
lastChar = char
|
||||
}
|
||||
|
||||
if ch == '\t' {
|
||||
// If the character we are displaying is a tab, we need to do a bunch of special things
|
||||
|
||||
// First the user may have configured an `indent-char` to be displayed to show that this
|
||||
// is a tab character
|
||||
lineIndentStyle := defStyle
|
||||
if style, ok := colorscheme["indent-char"]; ok && v.Buf.Settings["indentchar"].(string) != " " {
|
||||
lineIndentStyle = style
|
||||
}
|
||||
if v.Cursor.HasSelection() &&
|
||||
(charNum.GreaterEqual(v.Cursor.CurSelection[0]) && charNum.LessThan(v.Cursor.CurSelection[1]) ||
|
||||
charNum.LessThan(v.Cursor.CurSelection[0]) && charNum.GreaterEqual(v.Cursor.CurSelection[1])) {
|
||||
|
||||
lineIndentStyle = defStyle.Reverse(true)
|
||||
|
||||
if style, ok := colorscheme["selection"]; ok {
|
||||
lineIndentStyle = style
|
||||
}
|
||||
}
|
||||
if v.Buf.Settings["cursorline"].(bool) && tabs[curTab].CurView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == curLineN {
|
||||
if style, ok := colorscheme["cursor-line"]; ok {
|
||||
fg, _, _ := style.Decompose()
|
||||
lineIndentStyle = lineIndentStyle.Background(fg)
|
||||
}
|
||||
}
|
||||
// Here we get the indent char
|
||||
indentChar := []rune(v.Buf.Settings["indentchar"].(string))
|
||||
if screenX-v.x-v.leftCol >= v.lineNumOffset {
|
||||
v.drawCell(screenX-v.leftCol, screenY, indentChar[0], nil, lineIndentStyle)
|
||||
}
|
||||
// Now the tab has to be displayed as a bunch of spaces
|
||||
visLoc := strWidth
|
||||
remainder := tabSize - (visLoc % tabSize)
|
||||
for i := 0; i < remainder-1; i++ {
|
||||
screenX++
|
||||
if screenX-v.x-v.leftCol >= v.lineNumOffset {
|
||||
v.drawCell(screenX-v.leftCol, screenY, ' ', nil, lineStyle)
|
||||
}
|
||||
}
|
||||
strWidth += remainder
|
||||
} else if runewidth.RuneWidth(ch) > 1 {
|
||||
if screenX-v.x-v.leftCol >= v.lineNumOffset {
|
||||
v.drawCell(screenX, screenY, ch, nil, lineStyle)
|
||||
}
|
||||
for i := 0; i < runewidth.RuneWidth(ch)-1; i++ {
|
||||
screenX++
|
||||
if screenX-v.x-v.leftCol >= v.lineNumOffset {
|
||||
v.drawCell(screenX-v.leftCol, screenY, '<', nil, lineStyle)
|
||||
}
|
||||
}
|
||||
strWidth += StringWidth(string(ch), tabSize)
|
||||
} else {
|
||||
if screenX-v.x-v.leftCol >= v.lineNumOffset {
|
||||
v.drawCell(screenX-v.leftCol, screenY, ch, nil, lineStyle)
|
||||
}
|
||||
strWidth += StringWidth(string(ch), tabSize)
|
||||
}
|
||||
charNum = charNum.Move(1, v.Buf)
|
||||
screenX++
|
||||
colN++
|
||||
}
|
||||
// Here we are at a newline
|
||||
|
||||
if tabs[curTab].CurView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == curLineN && colN == v.Cursor.X {
|
||||
v.DisplayCursor(screenX-v.leftCol, screenY)
|
||||
}
|
||||
|
||||
// The newline may be selected, in which case we should draw the selection style
|
||||
// with a space to represent it
|
||||
lastX := 0
|
||||
var realLoc Loc
|
||||
var visualLoc Loc
|
||||
if lastChar != nil {
|
||||
lastX = xOffset + lastChar.visualLoc.X + lastChar.width
|
||||
if tabs[curTab].CurView == v.Num && !v.Cursor.HasSelection() &&
|
||||
v.Cursor.Y == lastChar.realLoc.Y && v.Cursor.X == lastChar.realLoc.X+1 {
|
||||
screen.ShowCursor(lastX, yOffset+lastChar.visualLoc.Y)
|
||||
}
|
||||
realLoc = Loc{lastChar.realLoc.X, realLineN}
|
||||
visualLoc = Loc{lastX - xOffset, lastChar.visualLoc.Y}
|
||||
} else if len(line) == 0 {
|
||||
if tabs[curTab].CurView == v.Num && !v.Cursor.HasSelection() &&
|
||||
v.Cursor.Y == realLineN {
|
||||
screen.ShowCursor(xOffset, yOffset+visualLineN)
|
||||
}
|
||||
lastX = xOffset
|
||||
realLoc = Loc{0, realLineN}
|
||||
visualLoc = Loc{0, visualLineN}
|
||||
}
|
||||
|
||||
if v.Cursor.HasSelection() &&
|
||||
(charNum.GreaterEqual(v.Cursor.CurSelection[0]) && charNum.LessThan(v.Cursor.CurSelection[1]) ||
|
||||
charNum.LessThan(v.Cursor.CurSelection[0]) && charNum.GreaterEqual(v.Cursor.CurSelection[1])) {
|
||||
|
||||
(realLoc.GreaterEqual(v.Cursor.CurSelection[0]) && realLoc.LessThan(v.Cursor.CurSelection[1]) ||
|
||||
realLoc.LessThan(v.Cursor.CurSelection[0]) && realLoc.GreaterEqual(v.Cursor.CurSelection[1])) {
|
||||
// The current character is selected
|
||||
selectStyle := defStyle.Reverse(true)
|
||||
|
||||
if style, ok := colorscheme["selection"]; ok {
|
||||
selectStyle = style
|
||||
}
|
||||
v.drawCell(screenX, screenY, ' ', nil, selectStyle)
|
||||
screenX++
|
||||
screen.SetContent(xOffset+visualLoc.X, yOffset+visualLoc.Y, ' ', nil, selectStyle)
|
||||
}
|
||||
|
||||
charNum = charNum.Move(1, v.Buf)
|
||||
if v.Buf.Settings["cursorline"].(bool) && tabs[curTab].CurView == v.Num &&
|
||||
!v.Cursor.HasSelection() && v.Cursor.Y == realLineN {
|
||||
for i := lastX; i < xOffset+v.Width; i++ {
|
||||
style := GetColor("cursor-line")
|
||||
fg, _, _ := style.Decompose()
|
||||
style = style.Background(fg)
|
||||
screen.SetContent(i, yOffset+visualLineN, ' ', nil, style)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for i := 0; i < v.Width; i++ {
|
||||
lineStyle := defStyle
|
||||
if v.Buf.Settings["cursorline"].(bool) && tabs[curTab].CurView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == curLineN {
|
||||
if style, ok := colorscheme["cursor-line"]; ok {
|
||||
fg, _, _ := style.Decompose()
|
||||
lineStyle = lineStyle.Background(fg)
|
||||
}
|
||||
}
|
||||
if screenX-v.x-v.leftCol+i >= v.lineNumOffset {
|
||||
colorcolumn := int(v.Buf.Settings["colorcolumn"].(float64))
|
||||
if colorcolumn != 0 && screenX-v.lineNumOffset+i == colorcolumn-1 {
|
||||
if style, ok := colorscheme["color-column"]; ok {
|
||||
fg, _, _ := style.Decompose()
|
||||
lineStyle = lineStyle.Background(fg)
|
||||
}
|
||||
}
|
||||
v.drawCell(screenX-v.leftCol+i, screenY, ' ', nil, lineStyle)
|
||||
}
|
||||
if v.x != 0 && visualLineN < v.Height {
|
||||
dividerStyle := defStyle
|
||||
if style, ok := colorscheme["divider"]; ok {
|
||||
dividerStyle = style
|
||||
}
|
||||
for i := visualLineN + 1; i < v.Height; i++ {
|
||||
screen.SetContent(v.x, yOffset+i, '|', nil, dividerStyle.Reverse(true))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# Runtime files for Micro
|
||||
|
||||
This directory will be embedded in the Go binary for portability, but it may just as well be put in `~/.config/micro`. If you would like to make your own colorschemes
|
||||
and syntax files, you can put in in `~/.config/micro/colorschemes` and `~/.config/micro/syntax` respectively.
|
||||
and syntax files, you can put them in `~/.config/micro/colorschemes` and `~/.config/micro/syntax` respectively.
|
||||
|
||||
|
|
|
|||
|
|
@ -195,6 +195,9 @@ In the future, plugins may also be able to use color groups for styling.
|
|||
|
||||
The syntax files specify how to highlight certain languages.
|
||||
|
||||
<<<<<<< HEAD
|
||||
Syntax files are specified in the yaml format.
|
||||
=======
|
||||
Micro's builtin syntax highlighting tries very hard to be sane, sensible
|
||||
and provide ample coverage of the meaningful elements of a language. Micro has
|
||||
syntax files built int for over 100 languages now. However, there may be
|
||||
|
|
@ -204,42 +207,97 @@ your liking. Good news is you can create syntax files (.micro extension), place
|
|||
|
||||
The first statement in a syntax file will probably the syntax statement. This tells micro
|
||||
what language the syntax file is for and how to detect a file in that language.
|
||||
>>>>>>> master
|
||||
|
||||
Essentially, it's just
|
||||
#### Filetype defintion
|
||||
|
||||
You must start the syntax file by declaring the filetype:
|
||||
|
||||
```
|
||||
syntax "Name of language" "\.extension$"
|
||||
filetype: go
|
||||
```
|
||||
|
||||
For the extension, micro will just compare that regex to the filename and if it matches then it
|
||||
will use the syntax rules defined in the remainder of the file.
|
||||
#### Detect definition
|
||||
|
||||
There is also a possibility to use a header statement which is a regex that micro will compare
|
||||
with the first line of the file. This is almost only used for shebangs at the top of shell scripts
|
||||
which don't have any extension (see sh.micro for an example).
|
||||
|
||||
---
|
||||
|
||||
The rest of a syntax file is very simple and is essentially a list of regexes specifying how to highlight
|
||||
different expressions.
|
||||
|
||||
It is recommended that when creating a syntax file you use the colorscheme groups (see above) to
|
||||
highlight different expressions. You may also hard code colors, but that may not look good depending
|
||||
on what terminal colorscheme the user has installed.
|
||||
|
||||
Here is an example to highlight comments (expressions starting with `//`):
|
||||
Then you can provide information about how to detect the filetype:
|
||||
|
||||
```
|
||||
color comment "//.*"
|
||||
detect:
|
||||
filename: "\\.go$"
|
||||
```
|
||||
|
||||
This will highlight the regex `//.*` in the color that the user's colorscheme has linked to the comment
|
||||
group.
|
||||
|
||||
Note that this regex only matches the current line. Here is an example for multiline comments (`/* comment */`):
|
||||
Micro will match this regex against a given filename to detect the filetype. You may also
|
||||
provide an optional `header` regex that will check the first line of the file. For example for yaml:
|
||||
|
||||
```
|
||||
color comment start="/\*" end="\*/"
|
||||
detect:
|
||||
filename: "\\.ya?ml$"
|
||||
header: "%YAML"
|
||||
```
|
||||
|
||||
#### Syntax rules
|
||||
|
||||
Next you must provide the syntax highlighting rules. There are two types of rules: patterns and regions.
|
||||
A pattern is matched on a single line and usually a single word as well. A region highlights between two
|
||||
patterns over multiple lines and may have rules of its own inside the region.
|
||||
|
||||
Here are some example patterns in Go:
|
||||
|
||||
```
|
||||
rules:
|
||||
- special: "\\b(break|case|continue|default|go|goto|range|return)\\b"
|
||||
- statement: "\\b(else|for|if|switch)\\b"
|
||||
- preproc: "\\b(package|import|const|var|type|struct|func|go|defer|iota)\\b"
|
||||
```
|
||||
|
||||
The order of patterns does matter as patterns lower in the file will overwrite the ones defined above them.
|
||||
|
||||
And here are some example regions for Go:
|
||||
|
||||
```
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "%."
|
||||
- constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
|
||||
- constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
|
||||
|
||||
- comment:
|
||||
start: "//"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
- comment:
|
||||
start: "/\\*"
|
||||
end: "\\*/"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
```
|
||||
|
||||
Notice how the regions may contain rules inside of them.
|
||||
|
||||
Also the regexes for region start and end may contain more complex regexes with lookahead and lookbehind,
|
||||
but this is not supported for pattern regexes.
|
||||
|
||||
#### Includes
|
||||
|
||||
You may also include rules from other syntax files as embedded languages. For example, the following is possible
|
||||
for html:
|
||||
|
||||
```
|
||||
- default:
|
||||
start: "<script.*?>"
|
||||
end: "</script.*?>"
|
||||
rules:
|
||||
- include: "javascript"
|
||||
|
||||
- default:
|
||||
start: "<style.*?>"
|
||||
end: "</style.*?>"
|
||||
rules:
|
||||
- include: "css"
|
||||
```
|
||||
|
||||
Note: The format of syntax files will be changing with the view refactor.
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
## Syntax highlighting for Dockerfiles
|
||||
syntax "dockerfile" "Dockerfile[^/]*$" "\.dockerfile$"
|
||||
|
||||
## Keywords
|
||||
color statement "^(FROM|MAINTAINER|RUN|CMD|LABEL|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR|ONBUILD|ARG|HEALTHCHECK|STOPSIGNAL|SHELL)[[:space:]]"
|
||||
|
||||
## Brackets & parenthesis
|
||||
color symbol.brackets "(\(|\)|\[|\])"
|
||||
|
||||
## Double ampersand
|
||||
color special "&&"
|
||||
|
||||
## Comments
|
||||
color comment "^[[:space:]]*#.*$"
|
||||
|
||||
## Strings, single-quoted
|
||||
color constant.string "'([^']|(\\'))*'" "%[qw]\{[^}]*\}" "%[qw]\([^)]*\)" "%[qw]<[^>]*>" "%[qw]\[[^]]*\]" "%[qw]\$[^$]*\$" "%[qw]\^[^^]*\^" "%[qw]![^!]*!"
|
||||
|
||||
## Strings, double-quoted
|
||||
color constant.string ""([^"]|(\\"))*"" "%[QW]?\{[^}]*\}" "%[QW]?\([^)]*\)" "%[QW]?<[^>]*>" "%[QW]?\[[^]]*\]" "%[QW]?\$[^$]*\$" "%[QW]?\^[^^]*\^" "%[QW]?![^!]*!"
|
||||
|
|
@ -1,15 +1,22 @@
|
|||
micro syntax files
|
||||
Copyright (C) 2016+ Zachary Yedidia, Collin Warren, et al.
|
||||
Micro's syntax files are licensed under the MIT "Expat" License:
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
Copyright (c) 2016: Zachary Yedidia, Collin Warren, et al.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
export
|
||||
:=
|
||||
error
|
||||
|
||||
|
|
@ -1,3 +1,32 @@
|
|||
<<<<<<< HEAD
|
||||
# Syntax Files
|
||||
|
||||
Here are micro's syntax files.
|
||||
|
||||
Each yaml file specifies how to detect the filetype based on file extension or headers (first line of the file).
|
||||
Then there are patterns and regions linked to highlight groups which tell micro how to highlight that filetype.
|
||||
|
||||
Making your own syntax files is very simple. I recommend you check the file after you are finished with the
|
||||
[`syntax_checker.go`](./syntax_checker.go) program (located in this directory). Just place your yaml syntax
|
||||
file in the current directory and run `go run syntax_checker.go` and it will check every file. If there are no
|
||||
errors it will print `No issues!`.
|
||||
|
||||
You can read more about how to write syntax files (and colorschemes) in the [colors](../help/colors.md) documentation.
|
||||
|
||||
# Legacy '.micro' filetype
|
||||
|
||||
Micro used to use the `.micro` filetype for syntax files which is no longer supported. If you have `.micro`
|
||||
syntax files that you would like to convert to the new filetype, you can use the [`syntax_converter.go`](./syntax_converter.go) program (also located in this directory):
|
||||
|
||||
```
|
||||
$ go run syntax_converter.go c.micro > c.yaml
|
||||
```
|
||||
|
||||
Most the the syntax files here have been converted using that tool.
|
||||
|
||||
Note that the tool isn't perfect and though it is unlikely, you may run into some small issues that you will have to fix manually
|
||||
(about 4 files from this directory had issues after being converted).
|
||||
=======
|
||||
# Micro syntax highlighting files
|
||||
|
||||
These are the syntax highlighting files for micro. To install them, just
|
||||
|
|
@ -38,3 +67,4 @@ Here is a list of the files that have been converted to properly use colorscheme
|
|||
|
||||
Because the nano syntax files I have modified are distributed under the GNU GPLv3 license, these files are also distributed
|
||||
under that license. See [LICENSE](LICENSE).
|
||||
>>>>>>> master
|
||||
|
|
|
|||
|
|
@ -1,44 +0,0 @@
|
|||
# Apache files
|
||||
syntax "apacheconf" "httpd\.conf|mime\.types|vhosts\.d\\*|\.htaccess"
|
||||
color special ".+"
|
||||
color identifier "(AcceptMutex|AcceptPathInfo|AccessFileName|Action|AddAlt|AddAltByEncoding|AddAltByType|AddCharset|AddDefaultCharset|AddDescription|AddEncoding)"
|
||||
color identifier "(AddHandler|AddIcon|AddIconByEncoding|AddIconByType|AddInputFilter|AddLanguage|AddModuleInfo|AddOutputFilter|AddOutputFilterByType|AddType|Alias|AliasMatch)"
|
||||
color identifier "(Allow|AllowCONNECT|AllowEncodedSlashes|AllowOverride|Anonymous|Anonymous_Authoritative|Anonymous_LogEmail|Anonymous_MustGiveEmail|Anonymous_NoUserID)"
|
||||
color identifier "(Anonymous_VerifyEmail|AssignUserID|AuthAuthoritative|AuthDBMAuthoritative|AuthDBMGroupFile|AuthDBMType|AuthDBMUserFile|AuthDigestAlgorithm)"
|
||||
color identifier "(AuthDigestDomain|AuthDigestFile|AuthDigestGroupFile|AuthDigestNcCheck|AuthDigestNonceFormat|AuthDigestNonceLifetime|AuthDigestQop|AuthDigestShmemSize)"
|
||||
color identifier "(AuthGroupFile|AuthLDAPAuthoritative|AuthLDAPBindDN|AuthLDAPBindPassword|AuthLDAPCharsetConfig|AuthLDAPCompareDNOnServer|AuthLDAPDereferenceAliases)"
|
||||
color identifier "(AuthLDAPEnabled|AuthLDAPFrontPageHack|AuthLDAPGroupAttribute|AuthLDAPGroupAttributeIsDN|AuthLDAPRemoteUserIsDN|AuthLDAPUrl|AuthName|AuthType|AuthUserFile)"
|
||||
color identifier "(BrowserMatch|BrowserMatchNoCase|BS2000Account|BufferedLogs|CacheDefaultExpire|CacheDirLength|CacheDirLevels|CacheDisable|CacheEnable|CacheExpiryCheck)"
|
||||
color identifier "(CacheFile|CacheForceCompletion|CacheGcClean|CacheGcDaily|CacheGcInterval|CacheGcMemUsage|CacheGcUnused|CacheIgnoreCacheControl|CacheIgnoreHeaders)"
|
||||
color identifier "(CacheIgnoreNoLastMod|CacheLastModifiedFactor|CacheMaxExpire|CacheMaxFileSize|CacheMinFileSize|CacheNegotiatedDocs|CacheRoot|CacheSize|CacheTimeMargin)"
|
||||
color identifier "(CGIMapExtension|CharsetDefault|CharsetOptions|CharsetSourceEnc|CheckSpelling|ChildPerUserID|ContentDigest|CookieDomain|CookieExpires|CookieLog|CookieName)"
|
||||
color identifier "(CookieStyle|CookieTracking|CoreDumpDirectory|CustomLog|Dav|DavDepthInfinity|DavLockDB|DavMinTimeout|DefaultIcon|DefaultLanguage|DefaultType)"
|
||||
color identifier "(DeflateBufferSize|DeflateCompressionLevel|DeflateFilterNote|DeflateMemLevel|DeflateWindowSize|Deny|Directory|DirectoryIndex|DirectoryMatch|DirectorySlash)"
|
||||
color identifier "(DocumentRoot|DumpIOInput|DumpIOOutput|EnableExceptionHook|EnableMMAP|EnableSendfile|ErrorDocument|ErrorLog|Example|ExpiresActive|ExpiresByType)"
|
||||
color identifier "(ExpiresDefault|ExtendedStatus|ExtFilterDefine|ExtFilterOptions|FileETag|Files|FilesMatch|ForceLanguagePriority|ForceType|ForensicLog|Group|Header)"
|
||||
color identifier "(HeaderName|HostnameLookups|IdentityCheck|IfDefine|IfModule|IfVersion|ImapBase|ImapDefault|ImapMenu|Include|IndexIgnore|IndexOptions|IndexOrderDefault)"
|
||||
color identifier "(ISAPIAppendLogToErrors|ISAPIAppendLogToQuery|ISAPICacheFile|ISAPIFakeAsync|ISAPILogNotSupported|ISAPIReadAheadBuffer|KeepAlive|KeepAliveTimeout)"
|
||||
color identifier "(LanguagePriority|LDAPCacheEntries|LDAPCacheTTL|LDAPConnectionTimeout|LDAPOpCacheEntries|LDAPOpCacheTTL|LDAPSharedCacheFile|LDAPSharedCacheSize)"
|
||||
color identifier "(LDAPTrustedCA|LDAPTrustedCAType|Limit|LimitExcept|LimitInternalRecursion|LimitRequestBody|LimitRequestFields|LimitRequestFieldSize|LimitRequestLine)"
|
||||
color identifier "(LimitXMLRequestBody|Listen|ListenBackLog|LoadFile|LoadModule|Location|LocationMatch|LockFile|LogFormat|LogLevel|MaxClients|MaxKeepAliveRequests)"
|
||||
color identifier "(MaxMemFree|MaxRequestsPerChild|MaxRequestsPerThread|MaxSpareServers|MaxSpareThreads|MaxThreads|MaxThreadsPerChild|MCacheMaxObjectCount|MCacheMaxObjectSize)"
|
||||
color identifier "(MCacheMaxStreamingBuffer|MCacheMinObjectSize|MCacheRemovalAlgorithm|MCacheSize|MetaDir|MetaFiles|MetaSuffix|MimeMagicFile|MinSpareServers|MinSpareThreads)"
|
||||
color identifier "(MMapFile|ModMimeUsePathInfo|MultiviewsMatch|NameVirtualHost|NoProxy|NumServers|NWSSLTrustedCerts|NWSSLUpgradeable|Options|Order|PassEnv|PidFile)"
|
||||
color identifier "(ProtocolEcho|Proxy|ProxyBadHeader|ProxyBlock|ProxyDomain|ProxyErrorOverride|ProxyIOBufferSize|ProxyMatch|ProxyMaxForwards|ProxyPass|ProxyPassReverse)"
|
||||
color identifier "(ProxyPreserveHost|ProxyReceiveBufferSize|ProxyRemote|ProxyRemoteMatch|ProxyRequests|ProxyTimeout|ProxyVia|ReadmeName|Redirect|RedirectMatch)"
|
||||
color identifier "(RedirectPermanent|RedirectTemp|RemoveCharset|RemoveEncoding|RemoveHandler|RemoveInputFilter|RemoveLanguage|RemoveOutputFilter|RemoveType|RequestHeader)"
|
||||
color identifier "(Require|RewriteBase|RewriteCond|RewriteEngine|RewriteLock|RewriteLog|RewriteLogLevel|RewriteMap|RewriteOptions|RewriteRule|RLimitCPU|RLimitMEM|RLimitNPROC)"
|
||||
color identifier "(Satisfy|ScoreBoardFile|Script|ScriptAlias|ScriptAliasMatch|ScriptInterpreterSource|ScriptLog|ScriptLogBuffer|ScriptLogLength|ScriptSock|SecureListen)"
|
||||
color identifier "(SendBufferSize|ServerAdmin|ServerAlias|ServerLimit|ServerName|ServerPath|ServerRoot|ServerSignature|ServerTokens|SetEnv|SetEnvIf|SetEnvIfNoCase|SetHandler)"
|
||||
color identifier "(SetInputFilter|SetOutputFilter|SSIEndTag|SSIErrorMsg|SSIStartTag|SSITimeFormat|SSIUndefinedEcho|SSLCACertificateFile|SSLCACertificatePath)"
|
||||
color identifier "(SSLCARevocationFile|SSLCARevocationPath|SSLCertificateChainFile|SSLCertificateFile|SSLCertificateKeyFile|SSLCipherSuite|SSLEngine|SSLMutex|SSLOptions)"
|
||||
color identifier "(SSLPassPhraseDialog|SSLProtocol|SSLProxyCACertificateFile|SSLProxyCACertificatePath|SSLProxyCARevocationFile|SSLProxyCARevocationPath|SSLProxyCipherSuite)"
|
||||
color identifier "(SSLProxyEngine|SSLProxyMachineCertificateFile|SSLProxyMachineCertificatePath|SSLProxyProtocol|SSLProxyVerify|SSLProxyVerifyDepth|SSLRandomSeed|SSLRequire)"
|
||||
color identifier "(SSLRequireSSL|SSLSessionCache|SSLSessionCacheTimeout|SSLUserName|SSLVerifyClient|SSLVerifyDepth|StartServers|StartThreads|SuexecUserGroup|ThreadLimit)"
|
||||
color identifier "(ThreadsPerChild|ThreadStackSize|TimeOut|TraceEnable|TransferLog|TypesConfig|UnsetEnv|UseCanonicalName|User|UserDir|VirtualDocumentRoot)"
|
||||
color identifier "(VirtualDocumentRootIP|VirtualHost|VirtualScriptAlias|VirtualScriptAliasIP|Win32DisableAcceptEx|XBitHack)"
|
||||
color symbol.tag "<[^>]+>"
|
||||
color identifier "</?[A-Za-z]+"
|
||||
color identifier "(<|</|>)"
|
||||
color constant.string "\"(\\.|[^\"])*\""
|
||||
color comment "#.*"
|
||||
58
runtime/syntax/apacheconf.yaml
Normal file
58
runtime/syntax/apacheconf.yaml
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
filetype: apacheconf
|
||||
|
||||
detect:
|
||||
filename: "httpd\\.conf|mime\\.types|vhosts\\.d\\\\*|\\.htaccess"
|
||||
|
||||
rules:
|
||||
- identifier: "(AcceptMutex|AcceptPathInfo|AccessFileName|Action|AddAlt|AddAltByEncoding|AddAltByType|AddCharset|AddDefaultCharset|AddDescription|AddEncoding)"
|
||||
- identifier: "(AddHandler|AddIcon|AddIconByEncoding|AddIconByType|AddInputFilter|AddLanguage|AddModuleInfo|AddOutputFilter|AddOutputFilterByType|AddType|Alias|AliasMatch)"
|
||||
- identifier: "(Allow|AllowCONNECT|AllowEncodedSlashes|AllowOverride|Anonymous|Anonymous_Authoritative|Anonymous_LogEmail|Anonymous_MustGiveEmail|Anonymous_NoUserID)"
|
||||
- identifier: "(Anonymous_VerifyEmail|AssignUserID|AuthAuthoritative|AuthDBMAuthoritative|AuthDBMGroupFile|AuthDBMType|AuthDBMUserFile|AuthDigestAlgorithm)"
|
||||
- identifier: "(AuthDigestDomain|AuthDigestFile|AuthDigestGroupFile|AuthDigestNcCheck|AuthDigestNonceFormat|AuthDigestNonceLifetime|AuthDigestQop|AuthDigestShmemSize)"
|
||||
- identifier: "(AuthGroupFile|AuthLDAPAuthoritative|AuthLDAPBindDN|AuthLDAPBindPassword|AuthLDAPCharsetConfig|AuthLDAPCompareDNOnServer|AuthLDAPDereferenceAliases)"
|
||||
- identifier: "(AuthLDAPEnabled|AuthLDAPFrontPageHack|AuthLDAPGroupAttribute|AuthLDAPGroupAttributeIsDN|AuthLDAPRemoteUserIsDN|AuthLDAPUrl|AuthName|AuthType|AuthUserFile)"
|
||||
- identifier: "(BrowserMatch|BrowserMatchNoCase|BS2000Account|BufferedLogs|CacheDefaultExpire|CacheDirLength|CacheDirLevels|CacheDisable|CacheEnable|CacheExpiryCheck)"
|
||||
- identifier: "(CacheFile|CacheForceCompletion|CacheGcClean|CacheGcDaily|CacheGcInterval|CacheGcMemUsage|CacheGcUnused|CacheIgnoreCacheControl|CacheIgnoreHeaders)"
|
||||
- identifier: "(CacheIgnoreNoLastMod|CacheLastModifiedFactor|CacheMaxExpire|CacheMaxFileSize|CacheMinFileSize|CacheNegotiatedDocs|CacheRoot|CacheSize|CacheTimeMargin)"
|
||||
- identifier: "(CGIMapExtension|CharsetDefault|CharsetOptions|CharsetSourceEnc|CheckSpelling|ChildPerUserID|ContentDigest|CookieDomain|CookieExpires|CookieLog|CookieName)"
|
||||
- identifier: "(CookieStyle|CookieTracking|CoreDumpDirectory|CustomLog|Dav|DavDepthInfinity|DavLockDB|DavMinTimeout|DefaultIcon|DefaultLanguage|DefaultType)"
|
||||
- identifier: "(DeflateBufferSize|DeflateCompressionLevel|DeflateFilterNote|DeflateMemLevel|DeflateWindowSize|Deny|Directory|DirectoryIndex|DirectoryMatch|DirectorySlash)"
|
||||
- identifier: "(DocumentRoot|DumpIOInput|DumpIOOutput|EnableExceptionHook|EnableMMAP|EnableSendfile|ErrorDocument|ErrorLog|Example|ExpiresActive|ExpiresByType)"
|
||||
- identifier: "(ExpiresDefault|ExtendedStatus|ExtFilterDefine|ExtFilterOptions|FileETag|Files|FilesMatch|ForceLanguagePriority|ForceType|ForensicLog|Group|Header)"
|
||||
- identifier: "(HeaderName|HostnameLookups|IdentityCheck|IfDefine|IfModule|IfVersion|ImapBase|ImapDefault|ImapMenu|Include|IndexIgnore|IndexOptions|IndexOrderDefault)"
|
||||
- identifier: "(ISAPIAppendLogToErrors|ISAPIAppendLogToQuery|ISAPICacheFile|ISAPIFakeAsync|ISAPILogNotSupported|ISAPIReadAheadBuffer|KeepAlive|KeepAliveTimeout)"
|
||||
- identifier: "(LanguagePriority|LDAPCacheEntries|LDAPCacheTTL|LDAPConnectionTimeout|LDAPOpCacheEntries|LDAPOpCacheTTL|LDAPSharedCacheFile|LDAPSharedCacheSize)"
|
||||
- identifier: "(LDAPTrustedCA|LDAPTrustedCAType|Limit|LimitExcept|LimitInternalRecursion|LimitRequestBody|LimitRequestFields|LimitRequestFieldSize|LimitRequestLine)"
|
||||
- identifier: "(LimitXMLRequestBody|Listen|ListenBackLog|LoadFile|LoadModule|Location|LocationMatch|LockFile|LogFormat|LogLevel|MaxClients|MaxKeepAliveRequests)"
|
||||
- identifier: "(MaxMemFree|MaxRequestsPerChild|MaxRequestsPerThread|MaxSpareServers|MaxSpareThreads|MaxThreads|MaxThreadsPerChild|MCacheMaxObjectCount|MCacheMaxObjectSize)"
|
||||
- identifier: "(MCacheMaxStreamingBuffer|MCacheMinObjectSize|MCacheRemovalAlgorithm|MCacheSize|MetaDir|MetaFiles|MetaSuffix|MimeMagicFile|MinSpareServers|MinSpareThreads)"
|
||||
- identifier: "(MMapFile|ModMimeUsePathInfo|MultiviewsMatch|NameVirtualHost|NoProxy|NumServers|NWSSLTrustedCerts|NWSSLUpgradeable|Options|Order|PassEnv|PidFile)"
|
||||
- identifier: "(ProtocolEcho|Proxy|ProxyBadHeader|ProxyBlock|ProxyDomain|ProxyErrorOverride|ProxyIOBufferSize|ProxyMatch|ProxyMaxForwards|ProxyPass|ProxyPassReverse)"
|
||||
- identifier: "(ProxyPreserveHost|ProxyReceiveBufferSize|ProxyRemote|ProxyRemoteMatch|ProxyRequests|ProxyTimeout|ProxyVia|ReadmeName|Redirect|RedirectMatch)"
|
||||
- identifier: "(RedirectPermanent|RedirectTemp|RemoveCharset|RemoveEncoding|RemoveHandler|RemoveInputFilter|RemoveLanguage|RemoveOutputFilter|RemoveType|RequestHeader)"
|
||||
- identifier: "(Require|RewriteBase|RewriteCond|RewriteEngine|RewriteLock|RewriteLog|RewriteLogLevel|RewriteMap|RewriteOptions|RewriteRule|RLimitCPU|RLimitMEM|RLimitNPROC)"
|
||||
- identifier: "(Satisfy|ScoreBoardFile|Script|ScriptAlias|ScriptAliasMatch|ScriptInterpreterSource|ScriptLog|ScriptLogBuffer|ScriptLogLength|ScriptSock|SecureListen)"
|
||||
- identifier: "(SendBufferSize|ServerAdmin|ServerAlias|ServerLimit|ServerName|ServerPath|ServerRoot|ServerSignature|ServerTokens|SetEnv|SetEnvIf|SetEnvIfNoCase|SetHandler)"
|
||||
- identifier: "(SetInputFilter|SetOutputFilter|SSIEndTag|SSIErrorMsg|SSIStartTag|SSITimeFormat|SSIUndefinedEcho|SSLCACertificateFile|SSLCACertificatePath)"
|
||||
- identifier: "(SSLCARevocationFile|SSLCARevocationPath|SSLCertificateChainFile|SSLCertificateFile|SSLCertificateKeyFile|SSLCipherSuite|SSLEngine|SSLMutex|SSLOptions)"
|
||||
- identifier: "(SSLPassPhraseDialog|SSLProtocol|SSLProxyCACertificateFile|SSLProxyCACertificatePath|SSLProxyCARevocationFile|SSLProxyCARevocationPath|SSLProxyCipherSuite)"
|
||||
- identifier: "(SSLProxyEngine|SSLProxyMachineCertificateFile|SSLProxyMachineCertificatePath|SSLProxyProtocol|SSLProxyVerify|SSLProxyVerifyDepth|SSLRandomSeed|SSLRequire)"
|
||||
- identifier: "(SSLRequireSSL|SSLSessionCache|SSLSessionCacheTimeout|SSLUserName|SSLVerifyClient|SSLVerifyDepth|StartServers|StartThreads|SuexecUserGroup|ThreadLimit)"
|
||||
- identifier: "(ThreadsPerChild|ThreadStackSize|TimeOut|TraceEnable|TransferLog|TypesConfig|UnsetEnv|UseCanonicalName|User|UserDir|VirtualDocumentRoot)"
|
||||
- identifier: "(VirtualDocumentRootIP|VirtualHost|VirtualScriptAlias|VirtualScriptAliasIP|Win32DisableAcceptEx|XBitHack)"
|
||||
- symbol.tag: "<[^>]+>"
|
||||
- identifier: "</?[A-Za-z]+"
|
||||
- identifier: "(<|</|>)"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- comment:
|
||||
start: "#"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
|
|
@ -1,116 +0,0 @@
|
|||
|
||||
## FILENAME: arduino.nanorc
|
||||
##
|
||||
## DESCRIPTION: The arduino.nanorc syntax files allows syntax highlighting
|
||||
## for Arduino sketch files in the GNU nano text editor.
|
||||
##
|
||||
## Maintainer: Nicholas Wilde
|
||||
## Version: 0.1
|
||||
## DATE: 06/23/2011
|
||||
##
|
||||
## HOMEPAGE: http://code.google.com/p/arduino-nano-editor-syntax/
|
||||
##
|
||||
## COMMENTS: -Most of the code was taken from the c.nanorc code found with
|
||||
## GNU nano 2.2.6.
|
||||
## -Direction was taken from the arduino vim syntax code by johannes
|
||||
## <https://bitbucket.org/johannes/arduino-vim-syntax/>
|
||||
## -Tested on Ubuntu Server 11.04 Natty Narwhal and GNU nano 2.2.6
|
||||
##
|
||||
## DIRECTIONS: For Ubuntu Server 11.04 Natty Narwhal:
|
||||
## -Move this file <arduino.nanorc> to the nano directory
|
||||
## /usr/share/nano/
|
||||
## -Add arduino.nanorc reference to the nanorc settings file
|
||||
## /etc/nanorc
|
||||
## ...
|
||||
## ## Arduino
|
||||
## /usr/share/nano/arduino.nanorc
|
||||
## ...
|
||||
|
||||
syntax "ino" "\.?ino$"
|
||||
|
||||
##
|
||||
color identifier.macro "\b[A-Z_][0-9A-Z_]+\b"
|
||||
|
||||
##
|
||||
color type "\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\b"
|
||||
|
||||
## Constants
|
||||
color constant "\b(HIGH|LOW|INPUT|OUTPUT)\b"
|
||||
|
||||
## Serial Print
|
||||
color identifier.macro "\b(DEC|BIN|HEX|OCT|BYTE)\b"
|
||||
|
||||
## PI Constants
|
||||
color constant "\b(PI|HALF_PI|TWO_PI)\b"
|
||||
|
||||
## ShiftOut
|
||||
color constant "\b(LSBFIRST|MSBFIRST)\b"
|
||||
|
||||
## Attach Interrupt
|
||||
color constant "\b(CHANGE|FALLING|RISING)\b"
|
||||
|
||||
## Analog Reference
|
||||
color constant "\b(DEFAULT|EXTERNAL|INTERNAL|INTERNAL1V1|INTERNAL2V56)\b"
|
||||
|
||||
## === FUNCTIONS === ##
|
||||
|
||||
## Data Types
|
||||
color type "\b(boolean|byte|char|float|int|long|word)\b"
|
||||
|
||||
## Control Structions
|
||||
color 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"
|
||||
color special "\b(goto|continue|break|return)\b"
|
||||
|
||||
## Math
|
||||
color statement "\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"
|
||||
|
||||
## Bits & Bytes
|
||||
color statement "\b(bitRead|bitWrite|bitSet|bitClear|bit|highByte|lowByte)\b"
|
||||
|
||||
## Analog I/O
|
||||
color statement "\b(analogReference|analogRead|analogWrite)\b"
|
||||
|
||||
## External Interrupts
|
||||
color statement "\b(attachInterrupt|detachInterrupt)\b"
|
||||
|
||||
## Time
|
||||
color statement "\b(delay|delayMicroseconds|millis|micros)\b"
|
||||
|
||||
## Digital I/O
|
||||
color statement "\b(pinMode|digitalWrite|digitalRead)\b"
|
||||
|
||||
## Interrupts
|
||||
color statement "\b(interrupts|noInterrupts)\b"
|
||||
|
||||
## Advanced I/O
|
||||
color statement "\b(noTone|pulseIn|shiftIn|shiftOut|tone)\b"
|
||||
|
||||
## Serial
|
||||
color special "\b(Serial|Serial1|Serial2|Serial3|begin|end|peek|read|print|println|available|flush)\b"
|
||||
|
||||
## Structure
|
||||
color statement "\b(setup|loop)\b"
|
||||
|
||||
##
|
||||
color preproc "^[[:space:]]*#[[:space:]]*(define|include(_next)?|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma)"
|
||||
|
||||
##
|
||||
color constant.specialChar "'([^']|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
|
||||
|
||||
## GCC builtins
|
||||
color preproc "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
|
||||
|
||||
## String highlighting. You will in general want your comments and
|
||||
## strings to come last, because syntax highlighting rules will be
|
||||
## applied in the order they are read in.
|
||||
color constant.string "<[^= ]*>" ""(\\.|[^"])*""
|
||||
|
||||
## This string is VERY resource intensive!
|
||||
color constant.string start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
|
||||
|
||||
## Comments
|
||||
color comment "//.*"
|
||||
color comment start="/\*" end="\*/"
|
||||
|
||||
## Trailing whitespace
|
||||
color indent-char.whitespace "[[:space:]]+$"
|
||||
99
runtime/syntax/arduino.yaml
Normal file
99
runtime/syntax/arduino.yaml
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
filetype: ino
|
||||
|
||||
detect:
|
||||
filename: "\\.?ino$"
|
||||
|
||||
rules:
|
||||
- identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
|
||||
|
||||
##
|
||||
- type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
|
||||
|
||||
## Constants
|
||||
- constant: "(?i)\\b(HIGH|LOW|INPUT|OUTPUT)\\b"
|
||||
|
||||
## Serial Print
|
||||
- constant: "(?i)\\b(DEC|BIN|HEX|OCT|BYTE)\\b"
|
||||
|
||||
## PI Constants
|
||||
- constant: "(?i)\\b(PI|HALF_PI|TWO_PI)\\b"
|
||||
|
||||
## ShiftOut
|
||||
- constant: "(?i)\\b(LSBFIRST|MSBFIRST)\\b"
|
||||
|
||||
## Attach Interrupt
|
||||
- constant: "(?i)\\b(CHANGE|FALLING|RISING)\\b"
|
||||
|
||||
## Analog Reference
|
||||
- constant: "(?i)\\b(DEFAULT|EXTERNAL|INTERNAL|INTERNAL1V1|INTERNAL2V56)\\b"
|
||||
|
||||
## === FUNCTIONS === ##
|
||||
|
||||
## Data Types
|
||||
- type: "\\b(boolean|byte|char|float|int|long|word)\\b"
|
||||
|
||||
## Control Structions
|
||||
- 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"
|
||||
- statement: "\\b(goto|continue|break|return)\\b"
|
||||
|
||||
## Math
|
||||
- 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"
|
||||
|
||||
## Bits & Bytes
|
||||
- identifier: "\\b(bitRead|bitWrite|bitSet|bitClear|bit|highByte|lowByte)\\b"
|
||||
|
||||
## Analog I/O
|
||||
- identifier: "\\b(analogReference|analogRead|analogWrite)\\b"
|
||||
|
||||
## External Interrupts
|
||||
- identifier: "\\b(attachInterrupt|detachInterrupt)\\b"
|
||||
|
||||
## Time
|
||||
- identifier: "\\b(delay|delayMicroseconds|millis|micros)\\b"
|
||||
|
||||
## Digital I/O
|
||||
- identifier: "\\b(pinMode|digitalWrite|digitalRead)\\b"
|
||||
|
||||
## Interrupts
|
||||
- identifier: "\\b(interrupts|noInterrupts)\\b"
|
||||
|
||||
## Advanced I/O
|
||||
- identifier: "\\b(noTone|pulseIn|shiftIn|shiftOut|tone)\\b"
|
||||
|
||||
## Serial
|
||||
- identifier: "\\b(Serial|Serial1|Serial2|Serial3|begin|end|peek|read|print|println|available|flush)\\b"
|
||||
|
||||
## Structure
|
||||
- identifier: "\\b(setup|loop)\\b"
|
||||
|
||||
##
|
||||
- statement: "^[[:space:]]*#[[:space:]]*(define|include(_next)?|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma)"
|
||||
|
||||
## GCC builtins
|
||||
- constant: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__)"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- constant.string:
|
||||
start: "'"
|
||||
end: "(?<!\\\\)'"
|
||||
rules:
|
||||
- preproc: "..+"
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- comment:
|
||||
start: "//"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
- comment:
|
||||
start: "/\\*"
|
||||
end: "\\*/"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
syntax "asciidoc" "\.(asc|asciidoc|adoc)$"
|
||||
|
||||
# main header
|
||||
color preproc "^====+$"
|
||||
# h1
|
||||
color statement "^==[[:space:]].*$"
|
||||
color statement "^----+$"
|
||||
# h2
|
||||
color symbol "^===[[:space:]].*$"
|
||||
color symbol "^~~~~+$"
|
||||
# h4
|
||||
color type "^====[[:space:]].*$"
|
||||
color type "^\^\^\^\^+$"
|
||||
# h5
|
||||
color constant "^=====[[:space:]].*$"
|
||||
color constant "^\+\+\+\++$"
|
||||
|
||||
# attributes
|
||||
color type.keyword ":.*:"
|
||||
color identifier.macro "\{[a-z0-9]*\}"
|
||||
color identifier "\\\{[a-z0-9]*\}"
|
||||
color identifier "\+\+\+\{[a-z0-9]*\}\+\+\+"
|
||||
|
||||
# Paragraph Title
|
||||
color statement "^\..*$"
|
||||
|
||||
# source
|
||||
color identifier "^\[(source,.+|NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]"
|
||||
|
||||
# Other markup
|
||||
color constant.string ".*[[:space:]]\+$"
|
||||
color constant.string "_[^_]+_"
|
||||
color constant.string "\*[^\*]+\*"
|
||||
color constant.string "\+[^\+]+\+"
|
||||
color constant.string "`[^`]+`"
|
||||
color constant.string "\^[^\^]+\^"
|
||||
color constant.string "~[^~]+~"
|
||||
color constant.string "'[^']+'"
|
||||
|
||||
color constant "`{1,2}[^']+'{1,2}"
|
||||
|
||||
# bullets
|
||||
color symbol "^[[:space:]]*[\*\.-]{1,5}[[:space:]]"
|
||||
|
||||
# anchors
|
||||
color bold default "\[\[.*\]\]"
|
||||
color bold default "<<.*>>"
|
||||
51
runtime/syntax/asciidoc.yaml
Normal file
51
runtime/syntax/asciidoc.yaml
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
filetype: asciidoc
|
||||
|
||||
detect:
|
||||
filename: "\\.(asc|asciidoc|adoc)$"
|
||||
|
||||
rules:
|
||||
# main header
|
||||
- preproc: "^====+$"
|
||||
# h1
|
||||
- statement: "^==[[:space:]].*$"
|
||||
- statement: "^----+$"
|
||||
# h2
|
||||
- symbol: "^===[[:space:]].*$"
|
||||
- symbol: "^~~~~+$"
|
||||
# h4
|
||||
- type: "^====[[:space:]].*$"
|
||||
- type: "^\\^\\^\\^\\^+$"
|
||||
# h5
|
||||
- constant: "^=====[[:space:]].*$"
|
||||
- constant: "^\\+\\+\\+\\++$"
|
||||
|
||||
# attributes
|
||||
- type.keyword: ":.*:"
|
||||
- identifier.macro: "\\{[a-z0-9]*\\}"
|
||||
- identifier: "\\\\\\{[a-z0-9]*\\}"
|
||||
- identifier: "\\+\\+\\+\\{[a-z0-9]*\\}\\+\\+\\+"
|
||||
|
||||
# Paragraph Title
|
||||
- statement: "^\\..*$"
|
||||
|
||||
# source
|
||||
- identifier: "^\\[(source,.+|NOTE|TIP|IMPORTANT|WARNING|CAUTION)\\]"
|
||||
|
||||
# Other markup
|
||||
- constant.string: ".*[[:space:]]\\+$"
|
||||
- constant.string: "_[^_]+_"
|
||||
- constant.string: "\\*[^\\*]+\\*"
|
||||
- constant.string: "\\+[^\\+]+\\+"
|
||||
- constant.string: "`[^`]+`"
|
||||
- constant.string: "\\^[^\\^]+\\^"
|
||||
- constant.string: "~[^~]+~"
|
||||
- constant.string: "'[^']+'"
|
||||
|
||||
- constant: "`{1,2}[^']+'{1,2}"
|
||||
|
||||
# bullets
|
||||
- symbol: "^[[:space:]]*[\\*\\.-]{1,5}[[:space:]]"
|
||||
|
||||
# anchors
|
||||
- "bold default": "\\[\\[.*\\]\\]"
|
||||
- "bold default": "<<.*>>"
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
## Made by Nickolay Ilyushin <nickolay02@inbox.ru>. Next line is from previous (first) version (no need for modifications :P)
|
||||
syntax "asm" "\.(S|s|asm)$"
|
||||
|
||||
# This file is made for NASM assembly
|
||||
|
||||
## Instructions
|
||||
# x86
|
||||
color statement "\b(?i)(mov|aaa|aad|aam|aas|adc|add|and|call|cbw|clc|cld|cli|cmc|cmp|cmpsb|cmpsw|cwd|daa|das|dec|div|esc|hlt|idiv|imul|in|inc|int|into|iret|ja|jae|jb|jbe|jc|je|jg|jge|jl|jle|jna|jnae|jnb|jnbe|jnc|jne|jng|jnge|jnl|jnle|jno|jnp|jns|jnz|jo|jp|jpe|jpo|js|jz|jcxz|jmp|lahf|lds|lea|les|lock|lodsb|lodsw|loop|loope|loopne|loopnz|loopz|movsb|movsw|mul|neg|nop|or|pop|popf|push|pushf|rcl|rcr|rep|repe|repne|repnz|repz|ret|retn|retf|rol|ror|sahf|sal|sar|sbb|scasb|scasw|shl|shr|stc|std|sti|stosb|stosw|sub|test|wait|xchg|xlat|xor)(?-i)\b"
|
||||
color statement "\b(?i)(bound|enter|ins|leave|outs|popa|pusha)(?-i)\b"
|
||||
color statement "\b(?i)(arpl|clts|lar|lgdt|lidt|lldt|lmsw|loadall|lsl|ltr|sgdt|sidt|sldt|smsw|str|verr|verw)(?-i)\b"
|
||||
color statement "\b(?i)(bsf|bsr|bt|btc|btr|bts|cdq|cmpsd|cwde|insd|iret|iretd|iretf|jecxz|lfs|lgs|lss|lodsd|loopw|loopew|loopnew|loopnzw|loopzw|loopd|looped|loopned|loopnzd|loopzd|cr|tr|dr|movsd|movsx|movzx|outsd|popad|popfd|pushad|pushfd|scasd|seta|setae|setb|setbe|setc|sete|setg|setge|setl|setle|setna|setnae|setnb|setnbe|setnc|setne|setng|setnge|setnl|setnle|setno|setnp|setns|setnz|seto|setp|setpe|setpo|sets|setz|shdl|shrd|stosd)(?-i)\b"
|
||||
color statement "\b(?i)(bswap|cmpxcgh|invd|invlpg|wbinvd|xadd)(?-i)\b"
|
||||
color statement "\b(?i)(cpuid|cmpxchg8b|rdmsr|rdtsc|wrmsr|rsm)(?-i)\b"
|
||||
color statement "\b(?i)(rdpmc)(?-i)\b"
|
||||
color statement "\b(?i)(syscall|sysret)(?-i)\b"
|
||||
color statement "\b(?i)(cmova|cmovae|cmovb|cmovbe|cmovc|cmove|cmovg|cmovge|cmovl|cmovle|cmovna|cmovnae|cmovnb|cmovnbe|cmovnc|cmovne|cmovng|cmovnge|cmovnle|cmovno|cmovpn|cmovns|cmovnz|cmovo|cmovp|cmovpe|cmovpo|cmovs|cmovz|sysenter|sysexit|ud2)(?-i)\b"
|
||||
color statement "\b(?i)(maskmovq|movntps|movntq|prefetch0|prefetch1|prefetch2|prefetchnta|sfence)(?-i)\b"
|
||||
color statement "\b(?i)(clflush|lfence|maskmovdqu|mfence|movntdq|movnti|movntpd|pause)(?-i)\b"
|
||||
color statement "\b(?i)(monitor|mwait)(?-i)\b"
|
||||
color statement "\b(?i)(cdqe|cqo|cmpsq|cmpxchg16b|iretq|jrcxz|lodsq|movsdx|popfq|pushfq|rdtscp|scasq|stosq|swapgs)(?-i)\b"
|
||||
color statement "\b(?i)(clgi|invlpga|skinit|stgi|vmload|vmmcall|vmrun|vmsave)(?-i)\b"
|
||||
color statement "\b(?i)(vmptrdl|vmptrst|vmclear|vmread|vmwrite|vmcall|vmlaunch|vmresume|vmxoff|vmxon)(?-i)\b"
|
||||
color statement "\b(?i)(lzcnt|popcnt)(?-i)\b"
|
||||
color statement "\b(?i)(bextr|blcfill|blci|blcic|blcmask|blcs|blsfill|blsic|t1mskc|tzmsk)(?-i)\b"
|
||||
|
||||
# x87
|
||||
color statement "\b(?i)(f2xm1|fabs|fadd|faddp|fbld|fbstp|fchs|fclex|fcom|fcomp|fcompp|fdecstp|fdisi|fdiv|fvidp|fdivr|fdivrp|feni|ffree|fiadd|ficom|ficomp|fidiv|fidivr|fild|fimul|fincstp|finit|fist|fistp|fisub|fisubr|fld|fld1|fldcw|fldenv|fldenvw|fldl2e|fldl2t|fldlg2|fldln2|fldpi|fldz|fmul|fmulp|fnclex|fndisi|fneni|fninit|fnop|fnsave|fnsavenew|fnstcw|fnstenv|fnstenvw|fnstsw|fpatan|fprem|fptan|frndint|frstor|frstorw|fsave|fsavew|fscale|fsqrt|fst|fstcw|fstenv|fstenvw|fstp|fstpsw|fsub|fsubp|fsubr|fsubrp|ftst|fwait|fxam|fxch|fxtract|fyl2x|fyl2xp1)(?-i)\b"
|
||||
color statement "\b(?i)(fsetpm)(?-i)\b"
|
||||
color statement "\b(?i)(fcos|fldenvd|fsaved|fstenvd|fprem1|frstord|fsin|fsincos|fstenvd|fucom|fucomp|fucompp)(?-i)\b"
|
||||
color statement "\b(?i)(fcmovb|fcmovbe|fcmove|fcmove|fcmovnb|fcmovnbe|fcmovne|fcmovnu|fcmovu)(?-i)\b"
|
||||
color statement "\b(?i)(fcomi|fcomip|fucomi|fucomip)(?-i)\b"
|
||||
color statement "\b(?i)(fxrstor|fxsave)(?-i)\b"
|
||||
color statement "\b(?i)(fisttp)(?-i)\b"
|
||||
color statement "\b(?i)(ffreep)(?-i)\b"
|
||||
|
||||
# SIMD
|
||||
color statement "\b(?i)(emms|movd|movq|packssdw|packsswb|packuswb|paddb|paddw|paddd|paddsb|paddsw|paddusb|paddusw|pand|pandn|por|pxor|pcmpeqb|pcmpeqw|pcmpeqd|pcmpgtb|pcmpgtw|pcmpgtd|pmaddwd|pmulhw|pmullw|psllw|pslld|psllq|psrad|psraw|psrlw|psrld|psrlq|psubb|psubw|psubd|psubsb|psubsw|psubusb|punpckhbw|punpckhwd|punpckhdq|punkcklbw|punpckldq|punpcklwd)(?-i)\b"
|
||||
color statement "\b(?i)(paveb|paddsiw|pmagw|pdistib|psubsiw|pmwzb|pmulhrw|pmvnzb|pmvlzb|pmvgezb|pmulhriw|pmachriw)(?-i)\b"
|
||||
color statement "\b(?i)(femms|pavgusb|pf2id|pfacc|pfadd|pfcmpeq|pfcmpge|pfcmpgt|pfmax|pfmin|pfmul|pfrcp|pfrcpit1|pfrcpit2|pfrsqit1|pfrsqrt|pfsub|pfsubr|pi2fd|pmulhrw|prefetch|prefetchw)(?-i)\b"
|
||||
color statement "\b(?i)(pf2iw|pfnacc|pfpnacc|pi2fw|pswapd)(?-i)\b"
|
||||
color statement "\b(?i)(pfrsqrtv|pfrcpv)(?-i)\b"
|
||||
color statement "\b(?i)(addps|addss|cmpps|cmpss|comiss|cvtpi2ps|cvtps2pi|cvtsi2ss|cvtss2si|cvttps2pi|cvttss2si|divps|divss|ldmxcsr|maxps|maxss|minps|minss|movaps|movhlps|movhps|movlhps|movlps|movmskps|movntps|movss|movups|mulps|mulss|rcpps|rcpss|rsqrtps|rsqrtss|shufps|sqrtps|sqrtss|stmxcsr|subps|subss|ucomiss|unpckhps|unpcklps)(?-i)\b"
|
||||
color statement "\b(?i)(andnps|andps|orps|pavgb|pavgw|pextrw|pinsrw|pmaxsw|pmaxub|pminsw|pminub|pmovmskb|pmulhuw|psadbw|pshufw|xorps)(?-i)\b"
|
||||
color statement "\b(?i)(movups|movss|movlps|movhlps|movlps|unpcklps|unpckhps|movhps|movlhps|prefetchnta|prefetch0|prefetch1|prefetch2|nop|movaps|cvtpi2ps|cvtsi2ss|cvtps2pi|cvttss2si|cvtps2pi|cvtss2si|ucomiss|comiss|sqrtps|sqrtss|rsqrtps|rsqrtss|rcpps|andps|orps|xorps|addps|addss|mulps|mulss|subps|subss|minps|minss|divps|divss|maxps|maxss|pshufw|ldmxcsr|stmxcsr|sfence|cmpps|cmpss|pinsrw|pextrw|shufps|pmovmskb|pminub|pmaxub|pavgb|pavgw|pmulhuw|movntq|pminsw|pmaxsw|psadbw|maskmovq)(?-i)\b"
|
||||
color statement "\b(?i)(addpd|addsd|addnpd|cmppd|cmpsd)(?-i)\b"
|
||||
color statement "\b(?i)(addpd|addsd|andnpd|andpd|cmppd|cmpsd|comisd|cvtdq2pd|cvtdq2ps|cvtpd2dq|cvtpd2pi|cvtpd2ps|cvtpi2pd|cvtps2dq|cvtps2pd|cvtsd2si|cvtsd2ss|cvtsi2sd|cvtss2sd|cvttpd2dq|cvttpd2pi|cvttps2dq|cvttsd2si|divpd|divsd|maxpd|maxsd|minpd|minsd|movapd|movhpd|movlpd|movmskpd|movsd|movupd|mulpd|mulsd|orpd|shufpd|sqrtpd|sqrtsd|subpd|subsd|ucomisd|unpckhpd|unpcklpd|xorpd)(?-i)\b"
|
||||
color statement "\b(?i)(movdq2q|movdqa|movdqu|movq2dq|paddq|psubq|pmuludq|pshufhw|pshuflw|pshufd|pslldq|psrldq|punpckhqdq|punpcklqdq)(?-i)\b"
|
||||
color statement "\b(?i)(addsubpd|addsubps|haddpd|haddps|hsubpd|hsubps|movddup|movshdup|movsldu)(?-i)\b"
|
||||
color statement "\b(?i)(lddqu)(?-i)\b"
|
||||
color statement "\b(?i)(psignw|psignd|psignb|pshufb|pmulhrsw|pmaddubsw|phsubw|phsubsw|phsubd|phaddw|phaddsw|phaddd|palignr|pabsw|pabsd|pabsb)(?-i)\b"
|
||||
color statement "\b(?i)(dpps|dppd|blendps|blendpd|blendvps|blendvpd|roundps|roundss|roundpd|roundsd|insertps|extractps)(?-i)\b"
|
||||
color statement "\b(?i)(mpsadbw|phminposuw|pmulld|pmuldq|pblendvb|pblendw|pminsb|pmaxsb|pminuw|pmaxuw|pminud|pmaxud|pminsd|pmaxsd|pinsrb|pinsrd/pinsrq|pextrb|pextrw|pextrd/pextrq|pmovsxbw|pmovzxbw|pmovsxbd|pmovzxbd|pmovsxbq|pmovzxbq|pmovsxwd|pmovzxwd|pmovsxwq|pmovzxwq|pmovsxdq|pmovzxdq|ptest|pcmpeqq|packusdw|movntdqa)(?-i)\b"
|
||||
color statement "\b(?i)(extrq|insertq|movntsd|movntss)(?-i)\b"
|
||||
color statement "\b(?i)(crc32|pcmpestri|pcmpestrm|pcmpistri|pcmpistrm|pcmpgtq)(?-i)\b"
|
||||
color statement "\b(?i)(vfmaddpd|vfmaddps|vfmaddsd|vfmaddss|vfmaddsubpd|vfmaddsubps|vfmsubaddpd|vfmsubaddps|vfmsubpd|vfmsubps|vfmsubsd|vfmsubss|vfnmaddpd|vfnmaddps|vfnmaddsd|vfnmaddss|vfnmsubps|vfnmsubsd|vfnmsubss)(?-i)\b"
|
||||
|
||||
# Crypto
|
||||
color statement "\b(?i)(aesenc|aesenclast|aesdec|aesdeclast|aeskeygenassist|aesimc)(?-i)\b"
|
||||
color statement "\b(?i)(sha1rnds4|sha1nexte|sha1msg1|sha1msg2|sha256rnds2|sha256msg1|sha256msg2)(?-i)\b"
|
||||
|
||||
# Undocumented
|
||||
color statement "\b(?i)(aam|aad|salc|icebp|loadall|loadalld|ud1)(?-i)\b"
|
||||
|
||||
## Registers
|
||||
color identifier "\b(?i)(al|ah|bl|bh|cl|ch|dl|dh|bpl|sil|r8b|r9b|r10b|r11b|dil|spl|r12b|r13b|r14b|r15)(?-i)\b"
|
||||
color identifier "\b(?i)(cw|sw|tw|fp_ds|fp_opc|fp_ip|fp_dp|fp_cs|cs|ss|ds|es|fs|gs|gdtr|idtr|tr|ldtr|ax|bx|cx|dx|bp|si|r8w|r9w|r10w|r11w|di|sp|r12w|r13w|r14w|r15w|ip)(?-i)\b"
|
||||
color identifier "\b(?i)(fp_dp|fp_ip|eax|ebx|ecx|edx|ebp|esi|r8d|r9d|r10d|r11d|edi|esp|r12d|r13d|r14d|r15d|eip|eflags|mxcsr)(?-i)\b"
|
||||
color identifier "\b(?i)(mm0|mm1|mm2|mm3|mm4|mm5|mm6|mm7|rax|rbx|rcx|rdx|rbp|rsi|r8|r9|r10|r11|rdi|rsp|r12|r13|r14|r15|rip|rflags|cr0|cr1|cr2|cr3|cr4|cr5|cr6|cr7|cr8|cr9|cr10|cr11|cr12|cr13|cr14|cr15|msw|dr0|dr1|dr2|dr3|r4|dr5|dr6|dr7|dr8|dr9|dr10|dr11|dr12|dr13|dr14|dr15)(?-i)\b"
|
||||
color identifier "\b(?i)(st0|st1|st2|st3|st4|st5|st6|st7)(?-i)\b"
|
||||
color identifier "\b(?i)(xmm0|xmm1|xmm2|xmm3|xmm4|xmm5|xmm6|xmm7|xmm8|xmm9|xmm10|xmm11|xmm12|xmm13|xmm14|xmm15)(?-i)\b"
|
||||
color identifier "\b(?i)(ymm0|ymm1|ymm2|ymm3|ymm4|ymm5|ymm6|ymm7|ymm8|ymm9|ymm10|ymm11|ymm12|ymm13|ymm14|ymm15)(?-i)\b"
|
||||
color identifier "\b(?i)(zmm0|zmm1|zmm2|zmm3|zmm4|zmm5|zmm6|zmm7|zmm8|zmm9|zmm10|zmm11|zmm12|zmm13|zmm14|zmm15|zmm16|zmm17|zmm18|zmm19|zmm20|zmm21|zmm22|zmm23|zmm24|zmm25|zmm26|zmm27|zmm28|zmm29|zmm30|zmm31)(?-i)\b"
|
||||
|
||||
## Constants
|
||||
# Number - it works
|
||||
color constant.number "\b(|h|A|0x)+[0-9]+(|h|A)+\b"
|
||||
color constant.number "\b0x[0-9 a-f A-F]+\b"
|
||||
|
||||
## Preprocessor (NASM)
|
||||
color preproc "%+(\+|\?|\?\?|)[a-z A-Z 0-9]+"
|
||||
color preproc "%\[[. a-z A-Z 0-9]*\]"
|
||||
|
||||
## Other
|
||||
color statement "\b(?i)(extern|global|section|segment|_start|\.text|\.data|\.bss)(?-i)\b"
|
||||
color statement "\b(?i)(db|dw|dd|dq|dt|ddq|do)(?-i)\b"
|
||||
color identifier "[a-z A-Z 0-9 _]+:"
|
||||
|
||||
# String
|
||||
color constant.string ""(\\.|[^"])*""
|
||||
color constant.string "'(\\.|[^'])*'"
|
||||
|
||||
## Comments
|
||||
color comment ";.*"
|
||||
108
runtime/syntax/asm.yaml
Normal file
108
runtime/syntax/asm.yaml
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
filetype: asm
|
||||
|
||||
detect:
|
||||
filename: "\\.(S|s|asm)$"
|
||||
|
||||
rules:
|
||||
# This file is made for NASM assembly
|
||||
|
||||
## Instructions
|
||||
# x86
|
||||
- statement: "\\b(?i)(mov|aaa|aad|aam|aas|adc|add|and|call|cbw|clc|cld|cli|cmc|cmp|cmpsb|cmpsw|cwd|daa|das|dec|div|esc|hlt|idiv|imul|in|inc|int|into|iret|ja|jae|jb|jbe|jc|je|jg|jge|jl|jle|jna|jnae|jnb|jnbe|jnc|jne|jng|jnge|jnl|jnle|jno|jnp|jns|jnz|jo|jp|jpe|jpo|js|jz|jcxz|jmp|lahf|lds|lea|les|lock|lodsb|lodsw|loop|loope|loopne|loopnz|loopz|movsb|movsw|mul|neg|nop|or|pop|popf|push|pushf|rcl|rcr|rep|repe|repne|repnz|repz|ret|retn|retf|rol|ror|sahf|sal|sar|sbb|scasb|scasw|shl|shr|stc|std|sti|stosb|stosw|sub|test|wait|xchg|xlat|xor)(?-i)\\b"
|
||||
- statement: "\\b(?i)(bound|enter|ins|leave|outs|popa|pusha)(?-i)\\b"
|
||||
- statement: "\\b(?i)(arpl|clts|lar|lgdt|lidt|lldt|lmsw|loadall|lsl|ltr|sgdt|sidt|sldt|smsw|str|verr|verw)(?-i)\\b"
|
||||
- statement: "\\b(?i)(bsf|bsr|bt|btc|btr|bts|cdq|cmpsd|cwde|insd|iret|iretd|iretf|jecxz|lfs|lgs|lss|lodsd|loopw|loopew|loopnew|loopnzw|loopzw|loopd|looped|loopned|loopnzd|loopzd|cr|tr|dr|movsd|movsx|movzx|outsd|popad|popfd|pushad|pushfd|scasd|seta|setae|setb|setbe|setc|sete|setg|setge|setl|setle|setna|setnae|setnb|setnbe|setnc|setne|setng|setnge|setnl|setnle|setno|setnp|setns|setnz|seto|setp|setpe|setpo|sets|setz|shdl|shrd|stosd)(?-i)\\b"
|
||||
- statement: "\\b(?i)(bswap|cmpxcgh|invd|invlpg|wbinvd|xadd)(?-i)\\b"
|
||||
- statement: "\\b(?i)(cpuid|cmpxchg8b|rdmsr|rdtsc|wrmsr|rsm)(?-i)\\b"
|
||||
- statement: "\\b(?i)(rdpmc)(?-i)\\b"
|
||||
- statement: "\\b(?i)(syscall|sysret)(?-i)\\b"
|
||||
- statement: "\\b(?i)(cmova|cmovae|cmovb|cmovbe|cmovc|cmove|cmovg|cmovge|cmovl|cmovle|cmovna|cmovnae|cmovnb|cmovnbe|cmovnc|cmovne|cmovng|cmovnge|cmovnle|cmovno|cmovpn|cmovns|cmovnz|cmovo|cmovp|cmovpe|cmovpo|cmovs|cmovz|sysenter|sysexit|ud2)(?-i)\\b"
|
||||
- statement: "\\b(?i)(maskmovq|movntps|movntq|prefetch0|prefetch1|prefetch2|prefetchnta|sfence)(?-i)\\b"
|
||||
- statement: "\\b(?i)(clflush|lfence|maskmovdqu|mfence|movntdq|movnti|movntpd|pause)(?-i)\\b"
|
||||
- statement: "\\b(?i)(monitor|mwait)(?-i)\\b"
|
||||
- statement: "\\b(?i)(cdqe|cqo|cmpsq|cmpxchg16b|iretq|jrcxz|lodsq|movsdx|popfq|pushfq|rdtscp|scasq|stosq|swapgs)(?-i)\\b"
|
||||
- statement: "\\b(?i)(clgi|invlpga|skinit|stgi|vmload|vmmcall|vmrun|vmsave)(?-i)\\b"
|
||||
- statement: "\\b(?i)(vmptrdl|vmptrst|vmclear|vmread|vmwrite|vmcall|vmlaunch|vmresume|vmxoff|vmxon)(?-i)\\b"
|
||||
- statement: "\\b(?i)(lzcnt|popcnt)(?-i)\\b"
|
||||
- statement: "\\b(?i)(bextr|blcfill|blci|blcic|blcmask|blcs|blsfill|blsic|t1mskc|tzmsk)(?-i)\\b"
|
||||
|
||||
# x87
|
||||
- statement: "\\b(?i)(f2xm1|fabs|fadd|faddp|fbld|fbstp|fchs|fclex|fcom|fcomp|fcompp|fdecstp|fdisi|fdiv|fvidp|fdivr|fdivrp|feni|ffree|fiadd|ficom|ficomp|fidiv|fidivr|fild|fimul|fincstp|finit|fist|fistp|fisub|fisubr|fld|fld1|fldcw|fldenv|fldenvw|fldl2e|fldl2t|fldlg2|fldln2|fldpi|fldz|fmul|fmulp|fnclex|fndisi|fneni|fninit|fnop|fnsave|fnsavenew|fnstcw|fnstenv|fnstenvw|fnstsw|fpatan|fprem|fptan|frndint|frstor|frstorw|fsave|fsavew|fscale|fsqrt|fst|fstcw|fstenv|fstenvw|fstp|fstpsw|fsub|fsubp|fsubr|fsubrp|ftst|fwait|fxam|fxch|fxtract|fyl2x|fyl2xp1)(?-i)\\b"
|
||||
- statement: "\\b(?i)(fsetpm)(?-i)\\b"
|
||||
- statement: "\\b(?i)(fcos|fldenvd|fsaved|fstenvd|fprem1|frstord|fsin|fsincos|fstenvd|fucom|fucomp|fucompp)(?-i)\\b"
|
||||
- statement: "\\b(?i)(fcmovb|fcmovbe|fcmove|fcmove|fcmovnb|fcmovnbe|fcmovne|fcmovnu|fcmovu)(?-i)\\b"
|
||||
- statement: "\\b(?i)(fcomi|fcomip|fucomi|fucomip)(?-i)\\b"
|
||||
- statement: "\\b(?i)(fxrstor|fxsave)(?-i)\\b"
|
||||
- statement: "\\b(?i)(fisttp)(?-i)\\b"
|
||||
- statement: "\\b(?i)(ffreep)(?-i)\\b"
|
||||
|
||||
# SIMD
|
||||
- statement: "\\b(?i)(emms|movd|movq|packssdw|packsswb|packuswb|paddb|paddw|paddd|paddsb|paddsw|paddusb|paddusw|pand|pandn|por|pxor|pcmpeqb|pcmpeqw|pcmpeqd|pcmpgtb|pcmpgtw|pcmpgtd|pmaddwd|pmulhw|pmullw|psllw|pslld|psllq|psrad|psraw|psrlw|psrld|psrlq|psubb|psubw|psubd|psubsb|psubsw|psubusb|punpckhbw|punpckhwd|punpckhdq|punkcklbw|punpckldq|punpcklwd)(?-i)\\b"
|
||||
- statement: "\\b(?i)(paveb|paddsiw|pmagw|pdistib|psubsiw|pmwzb|pmulhrw|pmvnzb|pmvlzb|pmvgezb|pmulhriw|pmachriw)(?-i)\\b"
|
||||
- statement: "\\b(?i)(femms|pavgusb|pf2id|pfacc|pfadd|pfcmpeq|pfcmpge|pfcmpgt|pfmax|pfmin|pfmul|pfrcp|pfrcpit1|pfrcpit2|pfrsqit1|pfrsqrt|pfsub|pfsubr|pi2fd|pmulhrw|prefetch|prefetchw)(?-i)\\b"
|
||||
- statement: "\\b(?i)(pf2iw|pfnacc|pfpnacc|pi2fw|pswapd)(?-i)\\b"
|
||||
- statement: "\\b(?i)(pfrsqrtv|pfrcpv)(?-i)\\b"
|
||||
- statement: "\\b(?i)(addps|addss|cmpps|cmpss|comiss|cvtpi2ps|cvtps2pi|cvtsi2ss|cvtss2si|cvttps2pi|cvttss2si|divps|divss|ldmxcsr|maxps|maxss|minps|minss|movaps|movhlps|movhps|movlhps|movlps|movmskps|movntps|movss|movups|mulps|mulss|rcpps|rcpss|rsqrtps|rsqrtss|shufps|sqrtps|sqrtss|stmxcsr|subps|subss|ucomiss|unpckhps|unpcklps)(?-i)\\b"
|
||||
- statement: "\\b(?i)(andnps|andps|orps|pavgb|pavgw|pextrw|pinsrw|pmaxsw|pmaxub|pminsw|pminub|pmovmskb|pmulhuw|psadbw|pshufw|xorps)(?-i)\\b"
|
||||
- statement: "\\b(?i)(movups|movss|movlps|movhlps|movlps|unpcklps|unpckhps|movhps|movlhps|prefetchnta|prefetch0|prefetch1|prefetch2|nop|movaps|cvtpi2ps|cvtsi2ss|cvtps2pi|cvttss2si|cvtps2pi|cvtss2si|ucomiss|comiss|sqrtps|sqrtss|rsqrtps|rsqrtss|rcpps|andps|orps|xorps|addps|addss|mulps|mulss|subps|subss|minps|minss|divps|divss|maxps|maxss|pshufw|ldmxcsr|stmxcsr|sfence|cmpps|cmpss|pinsrw|pextrw|shufps|pmovmskb|pminub|pmaxub|pavgb|pavgw|pmulhuw|movntq|pminsw|pmaxsw|psadbw|maskmovq)(?-i)\\b"
|
||||
- statement: "\\b(?i)(addpd|addsd|addnpd|cmppd|cmpsd)(?-i)\\b"
|
||||
- statement: "\\b(?i)(addpd|addsd|andnpd|andpd|cmppd|cmpsd|comisd|cvtdq2pd|cvtdq2ps|cvtpd2dq|cvtpd2pi|cvtpd2ps|cvtpi2pd|cvtps2dq|cvtps2pd|cvtsd2si|cvtsd2ss|cvtsi2sd|cvtss2sd|cvttpd2dq|cvttpd2pi|cvttps2dq|cvttsd2si|divpd|divsd|maxpd|maxsd|minpd|minsd|movapd|movhpd|movlpd|movmskpd|movsd|movupd|mulpd|mulsd|orpd|shufpd|sqrtpd|sqrtsd|subpd|subsd|ucomisd|unpckhpd|unpcklpd|xorpd)(?-i)\\b"
|
||||
- statement: "\\b(?i)(movdq2q|movdqa|movdqu|movq2dq|paddq|psubq|pmuludq|pshufhw|pshuflw|pshufd|pslldq|psrldq|punpckhqdq|punpcklqdq)(?-i)\\b"
|
||||
- statement: "\\b(?i)(addsubpd|addsubps|haddpd|haddps|hsubpd|hsubps|movddup|movshdup|movsldu)(?-i)\\b"
|
||||
- statement: "\\b(?i)(lddqu)(?-i)\\b"
|
||||
- statement: "\\b(?i)(psignw|psignd|psignb|pshufb|pmulhrsw|pmaddubsw|phsubw|phsubsw|phsubd|phaddw|phaddsw|phaddd|palignr|pabsw|pabsd|pabsb)(?-i)\\b"
|
||||
- statement: "\\b(?i)(dpps|dppd|blendps|blendpd|blendvps|blendvpd|roundps|roundss|roundpd|roundsd|insertps|extractps)(?-i)\\b"
|
||||
- statement: "\\b(?i)(mpsadbw|phminposuw|pmulld|pmuldq|pblendvb|pblendw|pminsb|pmaxsb|pminuw|pmaxuw|pminud|pmaxud|pminsd|pmaxsd|pinsrb|pinsrd/pinsrq|pextrb|pextrw|pextrd/pextrq|pmovsxbw|pmovzxbw|pmovsxbd|pmovzxbd|pmovsxbq|pmovzxbq|pmovsxwd|pmovzxwd|pmovsxwq|pmovzxwq|pmovsxdq|pmovzxdq|ptest|pcmpeqq|packusdw|movntdqa)(?-i)\\b"
|
||||
- statement: "\\b(?i)(extrq|insertq|movntsd|movntss)(?-i)\\b"
|
||||
- statement: "\\b(?i)(crc32|pcmpestri|pcmpestrm|pcmpistri|pcmpistrm|pcmpgtq)(?-i)\\b"
|
||||
- statement: "\\b(?i)(vfmaddpd|vfmaddps|vfmaddsd|vfmaddss|vfmaddsubpd|vfmaddsubps|vfmsubaddpd|vfmsubaddps|vfmsubpd|vfmsubps|vfmsubsd|vfmsubss|vfnmaddpd|vfnmaddps|vfnmaddsd|vfnmaddss|vfnmsubps|vfnmsubsd|vfnmsubss)(?-i)\\b"
|
||||
|
||||
# Crypto
|
||||
- statement: "\\b(?i)(aesenc|aesenclast|aesdec|aesdeclast|aeskeygenassist|aesimc)(?-i)\\b"
|
||||
- statement: "\\b(?i)(sha1rnds4|sha1nexte|sha1msg1|sha1msg2|sha256rnds2|sha256msg1|sha256msg2)(?-i)\\b"
|
||||
|
||||
# Undocumented
|
||||
- statement: "\\b(?i)(aam|aad|salc|icebp|loadall|loadalld|ud1)(?-i)\\b"
|
||||
|
||||
## Registers
|
||||
- identifier: "\\b(?i)(al|ah|bl|bh|cl|ch|dl|dh|bpl|sil|r8b|r9b|r10b|r11b|dil|spl|r12b|r13b|r14b|r15)(?-i)\\b"
|
||||
- identifier: "\\b(?i)(cw|sw|tw|fp_ds|fp_opc|fp_ip|fp_dp|fp_cs|cs|ss|ds|es|fs|gs|gdtr|idtr|tr|ldtr|ax|bx|cx|dx|bp|si|r8w|r9w|r10w|r11w|di|sp|r12w|r13w|r14w|r15w|ip)(?-i)\\b"
|
||||
- identifier: "\\b(?i)(fp_dp|fp_ip|eax|ebx|ecx|edx|ebp|esi|r8d|r9d|r10d|r11d|edi|esp|r12d|r13d|r14d|r15d|eip|eflags|mxcsr)(?-i)\\b"
|
||||
- identifier: "\\b(?i)(mm0|mm1|mm2|mm3|mm4|mm5|mm6|mm7|rax|rbx|rcx|rdx|rbp|rsi|r8|r9|r10|r11|rdi|rsp|r12|r13|r14|r15|rip|rflags|cr0|cr1|cr2|cr3|cr4|cr5|cr6|cr7|cr8|cr9|cr10|cr11|cr12|cr13|cr14|cr15|msw|dr0|dr1|dr2|dr3|r4|dr5|dr6|dr7|dr8|dr9|dr10|dr11|dr12|dr13|dr14|dr15)(?-i)\\b"
|
||||
- identifier: "\\b(?i)(st0|st1|st2|st3|st4|st5|st6|st7)(?-i)\\b"
|
||||
- identifier: "\\b(?i)(xmm0|xmm1|xmm2|xmm3|xmm4|xmm5|xmm6|xmm7|xmm8|xmm9|xmm10|xmm11|xmm12|xmm13|xmm14|xmm15)(?-i)\\b"
|
||||
- identifier: "\\b(?i)(ymm0|ymm1|ymm2|ymm3|ymm4|ymm5|ymm6|ymm7|ymm8|ymm9|ymm10|ymm11|ymm12|ymm13|ymm14|ymm15)(?-i)\\b"
|
||||
- identifier: "\\b(?i)(zmm0|zmm1|zmm2|zmm3|zmm4|zmm5|zmm6|zmm7|zmm8|zmm9|zmm10|zmm11|zmm12|zmm13|zmm14|zmm15|zmm16|zmm17|zmm18|zmm19|zmm20|zmm21|zmm22|zmm23|zmm24|zmm25|zmm26|zmm27|zmm28|zmm29|zmm30|zmm31)(?-i)\\b"
|
||||
|
||||
## Constants
|
||||
# Number - it works
|
||||
- constant.number: "\\b(|h|A|0x)+[0-9]+(|h|A)+\\b"
|
||||
- constant.number: "\\b0x[0-9 a-f A-F]+\\b"
|
||||
|
||||
## Preprocessor (NASM)
|
||||
- preproc: "%+(\\+|\\?|\\?\\?|)[a-z A-Z 0-9]+"
|
||||
- preproc: "%\\[[. a-z A-Z 0-9]*\\]"
|
||||
|
||||
## Other
|
||||
- statement: "\\b(?i)(extern|global|section|segment|_start|\\.text|\\.data|\\.bss)(?-i)\\b"
|
||||
- statement: "\\b(?i)(db|dw|dd|dq|dt|ddq|do)(?-i)\\b"
|
||||
- identifier: "[a-z A-Z 0-9 _]+:"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- constant.string:
|
||||
start: "'"
|
||||
end: "(?<!\\\\)'"
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- comment:
|
||||
start: ";"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
syntax "awk" "\.awk$"
|
||||
header "^#!.*bin/(env +)?awk( |$)"
|
||||
|
||||
color preproc "\$[A-Za-z0-9_!@#$*?\-]+"
|
||||
color preproc "\b(ARGC|ARGIND|ARGV|BINMODE|CONVFMT|ENVIRON|ERRNO|FIELDWIDTHS)\b"
|
||||
color preproc "\b(FILENAME|FNR|FS|IGNORECASE|LINT|NF|NR|OFMT|OFS|ORS)\b"
|
||||
color preproc "\b(PROCINFO|RS|RT|RSTART|RLENGTH|SUBSEP|TEXTDOMAIN)\b"
|
||||
color identifier.class "\b(function|extension|BEGIN|END)\b"
|
||||
color symbol.operator "[\-+*/%^|!=&<>?;:]|\\|\[|\]"
|
||||
color statement "\b(for|if|while|do|else|in|delete|exit)\b"
|
||||
color special "\b(break|continue|return)\b"
|
||||
color statement "\b(close|getline|next|nextfile|print|printf|system|fflush)\b"
|
||||
color statement "\b(atan2|cos|exp|int|log|rand|sin|sqrt|srand)\b"
|
||||
color statement "\b(asort|asorti|gensub|gsub|index|length|match)\b"
|
||||
color statement "\b(split|sprintf|strtonum|sub|substr|tolower|toupper)\b"
|
||||
color statement "\b(mktime|strftime|systime)\b"
|
||||
color statement "\b(and|compl|lshift|or|rshift|xor)\b"
|
||||
color statement "\b(bindtextdomain|dcgettext|dcngettext)\b"
|
||||
color special "/.*[^\\]/"
|
||||
color constant.string ""(\\.|[^"])*"|'(\\.|[^'])*'"
|
||||
color constant.specialChar "\\."
|
||||
color comment "(^|[[:space:]])#([^{].*)?$"
|
||||
color todo "TODO:?"
|
||||
color indent-char. "[[:space:]]+$"
|
||||
color indent-char " + +| + +"
|
||||
42
runtime/syntax/awk.yaml
Normal file
42
runtime/syntax/awk.yaml
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
filetype: awk
|
||||
|
||||
detect:
|
||||
filename: "\\.awk$"
|
||||
header: "^#!.*bin/(env +)?awk( |$)"
|
||||
|
||||
rules:
|
||||
- preproc: "\\$[A-Za-z0-9_!@#$*?\\-]+"
|
||||
- preproc: "\\b(ARGC|ARGIND|ARGV|BINMODE|CONVFMT|ENVIRON|ERRNO|FIELDWIDTHS)\\b"
|
||||
- preproc: "\\b(FILENAME|FNR|FS|IGNORECASE|LINT|NF|NR|OFMT|OFS|ORS)\\b"
|
||||
- preproc: "\\b(PROCINFO|RS|RT|RSTART|RLENGTH|SUBSEP|TEXTDOMAIN)\\b"
|
||||
- identifier.class: "\\b(function|extension|BEGIN|END)\\b"
|
||||
- symbol.operator: "[\\-+*/%^|!=&<>?;:]|\\\\|\\[|\\]"
|
||||
- statement: "\\b(for|if|while|do|else|in|delete|exit)\\b"
|
||||
- special: "\\b(break|continue|return)\\b"
|
||||
- statement: "\\b(close|getline|next|nextfile|print|printf|system|fflush)\\b"
|
||||
- statement: "\\b(atan2|cos|exp|int|log|rand|sin|sqrt|srand)\\b"
|
||||
- statement: "\\b(asort|asorti|gensub|gsub|index|length|match)\\b"
|
||||
- statement: "\\b(split|sprintf|strtonum|sub|substr|tolower|toupper)\\b"
|
||||
- statement: "\\b(mktime|strftime|systime)\\b"
|
||||
- statement: "\\b(and|compl|lshift|or|rshift|xor)\\b"
|
||||
- statement: "\\b(bindtextdomain|dcgettext|dcngettext)\\b"
|
||||
- special: "/.*[^\\\\]/"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- constant.string:
|
||||
start: "'"
|
||||
end: "(?<!\\\\)'"
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- comment:
|
||||
start: "#"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
## Here is an example for C++.
|
||||
##
|
||||
syntax "c++" "\.c(c|pp|xx)$" "\.h(h|pp|xx)$" "\.ii?$" "\.(def)$"
|
||||
color identifier "\b[A-Z_][0-9A-Z_]+\b"
|
||||
color type "\b(auto|float|double|bool|char|int|short|long|sizeof|enum|void|static|const|constexpr|struct|union|typedef|extern|(un)?signed|inline)\b"
|
||||
color type "\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\b"
|
||||
color statement "\b(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\b"
|
||||
color statement "\b(for|if|while|do|else|case|default|switch)\b"
|
||||
color statement "\b(try|throw|catch|operator|new|delete)\b"
|
||||
color special "\b(goto|continue|break|return)\b"
|
||||
color preproc "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
|
||||
color constant "'([^'\\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
|
||||
|
||||
##
|
||||
## GCC builtins
|
||||
color statement "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
|
||||
|
||||
#Operator Color
|
||||
color symbol.operator "[.:;,+*|=!\%]" "<" ">" "/" "-" "&"
|
||||
|
||||
#Parenthetical Color
|
||||
color symbol.brackets "[(){}]" "\[" "\]"
|
||||
|
||||
color constant.number "\b[0-9]+\b" "\b0x[0-9A-Fa-f]+\b"
|
||||
color constant.bool "\b(true|false)\b" "NULL"
|
||||
|
||||
##
|
||||
## String highlighting. You will in general want your brightblacks and
|
||||
## strings to come last, because syntax highlighting rules will be
|
||||
## applied in the order they are read in.
|
||||
color constant.string ""(\\.|[^"])*""
|
||||
##
|
||||
## This string is VERY resource intensive!
|
||||
#color cyan start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
|
||||
|
||||
## Comment highlighting
|
||||
color comment "//.*"
|
||||
color comment start="/\*" end="\*/"
|
||||
|
||||
## Trailing whitespace
|
||||
color indent-char.whitespace "[[:space:]]+$"
|
||||
28
runtime/syntax/c++.yaml
Normal file
28
runtime/syntax/c++.yaml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
filetype: c++
|
||||
|
||||
detect:
|
||||
filename: "\\.c(c|pp|xx)$|\\.h(h|pp|xx)$|\\.ii?$|\\.(def)$"
|
||||
|
||||
rules:
|
||||
- identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
|
||||
- type: "\\b(auto|float|double|bool|char|int|short|long|sizeof|enum|void|static|const|constexpr|struct|union|typedef|extern|(un)?signed|inline)\\b"
|
||||
- type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
|
||||
- statement: "\\b(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\\b"
|
||||
- statement: "\\b(for|if|while|do|else|case|default|switch)\\b"
|
||||
- statement: "\\b(try|throw|catch|operator|new|delete)\\b"
|
||||
- special: "\\b(goto|continue|break|return)\\b"
|
||||
- preproc: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
|
||||
- constant: "'([^'\\\\]|(\\\\[\"'abfnrtv\\\\]))'|'\\\\(([0-3]?[0-7]{1,2}))'|'\\\\x[0-9A-Fa-f]{1,2}'"
|
||||
- statement: "__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
|
||||
- symbol.operator: "[.:;,+*|=!\\%]|<|>|/|-|&"
|
||||
- symbol.brackets: "[(){}]|\\[|\\]"
|
||||
- constant.number: "\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b"
|
||||
- constant.bool: "\\b(true|false)\\b|NULL"
|
||||
- constant.string: "\"(\\\\.|[^\"])*\""
|
||||
- comment: "//.*"
|
||||
- comment:
|
||||
start: "/\\*"
|
||||
end: "\\*/"
|
||||
rules: []
|
||||
|
||||
- indent-char.whitespace: "[[:space:]]+$"
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
## Here is an example for C.
|
||||
##
|
||||
syntax "c" "\.(c|C)$" "\.(h|H)$" "\.ii?$" "\.(def)$"
|
||||
color identifier "\b[A-Z_][0-9A-Z_]+\b"
|
||||
color type "\b(float|double|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline)\b"
|
||||
color type "\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\b"
|
||||
color type.extended "\b(bool)\b"
|
||||
color statement "\b(typename|mutable|volatile|register|explicit)\b"
|
||||
color statement "\b(for|if|while|do|else|case|default|switch)\b"
|
||||
color statement "\b(try|throw|catch|operator|new|delete)\b"
|
||||
color special "\b(goto|continue|break|return)\b"
|
||||
color preproc "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
|
||||
color constant "'([^'\\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
|
||||
|
||||
##
|
||||
## GCC builtins
|
||||
color statement "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
|
||||
|
||||
#Includes
|
||||
color constant.string "<.+?>"
|
||||
|
||||
#Operator Color
|
||||
color symbol.operator "[.:;,+*|=!\%]" "<" ">" "/" "-" "&"
|
||||
|
||||
#Parenthetical Color
|
||||
color symbol.brackets "[(){}]" "\[" "\]"
|
||||
|
||||
#Integers
|
||||
color constant.number "\b[0-9]+\b" "\b0x[0-9A-Fa-f]+\b"
|
||||
color constant.number "NULL"
|
||||
|
||||
##
|
||||
## String highlighting. You will in general want your brightblacks and
|
||||
## strings to come last, because syntax highlighting rules will be
|
||||
## applied in the order they are read in.
|
||||
color constant.string ""(\\.|[^"])*""
|
||||
##
|
||||
## This string is VERY resource intensive!
|
||||
#color cyan start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
|
||||
|
||||
## Comment highlighting
|
||||
color comment "//.*"
|
||||
color comment start="/\*" end="\*/"
|
||||
|
||||
## Trailing whitespace
|
||||
color indent-char.whitespace "[[:space:]]+$"
|
||||
52
runtime/syntax/c.yaml
Normal file
52
runtime/syntax/c.yaml
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
filetype: c
|
||||
|
||||
detect:
|
||||
filename: "(\\.(c|C)$|\\.(h|H)$|\\.ii?$|\\.(def)$)"
|
||||
|
||||
rules:
|
||||
- identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
|
||||
- type: "\\b(float|double|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline)\\b"
|
||||
- type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
|
||||
- type.extended: "\\b(bool)\\b"
|
||||
- statement: "\\b(typename|mutable|volatile|register|explicit)\\b"
|
||||
- statement: "\\b(for|if|while|do|else|case|default|switch)\\b"
|
||||
- statement: "\\b(try|throw|catch|operator|new|delete)\\b"
|
||||
- statement: "\\b(goto|continue|break|return)\\b"
|
||||
- preproc: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
|
||||
- constant: "'([^'\\\\]|(\\\\[\"'abfnrtv\\\\]))'"
|
||||
- constant: "'\\\\(([0-3]?[0-7]{1,2}))'"
|
||||
- constant: "'\\\\x[0-9A-Fa-f]{1,2}'"
|
||||
# GCC builtins
|
||||
- statement: "__attribute__[[:space:]]*\\(\\([^)]*\\)\\)"
|
||||
- statement: "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
|
||||
# Operator Color
|
||||
- symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)"
|
||||
- symbol.brackets: "[(){}]|\\[|\\]"
|
||||
- constant.number: "(\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b)"
|
||||
- constant.number: "NULL"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- constant.string:
|
||||
start: "'"
|
||||
end: "(?<!\\\\)'"
|
||||
rules:
|
||||
- preproc: "..+"
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- comment:
|
||||
start: "//"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
- comment:
|
||||
start: "/\\*"
|
||||
end: "\\*/"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
syntax "caddyfile" "Caddyfile"
|
||||
|
||||
color identifier "^\s*\S+(\s|$)"
|
||||
color type "^([\w.:/-]+,? ?)+[,{]$"
|
||||
color constant.specialChar "\s{$"
|
||||
color constant.specialChar "^\s*}$"
|
||||
color constant.string start="\"" end="\""
|
||||
color preproc "\{(\w+|\$\w+|%\w+%)\}"
|
||||
color comment "#.*"
|
||||
|
||||
# extra and trailing spaces
|
||||
color indent-char "([[:space:]]{2,}|\t){$"
|
||||
color indent-char "[[:space:]]+$"
|
||||
22
runtime/syntax/caddyfile.yaml
Normal file
22
runtime/syntax/caddyfile.yaml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
filetype: caddyfile
|
||||
|
||||
detect:
|
||||
filename: "Caddyfile"
|
||||
|
||||
rules:
|
||||
- identifier: "^\\s*\\S+(\\s|$)"
|
||||
- type: "^([\\w.:/-]+,? ?)+[,{]$"
|
||||
- constant.specialChar: "\\s{$"
|
||||
- constant.specialChar: "^\\s*}$"
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- preproc: "\\{(\\w+|\\$\\w+|%\\w+%)\\}"
|
||||
- comment:
|
||||
start: "#"
|
||||
end: "$"
|
||||
rules: []
|
||||
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
#Syntax highlighting for Clojure
|
||||
syntax "clojure" "\.(clj)$"
|
||||
|
||||
#Constants
|
||||
color constant ""
|
||||
color constant.bool "\b(true|false)\b"
|
||||
color constant.macro "\b(nil)\b"
|
||||
#Valid numbers
|
||||
color constant.number "[\-]?[0-9]+?\b"
|
||||
color constant.number "0x[0-9][A-Fa-f]+?\b"
|
||||
color constant.number "[\-]?(3[0-6]|2[0-9]|1[0-9]|[2-9])r[0-9A-Z]+?\b"
|
||||
#Invalid numbers
|
||||
color error "[\-]?([4-9][0-9]|3[7-9]|1|0)r[0-9A-Z]+?\b"
|
||||
|
||||
#Symbols
|
||||
color symbol.operator "[=>+\-*/'?]"
|
||||
|
||||
#Types/casting
|
||||
color type "\b(byte|short|(big)?int(eger)?|long|float|num|bigdec|rationalize)\b"
|
||||
|
||||
#Bitwise operations
|
||||
color special ""
|
||||
|
||||
#String highlighting
|
||||
color constant.string ""
|
||||
color constant.specialChar "(\\u[0-9A-fa-f]{4,4}|\\newline|\\space|\\tab|\\formfeed|\\backspace|\\return|\\.)"
|
||||
|
||||
#Comments
|
||||
color comment ";.*$"
|
||||
37
runtime/syntax/clojure.yaml
Normal file
37
runtime/syntax/clojure.yaml
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
filetype: clojure
|
||||
|
||||
detect:
|
||||
filename: "\\.(clj)$"
|
||||
|
||||
rules:
|
||||
|
||||
# Constants
|
||||
- constant.bool: "\\b(true|false)\\b"
|
||||
- constant.macro: "\\b(nil)\\b"
|
||||
# Valid numbers
|
||||
- constant.number: "[\\-]?[0-9]+?\\b"
|
||||
- constant.number: "0x[0-9][A-Fa-f]+?\\b"
|
||||
- constant.number: "[\\-]?(3[0-6]|2[0-9]|1[0-9]|[2-9])r[0-9A-Z]+?\\b"
|
||||
# Invalid numbers
|
||||
- error: "[\\-]?([4-9][0-9]|3[7-9]|1|0)r[0-9A-Z]+?\\b"
|
||||
|
||||
# Symbols
|
||||
- symbol.operator: "[=>+\\-*/'?]"
|
||||
|
||||
# Types/casting
|
||||
- type: "\\b(byte|short|(big)?int(eger)?|long|float|num|bigdec|rationalize)\\b"
|
||||
|
||||
# String highlighting
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "(\\\\u[0-9A-fa-f]{4,4}|\\\\newline|\\\\space|\\\\tab|\\\\formfeed|\\\\backspace|\\\\return|\\\\.)"
|
||||
|
||||
# Comments
|
||||
- comment:
|
||||
start: ";"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
## CMake syntax highlighter for GNU Nano
|
||||
##
|
||||
syntax "cmake" "(CMakeLists\.txt|\.cmake)$"
|
||||
|
||||
color identifier.var "^[[:space:]]*[A-Z0-9_]+"
|
||||
color preproc "^[[:space:]]*(include|include_directories|include_external_msproject)\b"
|
||||
|
||||
color statement "^[[:space:]]*\b((else|end)?if|else|(end)?while|(end)?foreach|break)\b"
|
||||
color statement "\b(COPY|NOT|COMMAND|PROPERTY|POLICY|TARGET|EXISTS|IS_(DIRECTORY|ABSOLUTE)|DEFINED)\b[[:space:]]"
|
||||
color statement "[[:space:]]\b(OR|AND|IS_NEWER_THAN|MATCHES|(STR|VERSION_)?(LESS|GREATER|EQUAL))\b[[:space:]]"
|
||||
|
||||
color special "^[[:space:]]*\b((end)?(function|macro)|return)"
|
||||
|
||||
#String Color
|
||||
color constant.string "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}"
|
||||
color constant.string "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}"
|
||||
|
||||
color preproc start="\$(\{|ENV\{)" end="\}"
|
||||
color identifier.macro "\b(APPLE|UNIX|WIN32|CYGWIN|BORLAND|MINGW|MSVC(_IDE|60|71|80|90)?)\b"
|
||||
|
||||
color comment "^([[:space:]]*)?#.*"
|
||||
color comment "[[:space:]]#.*"
|
||||
|
||||
40
runtime/syntax/cmake.yaml
Normal file
40
runtime/syntax/cmake.yaml
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
filetype: cmake
|
||||
|
||||
detect:
|
||||
filename: "(CMakeLists\\.txt|\\.cmake)$"
|
||||
|
||||
rules:
|
||||
- identifier.var: "^[[:space:]]*[A-Z0-9_]+"
|
||||
- preproc: "^[[:space:]]*(include|include_directories|include_external_msproject)\\b"
|
||||
|
||||
- statement: "^[[:space:]]*\\b((else|end)?if|else|(end)?while|(end)?foreach|break)\\b"
|
||||
- statement: "\\b(COPY|NOT|COMMAND|PROPERTY|POLICY|TARGET|EXISTS|IS_(DIRECTORY|ABSOLUTE)|DEFINED)\\b[[:space:]]"
|
||||
- statement: "[[:space:]]\\b(OR|AND|IS_NEWER_THAN|MATCHES|(STR|VERSION_)?(LESS|GREATER|EQUAL))\\b[[:space:]]"
|
||||
|
||||
- special: "^[[:space:]]*\\b((end)?(function|macro)|return)"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- constant.string:
|
||||
start: "'"
|
||||
end: "(?<!\\\\)'"
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- preproc:
|
||||
start: "\\$(\\{|ENV\\{)"
|
||||
end: "\\}"
|
||||
rules: []
|
||||
|
||||
- identifier.macro: "\\b(APPLE|UNIX|WIN32|CYGWIN|BORLAND|MINGW|MSVC(_IDE|60|71|80|90)?)\\b"
|
||||
|
||||
- comment:
|
||||
start: "#"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
syntax "coffeescript" "\.coffee$"
|
||||
header "^#!.*/(env +)?coffee"
|
||||
|
||||
color symbol.operator "[!&|=/*+\-<>]|\b(and|or|is|isnt|not)\b"
|
||||
color identifier.class "[A-Za-z_][A-Za-z0-9_]*:[[:space:]]*(->|\()" "->"
|
||||
color symbol.brackets "[()]"
|
||||
color statement "\b(for|of|continue|break|isnt|null|unless|this|else|if|return)\b"
|
||||
color statement "\b(try|catch|finally|throw|new|delete|typeof|in|instanceof)\b"
|
||||
color statement "\b(debugger|switch|while|do|class|extends|super)\b"
|
||||
color statement "\b(undefined|then|unless|until|loop|of|by|when)\b"
|
||||
color constant.bool "\b(true|false|yes|no|on|off)\b"
|
||||
color identifier "@[A-Za-z0-9_]*"
|
||||
color constant.string ""(\\.|[^"])*"|'(\\.|[^'])*'"
|
||||
color comment "(^|[[:space:]])#([^{].*)?$"
|
||||
color indent-char.whitespace "[[:space:]]+$"
|
||||
color indent-char " + +| + +"
|
||||
color preproc.shebang "#!.+$"
|
||||
28
runtime/syntax/coffeescript.yaml
Normal file
28
runtime/syntax/coffeescript.yaml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
filetype: coffeescript
|
||||
|
||||
detect:
|
||||
filename: "\\.coffee$"
|
||||
|
||||
rules:
|
||||
- symbol.operator: "[!&|=/*+-<>]|\\b(and|or|is|isnt|not)\\b"
|
||||
- identifier.class: "([A-Za-z_][A-Za-z0-9_]*:[[:space:]]*(->|\\()|->)"
|
||||
- symbol.brackets: "[()]"
|
||||
- statement: "\\b(for|of|continue|break|isnt|null|unless|this|else|if|return)\\b"
|
||||
- statement: "\\b(try|catch|finally|throw|new|delete|typeof|in|instanceof)\\b"
|
||||
- statement: "\\b(debugger|switch|while|do|class|extends|super)\\b"
|
||||
- statement: "\\b(undefined|then|unless|until|loop|of|by|when)\\b"
|
||||
- constant.bool: "\\b(true|false|yes|no|on|off)\\b"
|
||||
- identifier: "@[A-Za-z0-9_]*"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- comment:
|
||||
start: "#"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
syntax "colortest" "ColorTest$"
|
||||
|
||||
color black "\bPLAIN\b"
|
||||
|
||||
color red "\bred\b"
|
||||
color green "\bgreen\b"
|
||||
color yellow "\byellow\b"
|
||||
color blue "\bblue\b"
|
||||
color magenta "\bmagenta\b"
|
||||
color cyan "\bcyan\b"
|
||||
|
||||
color brightred "\bbrightred\b"
|
||||
color brightgreen "\bbrightgreen\b"
|
||||
color brightyellow "\bbrightyellow\b"
|
||||
color brightblue "\bbrightblue\b"
|
||||
color brightmagenta "\bbrightmagenta\b"
|
||||
color brightcyan "\bbrightcyan\b"
|
||||
|
||||
19
runtime/syntax/colortest.yaml
Normal file
19
runtime/syntax/colortest.yaml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
filetype: colortest
|
||||
|
||||
detect:
|
||||
filename: "ColorTest$"
|
||||
|
||||
rules:
|
||||
- black: "\\bPLAIN\\b"
|
||||
- red: "\\bred\\b"
|
||||
- green: "\\bgreen\\b"
|
||||
- yellow: "\\byellow\\b"
|
||||
- blue: "\\bblue\\b"
|
||||
- magenta: "\\bmagenta\\b"
|
||||
- cyan: "\\bcyan\\b"
|
||||
- brightred: "\\bbrightred\\b"
|
||||
- brightgreen: "\\bbrightgreen\\b"
|
||||
- brightyellow: "\\bbrightyellow\\b"
|
||||
- brightblue: "\\bbrightblue\\b"
|
||||
- brightmagenta: "\\bbrightmagenta\\b"
|
||||
- brightcyan: "\\bbrightcyan\\b"
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
## Here is an example for nanorc files.
|
||||
##
|
||||
#Needs cleanup/extension?
|
||||
|
||||
syntax "conf" "\.c[o]?nf$"
|
||||
## Possible errors and parameters
|
||||
## Strings
|
||||
color constant.string ""(\\.|[^"])*""
|
||||
## Comments
|
||||
color comment "^[[:space:]]*#.*$"
|
||||
color comment "^[[:space:]]*##.*$"
|
||||
|
||||
16
runtime/syntax/conf.yaml
Normal file
16
runtime/syntax/conf.yaml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
filetype: conf
|
||||
|
||||
detect:
|
||||
filename: "\\.c[o]?nf$"
|
||||
|
||||
rules:
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules: []
|
||||
|
||||
- comment:
|
||||
start: "#"
|
||||
end: "$"
|
||||
rules: []
|
||||
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
##
|
||||
## Syntax highlighting for conkyrc files.
|
||||
##
|
||||
##
|
||||
syntax "conky" "(\.*conkyrc.*$|conky.conf)"
|
||||
|
||||
## Configuration items
|
||||
color type "\b(alignment|append_file|background|border_inner_margin|border_outer_margin|border_width|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|colorN|cpu_avg_samples|default_bar_height|default_bar_width|default_color|default_gauge_height|default_gauge_width|default_graph_height|default_graph_width|default_outline_color|default_shade_color|diskio_avg_samples|display|double_buffer|draw_borders|draw_graph_borders|draw_outline|draw_shades|extra_newline|font|format_human_readable|gap_x|gap_y|http_refresh|if_up_strictness|imap|imlib_cache_flush_interval|imlib_cache_size|lua_draw_hook_post|lua_draw_hook_pre|lua_load|lua_shutdown_hook|lua_startup_hook|mail_spool|max_port_monitor_connections|max_text_width|max_user_text|maximum_width|minimum_height|minimum_width|mpd_host|mpd_password|mpd_port|music_player_interval|mysql_host|mysql_port|mysql_user|mysql_password|mysql_db|net_avg_samples|no_buffers|nvidia_display|out_to_console|out_to_http|out_to_ncurses|out_to_stderr|out_to_x|override_utf8_locale|overwrite_file|own_window|own_window_class|own_window_colour|own_window_hints|own_window_title|own_window_transparent|own_window_type|pad_percents|pop3|sensor_device|short_units|show_graph_range|show_graph_scale|stippled_borders|temperature_unit|template|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|text|text_buffer_size|times_in_seconds|top_cpu_separate|top_name_width|total_run_times|update_interval|update_interval_on_battery|uppercase|use_spacer|use_xft|xftalpha|xftfont)\b"
|
||||
|
||||
## Configuration item constants
|
||||
color statement "\b(above|below|bottom_left|bottom_right|bottom_middle|desktop|dock|no|none|normal|override|skip_pager|skip_taskbar|sticky|top_left|top_right|top_middle|middle_left|middle_right|middle_middle|undecorated|yes)\b"
|
||||
|
||||
## Variables
|
||||
color preproc "\b(acpiacadapter|acpifan|acpitemp|addr|addrs|alignc|alignr|apcupsd|apcupsd_cable|apcupsd_charge|apcupsd_lastxfer|apcupsd_linev|apcupsd_load|apcupsd_loadbar|apcupsd_loadgauge|apcupsd_loadgraph|apcupsd_model|apcupsd_name|apcupsd_status|apcupsd_temp|apcupsd_timeleft|apcupsd_upsmode|apm_adapter|apm_battery_life|apm_battery_time|audacious_bar|audacious_bitrate|audacious_channels|audacious_filename|audacious_frequency|audacious_length|audacious_length_seconds|audacious_main_volume|audacious_playlist_length|audacious_playlist_position|audacious_position|audacious_position_seconds|audacious_status|audacious_title|battery|battery_bar|battery_percent|battery_short|battery_time|blink|bmpx_album|bmpx_artist|bmpx_bitrate|bmpx_title|bmpx_track|bmpx_uri|buffers|cached|cmdline_to_pid|color|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|combine|conky_build_arch|conky_build_date|conky_version|cpu|cpubar|cpugauge|cpugraph|curl|desktop|desktop_name|desktop_number|disk_protect|diskio|diskio_read|diskio_write|diskiograph|diskiograph_read|diskiograph_write|distribution|downspeed|downspeedf|downspeedgraph|draft_mails|else|endif|entropy_avail|entropy_bar|entropy_perc|entropy_poolsize|eval|eve|exec|execbar|execgauge|execgraph|execi|execibar|execigauge|execigraph|execp|execpi|flagged_mails|font|format_time|forwarded_mails|freq|freq_g|fs_bar|fs_bar_free|fs_free|fs_free_perc|fs_size|fs_type|fs_used|fs_used_perc|goto|gw_iface|gw_ip|hddtemp|head|hr|hwmon|i2c|i8k_ac_status|i8k_bios|i8k_buttons_status|i8k_cpu_temp|i8k_left_fan_rpm|i8k_left_fan_status|i8k_right_fan_rpm|i8k_right_fan_status|i8k_serial|i8k_version|ibm_brightness|ibm_fan|ibm_temps|ibm_volume|ical|iconv_start|iconv_stop|if_empty|if_existing|if_gw|if_match|if_mixer_mute|if_mounted|if_mpd_playing|if_running|if_smapi_bat_installed|if_up|if_updatenr|if_xmms2_connected|image|imap_messages|imap_unseen|ioscheduler|irc|kernel|laptop_mode|lines|loadavg|loadgraph|lua|lua_bar|lua_gauge|lua_graph|lua_parse|machine|mails|mboxscan|mem|memwithbuffers|membar|memwithbuffersbar|memeasyfree|memfree|memgauge|memgraph|memmax|memperc|mixer|mixerbar|mixerl|mixerlbar|mixerr|mixerrbar|moc_album|moc_artist|moc_bitrate|moc_curtime|moc_file|moc_rate|moc_song|moc_state|moc_timeleft|moc_title|moc_totaltime|monitor|monitor_number|mpd_album|mpd_artist|mpd_bar|mpd_bitrate|mpd_elapsed|mpd_file|mpd_length|mpd_name|mpd_percent|mpd_random|mpd_repeat|mpd_smart|mpd_status|mpd_title|mpd_track|mpd_vol|mysql|nameserver|new_mails|nodename|nodename_short|no_update|nvidia|obsd_product|obsd_sensors_fan|obsd_sensors_temp|obsd_sensors_volt|obsd_vendor|offset|outlinecolor|pb_battery|pid_chroot|pid_cmdline|pid_cwd|pid_environ|pid_environ_list|pid_exe|pid_nice|pid_openfiles|pid_parent|pid_priority|pid_state|pid_state_short|pid_stderr|pid_stdin|pid_stdout|pid_threads|pid_thread_list|pid_time_kernelmode|pid_time_usermode|pid_time|pid_uid|pid_euid|pid_suid|pid_fsuid|pid_gid|pid_egid|pid_sgid|pid_fsgid|pid_read|pid_vmpeak|pid_vmsize|pid_vmlck|pid_vmhwm|pid_vmrss|pid_vmdata|pid_vmstk|pid_vmexe|pid_vmlib|pid_vmpte|pid_write|platform|pop3_unseen|pop3_used|processes|read_tcp|read_udp|replied_mails|rss|running_processes|running_threads|scroll|seen_mails|shadecolor|smapi|smapi_bat_bar|smapi_bat_perc|smapi_bat_power|smapi_bat_temp|sony_fanspeed|stippled_hr|stock|swap|swapbar|swapfree|swapmax|swapperc|sysname|tab|tail|tcp_ping|tcp_portmon|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|texeci|texecpi|threads|time|to_bytes|top|top_io|top_mem|top_time|totaldown|totalup|trashed_mails|tztime|gid_name|uid_name|unflagged_mails|unforwarded_mails|unreplied_mails|unseen_mails|updates|upspeed|upspeedf|upspeedgraph|uptime|uptime_short|user_names|user_number|user_terms|user_times|user_time|utime|voffset|voltage_mv|voltage_v|weather|wireless_ap|wireless_bitrate|wireless_essid|wireless_link_bar|wireless_link_qual|wireless_link_qual_max|wireless_link_qual_perc|wireless_mode|words|xmms2_album|xmms2_artist|xmms2_bar|xmms2_bitrate|xmms2_comment|xmms2_date|xmms2_duration|xmms2_elapsed|xmms2_genre|xmms2_id|xmms2_percent|xmms2_playlist|xmms2_size|xmms2_smart|xmms2_status|xmms2_timesplayed|xmms2_title|xmms2_tracknr|xmms2_url)\b"
|
||||
|
||||
color identifier.var "\$\{?[0-9A-Z_!@#$*?-]+\}?"
|
||||
color symbol.operator "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
|
||||
color constant.macro "^TEXT$"
|
||||
17
runtime/syntax/conky.yaml
Normal file
17
runtime/syntax/conky.yaml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
filetype: conky
|
||||
|
||||
detect:
|
||||
filename: "(\\.*conkyrc.*$|conky.conf)"
|
||||
|
||||
rules:
|
||||
- type: "\\b(alignment|append_file|background|border_inner_margin|border_outer_margin|border_width|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|colorN|cpu_avg_samples|default_bar_height|default_bar_width|default_color|default_gauge_height|default_gauge_width|default_graph_height|default_graph_width|default_outline_color|default_shade_color|diskio_avg_samples|display|double_buffer|draw_borders|draw_graph_borders|draw_outline|draw_shades|extra_newline|font|format_human_readable|gap_x|gap_y|http_refresh|if_up_strictness|imap|imlib_cache_flush_interval|imlib_cache_size|lua_draw_hook_post|lua_draw_hook_pre|lua_load|lua_shutdown_hook|lua_startup_hook|mail_spool|max_port_monitor_connections|max_text_width|max_user_text|maximum_width|minimum_height|minimum_width|mpd_host|mpd_password|mpd_port|music_player_interval|mysql_host|mysql_port|mysql_user|mysql_password|mysql_db|net_avg_samples|no_buffers|nvidia_display|out_to_console|out_to_http|out_to_ncurses|out_to_stderr|out_to_x|override_utf8_locale|overwrite_file|own_window|own_window_class|own_window_colour|own_window_hints|own_window_title|own_window_transparent|own_window_type|pad_percents|pop3|sensor_device|short_units|show_graph_range|show_graph_scale|stippled_borders|temperature_unit|template|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|text|text_buffer_size|times_in_seconds|top_cpu_separate|top_name_width|total_run_times|update_interval|update_interval_on_battery|uppercase|use_spacer|use_xft|xftalpha|xftfont)\\b"
|
||||
|
||||
# Configuration item constants
|
||||
- statement: "\\b(above|below|bottom_left|bottom_right|bottom_middle|desktop|dock|no|none|normal|override|skip_pager|skip_taskbar|sticky|top_left|top_right|top_middle|middle_left|middle_right|middle_middle|undecorated|yes)\\b"
|
||||
|
||||
# Variables
|
||||
- preproc: "\\b(acpiacadapter|acpifan|acpitemp|addr|addrs|alignc|alignr|apcupsd|apcupsd_cable|apcupsd_charge|apcupsd_lastxfer|apcupsd_linev|apcupsd_load|apcupsd_loadbar|apcupsd_loadgauge|apcupsd_loadgraph|apcupsd_model|apcupsd_name|apcupsd_status|apcupsd_temp|apcupsd_timeleft|apcupsd_upsmode|apm_adapter|apm_battery_life|apm_battery_time|audacious_bar|audacious_bitrate|audacious_channels|audacious_filename|audacious_frequency|audacious_length|audacious_length_seconds|audacious_main_volume|audacious_playlist_length|audacious_playlist_position|audacious_position|audacious_position_seconds|audacious_status|audacious_title|battery|battery_bar|battery_percent|battery_short|battery_time|blink|bmpx_album|bmpx_artist|bmpx_bitrate|bmpx_title|bmpx_track|bmpx_uri|buffers|cached|cmdline_to_pid|color|color0|color1|color2|color3|color4|color5|color6|color7|color8|color9|combine|conky_build_arch|conky_build_date|conky_version|cpu|cpubar|cpugauge|cpugraph|curl|desktop|desktop_name|desktop_number|disk_protect|diskio|diskio_read|diskio_write|diskiograph|diskiograph_read|diskiograph_write|distribution|downspeed|downspeedf|downspeedgraph|draft_mails|else|endif|entropy_avail|entropy_bar|entropy_perc|entropy_poolsize|eval|eve|exec|execbar|execgauge|execgraph|execi|execibar|execigauge|execigraph|execp|execpi|flagged_mails|font|format_time|forwarded_mails|freq|freq_g|fs_bar|fs_bar_free|fs_free|fs_free_perc|fs_size|fs_type|fs_used|fs_used_perc|goto|gw_iface|gw_ip|hddtemp|head|hr|hwmon|i2c|i8k_ac_status|i8k_bios|i8k_buttons_status|i8k_cpu_temp|i8k_left_fan_rpm|i8k_left_fan_status|i8k_right_fan_rpm|i8k_right_fan_status|i8k_serial|i8k_version|ibm_brightness|ibm_fan|ibm_temps|ibm_volume|ical|iconv_start|iconv_stop|if_empty|if_existing|if_gw|if_match|if_mixer_mute|if_mounted|if_mpd_playing|if_running|if_smapi_bat_installed|if_up|if_updatenr|if_xmms2_connected|image|imap_messages|imap_unseen|ioscheduler|irc|kernel|laptop_mode|lines|loadavg|loadgraph|lua|lua_bar|lua_gauge|lua_graph|lua_parse|machine|mails|mboxscan|mem|memwithbuffers|membar|memwithbuffersbar|memeasyfree|memfree|memgauge|memgraph|memmax|memperc|mixer|mixerbar|mixerl|mixerlbar|mixerr|mixerrbar|moc_album|moc_artist|moc_bitrate|moc_curtime|moc_file|moc_rate|moc_song|moc_state|moc_timeleft|moc_title|moc_totaltime|monitor|monitor_number|mpd_album|mpd_artist|mpd_bar|mpd_bitrate|mpd_elapsed|mpd_file|mpd_length|mpd_name|mpd_percent|mpd_random|mpd_repeat|mpd_smart|mpd_status|mpd_title|mpd_track|mpd_vol|mysql|nameserver|new_mails|nodename|nodename_short|no_update|nvidia|obsd_product|obsd_sensors_fan|obsd_sensors_temp|obsd_sensors_volt|obsd_vendor|offset|outlinecolor|pb_battery|pid_chroot|pid_cmdline|pid_cwd|pid_environ|pid_environ_list|pid_exe|pid_nice|pid_openfiles|pid_parent|pid_priority|pid_state|pid_state_short|pid_stderr|pid_stdin|pid_stdout|pid_threads|pid_thread_list|pid_time_kernelmode|pid_time_usermode|pid_time|pid_uid|pid_euid|pid_suid|pid_fsuid|pid_gid|pid_egid|pid_sgid|pid_fsgid|pid_read|pid_vmpeak|pid_vmsize|pid_vmlck|pid_vmhwm|pid_vmrss|pid_vmdata|pid_vmstk|pid_vmexe|pid_vmlib|pid_vmpte|pid_write|platform|pop3_unseen|pop3_used|processes|read_tcp|read_udp|replied_mails|rss|running_processes|running_threads|scroll|seen_mails|shadecolor|smapi|smapi_bat_bar|smapi_bat_perc|smapi_bat_power|smapi_bat_temp|sony_fanspeed|stippled_hr|stock|swap|swapbar|swapfree|swapmax|swapperc|sysname|tab|tail|tcp_ping|tcp_portmon|template0|template1|template2|template3|template4|template5|template6|template7|template8|template9|texeci|texecpi|threads|time|to_bytes|top|top_io|top_mem|top_time|totaldown|totalup|trashed_mails|tztime|gid_name|uid_name|unflagged_mails|unforwarded_mails|unreplied_mails|unseen_mails|updates|upspeed|upspeedf|upspeedgraph|uptime|uptime_short|user_names|user_number|user_terms|user_times|user_time|utime|voffset|voltage_mv|voltage_v|weather|wireless_ap|wireless_bitrate|wireless_essid|wireless_link_bar|wireless_link_qual|wireless_link_qual_max|wireless_link_qual_perc|wireless_mode|words|xmms2_album|xmms2_artist|xmms2_bar|xmms2_bitrate|xmms2_comment|xmms2_date|xmms2_duration|xmms2_elapsed|xmms2_genre|xmms2_id|xmms2_percent|xmms2_playlist|xmms2_size|xmms2_smart|xmms2_status|xmms2_timesplayed|xmms2_title|xmms2_tracknr|xmms2_url)\\b"
|
||||
|
||||
- identifier.var: "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?"
|
||||
- symbol.operator: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|!|=|&|\\|)"
|
||||
- constant.macro: "^TEXT$"
|
||||
53
runtime/syntax/cpp.yaml
Normal file
53
runtime/syntax/cpp.yaml
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
filetype: c++
|
||||
|
||||
detect:
|
||||
filename: "(\\.c(c|pp|xx)$|\\.h(h|pp|xx)$|\\.ii?$|\\.(def)$)"
|
||||
|
||||
rules:
|
||||
|
||||
- identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
|
||||
- type: "\\b(auto|float|double|bool|char|int|short|long|sizeof|enum|void|static|const|constexpr|struct|union|typedef|extern|(un)?signed|inline)\\b"
|
||||
- type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
|
||||
- statement: "\\b(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\\b"
|
||||
- statement: "\\b(for|if|while|do|else|case|default|switch)\\b"
|
||||
- statement: "\\b(try|throw|catch|operator|new|delete)\\b"
|
||||
- statement: "\\b(goto|continue|break|return)\\b"
|
||||
- preproc: "^[[:space:]]*#[[:space:]]*(define|pragma|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
|
||||
- constant: "('([^'\\\\]|(\\\\[\"'abfnrtv\\\\]))'|'\\\\(([0-3]?[0-7]{1,2}))'|'\\\\x[0-9A-Fa-f]{1,2}')"
|
||||
|
||||
# GCC builtins
|
||||
- statement: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__)"
|
||||
|
||||
# Operator Color
|
||||
- symbol.operator: "([.:;,+*|=!\\%]|<|>|/|-|&)"
|
||||
# Parenthetical Color
|
||||
- symbol.brackets: "[(){}]|\\[|\\]"
|
||||
|
||||
- constant.number: "(\\b[0-9]+\\b|\\b0x[0-9A-Fa-f]+\\b)"
|
||||
- constant.bool: "(\\b(true|false)\\b|NULL)"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- constant.string:
|
||||
start: "'"
|
||||
end: "(?<!\\\\)'"
|
||||
rules:
|
||||
- preproc: "..+"
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- comment:
|
||||
start: "//"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
- comment:
|
||||
start: "/\\*"
|
||||
end: "\\*/"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
## Crystal Syntax file.
|
||||
##
|
||||
syntax "crystal" "\.cr$" "Gemfile" "config.ru" "Rakefile" "Capfile" "Vagrantfile"
|
||||
header "^#!.*/(env +)?crystal( |$)"
|
||||
|
||||
## Asciibetical list of reserved words
|
||||
color 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"
|
||||
## Constants
|
||||
color constant "(\$|@|@@)?\b[A-Z]+[0-9A-Z_a-z]*"
|
||||
color constant.number "\b[0-9]+\b"
|
||||
## Crystal "symbols"
|
||||
color constant "([ ]|^):[0-9A-Z_]+\b"
|
||||
## Some unique things we want to stand out
|
||||
color constant "\b(__FILE__|__LINE__)\b"
|
||||
## Regular expressions
|
||||
color constant "/([^/]|(\\/))*/[iomx]*" "%r\{([^}]|(\\}))*\}[iomx]*"
|
||||
## Shell command expansion is in `backticks` or like %x{this}. These are
|
||||
## "double-quotish" (to use a perlism).
|
||||
color constant.string "`[^`]*`" "%x\{[^}]*\}"
|
||||
## Strings, double-quoted
|
||||
color constant.string ""([^"]|(\\"))*"" "%[QW]?\{[^}]*\}" "%[QW]?\([^)]*\)" "%[QW]?<[^>]*>" "%[QW]?\[[^]]*\]" "%[QW]?\$[^$]*\$" "%[QW]?\^[^^]*\^" "%[QW]?![^!]*!"
|
||||
## Expression substitution. These go inside double-quoted strings,
|
||||
## "like #{this}".
|
||||
color special "#\{[^}]*\}"
|
||||
## Characters are single-quoted
|
||||
color constant.string.char "'([^']|(\\'))*'" "%[qw]\{[^}]*\}" "%[qw]\([^)]*\)" "%[qw]<[^>]*>" "%[qw]\[[^]]*\]" "%[qw]\$[^$]*\$" "%[qw]\^[^^]*\^" "%[qw]![^!]*!"
|
||||
## Comments
|
||||
color comment "#[^{].*$" "#$"
|
||||
color comment.bright "##[^{].*$" "##$"
|
||||
## "Here" docs
|
||||
color constant start="<<-?'?EOT'?" end="^EOT"
|
||||
## Some common markers
|
||||
color todo "(XXX|TODO|FIXME|\?\?\?)"
|
||||
|
||||
61
runtime/syntax/crystal.yaml
Normal file
61
runtime/syntax/crystal.yaml
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
filetype: crystal
|
||||
|
||||
detect:
|
||||
filename: "\\.cr$|Gemfile|config.ru|Rakefile|Capfile|Vagrantfile"
|
||||
|
||||
rules:
|
||||
# Asciibetical list of reserved words
|
||||
- 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"
|
||||
# Constants
|
||||
- constant: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*"
|
||||
- constant.number: "\\b[0-9]+\\b"
|
||||
# Crystal "symbols"
|
||||
- constant: "([ ]|^):[0-9A-Z_]+\\b"
|
||||
# Some unique things we want to stand out
|
||||
- constant: "\\b(__FILE__|__LINE__)\\b"
|
||||
# Regular expressions
|
||||
- constant: "/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*"
|
||||
|
||||
# Shell command expansion is in `backticks` or like %x{this}. These are
|
||||
# "double-quotish" (to use a perlism).
|
||||
- constant.string: "`[^`]*`|%x\\{[^}]*\\}"
|
||||
|
||||
- constant.string:
|
||||
start: "`"
|
||||
end: "`"
|
||||
rules: []
|
||||
|
||||
- constant.string:
|
||||
start: "%x\\{"
|
||||
end: "\\}"
|
||||
rules: []
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialchar: "\\\\."
|
||||
- special: "#\\{[^}]*\\}"
|
||||
|
||||
- constant.string:
|
||||
start: "'"
|
||||
end: "(?<!\\\\)'"
|
||||
rules: []
|
||||
|
||||
- comment:
|
||||
start: "#"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
- comment.bright:
|
||||
start: "##"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
- constant:
|
||||
start: "<<-?'?EOT'?"
|
||||
end: "^EOT"
|
||||
rules: []
|
||||
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
syntax "c#" "\.cs$"
|
||||
|
||||
# Class
|
||||
color identifier.class "class +[A-Za-z0-9]+ *((:) +[A-Za-z0-9.]+)?"
|
||||
|
||||
# Annotation
|
||||
color identifier.var "@[A-Za-z]+"
|
||||
|
||||
color identifier "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[()]"
|
||||
color type "\b(bool|byte|sbyte|char|decimal|double|float|IntPtr|int|uint|long|ulong|object|short|ushort|string|base|this|var|void)\b"
|
||||
color 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"
|
||||
color 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"
|
||||
# LINQ-only keywords (ones that cannot be used outside of a LINQ query - lots others can)
|
||||
color statement "\b(from|where|select|group|info|orderby|join|let|in|on|equals|by|ascending|descending)\b"
|
||||
color special "\b(break|continue)\b"
|
||||
color constant.bool "\b(true|false)\b"
|
||||
color symbol.operator "[\-+/*=<>?:!~%&|]"
|
||||
color constant.number "\b([0-9._]+|0x[A-Fa-f0-9_]+|0b[0-1_]+)[FL]?\b"
|
||||
color constant.string ""(\\.|[^"])*"|'(\\.|[^'])*'"
|
||||
color constant.specialChar "\\([btnfr]|'|\"|\\)"
|
||||
color constant.specialChar "\\u[A-Fa-f0-9]{4}"
|
||||
color comment "(^|[[:space:]])//.*"
|
||||
color comment start="/\*" end="\*/"
|
||||
color todo "TODO:?"
|
||||
color indent-char.whitespace "[[:space:]]+$"
|
||||
color indent-char " + +| + +"
|
||||
49
runtime/syntax/csharp.yaml
Normal file
49
runtime/syntax/csharp.yaml
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
filetype: csharp
|
||||
|
||||
detect:
|
||||
filename: "\\.cs"
|
||||
|
||||
rules:
|
||||
# Class
|
||||
- identifier.class: "class +[A-Za-z0-9]+ *((:) +[A-Za-z0-9.]+)?"
|
||||
|
||||
# Annotation
|
||||
- identifier.var: "@[A-Za-z]+"
|
||||
|
||||
- identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[()]"
|
||||
- type: "\\b(bool|byte|sbyte|char|decimal|double|float|IntPtr|int|uint|long|ulong|object|short|ushort|string|base|this|var|void)\\b"
|
||||
- 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"
|
||||
- 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"
|
||||
# LINQ-only keywords (ones that cannot be used outside of a LINQ query - lots others can)
|
||||
- statement: "\\b(from|where|select|group|info|orderby|join|let|in|on|equals|by|ascending|descending)\\b"
|
||||
- special: "\\b(break|continue)\\b"
|
||||
- constant.bool: "\\b(true|false)\\b"
|
||||
- symbol.operator: "[\\-+/*=<>?:!~%&|]"
|
||||
- constant.number: "\\b([0-9._]+|0x[A-Fa-f0-9_]+|0b[0-1_]+)[FL]?\\b"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
|
||||
- constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
|
||||
|
||||
- constant.string:
|
||||
start: "'"
|
||||
end: "(?<!\\\\)'"
|
||||
rules:
|
||||
- constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
|
||||
- constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
|
||||
|
||||
- comment:
|
||||
start: "//"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
- comment:
|
||||
start: "/\\*"
|
||||
end: "\\*/"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
File diff suppressed because one or more lines are too long
42
runtime/syntax/css.yaml
Normal file
42
runtime/syntax/css.yaml
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -1,30 +0,0 @@
|
|||
## Cython nanorc, based off of Python nanorc.
|
||||
##
|
||||
syntax "cython" "\.pyx$" "\.pxd$" "\.pyi$"
|
||||
color preproc "def [ 0-9A-Z_]+"
|
||||
color preproc "cpdef [0-9A-Z_]+\(.*\):"
|
||||
color preproc "cdef cppclass [ 0-9A-Z_]+\(.*\):"
|
||||
|
||||
|
||||
|
||||
# Python Keyword Color
|
||||
color 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"
|
||||
color special "\b(continue|break|return)\b"
|
||||
|
||||
# Cython Keyword Color
|
||||
color identifier.macro "\b(cdef|cimport|cpdef|cppclass|ctypedef|extern|include|namespace|property|struct)\b"
|
||||
color type "\b(bint|char|double|int|public|void|unsigned)\b"
|
||||
|
||||
#Operator Color
|
||||
color symbol "[.:;,+*|=!\%]" "<" ">" "/" "-" "&"
|
||||
|
||||
#Parenthetical Color
|
||||
color symbol.brackets "[(){}]" "\[" "\]"
|
||||
|
||||
#String Color
|
||||
color constant.string "['][^']*[^\\][']" "[']{3}.*[^\\][']{3}"
|
||||
color constant.string "["][^"]*[^\\]["]" "["]{3}.*[^\\]["]{3}"
|
||||
color constant.string start=""""[^"]" end=""""" start="'''[^']" end="'''"
|
||||
|
||||
# Comment Color
|
||||
color comment "#.*$"
|
||||
50
runtime/syntax/cython.yaml
Normal file
50
runtime/syntax/cython.yaml
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
filetype: cython
|
||||
|
||||
detect:
|
||||
filename: "\\.pyx$|\\.pxd$|\\.pyi$"
|
||||
|
||||
rules:
|
||||
# Python Keyword Color
|
||||
- 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"
|
||||
- special: "\\b(continue|break|return)\\b"
|
||||
|
||||
# Cython Keyword Color
|
||||
- identifier.macro: "\\b(cdef|cimport|cpdef|cppclass|ctypedef|extern|include|namespace|property|struct)\\b"
|
||||
- type: "\\b(bint|char|double|int|public|void|unsigned)\\b"
|
||||
|
||||
# Operator Color
|
||||
- symbol: "[.:;,+*|=!\\%]|<|>|/|-|&"
|
||||
|
||||
# Parenthetical Color
|
||||
- symbol.brackets: "[(){}]|\\[|\\]"
|
||||
|
||||
- constant.string:
|
||||
start: "\"\"\""
|
||||
end: "\"\"\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- constant.string:
|
||||
start: "'''"
|
||||
end: "'''"
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- constant.string:
|
||||
start: "'"
|
||||
end: "(?<!\\\\)'"
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- comment:
|
||||
start: "#"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
## D syntax highlighting for GNU nano
|
||||
##
|
||||
## Author: Andrei Vinokurov
|
||||
## Based on D lexer specification (http://dlang.org/lex)
|
||||
|
||||
syntax "d" "\.(d(i|d)?)$"
|
||||
|
||||
## Operators and punctuation
|
||||
color statement "(\*|/|%|\+|-|>>|<<|>>>|&|\^(\^)?|\||~)?="
|
||||
color statement "\.\.(\.)?|!|\*|&|~|\(|\)|\[|\]|\\|/|\+|-|%|<|>|\?|:|;"
|
||||
|
||||
## Octal integer literals are deprecated
|
||||
color error "(0[0-7_]*)(L[uU]?|[uU]L?)?"
|
||||
|
||||
## Decimal integer literals
|
||||
color constant.number "([0-9]|[1-9][0-9_]*)(L[uU]?|[uU]L?)?"
|
||||
|
||||
## Binary integer literals
|
||||
color constant "(0[bB][01_]*)(L[uU]?|[uU]L?)?"
|
||||
|
||||
## Decimal float literals
|
||||
color constant.number "[0-9][0-9_]*\.([0-9][0-9_]*)([eE][+-]?([0-9][0-9_]*))?[fFL]?i?"
|
||||
color constant.number "[0-9][0-9_]*([eE][+-]?([0-9][0-9_]*))[fFL]?i?"
|
||||
color constant.number "[^.]\.([0-9][0-9_]*)([eE][+-]?([0-9][0-9_]*))?[fFL]?i?"
|
||||
color constant.number "[0-9][0-9_]*([fFL]?i|[fF])"
|
||||
|
||||
## Hexadecimal integer literals
|
||||
color constant.number "(0[xX]([0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F]))(L[uU]?|[uU]L?)?"
|
||||
|
||||
## Hexadecimal float literals
|
||||
color constant.number "0[xX]([0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F])(\.[0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F])?[pP][+-]?([0-9][0-9_]*)[fFL]?i?"
|
||||
color constant.number "0[xX]\.([0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F])[pP][+-]?([0-9][0-9_]*)[fFL]?i?"
|
||||
|
||||
|
||||
## Character literals
|
||||
color constant.string "'([^\']|\\(['"?\abfnrtv]|x[[:xdigit:]]{2}|[0-7]{1,3}|u[[:xdigit:]]{4}|U[[:xdigit:]]{8}|&.*;))'"
|
||||
|
||||
## Keywords
|
||||
## a-e
|
||||
color statement "\b(abstract|alias|align|asm|assert|auto|body|break|case|cast|catch|class|const|continue|debug|default|delegate|do|else|enum|export|extern)\b"
|
||||
## f-l
|
||||
color statement "\b(false|final|finally|for|foreach|foreach_reverse|function|goto|if|immutable|import|in|inout|interface|invariant|is|lazy)\b"
|
||||
## m-r
|
||||
color statement "\b(macro|mixin|module|new|nothrow|null|out|override|package|pragma|private|protected|public|pure|ref|return)\b"
|
||||
## s-w
|
||||
color statement "\b(scope|shared|static|struct|super|switch|synchronized|template|this|throw|true|try|typeid|typeof|union|unittest|version|while|with)\b"
|
||||
## __
|
||||
color statement "\b(__FILE__|__MODULE__|__LINE__|__FUNCTION__|__PRETTY_FUNCTION__|__gshared|__traits|__vector|__parameters)\b"
|
||||
|
||||
## Deprecated keywords
|
||||
color error "\b(delete|deprecated|typedef|volatile)\b"
|
||||
|
||||
## Primitive types
|
||||
color type "\b(bool|byte|cdouble|cent|cfloat|char|creal|dchar|double|float|idouble|ifloat|int|ireal|long|real|short|ubyte|ucent|uint|ulong|ushort|void|wchar)\b"
|
||||
|
||||
## Globally defined symbols
|
||||
color type "\b(string|wstring|dstring|size_t|ptrdiff_t)\b"
|
||||
|
||||
## Special tokens
|
||||
color constant "\b(__DATE__|__EOF__|__TIME__|__TIMESTAMP__|__VENDOR__|__VERSION__)\b"
|
||||
|
||||
## String literals
|
||||
## TODO: multiline backtick and doublequote string. (Unlikely possible at all with nano.)
|
||||
### DoubleQuotedString
|
||||
color constant.string ""(\\.|[^"])*""
|
||||
|
||||
### WysiwygString
|
||||
color constant.string start="r"" end="""
|
||||
color constant.string "`[^`]*`"
|
||||
|
||||
### HexString
|
||||
color constant.string "x"([[:space:]]*[[:xdigit:]][[:space:]]*[[:xdigit:]])*[[:space:]]*""
|
||||
|
||||
### DelimitedString
|
||||
color constant.string "q"\(.*\)""
|
||||
color constant.string "q"\{.*\}""
|
||||
color constant.string "q"\[.*\]""
|
||||
color constant.string "q"<.*>""
|
||||
color constant.string start="q"[^({[<"][^"]*$" end="^[^"]+""
|
||||
color constant.string "q"([^({[<"]).*""
|
||||
|
||||
### TokenString
|
||||
### True token strings require nesting, so, again, they can't be implemented accurately here.
|
||||
### At the same time, the intended purpose of token strings makes it questionable to highlight them as strings at all.
|
||||
## color ,magenta start="q\{" end="\}"
|
||||
|
||||
## Comments
|
||||
## NB: true nested brightblacks are impossible to implement with plain regex
|
||||
color comment "//.*"
|
||||
color comment start="/\*" end="\*/"
|
||||
color comment start="/\+" end="\+/"
|
||||
119
runtime/syntax/d.yaml
Normal file
119
runtime/syntax/d.yaml
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
filetype: d
|
||||
|
||||
detect:
|
||||
filename: "\\.(d(i|d)?)$"
|
||||
|
||||
rules:
|
||||
# Operators and punctuation
|
||||
- statement: "(\\*|/|%|\\+|-|>>|<<|>>>|&|\\^(\\^)?|\\||~)?="
|
||||
- statement: "\\.\\.(\\.)?|!|\\*|&|~|\\(|\\)|\\[|\\]|\\\\|/|\\+|-|%|<|>|\\?|:|;"
|
||||
# Octal integer literals are deprecated
|
||||
- error: "(0[0-7_]*)(L[uU]?|[uU]L?)?"
|
||||
# Decimal integer literals
|
||||
- constant.number: "([0-9]|[1-9][0-9_]*)(L[uU]?|[uU]L?)?"
|
||||
# Binary integer literals
|
||||
- constant: "(0[bB][01_]*)(L[uU]?|[uU]L?)?"
|
||||
# Decimal float literals
|
||||
- constant.number: "[0-9][0-9_]*\\.([0-9][0-9_]*)([eE][+-]?([0-9][0-9_]*))?[fFL]?i?"
|
||||
- constant.number: "[0-9][0-9_]*([eE][+-]?([0-9][0-9_]*))[fFL]?i?"
|
||||
- constant.number: "[^.]\\.([0-9][0-9_]*)([eE][+-]?([0-9][0-9_]*))?[fFL]?i?"
|
||||
- constant.number: "[0-9][0-9_]*([fFL]?i|[fF])"
|
||||
# Hexadecimal integer literals
|
||||
- constant.number: "(0[xX]([0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F]))(L[uU]?|[uU]L?)?"
|
||||
# Hexadecimal float literals
|
||||
- constant.number: "0[xX]([0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F])(\\.[0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F])?[pP][+-]?([0-9][0-9_]*)[fFL]?i?"
|
||||
- constant.number: "0[xX]\\.([0-9a-fA-F][0-9a-fA-F_]*|[0-9a-fA-F_]*[0-9a-fA-F])[pP][+-]?([0-9][0-9_]*)[fFL]?i?"
|
||||
# Character literals
|
||||
- constant.string:
|
||||
start: "'"
|
||||
end: "(?<!\\\\)'"
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
# Keywords
|
||||
# a-e
|
||||
- statement: "\\b(abstract|alias|align|asm|assert|auto|body|break|case|cast|catch|class|const|continue|debug|default|delegate|do|else|enum|export|extern)\\b"
|
||||
# f-l
|
||||
- statement: "\\b(false|final|finally|for|foreach|foreach_reverse|function|goto|if|immutable|import|in|inout|interface|invariant|is|lazy)\\b"
|
||||
# m-r
|
||||
- statement: "\\b(macro|mixin|module|new|nothrow|null|out|override|package|pragma|private|protected|public|pure|ref|return)\\b"
|
||||
# s-w
|
||||
- statement: "\\b(scope|shared|static|struct|super|switch|synchronized|template|this|throw|true|try|typeid|typeof|union|unittest|version|while|with)\\b"
|
||||
# __
|
||||
- statement: "\\b(__FILE__|__MODULE__|__LINE__|__FUNCTION__|__PRETTY_FUNCTION__|__gshared|__traits|__vector|__parameters)\\b"
|
||||
# Deprecated keywords
|
||||
- error: "\\b(delete|deprecated|typedef|volatile)\\b"
|
||||
# Primitive types
|
||||
- type: "\\b(bool|byte|cdouble|cent|cfloat|char|creal|dchar|double|float|idouble|ifloat|int|ireal|long|real|short|ubyte|ucent|uint|ulong|ushort|void|wchar)\\b"
|
||||
# Globally defined symbols
|
||||
- type: "\\b(string|wstring|dstring|size_t|ptrdiff_t)\\b"
|
||||
# Special tokens
|
||||
- constant: "\\b(__DATE__|__EOF__|__TIME__|__TIMESTAMP__|__VENDOR__|__VERSION__)\\b"
|
||||
# String literals
|
||||
# DoubleQuotedString
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
# WysiwygString
|
||||
- constant.string:
|
||||
start: "r\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
- constant.string:
|
||||
start: "`"
|
||||
end: "`"
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
# HexString
|
||||
- constant.string:
|
||||
start: "x\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
# DelimitedString
|
||||
- constant.string:
|
||||
start: "q\"\\("
|
||||
end: "\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
- constant.string:
|
||||
start: "q\"\\{"
|
||||
end: "q\"\\}"
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
- constant.string:
|
||||
start: "q\"\\["
|
||||
end: "q\"\\]"
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
- constant.string:
|
||||
start: "q\"<"
|
||||
end: "q\">"
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
- constant.string:
|
||||
start: "q\"[^({[<\"][^\"]*$"
|
||||
end: "^[^\"]+\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
- constant.string:
|
||||
start: "q\"([^({[<\"])"
|
||||
end: "\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
# Comments
|
||||
- comment:
|
||||
start: "//"
|
||||
end: "$"
|
||||
rules: []
|
||||
- comment:
|
||||
start: "/\\*"
|
||||
end: "\\*/"
|
||||
rules: []
|
||||
- comment:
|
||||
start: "/\\+"
|
||||
end: "\\+/"
|
||||
rules: []
|
||||
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
syntax "dart" "\.dart$"
|
||||
|
||||
color constant.number "\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\b"
|
||||
color constant.number "\b[-+]?([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"
|
||||
color constant.number "\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
|
||||
color identifier "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]"
|
||||
color statement "\b(break|case|catch|continue|default|else|finally)\b"
|
||||
color statement "\b(for|function|get|if|in|as|is|new|return|set|switch|final|await|async|sync)\b"
|
||||
color statement "\b(switch|this|throw|try|var|void|while|with|import|library|part|const|export)\b"
|
||||
color constant.bool "\b(true|false|null)\b"
|
||||
color type "\b(List|String)\b"
|
||||
color type "\b(int|num|double|bool)\b"
|
||||
color symbol.operator "[-+/*=<>!~%?:&|]"
|
||||
color constant "/[^*]([^/]|(\\/))*[^\\]/[gim]*"
|
||||
color constant "\\[0-7][0-7]?[0-7]?|\\x[0-9a-fA-F]+|\\[bfnrt'"\?\\]"
|
||||
color comment "(^|[[:space:]])//.*"
|
||||
color comment "/\*.+\*/"
|
||||
color todo "TODO:?"
|
||||
color constant.string ""(\\.|[^"])*"|'(\\.|[^'])*'"
|
||||
44
runtime/syntax/dart.yaml
Normal file
44
runtime/syntax/dart.yaml
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
filetype: dart
|
||||
|
||||
detect:
|
||||
filename: "\\.dart$"
|
||||
|
||||
rules:
|
||||
- constant.number: "\\b[-+]?([1-9][0-9]*|0[0-7]*|0x[0-9a-fA-F]+)([uU][lL]?|[lL][uU]?)?\\b"
|
||||
- constant.number: "\\b[-+]?([0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)([EePp][+-]?[0-9]+)?[fFlL]?"
|
||||
- constant.number: "\\b[-+]?([0-9]+[EePp][+-]?[0-9]+)[fFlL]?"
|
||||
- identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[(]"
|
||||
- statement: "\\b(break|case|catch|continue|default|else|finally)\\b"
|
||||
- statement: "\\b(for|function|get|if|in|as|is|new|return|set|switch|final|await|async|sync)\\b"
|
||||
- statement: "\\b(switch|this|throw|try|var|void|while|with|import|library|part|const|export)\\b"
|
||||
- constant: "\\b(true|false|null)\\b"
|
||||
- type: "\\b(List|String)\\b"
|
||||
- type: "\\b(int|num|double|bool)\\b"
|
||||
- statement: "[-+/*=<>!~%?:&|]"
|
||||
- constant: "/[^*]([^/]|(\\\\/))*[^\\\\]/[gim]*"
|
||||
- constant: "\\\\[0-7][0-7]?[0-7]?|\\\\x[0-9a-fA-F]+|\\\\[bfnrt'\"\\?\\\\]"
|
||||
|
||||
- comment:
|
||||
start: "//"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "TODO:?"
|
||||
|
||||
- comment:
|
||||
start: "/\\*"
|
||||
end: "\\*/"
|
||||
rules:
|
||||
- todo: "TODO:?"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- constant.string:
|
||||
start: "'"
|
||||
end: "(?<!\\\\)'"
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
34
runtime/syntax/dockerfile.yaml
Normal file
34
runtime/syntax/dockerfile.yaml
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
filetype: dockerfile
|
||||
|
||||
detect:
|
||||
filename: "(Dockerfile[^/]*$|\\.dockerfile$)"
|
||||
|
||||
rules:
|
||||
## Keywords
|
||||
- keyword: "(?i)^(FROM|MAINTAINER|RUN|CMD|LABEL|EXPOSE|ENV|ADD|COPY|ENTRYPOINT|VOLUME|USER|WORKDIR|ONBUILD|ARG|HEALTHCHECK|STOPSIGNAL|SHELL)[[:space:]]"
|
||||
|
||||
## Brackets & parenthesis
|
||||
- statement: "(\\(|\\)|\\[|\\])"
|
||||
|
||||
## Double ampersand
|
||||
- special: "&&"
|
||||
|
||||
## Comments
|
||||
- comment:
|
||||
start: "#"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- constant.string:
|
||||
start: "'"
|
||||
end: "(?<!\\\\)'"
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
syntax "dot" "\.(dot|gv)$"
|
||||
|
||||
color type "\b(digraph|edge|graph|node|subgraph)\b"
|
||||
color 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"
|
||||
color symbol "=|->|--"
|
||||
color constant.string ""(\\.|[^"])*"|'(\\.|[^'])*'"
|
||||
color comment "(^|[[:space:]])//.*"
|
||||
color comment start="/\*" end="\*/"
|
||||
28
runtime/syntax/dot.yaml
Normal file
28
runtime/syntax/dot.yaml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
filetype: dot
|
||||
|
||||
detect:
|
||||
filename: "\\.(dot|gv)$"
|
||||
|
||||
rules:
|
||||
- type: "\\b(digraph|edge|graph|node|subgraph)\\b"
|
||||
- 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"
|
||||
- symbol: "=|->|--"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- comment:
|
||||
start: "//"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
- comment:
|
||||
start: "/\\*"
|
||||
end: "\\*/"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
## A HTML+Ruby set for Syntax Highlighting .erb files (Embedded RubyRails Views etc) ERB
|
||||
## (c) 2009, Georgios V. Michalakidis - g.michalakidis@computer.org
|
||||
## Licensed under the CC (Creative Commons) License.
|
||||
##
|
||||
## https://github.com/geomic/ERB-And-More-Code-Highlighting-for-nano
|
||||
#Note for dummies like me who had no idea what Embedded Ruby is:
|
||||
# https://en.wikipedia.org/wiki/ERuby
|
||||
# It's like Ruby for your browser. Heh. Cheers, CaptainMcClellan
|
||||
|
||||
syntax "erb" "\.erb$" "\.rhtml$"
|
||||
#Highlights from html-land
|
||||
color error "<[^!].*?>"
|
||||
color 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)( .*|>)*?>"
|
||||
color symbol.tag.extended "(?i)<[/]?(body|div|html|head(er)?|footer|title|table|t(body|d|h(ead)?|r|foot))( .*|>)*?>"
|
||||
color preproc "(?i)<[/]?(script|style)( .*|>)*?>"
|
||||
color special "&[^;[[:space:]]]*;"
|
||||
color symbol "[:=]"
|
||||
color identifier "(alt|bgcolor|height|href|id|label|longdesc|name|onclick|onfocus|onload|onmouseover|size|span|src|style|target|type|value|width)="
|
||||
color constant.string ""[^"]*""
|
||||
color constant.number "(?i)#[0-9A-F]{6,6}"
|
||||
color constant.string.url "(ftp(s)?|http(s)?|git|chrome)://[^ ]+"
|
||||
color comment "<!--.+?-->"
|
||||
color preproc "<!DOCTYPE.+?>"
|
||||
## The tags that were here before. Disabled now.
|
||||
#color symbol.tag start="<" end=">"
|
||||
#Reset syntax highlighting for ruby
|
||||
color default start="<%" end="%>"
|
||||
color preproc "<%|%>"
|
||||
color red "&[^;[[:space:]]]*;"
|
||||
color 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"
|
||||
color identifier.var "(\$|@|@@)?\b[A-Z]+[0-9A-Z_a-z]*"
|
||||
color magenta "(?i)([ ]|^):[0-9A-Z_]+\b"
|
||||
color identifier.macro "\b(__FILE__|__LINE__)\b"
|
||||
color brightmagenta "!/([^/]|(\\/))*/[iomx]*" "%r\{([^}]|(\\}))*\}[iomx]*"
|
||||
color brightblue "`[^`]*`" "%x\{[^}]*\}"
|
||||
color constant.string ""([^"]|(\\"))*"" "%[QW]?\{[^}]*\}" "%[QW]?\([^)]*\)" "%[QW]?<[^>]*>" "%[QW]?\[[^]]*\]" "%[QW]?\$[^$]*\$" "%[QW]?\^[^^]*\^" "%[QW]?![^!]*!"
|
||||
color brightgreen "#\{[^}]*\}"
|
||||
color green "'([^']|(\\'))*'" "%[qw]\{[^}]*\}" "%[qw]\([^)]*\)" "%[qw]<[^>]*>" "%[qw]\[[^]]*\]" "%[qw]\$[^$]*\$" "%[qw]\^[^^]*\^" "%[qw]![^!]*!"
|
||||
color comment "#[^{].*$" "#$"
|
||||
color comment.bright "##[^{].*$" "##$"
|
||||
color identifier.macro start="<<-?'?EOT'?" end="^EOT"
|
||||
color todo "(XXX|TODO|FIXME|\?\?\?)"
|
||||
|
||||
42
runtime/syntax/erb.yaml
Normal file
42
runtime/syntax/erb.yaml
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
filetype: erb
|
||||
|
||||
detect:
|
||||
filename: "\\.erb$|\\.rhtml$"
|
||||
|
||||
rules:
|
||||
- error: "<[^!].*?>"
|
||||
- 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)( .*|>)*?>"
|
||||
- symbol.tag.extended: "(?i)<[/]?(body|div|html|head(er)?|footer|title|table|t(body|d|h(ead)?|r|foot))( .*|>)*?>"
|
||||
- preproc: "(?i)<[/]?(script|style)( .*|>)*?>"
|
||||
- special: "&[^;[[:space:]]]*;"
|
||||
- symbol: "[:=]"
|
||||
- identifier: "(alt|bgcolor|height|href|id|label|longdesc|name|onclick|onfocus|onload|onmouseover|size|span|src|style|target|type|value|width)="
|
||||
- constant.string: "\"[^\"]*\""
|
||||
- constant.number: "(?i)#[0-9A-F]{6,6}"
|
||||
- constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+"
|
||||
- comment: "<!--.+?-->"
|
||||
- preproc: "<!DOCTYPE.+?>"
|
||||
- default:
|
||||
start: "<%"
|
||||
end: "%>"
|
||||
rules: []
|
||||
|
||||
- preproc: "<%|%>"
|
||||
- red: "&[^;[[:space:]]]*;"
|
||||
- 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"
|
||||
- identifier.var: "(\\$|@|@@)?\\b[A-Z]+[0-9A-Z_a-z]*"
|
||||
- magenta: "(?i)([ ]|^):[0-9A-Z_]+\\b"
|
||||
- identifier.macro: "\\b(__FILE__|__LINE__)\\b"
|
||||
- brightmagenta: "!/([^/]|(\\\\/))*/[iomx]*|%r\\{([^}]|(\\\\}))*\\}[iomx]*"
|
||||
- brightblue: "`[^`]*`|%x\\{[^}]*\\}"
|
||||
- constant.string: "\"([^\"]|(\\\\\"))*\"|%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\[[^]]*\\]|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!"
|
||||
- brightgreen: "#\\{[^}]*\\}"
|
||||
- green: "'([^']|(\\\\'))*'|%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!"
|
||||
- comment: "#[^{].*$|#$"
|
||||
- comment.bright: "##[^{].*$|##$"
|
||||
- identifier.macro:
|
||||
start: "<<-?'?EOT'?"
|
||||
end: "^EOT"
|
||||
rules: []
|
||||
|
||||
- todo: "(XXX|TODO|FIXME|\\?\\?\\?)"
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
syntax "fish" "\.fish$"
|
||||
header "^#!.*/(env +)?fish( |$)"
|
||||
|
||||
# Numbers
|
||||
color constant.number "\b[0-9]+\b"
|
||||
|
||||
# Conditionals and control flow
|
||||
color statement "\b(and|begin|case|else|end|for|function|if|in|not|or|select|shift|switch|while)\b"
|
||||
color special "\b(break|continue|return)\b"
|
||||
color symbol "(\;|`|\\|\$|<|>|^|!|=|&|\|)"
|
||||
color symbol.brackets "\{|\}|\(|\)|\[|\]"
|
||||
# Fish commands
|
||||
color 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"
|
||||
|
||||
# Common linux commands
|
||||
color type "\b((g|ig)?awk|bash|dash|find|\w{0,4}grep|kill|killall|\w{0,4}less|make|pkill|sed|sh|tar)\b"
|
||||
|
||||
# Coreutils commands
|
||||
color 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"
|
||||
|
||||
# Conditional flags
|
||||
color statement "--[a-z-]+"
|
||||
color statement "\ -[a-z]+"
|
||||
|
||||
# Strings
|
||||
color constant.string ""(\\.|[^"])*""
|
||||
color constant.string "'(\\.|[^'])*'"
|
||||
color constant.specialChar """
|
||||
color constant.specialChar "'"
|
||||
|
||||
# Variables
|
||||
color identifier "\$\{?[0-9A-Za-z_!@#$*?-]+\}?"
|
||||
|
||||
# Comments & TODOs
|
||||
color comment "(^|[[:space:]])#.*$"
|
||||
color todo "(TODO|XXX|FIXME):?"
|
||||
|
||||
# Shebang
|
||||
color preproc.shebang "^#!.+?( |$)"
|
||||
46
runtime/syntax/fish.yaml
Normal file
46
runtime/syntax/fish.yaml
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
filetype: fish
|
||||
|
||||
detect:
|
||||
filename: "\\.fish$"
|
||||
header: "^#!.*/(env +)?fish( |$)"
|
||||
|
||||
rules:
|
||||
# Numbers
|
||||
- constant: "\\b[0-9]+\\b"
|
||||
|
||||
# Conditionals and control flow
|
||||
- statement: "\\b(and|begin|break|case|continue|else|end|for|function|if|in|not|or|return|select|shift|switch|while)\\b"
|
||||
- special: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|^|!|=|&|\\|)"
|
||||
|
||||
# Fish commands
|
||||
- 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"
|
||||
|
||||
# Common linux commands
|
||||
- type: "\\b((g|ig)?awk|bash|dash|find|\\w{0,4}grep|kill|killall|\\w{0,4}less|make|pkill|sed|sh|tar)\\b"
|
||||
|
||||
# Coreutils commands
|
||||
- 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"
|
||||
|
||||
# Conditional flags
|
||||
- statement: "--[a-z-]+"
|
||||
- statement: "\\ -[a-z]+"
|
||||
|
||||
- identifier: "(?i)\\$\\{?[0-9A-Z_!@#$*?-]+\\}?"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- constant.string:
|
||||
start: "'"
|
||||
end: "(?<!\\\\)'"
|
||||
rules: []
|
||||
|
||||
- comment:
|
||||
start: "#"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
## Here is an example for Fortran 90/95
|
||||
|
||||
syntax "fortran" "\.([Ff]|[Ff]90|[Ff]95|[Ff][Oo][Rr])$"
|
||||
|
||||
#color red "\b[A-Z_]a[0-9A-Z_]+\b"
|
||||
color constant.number "\b[0-9]+\b"
|
||||
|
||||
color type "(?i)\b(action|advance|all|allocatable|allocated|any|apostrophe)\b"
|
||||
color type "(?i)\b(append|asis|assign|assignment|associated|character|common)\b"
|
||||
color type "(?i)\b(complex|data|default|delim|dimension|double precision)\b"
|
||||
color type "(?i)\b(elemental|epsilon|external|file|fmt|form|format|huge)\b"
|
||||
color type "(?i)\b(implicit|include|index|inquire|integer|intent|interface)\b"
|
||||
color type "(?i)\b(intrinsic|iostat|kind|logical|module|none|null|only)\\b"
|
||||
color type "(?i)\b(operator|optional|pack|parameter|pointer|position|private)\b"
|
||||
color type "(?i)\b(program|public|real|recl|recursive|selected_int_kind)\b"
|
||||
color type "(?i)\b(selected_real_kind|subroutine|status)\b"
|
||||
|
||||
color constant "(?i)\b(abs|achar|adjustl|adjustr|allocate|bit_size|call|char)\b"
|
||||
color constant "(?i)\b(close|contains|count|cpu_time|cshift|date_and_time)\b"
|
||||
color constant "(?i)\b(deallocate|digits|dot_product|eor|eoshift|function|iachar)\b"
|
||||
color constant "(?i)\b(iand|ibclr|ibits|ibset|ichar|ieor|iolength|ior|ishft|ishftc)\b"
|
||||
color constant "(?i)\b(lbound|len|len_trim|matmul|maxexponent|maxloc|maxval|merge)\b"
|
||||
color constant "(?i)\b(minexponent|minloc|minval|mvbits|namelist|nearest|nullify)\b"
|
||||
color constant "(?i)\b(open|pad|present|print|product|pure|quote|radix)\b"
|
||||
color constant "(?i)\b(random_number|random_seed|range|read|readwrite|replace)\b"
|
||||
color constant "(?i)\b(reshape|rewind|save|scan|sequence|shape|sign|size|spacing)\b"
|
||||
color constant "(?i)\b(spread|sum|system_clock|target|transfer|transpose|trim)\b"
|
||||
color constant "(?i)\b(ubound|unpack|verify|write|tiny|type|use|yes)\b"
|
||||
|
||||
color statement "(?i)\b(.and.|case|do|else|else?if|else?where|end|end?do|end?if)\b"
|
||||
color statement "(?i)\b(end?select|.eqv.|forall|if|lge|lgt|lle|llt|.neqv.|.not.)\b"
|
||||
color statement "(?i)\b(.or.|repeat|select case|then|where|while)\b"
|
||||
|
||||
color special "(?i)\b(continue|cycle|exit|go?to|result|return)\b"
|
||||
|
||||
#Operator Color
|
||||
color symbol.operator "[.:;,+*|=!\%]" "\b" "\b" "/" "-" "&"
|
||||
|
||||
#Parenthetical Color
|
||||
color symbol.bracket "[(){}]" "\[" "\]"
|
||||
|
||||
# Add preprocessor commands.
|
||||
color preproc "^[[:space:]]*#[[:space:]]*(define|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
|
||||
|
||||
## String highlighting.
|
||||
color constant.string "\b[^= ]*\b" ""(\\.|[^"])*""
|
||||
color constant.string "\b[^= ]*\b" "'(\\.|[^"])*'"
|
||||
|
||||
## Comment highlighting
|
||||
color comment "!.*$" "(^[Cc]| [Cc]) .*$"
|
||||
|
||||
61
runtime/syntax/fortran.yaml
Normal file
61
runtime/syntax/fortran.yaml
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
filetype: fortran
|
||||
|
||||
detect:
|
||||
filename: "\\.([Ff]|[Ff]90|[Ff]95|[Ff][Oo][Rr])$"
|
||||
|
||||
rules:
|
||||
- type: "(?i)\\b(action|advance|all|allocatable|allocated|any|apostrophe)\\b"
|
||||
- type: "(?i)\\b(append|asis|assign|assignment|associated|character|common)\\b"
|
||||
- type: "(?i)\\b(complex|data|default|delim|dimension|double precision)\\b"
|
||||
- type: "(?i)\\b(elemental|epsilon|external|file|fmt|form|format|huge)\\b"
|
||||
- type: "(?i)\\b(implicit|include|index|inquire|integer|intent|interface)\\b"
|
||||
- type: "(?i)\\b(intrinsic|iostat|kind|logical|module|none|null|only)\\\\b"
|
||||
- type: "(?i)\\b(operator|optional|pack|parameter|pointer|position|private)\\b"
|
||||
- type: "(?i)\\b(program|public|real|recl|recursive|selected_int_kind)\\b"
|
||||
- type: "(?i)\\b(selected_real_kind|subroutine|status)\\b"
|
||||
|
||||
- constant: "(?i)\\b(abs|achar|adjustl|adjustr|allocate|bit_size|call|char)\\b"
|
||||
- constant: "(?i)\\b(close|contains|count|cpu_time|cshift|date_and_time)\\b"
|
||||
- constant: "(?i)\\b(deallocate|digits|dot_product|eor|eoshift|function|iachar)\\b"
|
||||
- constant: "(?i)\\b(iand|ibclr|ibits|ibset|ichar|ieor|iolength|ior|ishft|ishftc)\\b"
|
||||
- constant: "(?i)\\b(lbound|len|len_trim|matmul|maxexponent|maxloc|maxval|merge)\\b"
|
||||
- constant: "(?i)\\b(minexponent|minloc|minval|mvbits|namelist|nearest|nullify)\\b"
|
||||
- constant: "(?i)\\b(open|pad|present|print|product|pure|quote|radix)\\b"
|
||||
- constant: "(?i)\\b(random_number|random_seed|range|read|readwrite|replace)\\b"
|
||||
- constant: "(?i)\\b(reshape|rewind|save|scan|sequence|shape|sign|size|spacing)\\b"
|
||||
- constant: "(?i)\\b(spread|sum|system_clock|target|transfer|transpose|trim)\\b"
|
||||
- constant: "(?i)\\b(ubound|unpack|verify|write|tiny|type|use|yes)\\b"
|
||||
|
||||
- statement: "(?i)\\b(.and.|case|do|else|else?if|else?where|end|end?do|end?if)\\b"
|
||||
- statement: "(?i)\\b(end?select|.eqv.|forall|if|lge|lgt|lle|llt|.neqv.|.not.)\\b"
|
||||
- statement: "(?i)\\b(.or.|repeat|select case|then|where|while)\\b"
|
||||
|
||||
- special: "(?i)\\b(continue|cycle|exit|go?to|result|return)\\b"
|
||||
|
||||
#Operator Color
|
||||
- symbol.operator: "[.:;,+*|=!\\%]|/|-|&"
|
||||
|
||||
#Parenthetical Color
|
||||
- symbol.bracket: "[(){}]|\\[|\\]"
|
||||
|
||||
# Add preprocessor commands.
|
||||
- preproc: "^[[:space:]]*#[[:space:]]*(define|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- constant.string:
|
||||
start: "'"
|
||||
end: "(?<!\\\\)'"
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- comment:
|
||||
start: "!"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
## GDScript syntax file, based on Python syntax file.
|
||||
##
|
||||
syntax "gdscript" "\.gd$"
|
||||
|
||||
## built-in objects
|
||||
color constant "\b(null|self|true|false)\b"
|
||||
## built-in attributes
|
||||
# color constant "\b()\b"
|
||||
## built-in functions
|
||||
color 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"
|
||||
## special method names
|
||||
color identifier "\b(AnimationPlayer|AnimationTreePlayer|Button|Control|HTTPClient|HTTPRequest|Input|InputEvent|MainLoop|Node|Node2D|SceneTree|Spatial|SteamPeer|PacketPeer|PacketPeerUDP|Timer|Tween)\b"
|
||||
## types
|
||||
color type "\b(Vector2|Vector3)\b"
|
||||
## definitions
|
||||
color identifier "func [a-zA-Z_0-9]+"
|
||||
## keywords
|
||||
color statement "\b(and|as|assert|break|breakpoint|class|const|continue|elif|else|export|extends|for|func|if|in|map|not|onready|or|pass|return|signal|var|while|yield)\b"
|
||||
|
||||
## decorators
|
||||
color special "@.*[(]"
|
||||
|
||||
## operators
|
||||
color statement "[.:;,+*|=!\%@]" "<" ">" "/" "-" "&"
|
||||
|
||||
## parentheses
|
||||
color statement "[(){}]" "\[" "\]"
|
||||
|
||||
## numbers
|
||||
color constant "\b[0-9]+\b"
|
||||
|
||||
## strings
|
||||
color constant.number "\b([0-9]+|0x[0-9a-fA-F]*)\b|'.'"
|
||||
color constant.string ""(\\.|[^"])*"|'(\\.|[^'])*'"
|
||||
color constant.specialChar "\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
|
||||
color constant.string "`[^`]*`"
|
||||
|
||||
## brightblacks
|
||||
color comment "#.*$"
|
||||
|
||||
## block brightblacks
|
||||
color comment start=""""([^"]|$)" end="""""
|
||||
color comment start="'''([^']|$)" end="'''"
|
||||
69
runtime/syntax/gdscript.yaml
Normal file
69
runtime/syntax/gdscript.yaml
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
filetype: gdscript
|
||||
|
||||
detect:
|
||||
filename: "\\.gd$"
|
||||
|
||||
rules:
|
||||
# built-in objects
|
||||
- constant: "\\b(null|self|true|false)\\b"
|
||||
# built-in attributes
|
||||
# color constant "\\b()\\b"
|
||||
# built-in functions
|
||||
- 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"
|
||||
# special method names
|
||||
- identifier: "\\b(AnimationPlayer|AnimationTreePlayer|Button|Control|HTTPClient|HTTPRequest|Input|InputEvent|MainLoop|Node|Node2D|SceneTree|Spatial|SteamPeer|PacketPeer|PacketPeerUDP|Timer|Tween)\\b"
|
||||
# types
|
||||
- type: "\\b(Vector2|Vector3)\\b"
|
||||
# definitions
|
||||
- identifier: "func [a-zA-Z_0-9]+"
|
||||
# keywords
|
||||
- statement: "\\b(and|as|assert|break|breakpoint|class|const|continue|elif|else|export|extends|for|func|if|in|map|not|onready|or|pass|return|signal|var|while|yield)\\b"
|
||||
|
||||
# decorators
|
||||
- special: "@.*[(]"
|
||||
|
||||
# operators
|
||||
- statement: "[.:;,+*|=!\\%@]|<|>|/|-|&"
|
||||
|
||||
# parentheses
|
||||
- statement: "[(){}]|\\[|\\]"
|
||||
|
||||
# numbers
|
||||
- constant: "\\b[0-9]+\\b"
|
||||
- constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'"
|
||||
|
||||
- comment:
|
||||
start: "\"\"\""
|
||||
end: "\"\"\""
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
- comment:
|
||||
start: "'''"
|
||||
end: "'''"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
|
||||
|
||||
- constant.string:
|
||||
start: "'"
|
||||
end: "(?<!\\\\)'"
|
||||
rules:
|
||||
- constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
|
||||
|
||||
- constant.string:
|
||||
start: "`"
|
||||
end: "`"
|
||||
rules: []
|
||||
|
||||
- comment:
|
||||
start: "#"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
## Here is an example for ebuilds/eclasses
|
||||
##
|
||||
syntax "ebuild" "\.e(build|class)$"
|
||||
## All the standard portage functions
|
||||
color identifier "^src_(unpack|compile|install|test)" "^pkg_(config|nofetch|setup|(pre|post)(inst|rm))"
|
||||
## Highlight bash related syntax
|
||||
color 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"
|
||||
color statement "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
|
||||
color statement "-(e|d|f|r|g|u|w|x|L)\b"
|
||||
color statement "-(eq|ne|gt|lt|ge|le|s|n|z)\b"
|
||||
## Highlight variables ... official portage ones in red, all others in bright red
|
||||
color preproc "\$\{?[a-zA-Z_0-9]+\}?"
|
||||
color special "\b(ARCH|HOMEPAGE|DESCRIPTION|IUSE|SRC_URI|LICENSE|SLOT|KEYWORDS|FILESDIR|WORKDIR|(P|R)?DEPEND|PROVIDE|DISTDIR|RESTRICT|USERLAND)\b"
|
||||
color special "\b(S|D|T|PV|PF|P|PN|A)\b" "\bC(XX)?FLAGS\b" "\bLDFLAGS\b" "\bC(HOST|TARGET|BUILD)\b"
|
||||
## Highlight portage commands
|
||||
color identifier "\buse(_(with|enable))?\b [!a-zA-Z0-9_+ -]*" "inherit.*"
|
||||
color statement "\be(begin|end|conf|install|make|warn|infon?|error|log|patch|new(group|user))\b"
|
||||
color statement "\bdie\b" "\buse(_(with|enable))?\b" "\binherit\b" "\bhas\b" "\b(has|best)_version\b" "\bunpack\b"
|
||||
color statement "\b(do|new)(ins|s?bin|doc|lib(\.so|\.a)|man|info|exe|initd|confd|envd|pam|menu|icon)\b"
|
||||
color statement "\bdo(python|sed|dir|hard|sym|html|jar|mo)\b" "\bkeepdir\b"
|
||||
color statement "prepall(docs|info|man|strip)" "prep(info|lib|lib\.(so|a)|man|strip)"
|
||||
color statement "\b(doc|ins|exe)into\b" "\bf(owners|perms)\b" "\b(exe|ins|dir)opts\b"
|
||||
## Highlight common commands used in ebuilds
|
||||
color type "\bmake\b" "\b(cat|cd|chmod|chown|cp|echo|env|export|grep|let|ln|mkdir|mv|rm|sed|set|tar|touch|unset)\b"
|
||||
## Highlight comments (doesnt work that well)
|
||||
color comment "#.*$"
|
||||
## Highlight strings (doesnt work that well)
|
||||
color constant.string ""(\\.|[^\"])*"" "'(\\.|[^'])*'"
|
||||
46
runtime/syntax/gentoo-ebuild.yaml
Normal file
46
runtime/syntax/gentoo-ebuild.yaml
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
filetype: ebuild
|
||||
|
||||
detect:
|
||||
filename: "\\.e(build|class)$"
|
||||
|
||||
rules:
|
||||
# All the standard portage functions
|
||||
- identifier: "^src_(unpack|compile|install|test)|^pkg_(config|nofetch|setup|(pre|post)(inst|rm))"
|
||||
# Highlight bash related syntax
|
||||
- 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"
|
||||
- statement: "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|!|=|&|\\|)"
|
||||
- statement: "-(e|d|f|r|g|u|w|x|L)\\b"
|
||||
- statement: "-(eq|ne|gt|lt|ge|le|s|n|z)\\b"
|
||||
# Highlight variables ... official portage ones in red, all others in bright red
|
||||
- preproc: "\\$\\{?[a-zA-Z_0-9]+\\}?"
|
||||
- special: "\\b(ARCH|HOMEPAGE|DESCRIPTION|IUSE|SRC_URI|LICENSE|SLOT|KEYWORDS|FILESDIR|WORKDIR|(P|R)?DEPEND|PROVIDE|DISTDIR|RESTRICT|USERLAND)\\b"
|
||||
- special: "\\b(S|D|T|PV|PF|P|PN|A)\\b|\\bC(XX)?FLAGS\\b|\\bLDFLAGS\\b|\\bC(HOST|TARGET|BUILD)\\b"
|
||||
# Highlight portage commands
|
||||
- identifier: "\\buse(_(with|enable))?\\b [!a-zA-Z0-9_+ -]*|inherit.*"
|
||||
- statement: "\\be(begin|end|conf|install|make|warn|infon?|error|log|patch|new(group|user))\\b"
|
||||
- statement: "\\bdie\\b|\\buse(_(with|enable))?\\b|\\binherit\\b|\\bhas\\b|\\b(has|best)_version\\b|\\bunpack\\b"
|
||||
- statement: "\\b(do|new)(ins|s?bin|doc|lib(\\.so|\\.a)|man|info|exe|initd|confd|envd|pam|menu|icon)\\b"
|
||||
- statement: "\\bdo(python|sed|dir|hard|sym|html|jar|mo)\\b|\\bkeepdir\\b"
|
||||
- statement: "prepall(docs|info|man|strip)|prep(info|lib|lib\\.(so|a)|man|strip)"
|
||||
- statement: "\\b(doc|ins|exe)into\\b|\\bf(owners|perms)\\b|\\b(exe|ins|dir)opts\\b"
|
||||
# Highlight common commands used in ebuilds
|
||||
- type: "\\bmake\\b|\\b(cat|cd|chmod|chown|cp|echo|env|export|grep|let|ln|mkdir|mv|rm|sed|set|tar|touch|unset)\\b"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- constant.string:
|
||||
start: "'"
|
||||
end: "(?<!\\\\)'"
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- comment:
|
||||
start: "#"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
## Here is an example for Portage control files
|
||||
##
|
||||
syntax "etc-portage" "\.(keywords|mask|unmask|use)$"
|
||||
## Base text:
|
||||
color default "^.+$"
|
||||
## Use flags:
|
||||
color constant.bool.false "[[:space:]]+\+?[a-zA-Z0-9_-]+"
|
||||
color constant.bool.true "[[:space:]]+-[a-zA-Z0-9_-]+"
|
||||
## Likely version numbers:
|
||||
color special "-[[:digit:]].*([[:space:]]|$)"
|
||||
## Accepted arches:
|
||||
color identifier.class "[~-]?\b(alpha|amd64|arm|hppa|ia64|mips|ppc|ppc64|s390|sh|sparc|x86|x86-fbsd)\b"
|
||||
color identifier.class "[[:space:]][~-]?\*"
|
||||
## Categories:
|
||||
color statement "^[[:space:]]*.*/"
|
||||
## Masking regulators:
|
||||
color symbol "^[[:space:]]*(=|~|<|<=|=<|>|>=|=>)"
|
||||
## Comments:
|
||||
color comment "#.*$"
|
||||
23
runtime/syntax/gentoo-etc-portage.yaml
Normal file
23
runtime/syntax/gentoo-etc-portage.yaml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
filetype: etc-portage
|
||||
|
||||
detect:
|
||||
filename: "\\.(keywords|mask|unmask|use)$"
|
||||
|
||||
rules:
|
||||
# Use flags:
|
||||
- constant.bool.false: "[[:space:]]+\\+?[a-zA-Z0-9_-]+"
|
||||
- constant.bool.true: "[[:space:]]+-[a-zA-Z0-9_-]+"
|
||||
# Likely version numbers:
|
||||
- special: "-[[:digit:]].*([[:space:]]|$)"
|
||||
# Accepted arches:
|
||||
- identifier.class: "[~-]?\\b(alpha|amd64|arm|hppa|ia64|mips|ppc|ppc64|s390|sh|sparc|x86|x86-fbsd)\\b"
|
||||
- identifier.class: "[[:space:]][~-]?\\*"
|
||||
# Categories:
|
||||
- statement: "^[[:space:]]*.*/"
|
||||
# Masking regulators:
|
||||
- symbol: "^[[:space:]]*(=|~|<|<=|=<|>|>=|=>)"
|
||||
# Comments:
|
||||
- comment:
|
||||
start: "#"
|
||||
end: "$"
|
||||
rules: []
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
# This code is free software; you can redistribute it and/or modify it under
|
||||
# the terms of the new BSD License.
|
||||
#
|
||||
# Copyright (c) 2010, Sebastian Staudt
|
||||
# A nano configuration file to enable syntax highlighting of some Git specific
|
||||
# files with the GNU nano text editor (http://www.nano-editor.org)
|
||||
#
|
||||
syntax "git-commit" "COMMIT_EDITMSG|TAG_EDITMSG"
|
||||
|
||||
# Commit message
|
||||
color ignore ".*"
|
||||
|
||||
# Comments
|
||||
color comment "^#.*"
|
||||
|
||||
# Files changes
|
||||
color statement "#[[:space:]](deleted|modified|new file|renamed):[[:space:]].*"
|
||||
color statement "#[[:space:]]deleted:"
|
||||
color statement "#[[:space:]]modified:"
|
||||
color statement "#[[:space:]]new file:"
|
||||
color statement "#[[:space:]]renamed:"
|
||||
|
||||
# Untracked filenames
|
||||
color error "^# [^/?*:;{}\\]+\.[^/?*:;{}\\]+$"
|
||||
|
||||
color statement "^#[[:space:]]Changes.*[:]"
|
||||
color statement "^#[[:space:]]Your branch and '[^']+"
|
||||
color statement "^#[[:space:]]Your branch and '"
|
||||
color statement "^#[[:space:]]On branch [^ ]+"
|
||||
color statement "^#[[:space:]]On branch"
|
||||
|
||||
# Recolor hash symbols
|
||||
|
||||
# Recolor hash symbols
|
||||
color special "#"
|
||||
|
||||
# Trailing spaces (+LINT is not ok, git uses tabs)
|
||||
color ,error "[[:space:]]+$"
|
||||
28
runtime/syntax/git-commit.yaml
Normal file
28
runtime/syntax/git-commit.yaml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
filetype: git-commit
|
||||
|
||||
detect:
|
||||
filename: "COMMIT_EDITMSG|TAG_EDITMSG"
|
||||
|
||||
rules:
|
||||
# Commit message
|
||||
- ignore: ".*"
|
||||
# Comments
|
||||
- comment:
|
||||
start: "#"
|
||||
end: "$"
|
||||
rules: []
|
||||
# File changes
|
||||
- keyword: "#[[:space:]](deleted|modified|new file|renamed):[[:space:]].*"
|
||||
- keyword: "#[[:space:]]deleted:"
|
||||
- keyword: "#[[:space:]]modified:"
|
||||
- keyword: "#[[:space:]]new file:"
|
||||
- keyword: "#[[:space:]]renamed:"
|
||||
# Untracked filenames
|
||||
- error: "^# [^/?*:;{}\\\\]+\\.[^/?*:;{}\\\\]+$"
|
||||
- keyword: "^#[[:space:]]Changes.*[:]"
|
||||
- keyword: "^#[[:space:]]Your branch and '[^']+"
|
||||
- keyword: "^#[[:space:]]Your branch and '"
|
||||
- keyword: "^#[[:space:]]On branch [^ ]+"
|
||||
- keyword: "^#[[:space:]]On branch"
|
||||
# Recolor hash symbols
|
||||
- special: "#"
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
syntax "git-config" "git(config|modules)$|\.git/config$"
|
||||
|
||||
color constant.bool.true "\btrue\b"
|
||||
color constant.bool.false "\bfalse\b"
|
||||
color statement "^[[:space:]]*[^=]*="
|
||||
color constant "^[[:space:]]*\[.*\]$"
|
||||
color constant.string ""(\\.|[^"])*"|'(\\.|[^'])*'"
|
||||
color comment "(^|[[:space:]])#([^{].*)?$"
|
||||
14
runtime/syntax/git-config.yaml
Normal file
14
runtime/syntax/git-config.yaml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
filetype: git-config
|
||||
|
||||
detect:
|
||||
filename: "git(config|modules)$|\\.git/config$"
|
||||
|
||||
rules:
|
||||
- constant: "\\<(true|false)\\>"
|
||||
- keyword: "^[[:space:]]*[^=]*="
|
||||
- constant: "^[[:space:]]*\\[.*\\]$"
|
||||
- constant: "\"(\\\\.|[^\"])*\"|'(\\\\.|[^'])*'"
|
||||
- comment:
|
||||
start: "#"
|
||||
end: "$"
|
||||
rules: []
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
# This syntax format is used for interactive rebasing
|
||||
syntax "git-rebase-todo" "git-rebase-todo"
|
||||
|
||||
# Default
|
||||
color ignore ".*"
|
||||
|
||||
# Comments
|
||||
color comment "^#.*"
|
||||
|
||||
# Rebase commands
|
||||
color statement "^(e|edit) [0-9a-f]{7,40}"
|
||||
color statement "^# (e, edit)"
|
||||
color statement "^(f|fixup) [0-9a-f]{7,40}"
|
||||
color statement "^# (f, fixup)"
|
||||
color statement "^(p|pick) [0-9a-f]{7,40}"
|
||||
color statement "^# (p, pick)"
|
||||
color statement "^(r|reword) [0-9a-f]{7,40}"
|
||||
color statement "^# (r, reword)"
|
||||
color statement "^(s|squash) [0-9a-f]{7,40}"
|
||||
color statement "^# (s, squash)"
|
||||
color statement "^(x|exec) [^ ]+ [0-9a-f]{7,40}"
|
||||
color statement "^# (x, exec)"
|
||||
|
||||
# Recolor hash symbols
|
||||
color special "#"
|
||||
|
||||
# Commit IDs
|
||||
color identifier "[0-9a-f]{7,40}"
|
||||
28
runtime/syntax/git-rebase-todo.yaml
Normal file
28
runtime/syntax/git-rebase-todo.yaml
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
filetype: git-rebase-todo
|
||||
|
||||
detect:
|
||||
filename: "git-rebase-todo"
|
||||
|
||||
rules:
|
||||
# Comments
|
||||
- comment:
|
||||
start: "#"
|
||||
end: "$"
|
||||
rules: []
|
||||
# Rebase commands
|
||||
- statement: "^(e|edit) [0-9a-f]{7,40}"
|
||||
- statement: "^# (e, edit)"
|
||||
- statement: "^(f|fixup) [0-9a-f]{7,40}"
|
||||
- statement: "^# (f, fixup)"
|
||||
- statement: "^(p|pick) [0-9a-f]{7,40}"
|
||||
- statement: "^# (p, pick)"
|
||||
- statement: "^(r|reword) [0-9a-f]{7,40}"
|
||||
- statement: "^# (r, reword)"
|
||||
- statement: "^(s|squash) [0-9a-f]{7,40}"
|
||||
- statement: "^# (s, squash)"
|
||||
- statement: "^(x|exec) [^ ]+ [0-9a-f]{7,40}"
|
||||
- statement: "^# (x, exec)"
|
||||
# Recolor hash symbols
|
||||
- special: "#"
|
||||
# Commit IDs
|
||||
- identifier: "[0-9a-f]{7,40}"
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
syntax "glsl" "\.(frag|vert|fp|vp|glsl)$"
|
||||
|
||||
color identifier.class "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[()]"
|
||||
color 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"
|
||||
color identifier "\bgl_(DepthRangeParameters|PointParameters|MaterialParameters|LightSourceParameters|LightModelParameters|LightModelProducts|LightProducts|FogParameters)\b"
|
||||
color statement "\b(const|attribute|varying|uniform|in|out|inout|if|else|discard|while|for|do)\b"
|
||||
color special "\b(break|continue|return)\b"
|
||||
color constant.bool "\b(true|false)\b"
|
||||
color symbol.operator "[\-+/*=<>?:!~%&|^]"
|
||||
color constant.number "\b([0-9]+|0x[0-9a-fA-F]*)\b"
|
||||
color comment "(^|[[:space:]])//.*"
|
||||
color comment start="/\*" end="\*/"
|
||||
color todo "TODO:?"
|
||||
color indent-char.whitespace "[[:space:]]+$"
|
||||
color indent-char " + +| + +"
|
||||
26
runtime/syntax/glsl.yaml
Normal file
26
runtime/syntax/glsl.yaml
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
filetype: glsl
|
||||
|
||||
detect:
|
||||
filename: "\\.(frag|vert|fp|vp|glsl)$"
|
||||
|
||||
rules:
|
||||
- identifier: "[A-Za-z_][A-Za-z0-9_]*[[:space:]]*[()]"
|
||||
- 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"
|
||||
- identifier: "\\bgl_(DepthRangeParameters|PointParameters|MaterialParameters|LightSourceParameters|LightModelParameters|LightModelProducts|LightProducts|FogParameters)\\b"
|
||||
- statement: "\\b(const|attribute|varying|uniform|in|out|inout|if|else|return|discard|while|for|do)\\b"
|
||||
- statement: "\\b(break|continue)\\b"
|
||||
- constant.bool: "\\b(true|false)\\b"
|
||||
- symbol.operator: "[-+/*=<>?:!~%&|^]"
|
||||
- constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b"
|
||||
|
||||
- comment:
|
||||
start: "//"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "TODO:?"
|
||||
|
||||
- comment:
|
||||
start: "/\\*"
|
||||
end: "\\*/"
|
||||
rules:
|
||||
- todo: "TODO:?"
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
syntax "go" "\.go$"
|
||||
|
||||
##This file may need cleanup.
|
||||
|
||||
# Conditionals and control flow
|
||||
color special "\b(break|case|continue|default|go|goto|range|return)\b"
|
||||
color statement "\b(else|for|if|switch)\b"
|
||||
color preproc "\b(package|import|const|var|type|struct|func|go|defer|iota)\b"
|
||||
color symbol.operator "[-+/*=<>!~%&|^]|:="
|
||||
|
||||
# Types
|
||||
color special "[a-zA-Z0-9]*\("
|
||||
color symbol "(,|\.)"
|
||||
color type "\b(u?int(8|16|32|64)?|float(32|64)|complex(64|128))\b"
|
||||
color type "\b(uintptr|byte|rune|string|interface|bool|map|chan|error)\b"
|
||||
##I'm... not sure, but aren't structs a type?
|
||||
color type.keyword "\b(struct)\b"
|
||||
color constant.bool "\b(true|false|nil)\b"
|
||||
|
||||
# Brackets
|
||||
color symbol.brackets "(\{|\})"
|
||||
color symbol.brackets "(\(|\))"
|
||||
color symbol.brackets "(\[|\])"
|
||||
##Redundant??
|
||||
#color symbol.operator "!"
|
||||
#color symbol.operator ","
|
||||
|
||||
# Numbers and strings
|
||||
color constant.number "\b([0-9]+|0x[0-9a-fA-F]*)\b|'.'"
|
||||
color constant.string ""(\\.|[^"])*"|'(\\.|[^'])*'"
|
||||
color constant.specialChar "\\[abfnrtv'\"\\]"
|
||||
color constant.specialChar "\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
|
||||
color constant.string "`[^`]*`"
|
||||
|
||||
# Comments & TODOs
|
||||
color comment "(^|[[:space:]])//.*"
|
||||
color comment start="/\*" end="\*/"
|
||||
color todo "(TODO|XXX|FIXME):?"
|
||||
62
runtime/syntax/go.yaml
Normal file
62
runtime/syntax/go.yaml
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
filetype: go
|
||||
|
||||
detect:
|
||||
filename: "\\.go$"
|
||||
|
||||
rules:
|
||||
# Conditionals and control flow
|
||||
- special: "\\b(break|case|continue|default|go|goto|range|return)\\b"
|
||||
- statement: "\\b(else|for|if|switch)\\b"
|
||||
- preproc: "\\b(package|import|const|var|type|struct|func|go|defer|iota)\\b"
|
||||
- symbol.operator: "[-+/*=<>!~%&|^]|:="
|
||||
|
||||
# Types
|
||||
- special: "[a-zA-Z0-9]*\\("
|
||||
- symbol: "(,|\\.)"
|
||||
- type: "\\b(u?int(8|16|32|64)?|float(32|64)|complex(64|128))\\b"
|
||||
- type: "\\b(uintptr|byte|rune|string|interface|bool|map|chan|error)\\b"
|
||||
##I'm... not sure, but aren't structs a type?
|
||||
- type.keyword: "\\b(struct)\\b"
|
||||
- constant.bool: "\\b(true|false|nil)\\b"
|
||||
|
||||
# Brackets
|
||||
- symbol.brackets: "(\\{|\\})"
|
||||
- symbol.brackets: "(\\(|\\))"
|
||||
- symbol.brackets: "(\\[|\\])"
|
||||
|
||||
# Numbers and strings
|
||||
- constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "%."
|
||||
- constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
|
||||
- constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
|
||||
|
||||
- constant.string:
|
||||
start: "'"
|
||||
end: "(?<!\\\\)'"
|
||||
rules:
|
||||
- error: "..+"
|
||||
- constant.specialChar: "%."
|
||||
- constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
|
||||
- constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
|
||||
|
||||
- constant.string:
|
||||
start: "`"
|
||||
end: "`"
|
||||
rules: []
|
||||
|
||||
- comment:
|
||||
start: "//"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
- comment:
|
||||
start: "/\\*"
|
||||
end: "\\*/"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
syntax "golo" "\.golo$"
|
||||
|
||||
color type "\b(function|fun|)\b"
|
||||
color type "\b(struct|DynamicObject|union|AdapterFabric|Adapter|DynamicVariable|Observable)\b"
|
||||
color type "\b(list|set|array|vector|tuple|map)\b"
|
||||
color type "\b(Ok|Error|Empty|None|Some|Option|Result|Result.ok|Result.fail|Result.error|Result.empty|Optional.empty|Optional.of)\b"
|
||||
|
||||
color identifier.class "\b(augment|pimp)\b"
|
||||
color identifier.class "\b(interfaces|implements|extends|overrides|maker|newInstance)\b"
|
||||
color identifier.class "\b(isEmpty|isNone|isPresent|isSome|iterator|flattened|toList|flatMap|`and|orElseGet|`or|toResult|apply|either)\b"
|
||||
color identifier.class "\b(result|option|trying|raising|nullify|catching)\b"
|
||||
color identifier.class "\b(promise|setFuture|failedFuture|all|any)\b"
|
||||
color identifier.class "\b(initialize|initializeWithinThread|start|future|fallbackTo|onSet|onFail|cancel|enqueue)\b"
|
||||
color 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"
|
||||
color 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"
|
||||
color identifier.class "\b(emptyList|cons|lazyList|fromIter|generator|repeat|iterate)\b"
|
||||
color identifier.class "\b(asLazyList|foldl|foldr|take|takeWhile|drop|dropWhile|subList)\b"
|
||||
color identifier.class "\b(import)\b"
|
||||
color identifier.class "\b(module)\b"
|
||||
color identifier.class "\b(JSON)\b"
|
||||
color identifier.class "\b(stringify|parse|toJSON|toDynamicObject|updateFromJSON)\b"
|
||||
color identifier.class "\b(newInstance|define|getKey|getValue|properties|fallback)\b"
|
||||
color identifier.class "\b(times|upTo|downTo)\b"
|
||||
color identifier.class "\b(format|toInt|toInteger|toDouble|toFloat|toLong)\b"
|
||||
color identifier.class "\b(head|tail|isEmpty|reduce|each|count|exists)\b"
|
||||
color 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"
|
||||
color 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"
|
||||
color identifier.class "\b(toUpperCase|equals|startsWith)\b"
|
||||
|
||||
color statement "\b(if|else|then|when|case|match|otherwise)\b"
|
||||
color special "\b(with|break|continue|return)\b"
|
||||
color error "\b(try|catch|finally|throw)\b"
|
||||
color identifier "\b(super|this|let|var|local)\b"
|
||||
color symbol.brackets "[(){}]" "\[" "\]"
|
||||
color statement "\b(for|while|foreach|in)\b"
|
||||
color constant "\b(and|in|is|not|or|isnt|orIfNull)\b"
|
||||
|
||||
color constant.bool "\b(true|false)\b"
|
||||
color constant "\b(null|undefined)\b"
|
||||
|
||||
color symbol.operator "[\-+/*=<>!~%&|^]|:="
|
||||
color constant.number "\b([0-9]+|0x[0-9a-fA-F]*)\b|'.'"
|
||||
color constant.string ""(\\.|[^"])*"|'(\\.|[^'])*'"
|
||||
|
||||
color comment "#.*$"
|
||||
color comment start="----" end="----"
|
||||
|
||||
color todo "TODO:?"
|
||||
71
runtime/syntax/golo.yaml
Normal file
71
runtime/syntax/golo.yaml
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
filetype: golo
|
||||
|
||||
detect:
|
||||
filename: "\\.golo$"
|
||||
|
||||
rules:
|
||||
- type: "\\b(function|fun|)\\b"
|
||||
- type: "\\b(struct|DynamicObject|union|AdapterFabric|Adapter|DynamicVariable|Observable)\\b"
|
||||
- type: "\\b(list|set|array|vector|tuple|map)\\b"
|
||||
- type: "\\b(Ok|Error|Empty|None|Some|Option|Result|Result.ok|Result.fail|Result.error|Result.empty|Optional.empty|Optional.of)\\b"
|
||||
|
||||
- identifier.class: "\\b(augment|pimp)\\b"
|
||||
- identifier.class: "\\b(interfaces|implements|extends|overrides|maker|newInstance)\\b"
|
||||
- identifier.class: "\\b(isEmpty|isNone|isPresent|isSome|iterator|flattened|toList|flatMap|`and|orElseGet|`or|toResult|apply|either)\\b"
|
||||
- identifier.class: "\\b(result|option|trying|raising|nullify|catching)\\b"
|
||||
- identifier.class: "\\b(promise|setFuture|failedFuture|all|any)\\b"
|
||||
- identifier.class: "\\b(initialize|initializeWithinThread|start|future|fallbackTo|onSet|onFail|cancel|enqueue)\\b"
|
||||
- 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"
|
||||
- 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"
|
||||
- identifier.class: "\\b(emptyList|cons|lazyList|fromIter|generator|repeat|iterate)\\b"
|
||||
- identifier.class: "\\b(asLazyList|foldl|foldr|take|takeWhile|drop|dropWhile|subList)\\b"
|
||||
- identifier.class: "\\b(import)\\b"
|
||||
- identifier.class: "\\b(module)\\b"
|
||||
- identifier.class: "\\b(JSON)\\b"
|
||||
- identifier.class: "\\b(stringify|parse|toJSON|toDynamicObject|updateFromJSON)\\b"
|
||||
- identifier.class: "\\b(newInstance|define|getKey|getValue|properties|fallback)\\b"
|
||||
- identifier.class: "\\b(times|upTo|downTo)\\b"
|
||||
- identifier.class: "\\b(format|toInt|toInteger|toDouble|toFloat|toLong)\\b"
|
||||
- identifier.class: "\\b(head|tail|isEmpty|reduce|each|count|exists)\\b"
|
||||
- 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"
|
||||
- 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"
|
||||
- identifier.class: "\\b(toUpperCase|equals|startsWith)\\b"
|
||||
|
||||
- statement: "\\b(if|else|then|when|case|match|otherwise)\\b"
|
||||
- special: "\\b(with|break|continue|return)\\b"
|
||||
- error: "\\b(try|catch|finally|throw)\\b"
|
||||
- identifier: "\\b(super|this|let|var|local)\\b"
|
||||
- symbol.brackets: "[(){}]|\\[|\\]"
|
||||
- statement: "\\b(for|while|foreach|in)\\b"
|
||||
- constant: "\\b(and|in|is|not|or|isnt|orIfNull)\\b"
|
||||
|
||||
- constant.bool: "\\b(true|false)\\b"
|
||||
- constant: "\\b(null|undefined)\\b"
|
||||
|
||||
- symbol.operator: "[\\-+/*=<>!~%&|^]|:="
|
||||
- constant.number: "\\b([0-9]+|0x[0-9a-fA-F]*)\\b|'.'"
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- constant.string:
|
||||
start: "'"
|
||||
end: "(?<!\\\\)'"
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
- comment:
|
||||
start: "#"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
- comment:
|
||||
start: "----"
|
||||
end: "----"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
## Here is an example for groff.
|
||||
##
|
||||
syntax "groff" "\.m[ems]$" "\.rof" "\.tmac$" "^tmac."
|
||||
## The argument of .ds or .nr
|
||||
color statement "^\.(ds|nr) [^[[:space:]]]*"
|
||||
## Single character escapes
|
||||
color constant.specialChar "\\."
|
||||
## Highlight the argument of \f or \s in the same color
|
||||
color constant.specialChar "\\f." "\\f\(.." "\\s(\+|\-)?[0-9]"
|
||||
## Newlines
|
||||
color constant "(\\|\\\\)n(.|\(..)"
|
||||
color constant start="(\\|\\\\)n\[" end="]"
|
||||
## Requests
|
||||
color type "^\.[[:space:]]*[^[[:space:]]]*"
|
||||
## Comments
|
||||
color comment "^\.\\".*$"
|
||||
## Strings
|
||||
color constant.string "(\\|\\\\)\*(.|\(..)"
|
||||
color constant.string start="(\\|\\\\)\*\[" end="]"
|
||||
## Characters
|
||||
color constant.specialChar "\\\(.."
|
||||
color constant.specialChar start="\\\[" end="]"
|
||||
## Macro arguments
|
||||
color identifier.macro "\\\\\$[1-9]"
|
||||
30
runtime/syntax/groff.yaml
Normal file
30
runtime/syntax/groff.yaml
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
filetype: groff
|
||||
|
||||
detect:
|
||||
filename: "\\.m[ems]$|\\.rof|\\.tmac$|^tmac."
|
||||
|
||||
rules:
|
||||
- statement: "^\\.(ds|nr) [^[[:space:]]]*"
|
||||
- constant.specialChar: "\\\\."
|
||||
- constant.specialChar: "\\\\f.|\\\\f\\(..|\\\\s(\\+|\\-)?[0-9]"
|
||||
- constant: "(\\\\|\\\\\\\\)n(.|\\(..)"
|
||||
- constant:
|
||||
start: "(\\\\|\\\\\\\\)n\\["
|
||||
end: "]"
|
||||
rules: []
|
||||
|
||||
- type: "^\\.[[:space:]]*[^[[:space:]]]*"
|
||||
- comment: "^\\.\\\\\".*$"
|
||||
- constant.string: "(\\\\|\\\\\\\\)\\*(.|\\(..)"
|
||||
- constant.string:
|
||||
start: "(\\\\|\\\\\\\\)\\*\\["
|
||||
end: "]"
|
||||
rules: []
|
||||
|
||||
- constant.specialChar: "\\\\\\(.."
|
||||
- constant.specialChar:
|
||||
start: "\\\\\\["
|
||||
end: "]"
|
||||
rules: []
|
||||
|
||||
- identifier.macro: "\\\\\\\\\\$[1-9]"
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
syntax "haml" "\.haml$"
|
||||
|
||||
color symbol "-|="
|
||||
color default "->|=>"
|
||||
color constant "([ ]|^)%[0-9A-Za-z_]+>"
|
||||
color special ":[0-9A-Za-z_]+>"
|
||||
color type "\.[A-Za-z_]+>"
|
||||
## Double quote & single quote
|
||||
color constant.string ""([^"]|(\\"))*"" "%[QW]?\{[^}]*\}" "%[QW]?\([^)]*\)" "%[QW]?<[^>]*>" "%[QW]?\$[^$]*\$" "%[QW]?\^[^^]*\^" "%[QW]?![^!]*!"
|
||||
color constant.string "'([^']|(\\'))*'" "%[qw]\{[^}]*\}" "%[qw]\([^)]*\)" "%[qw]<[^>]*>" "%[qw]\[[^]]*\]" "%[qw]\$[^$]*\$" "%[qw]\^[^^]*\^" "%[qw]![^!]*!"
|
||||
## Vars
|
||||
color identifier "#\{[^}]*\}"
|
||||
color identifier.var "(@|@@)[0-9A-Z_a-z]+"
|
||||
## Comments
|
||||
color comment "#[^{].*$" "#$"
|
||||
|
||||
16
runtime/syntax/haml.yaml
Normal file
16
runtime/syntax/haml.yaml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
filetype: haml
|
||||
|
||||
detect:
|
||||
filename: "\\.haml$"
|
||||
|
||||
rules:
|
||||
- symbol: "-|="
|
||||
- default: "->|=>"
|
||||
- constant: "([ ]|^)%[0-9A-Za-z_]+>"
|
||||
- special: ":[0-9A-Za-z_]+>"
|
||||
- type: "\\.[A-Za-z_]+>"
|
||||
- constant.string: "\"([^\"]|(\\\\\"))*\"|%[QW]?\\{[^}]*\\}|%[QW]?\\([^)]*\\)|%[QW]?<[^>]*>|%[QW]?\\$[^$]*\\$|%[QW]?\\^[^^]*\\^|%[QW]?![^!]*!"
|
||||
- constant.string: "'([^']|(\\\\'))*'|%[qw]\\{[^}]*\\}|%[qw]\\([^)]*\\)|%[qw]<[^>]*>|%[qw]\\[[^]]*\\]|%[qw]\\$[^$]*\\$|%[qw]\\^[^^]*\\^|%[qw]![^!]*!"
|
||||
- identifier: "#\\{[^}]*\\}"
|
||||
- identifier.var: "(@|@@)[0-9A-Z_a-z]+"
|
||||
- comment: "#[^{].*$|#$"
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
syntax "haskell" "\.hs$"
|
||||
|
||||
## Keywords
|
||||
color statement "[ ](as|case|of|class|data|default|deriving|do|forall|foreign|hiding|if|then|else|import|infix|infixl|infixr|instance|let|in|mdo|module|newtype|qualified|type|where)[ ]"
|
||||
color statement "(^data|^foreign|^import|^infix|^infixl|^infixr|^instance|^module|^newtype|^type)[ ]"
|
||||
color statement "[ ](as$|case$|of$|class$|data$|default$|deriving$|do$|forall$|foreign$|hiding$|if$|then$|else$|import$|infix$|infixl$|infixr$|instance$|let$|in$|mdo$|module$|newtype$|qualified$|type$|where$)"
|
||||
|
||||
## Various symbols
|
||||
color symbol "(\||@|!|:|_|~|=|\\|;|\(\)|,|\[|\]|\{|\})"
|
||||
|
||||
## Operators
|
||||
color symbol.operator "(==|/=|&&|\|\||<|>|<=|>=)"
|
||||
|
||||
## Various symbols
|
||||
color special "(->|<-)"
|
||||
color symbol "\.|\$"
|
||||
|
||||
## Data constructors
|
||||
color constant.bool "\b(True|False)\b"
|
||||
color constant "(Nothing|Just|Left|Right|LT|EQ|GT)"
|
||||
|
||||
## Data classes
|
||||
color identifier.class "[ ](Read|Show|Enum|Eq|Ord|Data|Bounded|Typeable|Num|Real|Fractional|Integral|RealFrac|Floating|RealFloat|Monad|MonadPlus|Functor)"
|
||||
|
||||
## Strings
|
||||
color constant.string ""[^\"]*""
|
||||
|
||||
## Comments
|
||||
color comment "--.*"
|
||||
color comment start="\{-" end="-\}"
|
||||
|
||||
color identifier.micro "undefined"
|
||||
49
runtime/syntax/haskell.yaml
Normal file
49
runtime/syntax/haskell.yaml
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
filetype: haskell
|
||||
|
||||
detect:
|
||||
filename: "\\.hs$"
|
||||
|
||||
rules:
|
||||
# Keywords
|
||||
- statement: "[ ](as|case|of|class|data|default|deriving|do|forall|foreign|hiding|if|then|else|import|infix|infixl|infixr|instance|let|in|mdo|module|newtype|qualified|type|where)[ ]"
|
||||
- statement: "(^data|^foreign|^import|^infix|^infixl|^infixr|^instance|^module|^newtype|^type)[ ]"
|
||||
- statement: "[ ](as$|case$|of$|class$|data$|default$|deriving$|do$|forall$|foreign$|hiding$|if$|then$|else$|import$|infix$|infixl$|infixr$|instance$|let$|in$|mdo$|module$|newtype$|qualified$|type$|where$)"
|
||||
|
||||
# Various symbols
|
||||
- symbol: "(\\||@|!|:|_|~|=|\\\\|;|\\(\\)|,|\\[|\\]|\\{|\\})"
|
||||
|
||||
# Operators
|
||||
- symbol.operator: "(==|/=|&&|\\|\\||<|>|<=|>=)"
|
||||
|
||||
# Various symbols
|
||||
- special: "(->|<-)"
|
||||
- symbol: "\\.|\\$"
|
||||
|
||||
# Data constructors
|
||||
- constant.bool: "\\b(True|False)\\b"
|
||||
- constant: "(Nothing|Just|Left|Right|LT|EQ|GT)"
|
||||
|
||||
# Data classes
|
||||
- identifier.class: "[ ](Read|Show|Enum|Eq|Ord|Data|Bounded|Typeable|Num|Real|Fractional|Integral|RealFrac|Floating|RealFloat|Monad|MonadPlus|Functor)"
|
||||
|
||||
# Strings
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules:
|
||||
- constant.specialChar: "\\\\."
|
||||
|
||||
# Comments
|
||||
- comment:
|
||||
start: "--"
|
||||
end: "$"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
- comment:
|
||||
start: "\\{-"
|
||||
end: "-\\}"
|
||||
rules:
|
||||
- todo: "(TODO|XXX|FIXME):?"
|
||||
|
||||
- identifier.micro: "undefined"
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
## Here is a short improved example for generic HTML.
|
||||
##
|
||||
syntax "html" "\.htm[l]?$"
|
||||
|
||||
color error "<[^!].*?>"
|
||||
color 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)( .*|>)*?>"
|
||||
color symbol.tag.extended "(?i)<[/]?(body|div|html|head(er)?|footer|title|table|t(body|d|h(ead)?|r|foot))( .*)*?>"
|
||||
color preproc "(?i)<[/]?(script|style)( .*)*?>"
|
||||
color special "&[^;[[:space:]]]*;"
|
||||
color symbol "[:=]"
|
||||
color identifier "(alt|bgcolor|height|href|id|label|longdesc|name|on(click|focus|load|mouseover)|size|span|src|style|target|type|value|width)="
|
||||
color constant.string ""[^"]*""
|
||||
color constant.number "(?i)#[0-9A-F]{6,6}"
|
||||
#Don't want or need tag highlighting outside of a tag! :)
|
||||
color default start=">" end="<"
|
||||
color symbol.tag "<|>"
|
||||
color constant.string.url "(ftp(s)?|http(s)?|git|chrome)://[^ ]+"
|
||||
color comment "<!--.+?-->"
|
||||
color preproc "<!DOCTYPE.+?>"
|
||||
|
||||
# There's only so much we can do before regions and includes are implemented. :/
|
||||
27
runtime/syntax/html.yaml
Normal file
27
runtime/syntax/html.yaml
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
filetype: html
|
||||
|
||||
detect:
|
||||
filename: "\\.htm[l]?$"
|
||||
|
||||
rules:
|
||||
- identifier: "<.*?>"
|
||||
- special: "&[^;[[:space:]]]*;"
|
||||
- statement: "(alt|bgcolor|height|href|label|longdesc|name|onclick|onfocus|onload|onmouseover|size|span|src|style|target|type|value|width)="
|
||||
|
||||
- constant.string:
|
||||
start: "\""
|
||||
end: "(?<!\\\\)\""
|
||||
rules: []
|
||||
|
||||
- default:
|
||||
start: "<script.*?>"
|
||||
end: "</script.*?>"
|
||||
rules:
|
||||
- include: "javascript"
|
||||
|
||||
- default:
|
||||
start: "<style.*?>"
|
||||
end: "</style.*?>"
|
||||
rules:
|
||||
- include: "css"
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue