From a89c9319b3687bf8ebb0a6e1ca72572bfbdb2e8c Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Sun, 19 Feb 2017 21:00:54 -0500 Subject: [PATCH] Fix syncat example --- examples/syncat.go | 5 ++--- syntax_files/go.yaml | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/syncat.go b/examples/syncat.go index 8bc42ab..fcae35c 100644 --- a/examples/syncat.go +++ b/examples/syncat.go @@ -11,15 +11,14 @@ import ( "github.com/zyedidia/highlight" ) -var defs []*highlight.Def - func main() { + var defs []*highlight.Def gopath := os.Getenv("GOPATH") files, _ := ioutil.ReadDir(gopath + "/src/github.com/zyedidia/highlight/syntax_files") for _, f := range files { if strings.HasSuffix(f.Name(), ".yaml") { - input, _ := ioutil.ReadFile(gopath + "/src/github.com/zyedidia/highlight/syntax_files") + input, _ := ioutil.ReadFile(gopath + "/src/github.com/zyedidia/highlight/syntax_files/" + f.Name()) d, err := highlight.ParseDef(input) if err != nil { fmt.Println(err) diff --git a/syntax_files/go.yaml b/syntax_files/go.yaml index 3103e60..44bd570 100644 --- a/syntax_files/go.yaml +++ b/syntax_files/go.yaml @@ -1,7 +1,7 @@ filetype: go detect: - filename: "\\.go$" + filename: "\\.go$" rules: - statement: "\\b(break|case|continue|default|else|for|go|goto|if|range|return|switch)\\b"