php-parser/main.go

34 lines
437 B
Go
Raw Normal View History

2017-12-01 13:29:23 +00:00
package main
import (
2017-12-01 16:04:31 +00:00
"flag"
"fmt"
"log"
2017-12-01 13:29:23 +00:00
"os"
2017-12-01 16:04:31 +00:00
"github.com/yookoala/realpath"
)
2017-12-01 13:29:23 +00:00
func main() {
yyDebug = 0
yyErrorVerbose = true
2017-12-01 14:04:53 +00:00
2017-12-01 16:04:31 +00:00
flag.Parse()
for _, path := range flag.Args() {
real, err := realpath.Realpath(path)
checkErr(err)
fmt.Printf("\n==> %s", real)
src, _ := os.Open(string(real))
2017-12-03 18:49:18 +00:00
rootnode := parse(src, real)
fmt.Println(rootnode)
2017-12-01 14:04:53 +00:00
}
2017-12-01 16:04:31 +00:00
}
func checkErr(err error) {
if err != nil {
log.Fatal(err)
2017-12-01 14:04:53 +00:00
}
}