]> git.lizzy.rs Git - micro.git/blobdiff - runtime/syntax/syntax_checker.go
Merge branch 'python-highlight-zero' of https://github.com/a11ce/micro into a11ce...
[micro.git] / runtime / syntax / syntax_checker.go
index 20d2e1db4daeda712e0f0f58c9aefb24594d3e3b..5b8da244b1deb9764dd739b7c44dc91b0dc77386 100644 (file)
@@ -5,7 +5,7 @@ import (
        "io/ioutil"
        "strings"
 
-       "github.com/zyedidia/micro/cmd/micro/highlight"
+       "github.com/zyedidia/highlight"
 )
 
 func main() {
@@ -14,17 +14,25 @@ func main() {
        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)
+                       input, _ := ioutil.ReadFile(f.Name())
+                       //fmt.Println("Checking file -> ", f.Name())
+                       file, err := highlight.ParseFile(input)
                        if err != nil {
                                hadErr = true
-                               fmt.Printf("%s:\n", f.Name())
+                               fmt.Printf("Could not parse file -> %s:\n", f.Name())
                                fmt.Println(err)
                                continue
                        }
+                       _, err1 := highlight.ParseDef(file, nil)
+                       if err1 != nil {
+                               hadErr = true
+                               fmt.Printf("Could not parse input file using highlight.ParseDef(%s):\n", f.Name())
+                               fmt.Println(err1)
+                               continue
+                       }
                }
        }
        if !hadErr {
-               fmt.Println("No issues!")
+               fmt.Println("No issues found!")
        }
 }