diff --git a/highlighter.go b/highlighter.go
index 599a772..cf0fb48 100644
--- a/highlighter.go
+++ b/highlighter.go
@@ -60,7 +60,7 @@ func NewHighlighter(def *Def) *Highlighter {
// color's group (represented as one byte)
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()
if strings.Contains(regexStr, "^") {
if !canMatchStart {
@@ -74,18 +74,11 @@ func findIndex(regex *regexp.Regexp, skip []*regexp.Regexp, str []rune, canMatch
}
var strbytes []byte
- if skip != nil && len(skip) > 0 {
- for _, r := range skip {
- if r != nil {
- strbytes = r.ReplaceAllFunc([]byte(string(str)), func(match []byte) []byte {
- res := make([]byte, len(match))
- // for i := 0; i < len(match); i++ {
- //
- // }
- return res
- })
- }
- }
+ if skip != nil {
+ strbytes = skip.ReplaceAllFunc([]byte(string(str)), func(match []byte) []byte {
+ res := make([]byte, utf8.RuneCount(match))
+ return res
+ })
} else {
strbytes = []byte(string(str))
}
@@ -123,22 +116,16 @@ func (h *Highlighter) highlightRegion(highlights LineMatch, start int, canMatchE
if start == 0 {
if !statesOnly {
- highlights[0] = curRegion.group
+ if _, ok := highlights[0]; !ok {
+ highlights[0] = curRegion.group
+ }
}
}
- skips := make([]*regexp.Regexp, len(curRegion.rules.patterns)+1)
- 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)
+ loc := findIndex(curRegion.end, curRegion.skip, line, start == 0, canMatchEnd)
if loc != nil {
if !statesOnly {
- highlights[start+loc[1]-1] = curRegion.group
+ highlights[start+loc[0]] = curRegion.limitGroup
}
if curRegion.parent == nil {
if !statesOnly {
@@ -177,7 +164,7 @@ func (h *Highlighter) highlightRegion(highlights LineMatch, start int, canMatchE
}
}
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+firstLoc[1], canMatchEnd, lineNum, line[firstLoc[1]:], firstRegion, statesOnly)
return highlights
@@ -198,9 +185,9 @@ func (h *Highlighter) highlightRegion(highlights LineMatch, start int, canMatchE
}
for i, h := range fullHighlights {
if i == 0 || h != fullHighlights[i-1] {
- if _, ok := highlights[start+i]; !ok {
- highlights[start+i] = h
- }
+ // if _, ok := highlights[start+i]; !ok {
+ highlights[start+i] = h
+ // }
}
}
@@ -232,7 +219,7 @@ func (h *Highlighter) highlightEmptyRegion(highlights LineMatch, start int, canM
}
if firstLoc[0] != len(line) {
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.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 {
if i == 0 || h != fullHighlights[i-1] {
- if _, ok := highlights[start+i]; !ok {
- highlights[start+i] = h
- }
+ // if _, ok := highlights[start+i]; !ok {
+ highlights[start+i] = h
+ // }
}
}
diff --git a/parser.go b/parser.go
index f1a233d..6bf9270 100644
--- a/parser.go
+++ b/parser.go
@@ -57,12 +57,13 @@ type rules struct {
// 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 Group
- parent *region
- start *regexp.Regexp
- end *regexp.Regexp
- skip *regexp.Regexp
- rules *rules
+ group Group
+ limitGroup Group
+ parent *region
+ start *regexp.Regexp
+ end *regexp.Regexp
+ skip *regexp.Regexp
+ rules *rules
}
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)
if err != nil {
diff --git a/syntax_files/apacheconf.yaml b/syntax_files/apacheconf.yaml
index dff8fd2..a6f8914 100644
--- a/syntax_files/apacheconf.yaml
+++ b/syntax_files/apacheconf.yaml
@@ -47,6 +47,7 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/arduino.yaml b/syntax_files/arduino.yaml
index 29765ec..59ba451 100644
--- a/syntax_files/arduino.yaml
+++ b/syntax_files/arduino.yaml
@@ -75,12 +75,14 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- preproc: "..+"
- constant.specialChar: "\\\\."
diff --git a/syntax_files/asm.yaml b/syntax_files/asm.yaml
index aae47fb..f8f4c12 100644
--- a/syntax_files/asm.yaml
+++ b/syntax_files/asm.yaml
@@ -91,12 +91,14 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/awk.yaml b/syntax_files/awk.yaml
index 20b820c..ff3f698 100644
--- a/syntax_files/awk.yaml
+++ b/syntax_files/awk.yaml
@@ -25,12 +25,14 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/c.yaml b/syntax_files/c.yaml
index c31125b..44debd1 100644
--- a/syntax_files/c.yaml
+++ b/syntax_files/c.yaml
@@ -28,12 +28,14 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- preproc: "..+"
- constant.specialChar: "\\\\."
diff --git a/syntax_files/caddyfile.yaml b/syntax_files/caddyfile.yaml
index 80c241c..cb21821 100644
--- a/syntax_files/caddyfile.yaml
+++ b/syntax_files/caddyfile.yaml
@@ -11,6 +11,7 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/clojure.yaml b/syntax_files/clojure.yaml
index 692f51a..588b43c 100644
--- a/syntax_files/clojure.yaml
+++ b/syntax_files/clojure.yaml
@@ -25,6 +25,7 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "(\\\\u[0-9A-fa-f]{4,4}|\\\\newline|\\\\space|\\\\tab|\\\\formfeed|\\\\backspace|\\\\return|\\\\.)"
diff --git a/syntax_files/cmake.yaml b/syntax_files/cmake.yaml
index 2a13247..d23e613 100644
--- a/syntax_files/cmake.yaml
+++ b/syntax_files/cmake.yaml
@@ -16,12 +16,14 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/coffeescript.yaml b/syntax_files/coffeescript.yaml
index c4feca7..d9b3748 100644
--- a/syntax_files/coffeescript.yaml
+++ b/syntax_files/coffeescript.yaml
@@ -17,6 +17,7 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/conf.yaml b/syntax_files/conf.yaml
index 4a10448..0fbefa6 100644
--- a/syntax_files/conf.yaml
+++ b/syntax_files/conf.yaml
@@ -7,6 +7,7 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules: []
- comment:
diff --git a/syntax_files/cpp.yaml b/syntax_files/cpp.yaml
index 86b3545..d1ffaeb 100644
--- a/syntax_files/cpp.yaml
+++ b/syntax_files/cpp.yaml
@@ -29,12 +29,14 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- preproc: "..+"
- constant.specialChar: "\\\\."
diff --git a/syntax_files/crystal.yaml b/syntax_files/crystal.yaml
index ae28480..de80e53 100644
--- a/syntax_files/crystal.yaml
+++ b/syntax_files/crystal.yaml
@@ -1,7 +1,7 @@
filetype: crystal
detect:
- filename: "\\.cr$|Gemfile|config.ru|Rakefile|Capfile|Vagrantfile"
+ filename: "\\.cr$"
rules:
# Asciibetical list of reserved words
@@ -33,14 +33,17 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- - constant.specialchar: "\\\\."
+ - constant.specialChar: "\\\\."
- special: "#\\{[^}]*\\}"
- constant.string:
start: "'"
end: "'"
- rules: []
+ skip: "\\\\."
+ rules:
+ - constant.specialChar: "\\\\."
- comment:
start: "#"
diff --git a/syntax_files/csharp.yaml b/syntax_files/csharp.yaml
index 11088a2..028b661 100644
--- a/syntax_files/csharp.yaml
+++ b/syntax_files/csharp.yaml
@@ -1,7 +1,7 @@
filetype: csharp
detect:
- filename: "\\.cs"
+ filename: "\\.cs$"
rules:
# Class
@@ -24,6 +24,7 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
- constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
@@ -31,6 +32,7 @@ rules:
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
- constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
diff --git a/syntax_files/css.yaml b/syntax_files/css.yaml
index d9a328c..9d2ce41 100644
--- a/syntax_files/css.yaml
+++ b/syntax_files/css.yaml
@@ -6,16 +6,16 @@ detect:
rules:
# Classes and IDs
- statement: "(?i)."
- - normal:
- start: "\\{"
- end: "\\}"
- rules: []
+ # - normal:
+ # start: "\\{"
+ # end: "\\}"
+ # rules: []
# css commands
- type: "(align-content|align-items|alignment-baseline|align-self|all|animation|animation-delay|animation-direction|animation-duration|animation-fill-mode|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|appearance|azimuth|backface-visibility|background|background-attachment|background-blend-mode|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|baseline-shift|bookmark-label|bookmark-level|bookmark-state|border|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-boundary|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|bottom|box-decoration-break|box-shadow|box-sizing|box-snap|box-suppress|break-after|break-before|break-inside|caption-side|caret|caret-animation|caret-color|caret-shape|chains|clear|clip|clip-path|clip-rule|color|color-interpolation-filters|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|columns|column-span|column-width|content|continue|counter-increment|counter-reset|counter-set|cue|cue-after|cue-before|cursor|direction|display|dominant-baseline|elevation|empty-cells|filter|flex|flex-basis|flex-direction|flex-flow|flex-grow|flex-shrink|flex-wrap|float|float-defer|float-offset|float-reference|flood-color|flood-opacity|flow|flow-from|flow-into|font|font-family|font-feature-settings|font-kerning|font-language-override|font-size|font-size-adjust|font-stretch|font-style|font-synthesis|font-variant|font-variant-alternates|font-variant-caps|font-variant-east-asian|font-variant-ligatures|font-variant-numeric|font-variant-position|font-weight|footnote-display|footnote-policy|glyph-orientation-vertical|grid|grid-area|grid-auto-columns|grid-auto-flow|grid-auto-rows|grid-column|grid-column-end|grid-column-gap|grid-column-start|grid-gap|grid-row|grid-row-end|grid-row-gap|grid-row-start|grid-template|grid-template-areas|grid-template-columns|grid-template-rows|hanging-punctuation|height|hyphenate-character|hyphenate-limit-chars|hyphenate-limit-last|hyphenate-limit-lines|hyphenate-limit-zone|hyphens|image-orientation|image-rendering|image-resolution|initial-letter|initial-letter-align|initial-letter-wrap|isolation|justify-content|justify-items|justify-self|left|letter-spacing|lighting-color|line-break|line-grid|line-height|line-snap|list-style|list-style-image|list-style-position|list-style-type|margin|margin-bottom|margin-left|margin-right|margin-top|marker|marker-end|marker-knockout-left|marker-knockout-right|marker-mid|marker-pattern|marker-segment|marker-side|marker-start|marquee-direction|marquee-loop|marquee-speed|marquee-style|mask|mask-border|mask-border-mode|mask-border-outset|mask-border-repeat|mask-border-slice|mask-border-source|mask-border-width|mask-clip|mask-composite|mask-image|mask-mode|mask-origin|mask-position|mask-repeat|mask-size|mask-type|max-height|max-lines|max-width|min-height|min-width|mix-blend-mode|motion|motion-offset|motion-path|motion-rotation|nav-down|nav-left|nav-right|nav-up|object-fit|object-position|offset-after|offset-before|offset-end|offset-start|opacity|order|orphans|outline|outline-color|outline-offset|outline-style|outline-width|overflow|overflow-style|overflow-wrap|overflow-x|overflow-y|padding|padding-bottom|padding-left|padding-right|padding-top|page|page-break-after|page-break-before|page-break-inside|pause|pause-after|pause-before|perspective|perspective-origin|pitch|pitch-range|play-during|polar-anchor|polar-angle|polar-distance|polar-origin|position|presentation-level|quotes|region-fragment|resize|rest|rest-after|rest-before|richness|right|rotation|rotation-point|ruby-align|ruby-merge|ruby-position|running|scroll-behavior|scroll-snap-align|scroll-snap-margin|scroll-snap-margin-block|scroll-snap-margin-block-end|scroll-snap-margin-block-start|scroll-snap-margin-bottom|scroll-snap-margin-inline|scroll-snap-margin-inline-end|scroll-snap-margin-inline-start|scroll-snap-margin-left|scroll-snap-margin-right|scroll-snap-margin-top|scroll-snap-padding|scroll-snap-padding-block|scroll-snap-padding-block-end|scroll-snap-padding-block-start|scroll-snap-padding-bottom|scroll-snap-padding-inline|scroll-snap-padding-inline-end|scroll-snap-padding-inline-start|scroll-snap-padding-left|scroll-snap-padding-right|scroll-snap-padding-top|scroll-snap-type|shape-image-threshold|shape-inside|shape-margin|shape-outside|size|speak|speak-as|speak-header|speak-numeral|speak-punctuation|speech-rate|stress|string-set|stroke|stroke-alignment|stroke-dashadjust|stroke-dasharray|stroke-dashcorner|stroke-dashoffset|stroke-linecap|stroke-linejoin|stroke-miterlimit|stroke-opacity|stroke-width|table-layout|tab-size|text-align|text-align-all|text-align-last|text-combine-upright|text-decoration|text-decoration-color|text-decoration-line|text-decoration-skip|text-decoration-style|text-emphasis|text-emphasis-color|text-emphasis-position|text-emphasis-style|text-indent|text-justify|text-orientation|text-overflow|text-shadow|text-space-collapse|text-space-trim|text-spacing|text-transform|text-underline-position|text-wrap|top|transform|transform-box|transform-origin|transform-style|transition|transition-delay|transition-duration|transition-property|transition-timing-function|unicode-bidi|user-select|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch|voice-range|voice-rate|voice-stress|voice-volume|volume|white-space|widows|width|will-change|word-break|word-spacing|word-wrap|wrap-after|wrap-before|wrap-flow|wrap-inside|wrap-through|writing-mode|z-index):"
- - default:
- start: ":"
- end: "[;^\\{]"
- rules: []
+ # - default:
+ # start: ":"
+ # end: "[;^\\{]"
+ # rules: []
- special: "!important"
- identifier: ":active|:focus|:hover|:link|:visited|:link|:after|:before|$"
- special: "(\\{|\\}|\\(|\\)|\\;|:|\\]|~|<|>|,)"
@@ -25,11 +25,13 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- special: "\"|'"
diff --git a/syntax_files/cython.yaml b/syntax_files/cython.yaml
index 844adcf..5a30c60 100644
--- a/syntax_files/cython.yaml
+++ b/syntax_files/cython.yaml
@@ -33,12 +33,14 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/d.yaml b/syntax_files/d.yaml
index e7ab369..10f69ca 100644
--- a/syntax_files/d.yaml
+++ b/syntax_files/d.yaml
@@ -53,6 +53,7 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
# WysiwygString
diff --git a/syntax_files/dart.yaml b/syntax_files/dart.yaml
index 43f4caa..5409d05 100644
--- a/syntax_files/dart.yaml
+++ b/syntax_files/dart.yaml
@@ -33,12 +33,14 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/dockerfile.yaml b/syntax_files/dockerfile.yaml
index f75b400..4d3577e 100644
--- a/syntax_files/dockerfile.yaml
+++ b/syntax_files/dockerfile.yaml
@@ -23,12 +23,14 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/dot.yaml b/syntax_files/dot.yaml
index 24e1567..cea9a58 100644
--- a/syntax_files/dot.yaml
+++ b/syntax_files/dot.yaml
@@ -11,6 +11,7 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/fish.yaml b/syntax_files/fish.yaml
index 6806cc7..88798a0 100644
--- a/syntax_files/fish.yaml
+++ b/syntax_files/fish.yaml
@@ -30,12 +30,14 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules: []
- comment:
diff --git a/syntax_files/fortran.yaml b/syntax_files/fortran.yaml
index 5b99a18..b30e544 100644
--- a/syntax_files/fortran.yaml
+++ b/syntax_files/fortran.yaml
@@ -44,12 +44,14 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/gdscript.yaml b/syntax_files/gdscript.yaml
index 3aa81e5..e323c15 100644
--- a/syntax_files/gdscript.yaml
+++ b/syntax_files/gdscript.yaml
@@ -47,12 +47,14 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
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: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
diff --git a/syntax_files/gentoo-ebuild.yaml b/syntax_files/gentoo-ebuild.yaml
index c1cdd31..0d118f4 100644
--- a/syntax_files/gentoo-ebuild.yaml
+++ b/syntax_files/gentoo-ebuild.yaml
@@ -29,12 +29,14 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/golo.yaml b/syntax_files/golo.yaml
index 8ff7262..54e0527 100644
--- a/syntax_files/golo.yaml
+++ b/syntax_files/golo.yaml
@@ -48,12 +48,14 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/haskell.yaml b/syntax_files/haskell.yaml
index aa3eb00..af406ab 100644
--- a/syntax_files/haskell.yaml
+++ b/syntax_files/haskell.yaml
@@ -30,6 +30,7 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/html.yaml b/syntax_files/html.yaml
index d4915c9..d858096 100644
--- a/syntax_files/html.yaml
+++ b/syntax_files/html.yaml
@@ -1,27 +1,44 @@
filetype: html
-detect:
+detect:
filename: "\\.htm[l]?$"
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:]]]*;"
- - 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: ""
- constant.string:
start: "\""
end: "\""
- rules: []
+ skip: "\\\\."
+ rules:
+ - constant.specialChar: "\\\\."
- default:
start: ""
end: ""
+ limit-group: symbol.tag
rules:
- include: "javascript"
- default:
start: ""
end: ""
+ limit-group: symbol.tag
rules:
- include: "css"
diff --git a/syntax_files/html4.yaml b/syntax_files/html4.yaml
index cd66276..7bf851e 100644
--- a/syntax_files/html4.yaml
+++ b/syntax_files/html4.yaml
@@ -1,7 +1,7 @@
filetype: html4
detect:
- filename: "\\.htm[l]?$"
+ filename: "\\.htm[l]?4$"
header: ""
rules:
diff --git a/syntax_files/html5.yaml b/syntax_files/html5.yaml
index 8232327..bce0ae8 100644
--- a/syntax_files/html5.yaml
+++ b/syntax_files/html5.yaml
@@ -1,7 +1,7 @@
filetype: html5
detect:
- filename: "\\.htm[l]?$"
+ filename: "\\.htm[l]?5$"
header: ""
rules:
diff --git a/syntax_files/java.yaml b/syntax_files/java.yaml
index 2327187..c045a0c 100644
--- a/syntax_files/java.yaml
+++ b/syntax_files/java.yaml
@@ -13,12 +13,14 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- preproc: "..+"
- constant.specialChar: "\\\\."
diff --git a/syntax_files/javascript.yaml b/syntax_files/javascript.yaml
index 79afd3e..5a3fee2 100644
--- a/syntax_files/javascript.yaml
+++ b/syntax_files/javascript.yaml
@@ -22,12 +22,14 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/json.yaml b/syntax_files/json.yaml
index e10f7f5..c590bd3 100644
--- a/syntax_files/json.yaml
+++ b/syntax_files/json.yaml
@@ -13,12 +13,15 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+
- statement: "\\\"(\\\\\"|[^\"])*\\\"[[:space:]]*:\" \"'(\\'|[^'])*'[[:space:]]*:"
- constant: "\\\\u[0-9a-fA-F]{4}|\\\\[bfnrt'\"/\\\\]"
diff --git a/syntax_files/keymap.yaml b/syntax_files/keymap.yaml
index 50aad50..317a1ee 100644
--- a/syntax_files/keymap.yaml
+++ b/syntax_files/keymap.yaml
@@ -11,11 +11,13 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- comment:
diff --git a/syntax_files/lilypond.yaml b/syntax_files/lilypond.yaml
index 2938188..8023091 100644
--- a/syntax_files/lilypond.yaml
+++ b/syntax_files/lilypond.yaml
@@ -12,6 +12,7 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- comment:
diff --git a/syntax_files/lua.yaml b/syntax_files/lua.yaml
index d8c6802..b05093c 100644
--- a/syntax_files/lua.yaml
+++ b/syntax_files/lua.yaml
@@ -27,12 +27,14 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/makefile.yaml b/syntax_files/makefile.yaml
index 86af21d..72502a8 100644
--- a/syntax_files/makefile.yaml
+++ b/syntax_files/makefile.yaml
@@ -19,11 +19,13 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- identifier: "\\$+(\\{[^} ]+\\}|\\([^) ]+\\))"
diff --git a/syntax_files/micro.yaml b/syntax_files/micro.yaml
index 4c53da8..8c84ffd 100644
--- a/syntax_files/micro.yaml
+++ b/syntax_files/micro.yaml
@@ -16,6 +16,7 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.number: "#[0-9 A-F a-f]+"
diff --git a/syntax_files/objc.yaml b/syntax_files/objc.yaml
index 5644ac7..1a8b719 100644
--- a/syntax_files/objc.yaml
+++ b/syntax_files/objc.yaml
@@ -35,12 +35,14 @@ rules:
- constant.string:
start: "@\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/pascal.yaml b/syntax_files/pascal.yaml
index 69795ee..cb67881 100644
--- a/syntax_files/pascal.yaml
+++ b/syntax_files/pascal.yaml
@@ -23,6 +23,7 @@ rules:
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- preproc:
diff --git a/syntax_files/python2.yaml b/syntax_files/python2.yaml
index f702c15..dc892ba 100644
--- a/syntax_files/python2.yaml
+++ b/syntax_files/python2.yaml
@@ -42,12 +42,14 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
@@ -55,3 +57,4 @@ rules:
start: "#"
end: "$"
rules: []
+
diff --git a/syntax_files/python3.yaml b/syntax_files/python3.yaml
index 8fc05af..79b353d 100644
--- a/syntax_files/python3.yaml
+++ b/syntax_files/python3.yaml
@@ -16,9 +16,9 @@ rules:
# 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"
# definitions
- - identifier: "def [a-zA-Z_0-9]+"
+ - identifier: "def [a-zA-Z_0-9]+"
# 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
- brightgreen: "@.*[(]"
# operators
@@ -41,12 +41,14 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/rust.yaml b/syntax_files/rust.yaml
index 4347260..9bc1901 100644
--- a/syntax_files/rust.yaml
+++ b/syntax_files/rust.yaml
@@ -20,6 +20,7 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/scala.yaml b/syntax_files/scala.yaml
index ec10cde..327b2b9 100644
--- a/syntax_files/scala.yaml
+++ b/syntax_files/scala.yaml
@@ -10,6 +10,7 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant: "\\b(true|false|null)\\b"
diff --git a/syntax_files/sh.yaml b/syntax_files/sh.yaml
index 88f7203..069433f 100644
--- a/syntax_files/sh.yaml
+++ b/syntax_files/sh.yaml
@@ -26,6 +26,7 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/solidity.yaml b/syntax_files/solidity.yaml
index 4f5ea54..659a8fb 100644
--- a/syntax_files/solidity.yaml
+++ b/syntax_files/solidity.yaml
@@ -29,11 +29,13 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/swift.yaml b/syntax_files/swift.yaml
index abaee1a..348480a 100644
--- a/syntax_files/swift.yaml
+++ b/syntax_files/swift.yaml
@@ -27,6 +27,7 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/toml.yaml b/syntax_files/toml.yaml
index 1018324..dcbc125 100644
--- a/syntax_files/toml.yaml
+++ b/syntax_files/toml.yaml
@@ -17,12 +17,14 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/typescript.yaml b/syntax_files/typescript.yaml
index 12b4037..9ce50eb 100644
--- a/syntax_files/typescript.yaml
+++ b/syntax_files/typescript.yaml
@@ -32,11 +32,13 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/vi.yaml b/syntax_files/vi.yaml
index faac7cf..d7fe496 100644
--- a/syntax_files/vi.yaml
+++ b/syntax_files/vi.yaml
@@ -13,12 +13,14 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/yaml.yaml b/syntax_files/yaml.yaml
index 63f28bf..68238df 100644
--- a/syntax_files/yaml.yaml
+++ b/syntax_files/yaml.yaml
@@ -17,12 +17,14 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
diff --git a/syntax_files/zsh.yaml b/syntax_files/zsh.yaml
index 1d5e754..2182b8c 100644
--- a/syntax_files/zsh.yaml
+++ b/syntax_files/zsh.yaml
@@ -36,6 +36,7 @@ rules:
- constant.string:
start: "\""
end: "\""
+ skip: "\\\\."
rules:
- constant.specialChar: "\\\\."