mirror of
https://github.com/rwinkhart/go-highlite.git
synced 2026-09-05 16:37:20 -04:00
Fixes.
This commit is contained in:
+5
-4
@@ -5,6 +5,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"os/ioutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RunePos returns the rune index of a given byte index
|
// RunePos returns the rune index of a given byte index
|
||||||
@@ -61,7 +62,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 ParseSyntaxFiles (dir string, defs *[]*highlight.Def) error{
|
func ParseSyntaxFiles (dir string, defs *[]*Def) error{
|
||||||
pattern := "*.yaml"
|
pattern := "*.yaml"
|
||||||
files, err := filepath.Glob(dir + "/" + pattern)
|
files, err := filepath.Glob(dir + "/" + pattern)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -74,14 +75,14 @@ func ParseSyntaxFiles (dir string, defs *[]*highlight.Def) error{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
d, err := highlight.ParseDef(file)
|
d, err := ParseDef(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Output(1, err.Error())
|
return err
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
*defs = append(*defs, d)
|
*defs = append(*defs, d)
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user