Add syntax_checker.go

Please use this file to check if the syntax files compile.
This commit is contained in:
Zachary Yedidia
2017-02-18 10:08:49 -05:00
parent e690c2cd5e
commit 9838375668
3 changed files with 47 additions and 6 deletions
+30
View File
@@ -0,0 +1,30 @@
package main
import (
"fmt"
"io/ioutil"
"strings"
"github.com/zyedidia/highlight"
)
func main() {
files, _ := ioutil.ReadDir(".")
hadErr := false
for _, f := range files {
if strings.HasSuffix(f.Name(), ".yaml") {
input, _ := ioutil.ReadFile("/Users/zachary/gocode/src/github.com/zyedidia/highlight/syntax_files/" + f.Name())
_, err := highlight.ParseDef(input)
if err != nil {
hadErr = true
fmt.Printf("%s:\n", f.Name())
fmt.Println(err)
continue
}
}
}
if !hadErr {
fmt.Println("No issues!")
}
}