Fix region highlighting and skipping

Ref #8
This commit is contained in:
Zachary Yedidia committed 2017-03-30 10:33:52 -04:00
1 parent 98b6b4f75e
commit c6faee5e6c
52 files changed
+161 -58

No files matched your search

+19 -32
View File
@@ -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
// }
}
}
+24 -6
View File
@@ -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 {
+1
View File
@@ -47,6 +47,7 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+2
View File
@@ -75,12 +75,14 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- preproc: "..+"
- constant.specialChar: "\\\\."
+2
View File
@@ -91,12 +91,14 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+2
View File
@@ -25,12 +25,14 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+2
View File
@@ -28,12 +28,14 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- preproc: "..+"
- constant.specialChar: "\\\\."
+1
View File
@@ -11,6 +11,7 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+1
View File
@@ -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|\\\\.)"
+2
View File
@@ -16,12 +16,14 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+1
View File
@@ -17,6 +17,7 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+1
View File
@@ -7,6 +7,7 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules: []
- comment:
+2
View File
@@ -29,12 +29,14 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- preproc: "..+"
- constant.specialChar: "\\\\."
+6 -3
View File
@@ -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: "#"
+3 -1
View File
@@ -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}"
+10 -8
View File
@@ -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-dashadjLine truncated
- 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: "\"|'"
+2
View File
@@ -33,12 +33,14 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+1
View File
@@ -53,6 +53,7 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
# WysiwygString
+2
View File
@@ -33,12 +33,14 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+2
View File
@@ -23,12 +23,14 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+1
View File
@@ -11,6 +11,7 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+2
View File
@@ -30,12 +30,14 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules: []
- comment:
+2
View File
@@ -44,12 +44,14 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+2
View File
@@ -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})"
+2
View File
@@ -29,12 +29,14 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+2
View File
@@ -48,12 +48,14 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+1
View File
@@ -30,6 +30,7 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+21 -4
View File
@@ -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: "<!DOCTYPE.+?>"
- constant.string:
start: "\""
end: "\""
rules: []
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- default:
start: "<script.*?>"
end: "</script.*?>"
limit-group: symbol.tag
rules:
- include: "javascript"
- default:
start: "<style.*?>"
end: "</style.*?>"
limit-group: symbol.tag
rules:
- include: "css"
+1 -1
View File
@@ -1,7 +1,7 @@
filetype: html4
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\">"
rules:
+1 -1
View File
@@ -1,7 +1,7 @@
filetype: html5
detect:
filename: "\\.htm[l]?$"
filename: "\\.htm[l]?5$"
header: "<!DOCTYPE html5>"
rules:
+2
View File
@@ -13,12 +13,14 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- preproc: "..+"
- constant.specialChar: "\\\\."
+2
View File
@@ -22,12 +22,14 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+3
View File
@@ -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'\"/\\\\]"
+2
View File
@@ -11,11 +11,13 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- comment:
+1
View File
@@ -12,6 +12,7 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- comment:
+2
View File
@@ -27,12 +27,14 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+2
View File
@@ -19,11 +19,13 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- identifier: "\\$+(\\{[^} ]+\\}|\\([^) ]+\\))"
+1
View File
@@ -16,6 +16,7 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.number: "#[0-9 A-F a-f]+"
+2
View File
@@ -35,12 +35,14 @@ rules:
- constant.string:
start: "@\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+1
View File
@@ -23,6 +23,7 @@ rules:
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- preproc:
+3
View File
@@ -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: []
+4 -2
View File
@@ -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: "\\\\."
+1
View File
@@ -20,6 +20,7 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+1
View File
@@ -10,6 +10,7 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant: "\\b(true|false|null)\\b"
+1
View File
@@ -26,6 +26,7 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+2
View File
@@ -29,11 +29,13 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+1
View File
@@ -27,6 +27,7 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+2
View File
@@ -17,12 +17,14 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+2
View File
@@ -32,11 +32,13 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+2
View File
@@ -13,12 +13,14 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+2
View File
@@ -17,12 +17,14 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "'"
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."
+1
View File
@@ -36,6 +36,7 @@ rules:
- constant.string:
start: "\""
end: "\""
skip: "\\\\."
rules:
- constant.specialChar: "\\\\."