Add support for skipping

This commit is contained in:
Zachary Yedidia
2017-03-27 20:47:03 -04:00
parent 7c0a62e2a4
commit 98b6b4f75e
51 changed files with 134 additions and 100 deletions
+33 -9
View File
@@ -4,8 +4,6 @@ import (
"regexp" "regexp"
"strings" "strings"
"unicode/utf8" "unicode/utf8"
"github.com/dlclark/regexp2"
) )
// RunePos returns the rune index of a given byte index // RunePos returns the rune index of a given byte index
@@ -62,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 *regexp2.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,12 +72,30 @@ func findIndex(regex *regexp2.Regexp, str []rune, canMatchStart, canMatchEnd boo
return nil return nil
} }
} }
match, _ := regex.FindStringMatch(string(str))
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
})
}
}
} else {
strbytes = []byte(string(str))
}
match := regex.FindIndex(strbytes)
if match == nil { if match == nil {
return nil return nil
} }
return []int{match.Index, match.Index + match.Length} // return []int{match.Index, match.Index + match.Length}
// return []int{runePos(match.Index, string(str)), runePos(match.Index+match.Length, string(str))} return []int{runePos(match[0], string(str)), runePos(match[1], string(str))}
} }
func findAllIndex(regex *regexp.Regexp, str []rune, canMatchStart, canMatchEnd bool) [][]int { func findAllIndex(regex *regexp.Regexp, str []rune, canMatchStart, canMatchEnd bool) [][]int {
@@ -111,7 +127,15 @@ func (h *Highlighter) highlightRegion(highlights LineMatch, start int, canMatchE
} }
} }
loc := findIndex(curRegion.end, line, start == 0, canMatchEnd) 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)
if loc != nil { if loc != nil {
if !statesOnly { if !statesOnly {
highlights[start+loc[1]-1] = curRegion.group highlights[start+loc[1]-1] = curRegion.group
@@ -144,7 +168,7 @@ func (h *Highlighter) highlightRegion(highlights LineMatch, start int, canMatchE
var firstRegion *region var firstRegion *region
for _, r := range curRegion.rules.regions { for _, r := range curRegion.rules.regions {
loc := findIndex(r.start, line, start == 0, canMatchEnd) loc := findIndex(r.start, nil, line, start == 0, canMatchEnd)
if loc != nil { if loc != nil {
if loc[0] < firstLoc[0] { if loc[0] < firstLoc[0] {
firstLoc = loc firstLoc = loc
@@ -198,7 +222,7 @@ func (h *Highlighter) highlightEmptyRegion(highlights LineMatch, start int, canM
firstLoc := []int{len(line), 0} firstLoc := []int{len(line), 0}
var firstRegion *region var firstRegion *region
for _, r := range h.Def.rules.regions { for _, r := range h.Def.rules.regions {
loc := findIndex(r.start, line, start == 0, canMatchEnd) loc := findIndex(r.start, nil, line, start == 0, canMatchEnd)
if loc != nil { if loc != nil {
if loc[0] < firstLoc[0] { if loc[0] < firstLoc[0] {
firstLoc = loc firstLoc = loc
+14 -6
View File
@@ -4,8 +4,6 @@ import (
"fmt" "fmt"
"regexp" "regexp"
"github.com/dlclark/regexp2"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
) )
@@ -61,8 +59,9 @@ type rules struct {
type region struct { type region struct {
group Group group Group
parent *region parent *region
start *regexp2.Regexp start *regexp.Regexp
end *regexp2.Regexp end *regexp.Regexp
skip *regexp.Regexp
rules *rules rules *rules
} }
@@ -217,18 +216,27 @@ func parseRegion(group string, regionInfo map[interface{}]interface{}, prevRegio
region.group = groupNum region.group = groupNum
region.parent = prevRegion region.parent = prevRegion
region.start, err = regexp2.Compile(regionInfo["start"].(string), 0) region.start, err = regexp.Compile(regionInfo["start"].(string))
if err != nil { if err != nil {
return nil, err return nil, err
} }
region.end, err = regexp2.Compile(regionInfo["end"].(string), 0) region.end, err = regexp.Compile(regionInfo["end"].(string))
if err != nil { if err != nil {
return nil, err return nil, err
} }
// skip is optional
if _, ok := regionInfo["skip"]; ok {
region.skip, err = regexp.Compile(regionInfo["skip"].(string))
if err != nil {
return nil, err
}
}
region.rules, err = parseRules(regionInfo["rules"].([]interface{}), region) region.rules, err = parseRules(regionInfo["rules"].([]interface{}), region)
if err != nil { if err != nil {
+1 -1
View File
@@ -46,7 +46,7 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+2 -2
View File
@@ -74,13 +74,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- preproc: "..+" - preproc: "..+"
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+2 -2
View File
@@ -90,13 +90,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+2 -2
View File
@@ -24,13 +24,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+2 -2
View File
@@ -27,13 +27,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- preproc: "..+" - preproc: "..+"
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+1 -1
View File
@@ -10,7 +10,7 @@ rules:
- constant.specialChar: "^\\s*}$" - constant.specialChar: "^\\s*}$"
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+1 -1
View File
@@ -24,7 +24,7 @@ rules:
# String highlighting # String highlighting
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
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|\\\\.)"
+2 -2
View File
@@ -15,13 +15,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+1 -1
View File
@@ -16,7 +16,7 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+1 -1
View File
@@ -6,7 +6,7 @@ detect:
rules: rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: [] rules: []
- comment: - comment:
+2 -2
View File
@@ -28,13 +28,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- preproc: "..+" - preproc: "..+"
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+2 -2
View File
@@ -32,14 +32,14 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialchar: "\\\\." - constant.specialchar: "\\\\."
- special: "#\\{[^}]*\\}" - special: "#\\{[^}]*\\}"
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: [] rules: []
- comment: - comment:
+2 -2
View File
@@ -23,14 +23,14 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)" - constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
- constant.specialChar: "\\\\u[A-Fa-f0-9]{4}" - constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)" - constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
- constant.specialChar: "\\\\u[A-Fa-f0-9]{4}" - constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
+2 -2
View File
@@ -24,12 +24,12 @@ rules:
# Strings # Strings
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- special: "\"|'" - special: "\"|'"
+2 -2
View File
@@ -32,13 +32,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+4 -4
View File
@@ -26,7 +26,7 @@ rules:
# Character literals # Character literals
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
# Keywords # Keywords
@@ -52,13 +52,13 @@ rules:
# DoubleQuotedString # DoubleQuotedString
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
# WysiwygString # WysiwygString
- constant.string: - constant.string:
start: "r\"" start: "r\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
@@ -69,7 +69,7 @@ rules:
# HexString # HexString
- constant.string: - constant.string:
start: "x\"" start: "x\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
# DelimitedString # DelimitedString
+2 -2
View File
@@ -32,13 +32,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+2 -2
View File
@@ -22,13 +22,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+1 -1
View File
@@ -10,7 +10,7 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+2 -2
View File
@@ -29,13 +29,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: [] rules: []
- comment: - comment:
+2 -2
View File
@@ -43,13 +43,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+2 -2
View File
@@ -46,13 +46,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
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: "'"
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})"
+2 -2
View File
@@ -28,13 +28,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+4 -2
View File
@@ -29,7 +29,8 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
skip: "\\\\."
rules: rules:
- constant.specialChar: "%." - constant.specialChar: "%."
- constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]" - constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
@@ -37,7 +38,8 @@ rules:
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
skip: "\\\\."
rules: rules:
- error: "..+" - error: "..+"
- constant.specialChar: "%." - constant.specialChar: "%."
+2 -2
View File
@@ -47,13 +47,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+1 -1
View File
@@ -29,7 +29,7 @@ rules:
# Strings # Strings
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+1 -1
View File
@@ -10,7 +10,7 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: [] rules: []
- default: - default:
+2 -2
View File
@@ -12,13 +12,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- preproc: "..+" - preproc: "..+"
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+2 -2
View File
@@ -21,13 +21,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+2 -2
View File
@@ -12,12 +12,12 @@ rules:
- constant: "\\b(true|false)\\b" - constant: "\\b(true|false)\\b"
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- statement: "\\\"(\\\\\"|[^\"])*\\\"[[:space:]]*:\" \"'(\\'|[^'])*'[[:space:]]*:" - statement: "\\\"(\\\\\"|[^\"])*\\\"[[:space:]]*:\" \"'(\\'|[^'])*'[[:space:]]*:"
+2 -2
View File
@@ -10,12 +10,12 @@ rules:
- special: "=" - special: "="
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- comment: - comment:
+1 -1
View File
@@ -11,7 +11,7 @@ rules:
- special: "[(){}<>]|\\[|\\]" - special: "[(){}<>]|\\[|\\]"
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- comment: - comment:
+2 -2
View File
@@ -26,13 +26,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+1 -1
View File
@@ -23,7 +23,7 @@ rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- identifier: "\\$+(\\{[^} ]+\\}|\\([^) ]+\\))" - identifier: "\\$+(\\{[^} ]+\\}|\\([^) ]+\\))"
+1 -1
View File
@@ -15,7 +15,7 @@ rules:
rules: [] rules: []
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.number: "#[0-9 A-F a-f]+" - constant.number: "#[0-9 A-F a-f]+"
+2 -2
View File
@@ -34,13 +34,13 @@ rules:
- constant.string: - constant.string:
start: "@\"" start: "@\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+1 -1
View File
@@ -22,7 +22,7 @@ rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- preproc: - preproc:
+2 -2
View File
@@ -41,13 +41,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+2 -2
View File
@@ -40,13 +40,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+1 -1
View File
@@ -19,7 +19,7 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+1 -1
View File
@@ -9,7 +9,7 @@ rules:
- statement: "\\b(def|object|case|trait|lazy|implicit|abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile|sealed)\\b" - statement: "\\b(def|object|case|trait|lazy|implicit|abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile|sealed)\\b"
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant: "\\b(true|false|null)\\b" - constant: "\\b(true|false|null)\\b"
+2 -2
View File
@@ -25,13 +25,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: [] rules: []
- comment: - comment:
+2 -2
View File
@@ -28,12 +28,12 @@ rules:
- todo: "TODO:?" - todo: "TODO:?"
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+1 -1
View File
@@ -26,7 +26,7 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+2 -2
View File
@@ -16,13 +16,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+2 -2
View File
@@ -31,12 +31,12 @@ rules:
- todo: "TODO:?" - todo: "TODO:?"
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+2 -2
View File
@@ -12,13 +12,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+2 -2
View File
@@ -16,13 +16,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
+2 -2
View File
@@ -35,13 +35,13 @@ rules:
- constant.string: - constant.string:
start: "\"" start: "\""
end: "(?<!\\\\)\"" end: "\""
rules: rules:
- constant.specialChar: "\\\\." - constant.specialChar: "\\\\."
- constant.string: - constant.string:
start: "'" start: "'"
end: "(?<!\\\\)'" end: "'"
rules: [] rules: []
- comment: - comment: