Merge branch 'master' of https://github.com/zyedidia/micro into build_tools

This commit is contained in:
GeigerCounter
2017-03-28 13:40:26 -04:00
61 changed files with 330 additions and 238 deletions

View File

@@ -2,7 +2,6 @@ package main
import (
"github.com/mattn/go-runewidth"
"github.com/zyedidia/micro/cmd/micro/highlight"
"github.com/zyedidia/tcell"
)
@@ -24,7 +23,7 @@ func visualToCharPos(visualIndex int, lineN int, str string, buf *Buffer, tabsiz
// width := StringWidth(str[:i], tabsize)
if group, ok := buf.Match(lineN)[charPos]; ok {
s := GetColor(highlight.GetGroup(group))
s := GetColor(group.String())
style = &s
}
@@ -123,7 +122,7 @@ func (c *CellView) Draw(buf *Buffer, top, height, left, width int) {
break
}
if group, ok := buf.Match(lineN)[colN]; ok {
curStyle = GetColor(highlight.GetGroup(group))
curStyle = GetColor(group.String())
}
char := line[colN]
@@ -136,6 +135,13 @@ func (c *CellView) Draw(buf *Buffer, top, height, left, width int) {
if viewCol >= 0 {
c.lines[viewLine][viewCol].drawChar = indentchar
c.lines[viewLine][viewCol].width = width
indentStyle := curStyle
if group, ok := colorscheme["indent-char"]; ok {
indentStyle = group
}
c.lines[viewLine][viewCol].style = indentStyle
}
for i := 1; i < width; i++ {
@@ -179,7 +185,7 @@ func (c *CellView) Draw(buf *Buffer, top, height, left, width int) {
}
if group, ok := buf.Match(lineN)[len(line)]; ok {
curStyle = GetColor(highlight.GetGroup(group))
curStyle = GetColor(group.String())
}
// newline

View File

@@ -1,5 +1,8 @@
package highlight
// DetectFiletype will use the list of syntax definitions provided and the filename and first line of the file
// to determine the filetype of the file
// It will return the corresponding syntax definition for the filetype
func DetectFiletype(defs []*Def, filename string, firstLine []byte) *Def {
for _, d := range defs {
if d.ftdetect[0].MatchString(filename) {
@@ -14,6 +17,6 @@ func DetectFiletype(defs []*Def, filename string, firstLine []byte) *Def {
emptyDef := new(Def)
emptyDef.FileType = "Unknown"
emptyDef.rules = new(Rules)
emptyDef.rules = new(rules)
return emptyDef
}

View File

@@ -3,10 +3,21 @@ package highlight
import (
"regexp"
"strings"
"github.com/dlclark/regexp2"
"unicode/utf8"
)
// RunePos returns the rune index of a given byte index
// This could cause problems if the byte index is between code points
func runePos(p int, str string) int {
if p < 0 {
return 0
}
if p >= len(str) {
return utf8.RuneCountInString(str)
}
return utf8.RuneCountInString(str[:p])
}
func combineLineMatch(src, dst LineMatch) LineMatch {
for k, v := range src {
if g, ok := dst[k]; ok {
@@ -21,7 +32,7 @@ func combineLineMatch(src, dst LineMatch) LineMatch {
}
// A State represents the region at the end of a line
type State *Region
type State *region
// LineStates is an interface for a buffer-like object which can also store the states and matches for every line
type LineStates interface {
@@ -34,22 +45,22 @@ type LineStates interface {
// A Highlighter contains the information needed to highlight a string
type Highlighter struct {
lastRegion *Region
def *Def
lastRegion *region
Def *Def
}
// NewHighlighter returns a new highlighter from the given syntax definition
func NewHighlighter(def *Def) *Highlighter {
h := new(Highlighter)
h.def = def
h.Def = def
return h
}
// LineMatch represents the syntax highlighting matches for one line. Each index where the coloring is changed is marked with that
// color's group (represented as one byte)
type LineMatch map[int]uint8
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()
if strings.Contains(regexStr, "^") {
if !canMatchStart {
@@ -61,11 +72,30 @@ func findIndex(regex *regexp2.Regexp, str []rune, canMatchStart, canMatchEnd boo
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 {
return nil
}
return []int{match.Index, match.Index + match.Length}
// return []int{match.Index, match.Index + match.Length}
return []int{runePos(match[0], string(str)), runePos(match[1], string(str))}
}
func findAllIndex(regex *regexp.Regexp, str []rune, canMatchStart, canMatchEnd bool) [][]int {
@@ -80,51 +110,65 @@ func findAllIndex(regex *regexp.Regexp, str []rune, canMatchStart, canMatchEnd b
return nil
}
}
return regex.FindAllIndex([]byte(string(str)), -1)
matches := regex.FindAllIndex([]byte(string(str)), -1)
for i, m := range matches {
matches[i][0] = runePos(m[0], string(str))
matches[i][1] = runePos(m[1], string(str))
}
return matches
}
func (h *Highlighter) highlightRegion(highlights LineMatch, start int, canMatchEnd bool, lineNum int, line []rune, region *Region, statesOnly bool) LineMatch {
func (h *Highlighter) highlightRegion(highlights LineMatch, start int, canMatchEnd bool, lineNum int, line []rune, curRegion *region, statesOnly bool) LineMatch {
// highlights := make(LineMatch)
if start == 0 {
if !statesOnly {
highlights[0] = region.group
highlights[0] = curRegion.group
}
}
loc := findIndex(region.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 !statesOnly {
highlights[start+loc[1]-1] = region.group
highlights[start+loc[1]-1] = curRegion.group
}
if region.parent == nil {
if curRegion.parent == nil {
if !statesOnly {
highlights[start+loc[1]] = 0
h.highlightRegion(highlights, start, false, lineNum, line[:loc[0]], region, statesOnly)
h.highlightRegion(highlights, start, false, lineNum, line[:loc[0]], curRegion, statesOnly)
}
h.highlightEmptyRegion(highlights, start+loc[1], canMatchEnd, lineNum, line[loc[1]:], statesOnly)
return highlights
}
if !statesOnly {
highlights[start+loc[1]] = region.parent.group
h.highlightRegion(highlights, start, false, lineNum, line[:loc[0]], region, statesOnly)
highlights[start+loc[1]] = curRegion.parent.group
h.highlightRegion(highlights, start, false, lineNum, line[:loc[0]], curRegion, statesOnly)
}
h.highlightRegion(highlights, start+loc[1], canMatchEnd, lineNum, line[loc[1]:], region.parent, statesOnly)
h.highlightRegion(highlights, start+loc[1], canMatchEnd, lineNum, line[loc[1]:], curRegion.parent, statesOnly)
return highlights
}
if len(line) == 0 || statesOnly {
if canMatchEnd {
h.lastRegion = region
h.lastRegion = curRegion
}
return highlights
}
firstLoc := []int{len(line), 0}
var firstRegion *Region
for _, r := range region.rules.regions {
loc := findIndex(r.start, line, start == 0, canMatchEnd)
var firstRegion *region
for _, r := range curRegion.rules.regions {
loc := findIndex(r.start, nil, line, start == 0, canMatchEnd)
if loc != nil {
if loc[0] < firstLoc[0] {
firstLoc = loc
@@ -134,17 +178,17 @@ func (h *Highlighter) highlightRegion(highlights LineMatch, start int, canMatchE
}
if firstLoc[0] != len(line) {
highlights[start+firstLoc[0]] = firstRegion.group
h.highlightRegion(highlights, start, false, lineNum, line[:firstLoc[0]], region, statesOnly)
h.highlightRegion(highlights, start, false, lineNum, line[:firstLoc[0]], curRegion, statesOnly)
h.highlightRegion(highlights, start+firstLoc[1], canMatchEnd, lineNum, line[firstLoc[1]:], firstRegion, statesOnly)
return highlights
}
fullHighlights := make([]uint8, len([]rune(string(line))))
fullHighlights := make([]Group, len([]rune(string(line))))
for i := 0; i < len(fullHighlights); i++ {
fullHighlights[i] = region.group
fullHighlights[i] = curRegion.group
}
for _, p := range region.rules.patterns {
for _, p := range curRegion.rules.patterns {
matches := findAllIndex(p.regex, line, start == 0, canMatchEnd)
for _, m := range matches {
for i := m[0]; i < m[1]; i++ {
@@ -161,7 +205,7 @@ func (h *Highlighter) highlightRegion(highlights LineMatch, start int, canMatchE
}
if canMatchEnd {
h.lastRegion = region
h.lastRegion = curRegion
}
return highlights
@@ -176,9 +220,9 @@ func (h *Highlighter) highlightEmptyRegion(highlights LineMatch, start int, canM
}
firstLoc := []int{len(line), 0}
var firstRegion *Region
for _, r := range h.def.rules.regions {
loc := findIndex(r.start, line, start == 0, canMatchEnd)
var firstRegion *region
for _, r := range h.Def.rules.regions {
loc := findIndex(r.start, nil, line, start == 0, canMatchEnd)
if loc != nil {
if loc[0] < firstLoc[0] {
firstLoc = loc
@@ -203,8 +247,8 @@ func (h *Highlighter) highlightEmptyRegion(highlights LineMatch, start int, canM
return highlights
}
fullHighlights := make([]uint8, len(line))
for _, p := range h.def.rules.patterns {
fullHighlights := make([]Group, len(line))
for _, p := range h.Def.rules.patterns {
matches := findAllIndex(p.regex, line, start == 0, canMatchEnd)
for _, m := range matches {
for i := m[0]; i < m[1]; i++ {

View File

@@ -4,17 +4,21 @@ import (
"fmt"
"regexp"
"github.com/dlclark/regexp2"
"gopkg.in/yaml.v2"
)
var Groups map[string]uint8
var numGroups uint8
// A Group represents a syntax group
type Group uint8
func GetGroup(n uint8) string {
// Groups contains all of the groups that are defined
// You can access them in the map via their string name
var Groups map[string]Group
var numGroups Group
// String returns the group name attached to the specific group
func (g Group) String() string {
for k, v := range Groups {
if v == n {
if v == g {
return k
}
}
@@ -28,40 +32,41 @@ func GetGroup(n uint8) string {
type Def struct {
FileType string
ftdetect []*regexp.Regexp
rules *Rules
rules *rules
}
// A Pattern is one simple syntax rule
// It has a group that the rule belongs to, as well as
// the regular expression to match the pattern
type Pattern struct {
group uint8
type pattern struct {
group Group
regex *regexp.Regexp
}
// Rules defines which patterns and regions can be used to highlight
// rules defines which patterns and regions can be used to highlight
// a filetype
type Rules struct {
regions []*Region
patterns []*Pattern
type rules struct {
regions []*region
patterns []*pattern
includes []string
}
// A Region is a highlighted region (such as a multiline comment, or a string)
// A region is a highlighted region (such as a multiline comment, or a string)
// It belongs to a group, and has start and end regular expressions
// A Region also has rules of its own that only apply when matching inside the
// A region also has rules of its own that only apply when matching inside the
// region and also rules from the above region do not match inside this region
// Note that a region may contain more regions
type Region struct {
group uint8
parent *Region
start *regexp2.Regexp
end *regexp2.Regexp
rules *Rules
type region struct {
group Group
parent *region
start *regexp.Regexp
end *regexp.Regexp
skip *regexp.Regexp
rules *rules
}
func init() {
Groups = make(map[string]uint8)
Groups = make(map[string]Group)
}
// ParseDef parses an input syntax file into a highlight Def
@@ -118,6 +123,8 @@ func ParseDef(input []byte) (s *Def, err error) {
return s, err
}
// ResolveIncludes will sort out the rules for including other filetypes
// You should call this after parsing all the Defs
func ResolveIncludes(defs []*Def) {
for _, d := range defs {
resolveIncludesInDef(defs, d)
@@ -139,7 +146,7 @@ func resolveIncludesInDef(defs []*Def, d *Def) {
}
}
func resolveIncludesInRegion(defs []*Def, region *Region) {
func resolveIncludesInRegion(defs []*Def, region *region) {
for _, lang := range region.rules.includes {
for _, searchDef := range defs {
if lang == searchDef.FileType {
@@ -154,8 +161,8 @@ func resolveIncludesInRegion(defs []*Def, region *Region) {
}
}
func parseRules(input []interface{}, curRegion *Region) (*Rules, error) {
rules := new(Rules)
func parseRules(input []interface{}, curRegion *region) (*rules, error) {
rules := new(rules)
for _, v := range input {
rule := v.(map[interface{}]interface{})
@@ -179,10 +186,10 @@ func parseRules(input []interface{}, curRegion *Region) (*Rules, error) {
Groups[groupStr] = numGroups
}
groupNum := Groups[groupStr]
rules.patterns = append(rules.patterns, &Pattern{groupNum, r})
rules.patterns = append(rules.patterns, &pattern{groupNum, r})
}
case map[interface{}]interface{}:
// Region
// region
region, err := parseRegion(group.(string), object, curRegion)
if err != nil {
return nil, err
@@ -197,10 +204,10 @@ func parseRules(input []interface{}, curRegion *Region) (*Rules, error) {
return rules, nil
}
func parseRegion(group string, regionInfo map[interface{}]interface{}, prevRegion *Region) (*Region, error) {
func parseRegion(group string, regionInfo map[interface{}]interface{}, prevRegion *region) (*region, error) {
var err error
region := new(Region)
region := new(region)
if _, ok := Groups[group]; !ok {
numGroups++
Groups[group] = numGroups
@@ -209,18 +216,27 @@ func parseRegion(group string, regionInfo map[interface{}]interface{}, prevRegio
region.group = groupNum
region.parent = prevRegion
region.start, err = regexp2.Compile(regionInfo["start"].(string), 0)
region.start, err = regexp.Compile(regionInfo["start"].(string))
if err != nil {
return nil, err
}
region.end, err = regexp2.Compile(regionInfo["end"].(string), 0)
region.end, err = regexp.Compile(regionInfo["end"].(string))
if err != nil {
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)
if err != nil {

View File

@@ -78,12 +78,19 @@ func NewLineArray(reader io.Reader) *LineArray {
br := bufio.NewReader(&buf)
for i := 0; i < numlines; i++ {
i := 0
for {
data, err := br.ReadBytes('\n')
if err != nil {
if err == io.EOF {
// la.lines[i] = Line{data[:len(data)], nil, nil, false}
la.lines[i].data = data
if i >= len(la.lines) {
if len(data) != 0 {
la.lines = append(la.lines, Line{data, nil, nil, false})
}
} else {
la.lines[i].data = data
}
}
// Last line was read
break
@@ -91,6 +98,9 @@ func NewLineArray(reader io.Reader) *LineArray {
la.lines[i].data = data[:len(data)-1]
// la.lines[i] = Line{data[:len(data)-1], nil, nil, false}
}
i++
}
for i := 0; i < numlines; i++ {
}
return la

View File

@@ -201,7 +201,14 @@ func InitScreen() {
// RedrawAll redraws everything -- all the views and the messenger
func RedrawAll() {
messenger.Clear()
screen.Clear()
w, h := screen.Size()
for x := 0; x < w; x++ {
for y := 0; y < h; y++ {
screen.SetContent(x, y, ' ', nil, defStyle)
}
}
for _, v := range tabs[curTab].views {
v.Display()
}

File diff suppressed because one or more lines are too long

View File

@@ -1,11 +1,12 @@
color-link comment "bold brightgreen"
color-link constant "cyan"
color-link constant.specialChar "red"
color-link identifier "blue"
color-link statement "green"
color-link symbol "green"
color-link preproc "bold brightred"
color-link preproc "brightred"
color-link type "yellow"
color-link special "red"
color-link special "blue"
color-link underlined "magenta"
color-link error "bold brightred"
color-link todo "bold magenta"
@@ -19,4 +20,4 @@ color-link gutter-warning "brightred,default"
color-link cursor-line "black"
color-link color-column "black"
color-link type.extended "default"
color-link symbol.brackets "default"
color-link symbol.brackets "default"

View File

@@ -5,7 +5,7 @@ This help page aims to cover two aspects of micro's syntax highlighting engine:
- How to create colorschemes and use them
- How to create syntax files to add to the list of languages micro can highlight
### Colorschemes
## Colorschemes
Micro comes with a number of colorschemes by default. Here is the list:
@@ -191,13 +191,10 @@ Here's a list of subgroups used in micro's built-in syntax files.
In the future, plugins may also be able to use color groups for styling.
### Syntax files
## Syntax files
The syntax files specify how to highlight certain languages.
The syntax files is written in yaml-format and specify how to highlight languages.
<<<<<<< HEAD
Syntax files are specified in the yaml format.
=======
Micro's builtin syntax highlighting tries very hard to be sane, sensible
and provide ample coverage of the meaningful elements of a language. Micro has
syntax files built int for over 100 languages now. However, there may be
@@ -205,11 +202,7 @@ situations where you find Micro's highlighting to be insufficient or not to
your liking. Good news is you can create syntax files (.micro extension), place them in
`~/.config/micro/syntax` and Micro will use those instead.
The first statement in a syntax file will probably the syntax statement. This tells micro
what language the syntax file is for and how to detect a file in that language.
>>>>>>> master
#### Filetype defintion
### Filetype defintion
You must start the syntax file by declaring the filetype:
@@ -219,7 +212,7 @@ filetype: go
#### Detect definition
Then you can provide information about how to detect the filetype:
Then you must provide information about how to detect the filetype:
```
detect:
@@ -227,7 +220,7 @@ detect:
```
Micro will match this regex against a given filename to detect the filetype. You may also
provide an optional `header` regex that will check the first line of the file. For example for yaml:
provide an optional `header` regex that will check the first line of the file. For example:
```
detect:
@@ -257,7 +250,7 @@ And here are some example regions for Go:
```
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "%."
- constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
@@ -276,10 +269,20 @@ And here are some example regions for Go:
- todo: "(TODO|XXX|FIXME):?"
```
Notice how the regions may contain rules inside of them.
Notice how the regions may contain rules inside of them. Any inner rules that are matched are then skipped when searching
for the end of the region. For example, when highlighting `"foo \" bar"`, since `\"` is matched by an inner rule in the
region, it is skipped. Likewise for `"foo \\" bar`, since `\\` is matched by an inner rule, it is skipped, and then the `"`
is found and the string ends at the correct place.
Also the regexes for region start and end may contain more complex regexes with lookahead and lookbehind,
but this is not supported for pattern regexes.
You may also explicitly mark skip regexes if you don't want them to be highlighted. For example:
```
- constant.string:
start: "\""
end: "\""
skip: "\\."
rules: []
```
#### Includes
@@ -299,7 +302,3 @@ for html:
rules:
- include: "css"
```
Note: The format of syntax files will be changing with the view refactor.
If this help file still retains this note but the syntax files are yaml
please open an issue.

View File

@@ -140,6 +140,12 @@ Here are the options that you can set:
default value: `on`
* `keepautoindent`: when using autoindent, whitespace is added for you. This option determines if
when you move to the next line without any insertions the whitespace that was added should be deleted.
By default the autoindent whitespace is deleted if the line was left empty.
default value: `off`
---
Default plugin options:

View File

@@ -46,7 +46,7 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."

View File

@@ -74,13 +74,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- preproc: "..+"
- constant.specialChar: "\\\\."

View File

@@ -90,13 +90,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."

View File

@@ -24,13 +24,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."

View File

@@ -27,13 +27,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- preproc: "..+"
- constant.specialChar: "\\\\."

View File

@@ -10,7 +10,7 @@ rules:
- constant.specialChar: "^\\s*}$"
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."

View File

@@ -24,7 +24,7 @@ rules:
# String highlighting
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "(\\\\u[0-9A-fa-f]{4,4}|\\\\newline|\\\\space|\\\\tab|\\\\formfeed|\\\\backspace|\\\\return|\\\\.)"

View File

@@ -15,13 +15,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."

View File

@@ -16,7 +16,7 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."

View File

@@ -6,7 +6,7 @@ detect:
rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules: []
- comment:

View File

@@ -28,13 +28,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- preproc: "..+"
- constant.specialChar: "\\\\."

View File

@@ -32,14 +32,14 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialchar: "\\\\."
- special: "#\\{[^}]*\\}"
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules: []
- comment:

View File

@@ -23,14 +23,14 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
- constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\([btnfr]|'|\\\"|\\\\)"
- constant.specialChar: "\\\\u[A-Fa-f0-9]{4}"

View File

@@ -24,12 +24,12 @@ rules:
# Strings
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."
- special: "\"|'"

View File

@@ -32,13 +32,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."

View File

@@ -26,7 +26,7 @@ rules:
# Character literals
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."
# Keywords
@@ -52,13 +52,13 @@ rules:
# DoubleQuotedString
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
# WysiwygString
- constant.string:
start: "r\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
@@ -69,7 +69,7 @@ rules:
# HexString
- constant.string:
start: "x\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
# DelimitedString

View File

@@ -32,13 +32,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."

View File

@@ -22,13 +22,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."

View File

@@ -10,7 +10,7 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."

View File

@@ -29,13 +29,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules: []
- comment:

View File

@@ -43,13 +43,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."

View File

@@ -46,13 +46,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\([0-7]{3}|x[A-Fa-f0-9]{2}|u[A-Fa-f0-9]{4}|U[A-Fa-f0-9]{8})"

View File

@@ -28,13 +28,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."

View File

@@ -29,7 +29,7 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "%."
- constant.specialChar: "\\\\[abfnrtv'\\\"\\\\]"
@@ -37,7 +37,7 @@ rules:
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- error: "..+"
- constant.specialChar: "%."

View File

@@ -47,13 +47,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."

View File

@@ -29,7 +29,7 @@ rules:
# Strings
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."

View File

@@ -10,7 +10,7 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules: []
- default:

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:

View File

@@ -1,7 +1,7 @@
filetype: html5
detect:
filename: "\\.htm[l]?$"
filename: "\\.htm[l]?5$"
header: "<!DOCTYPE html5>"
rules:

View File

@@ -12,13 +12,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- preproc: "..+"
- constant.specialChar: "\\\\."

View File

@@ -21,13 +21,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."

View File

@@ -12,12 +12,12 @@ rules:
- constant: "\\b(true|false)\\b"
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."
- statement: "\\\"(\\\\\"|[^\"])*\\\"[[:space:]]*:\" \"'(\\'|[^'])*'[[:space:]]*:"

View File

@@ -10,12 +10,12 @@ rules:
- special: "="
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."
- comment:

View File

@@ -11,7 +11,7 @@ rules:
- special: "[(){}<>]|\\[|\\]"
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- comment:

View File

@@ -26,13 +26,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."

View File

@@ -23,7 +23,7 @@ rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."
- identifier: "\\$+(\\{[^} ]+\\}|\\([^) ]+\\))"

View File

@@ -15,7 +15,7 @@ rules:
rules: []
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.number: "#[0-9 A-F a-f]+"

View File

@@ -34,13 +34,13 @@ rules:
- constant.string:
start: "@\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."

View File

@@ -22,7 +22,7 @@ rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."
- preproc:

View File

@@ -41,13 +41,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."

View File

@@ -40,13 +40,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."

View File

@@ -19,7 +19,7 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."

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"
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant: "\\b(true|false|null)\\b"

View File

@@ -25,13 +25,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules: []
- comment:

View File

@@ -28,12 +28,12 @@ rules:
- todo: "TODO:?"
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."

View File

@@ -26,7 +26,7 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."

View File

@@ -16,13 +16,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."

View File

@@ -31,12 +31,12 @@ rules:
- todo: "TODO:?"
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."

View File

@@ -12,13 +12,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."

View File

@@ -16,13 +16,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules:
- constant.specialChar: "\\\\."

View File

@@ -35,13 +35,13 @@ rules:
- constant.string:
start: "\""
end: "(?<!\\\\)\""
end: "\""
rules:
- constant.specialChar: "\\\\."
- constant.string:
start: "'"
end: "(?<!\\\\)'"
end: "'"
rules: []
- comment: