mirror of
https://github.com/rwinkhart/go-highlite.git
synced 2026-09-06 00:47:15 -04:00
+19
-32
@@ -60,7 +60,7 @@ func NewHighlighter(def *Def) *Highlighter {
|
|||||||
// color's group (represented as one byte)
|
// color's group (represented as one byte)
|
||||||
type LineMatch map[int]Group
|
type LineMatch map[int]Group
|
||||||
|
|
||||||
func findIndex(regex *regexp.Regexp, skip []*regexp.Regexp, str []rune, canMatchStart, canMatchEnd bool) []int {
|
func findIndex(regex *regexp.Regexp, skip *regexp.Regexp, str []rune, canMatchStart, canMatchEnd bool) []int {
|
||||||
regexStr := regex.String()
|
regexStr := regex.String()
|
||||||
if strings.Contains(regexStr, "^") {
|
if strings.Contains(regexStr, "^") {
|
||||||
if !canMatchStart {
|
if !canMatchStart {
|
||||||
@@ -74,18 +74,11 @@ func findIndex(regex *regexp.Regexp, skip []*regexp.Regexp, str []rune, canMatch
|
|||||||
}
|
}
|
||||||
|
|
||||||
var strbytes []byte
|
var strbytes []byte
|
||||||
if skip != nil && len(skip) > 0 {
|
if skip != nil {
|
||||||
for _, r := range skip {
|
strbytes = skip.ReplaceAllFunc([]byte(string(str)), func(match []byte) []byte {
|
||||||
if r != nil {
|
res := make([]byte, utf8.RuneCount(match))
|
||||||
strbytes = r.ReplaceAllFunc([]byte(string(str)), func(match []byte) []byte {
|
return res
|
||||||
res := make([]byte, len(match))
|
})
|
||||||
// for i := 0; i < len(match); i++ {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
return res
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
strbytes = []byte(string(str))
|
strbytes = []byte(string(str))
|
||||||
}
|
}
|
||||||
@@ -123,22 +116,16 @@ func (h *Highlighter) highlightRegion(highlights LineMatch, start int, canMatchE
|
|||||||
|
|
||||||
if start == 0 {
|
if start == 0 {
|
||||||
if !statesOnly {
|
if !statesOnly {
|
||||||
highlights[0] = curRegion.group
|
if _, ok := highlights[0]; !ok {
|
||||||
|
highlights[0] = curRegion.group
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
skips := make([]*regexp.Regexp, len(curRegion.rules.patterns)+1)
|
loc := findIndex(curRegion.end, curRegion.skip, line, start == 0, canMatchEnd)
|
||||||
for i := range skips {
|
|
||||||
if i != len(skips)-1 {
|
|
||||||
skips[i] = curRegion.rules.patterns[i].regex
|
|
||||||
} else {
|
|
||||||
skips[i] = curRegion.skip
|
|
||||||
}
|
|
||||||
}
|
|
||||||
loc := findIndex(curRegion.end, skips, line, start == 0, canMatchEnd)
|
|
||||||
if loc != nil {
|
if loc != nil {
|
||||||
if !statesOnly {
|
if !statesOnly {
|
||||||
highlights[start+loc[1]-1] = curRegion.group
|
highlights[start+loc[0]] = curRegion.limitGroup
|
||||||
}
|
}
|
||||||
if curRegion.parent == nil {
|
if curRegion.parent == nil {
|
||||||
if !statesOnly {
|
if !statesOnly {
|
||||||
@@ -177,7 +164,7 @@ func (h *Highlighter) highlightRegion(highlights LineMatch, start int, canMatchE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if firstLoc[0] != len(line) {
|
if firstLoc[0] != len(line) {
|
||||||
highlights[start+firstLoc[0]] = firstRegion.group
|
highlights[start+firstLoc[0]] = firstRegion.limitGroup
|
||||||
h.highlightRegion(highlights, start, false, lineNum, line[:firstLoc[0]], curRegion, statesOnly)
|
h.highlightRegion(highlights, start, false, lineNum, line[:firstLoc[0]], curRegion, statesOnly)
|
||||||
h.highlightRegion(highlights, start+firstLoc[1], canMatchEnd, lineNum, line[firstLoc[1]:], firstRegion, statesOnly)
|
h.highlightRegion(highlights, start+firstLoc[1], canMatchEnd, lineNum, line[firstLoc[1]:], firstRegion, statesOnly)
|
||||||
return highlights
|
return highlights
|
||||||
@@ -198,9 +185,9 @@ func (h *Highlighter) highlightRegion(highlights LineMatch, start int, canMatchE
|
|||||||
}
|
}
|
||||||
for i, h := range fullHighlights {
|
for i, h := range fullHighlights {
|
||||||
if i == 0 || h != fullHighlights[i-1] {
|
if i == 0 || h != fullHighlights[i-1] {
|
||||||
if _, ok := highlights[start+i]; !ok {
|
// if _, ok := highlights[start+i]; !ok {
|
||||||
highlights[start+i] = h
|
highlights[start+i] = h
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,7 +219,7 @@ func (h *Highlighter) highlightEmptyRegion(highlights LineMatch, start int, canM
|
|||||||
}
|
}
|
||||||
if firstLoc[0] != len(line) {
|
if firstLoc[0] != len(line) {
|
||||||
if !statesOnly {
|
if !statesOnly {
|
||||||
highlights[start+firstLoc[0]] = firstRegion.group
|
highlights[start+firstLoc[0]] = firstRegion.limitGroup
|
||||||
}
|
}
|
||||||
h.highlightEmptyRegion(highlights, start, false, lineNum, line[:firstLoc[0]], statesOnly)
|
h.highlightEmptyRegion(highlights, start, false, lineNum, line[:firstLoc[0]], statesOnly)
|
||||||
h.highlightRegion(highlights, start+firstLoc[1], canMatchEnd, lineNum, line[firstLoc[1]:], firstRegion, statesOnly)
|
h.highlightRegion(highlights, start+firstLoc[1], canMatchEnd, lineNum, line[firstLoc[1]:], firstRegion, statesOnly)
|
||||||
@@ -258,9 +245,9 @@ func (h *Highlighter) highlightEmptyRegion(highlights LineMatch, start int, canM
|
|||||||
}
|
}
|
||||||
for i, h := range fullHighlights {
|
for i, h := range fullHighlights {
|
||||||
if i == 0 || h != fullHighlights[i-1] {
|
if i == 0 || h != fullHighlights[i-1] {
|
||||||
if _, ok := highlights[start+i]; !ok {
|
// if _, ok := highlights[start+i]; !ok {
|
||||||
highlights[start+i] = h
|
highlights[start+i] = h
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,12 +57,13 @@ type rules struct {
|
|||||||
// region and also rules from the above region do not match inside this region
|
// region and also rules from the above region do not match inside this region
|
||||||
// Note that a region may contain more regions
|
// Note that a region may contain more regions
|
||||||
type region struct {
|
type region struct {
|
||||||
group Group
|
group Group
|
||||||
parent *region
|
limitGroup Group
|
||||||
start *regexp.Regexp
|
parent *region
|
||||||
end *regexp.Regexp
|
start *regexp.Regexp
|
||||||
skip *regexp.Regexp
|
end *regexp.Regexp
|
||||||
rules *rules
|
skip *regexp.Regexp
|
||||||
|
rules *rules
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -237,6 +238,23 @@ func parseRegion(group string, regionInfo map[interface{}]interface{}, prevRegio
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// limit-color is optional
|
||||||
|
if _, ok := regionInfo["limit-group"]; ok {
|
||||||
|
groupStr := regionInfo["limit-group"].(string)
|
||||||
|
if _, ok := Groups[groupStr]; !ok {
|
||||||
|
numGroups++
|
||||||
|
Groups[groupStr] = numGroups
|
||||||
|
}
|
||||||
|
groupNum := Groups[groupStr]
|
||||||
|
region.limitGroup = groupNum
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
region.limitGroup = region.group
|
||||||
|
}
|
||||||
|
|
||||||
region.rules, err = parseRules(regionInfo["rules"].([]interface{}), region)
|
region.rules, err = parseRules(regionInfo["rules"].([]interface{}), region)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -75,12 +75,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- preproc: "..+"
|
- preproc: "..+"
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|||||||
@@ -91,12 +91,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -25,12 +25,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -28,12 +28,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- preproc: "..+"
|
- preproc: "..+"
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "(\\\\u[0-9A-fa-f]{4,4}|\\\\newline|\\\\space|\\\\tab|\\\\formfeed|\\\\backspace|\\\\return|\\\\.)"
|
- constant.specialChar: "(\\\\u[0-9A-fa-f]{4,4}|\\\\newline|\\\\space|\\\\tab|\\\\formfeed|\\\\backspace|\\\\return|\\\\.)"
|
||||||
|
|
||||||
|
|||||||
@@ -16,12 +16,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules: []
|
rules: []
|
||||||
|
|
||||||
- comment:
|
- comment:
|
||||||
|
|||||||
@@ -29,12 +29,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- preproc: "..+"
|
- preproc: "..+"
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
filetype: crystal
|
filetype: crystal
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.cr$|Gemfile|config.ru|Rakefile|Capfile|Vagrantfile"
|
filename: "\\.cr$"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
# Asciibetical list of reserved words
|
# Asciibetical list of reserved words
|
||||||
@@ -33,14 +33,17 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialchar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
- special: "#\\{[^}]*\\}"
|
- special: "#\\{[^}]*\\}"
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
rules: []
|
skip: "\\\\."
|
||||||
|
rules:
|
||||||
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- comment:
|
- comment:
|
||||||
start: "#"
|
start: "#"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
filetype: csharp
|
filetype: csharp
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.cs"
|
filename: "\\.cs$"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
# Class
|
# Class
|
||||||
@@ -24,6 +24,7 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
|
- constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
|
||||||
- constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
|
- constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
|
||||||
@@ -31,6 +32,7 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
|
- constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
|
||||||
- constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
|
- constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
|
||||||
|
|||||||
+10
-8
File diff suppressed because one or more lines are too long
@@ -33,12 +33,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
# WysiwygString
|
# WysiwygString
|
||||||
|
|||||||
@@ -33,12 +33,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -23,12 +23,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -30,12 +30,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules: []
|
rules: []
|
||||||
|
|
||||||
- comment:
|
- comment:
|
||||||
|
|||||||
@@ -44,12 +44,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -47,12 +47,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
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.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
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.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
|
||||||
|
|
||||||
|
|||||||
@@ -29,12 +29,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -48,12 +48,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
+21
-4
@@ -1,27 +1,44 @@
|
|||||||
filetype: html
|
filetype: html
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.htm[l]?$"
|
filename: "\\.htm[l]?$"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
- identifier: "<.*?>"
|
- 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))( .*)*?>"
|
||||||
- special: "&[^;[[:space:]]]*;"
|
- special: "&[^;[[:space:]]]*;"
|
||||||
- statement: "(alt|bgcolor|height|href|label|longdesc|name|onclick|onfocus|onload|onmouseover|size|span|src|style|target|type|value|width)="
|
- symbol: "[:=]"
|
||||||
|
- identifier: "(alt|bgcolor|height|href|id|label|longdesc|name|on(click|focus|load|mouseover)|size|span|src|target|type|value|width)="
|
||||||
|
- constant.number: "(?i)#[0-9A-F]{6,6}"
|
||||||
|
# - default:
|
||||||
|
# start: ">"
|
||||||
|
# end: "<"
|
||||||
|
# rules: []
|
||||||
|
|
||||||
|
- symbol.tag: "<|>"
|
||||||
|
- constant.string.url: "(ftp(s)?|http(s)?|git|chrome)://[^ ]+"
|
||||||
|
- comment: "<!--.+?-->"
|
||||||
|
- preproc: "<!DOCTYPE.+?>"
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
rules: []
|
skip: "\\\\."
|
||||||
|
rules:
|
||||||
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- default:
|
- default:
|
||||||
start: "<script.*?>"
|
start: "<script.*?>"
|
||||||
end: "</script.*?>"
|
end: "</script.*?>"
|
||||||
|
limit-group: symbol.tag
|
||||||
rules:
|
rules:
|
||||||
- include: "javascript"
|
- include: "javascript"
|
||||||
|
|
||||||
- default:
|
- default:
|
||||||
start: "<style.*?>"
|
start: "<style.*?>"
|
||||||
end: "</style.*?>"
|
end: "</style.*?>"
|
||||||
|
limit-group: symbol.tag
|
||||||
rules:
|
rules:
|
||||||
- include: "css"
|
- include: "css"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
filetype: html4
|
filetype: html4
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.htm[l]?$"
|
filename: "\\.htm[l]?4$"
|
||||||
header: "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN|http://www.w3.org/TR/html4/strict.dtd\">"
|
header: "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN|http://www.w3.org/TR/html4/strict.dtd\">"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
filetype: html5
|
filetype: html5
|
||||||
|
|
||||||
detect:
|
detect:
|
||||||
filename: "\\.htm[l]?$"
|
filename: "\\.htm[l]?5$"
|
||||||
header: "<!DOCTYPE html5>"
|
header: "<!DOCTYPE html5>"
|
||||||
|
|
||||||
rules:
|
rules:
|
||||||
|
|||||||
@@ -13,12 +13,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- preproc: "..+"
|
- preproc: "..+"
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|||||||
@@ -22,12 +22,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -13,12 +13,15 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- statement: "\\\"(\\\\\"|[^\"])*\\\"[[:space:]]*:\" \"'(\\'|[^'])*'[[:space:]]*:"
|
- statement: "\\\"(\\\\\"|[^\"])*\\\"[[:space:]]*:\" \"'(\\'|[^'])*'[[:space:]]*:"
|
||||||
- constant: "\\\\u[0-9a-fA-F]{4}|\\\\[bfnrt'\"/\\\\]"
|
- constant: "\\\\u[0-9a-fA-F]{4}|\\\\[bfnrt'\"/\\\\]"
|
||||||
|
|||||||
@@ -11,11 +11,13 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
- comment:
|
- comment:
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
- comment:
|
- comment:
|
||||||
|
|||||||
@@ -27,12 +27,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -19,11 +19,13 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
- identifier: "\\$+(\\{[^} ]+\\}|\\([^) ]+\\))"
|
- identifier: "\\$+(\\{[^} ]+\\}|\\([^) ]+\\))"
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
- constant.number: "#[0-9 A-F a-f]+"
|
- constant.number: "#[0-9 A-F a-f]+"
|
||||||
|
|||||||
@@ -35,12 +35,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "@\""
|
start: "@\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
- preproc:
|
- preproc:
|
||||||
|
|||||||
@@ -42,12 +42,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
@@ -55,3 +57,4 @@ rules:
|
|||||||
start: "#"
|
start: "#"
|
||||||
end: "$"
|
end: "$"
|
||||||
rules: []
|
rules: []
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ rules:
|
|||||||
# types
|
# types
|
||||||
- type: "\\b(bool|bytearray|bytes|classmethod|complex|dict|enumerate|filter|float|frozenset|int|list|map|memoryview|object|property|range|reversed|set|slice|staticmethod|str|super|tuple|type|zip)\\b"
|
- type: "\\b(bool|bytearray|bytes|classmethod|complex|dict|enumerate|filter|float|frozenset|int|list|map|memoryview|object|property|range|reversed|set|slice|staticmethod|str|super|tuple|type|zip)\\b"
|
||||||
# definitions
|
# definitions
|
||||||
- identifier: "def [a-zA-Z_0-9]+"
|
- identifier: "def [a-zA-Z_0-9]+"
|
||||||
# keywords
|
# keywords
|
||||||
- statement: "\\b(and|as|assert|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|raise|return|try|while|with|yield)\\b"
|
- statement: "\\b(and|as|assert|break|class|continue|def|del|elif|else|except|finally|for|from|global|if|import|in|is|lambda|nonlocal|not|or|pass|raise|return|try|while|with|yield)\\b"
|
||||||
# decorators
|
# decorators
|
||||||
- brightgreen: "@.*[(]"
|
- brightgreen: "@.*[(]"
|
||||||
# operators
|
# operators
|
||||||
@@ -41,12 +41,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
- constant: "\\b(true|false|null)\\b"
|
- constant: "\\b(true|false|null)\\b"
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -29,11 +29,13 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -32,11 +32,13 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -13,12 +13,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,14 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
- constant.string:
|
- constant.string:
|
||||||
start: "'"
|
start: "'"
|
||||||
end: "'"
|
end: "'"
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ rules:
|
|||||||
- constant.string:
|
- constant.string:
|
||||||
start: "\""
|
start: "\""
|
||||||
end: "\""
|
end: "\""
|
||||||
|
skip: "\\\\."
|
||||||
rules:
|
rules:
|
||||||
- constant.specialChar: "\\\\."
|
- constant.specialChar: "\\\\."
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user