diff --git a/Makefile b/Makefile index 5af3a9c..4f0a311 100644 --- a/Makefile +++ b/Makefile @@ -22,6 +22,8 @@ bench: go test -benchmem -bench=. ./php7 compile: ./php5/php5.go ./php7/php7.go ./scanner/scanner.go + sed -i '' -e 's/yyErrorVerbose = false/yyErrorVerbose = true/g' ./php7/php7.go + sed -i '' -e 's/yyErrorVerbose = false/yyErrorVerbose = true/g' ./php5/php5.go rm -f y.output ./scanner/scanner.go: ./scanner/scanner.l diff --git a/main.go b/main.go index bef38c2..53f9901 100644 --- a/main.go +++ b/main.go @@ -64,7 +64,11 @@ func parserWorker(pathCh <-chan string, result chan<- parser.Parser) { var parserWorker parser.Parser for { - path := <-pathCh + path, ok := <-pathCh + if !ok { + return + } + src, _ := os.Open(path) if *usePhp5 { @@ -80,7 +84,11 @@ func parserWorker(pathCh <-chan string, result chan<- parser.Parser) { func printer(result <-chan parser.Parser) { for { - parserWorker := <-result + parserWorker, ok := <-result + if !ok { + return + } + fmt.Printf("==> %s\n", parserWorker.GetPath()) for _, e := range parserWorker.GetErrors() { diff --git a/php5/parser.go b/php5/parser.go index ffb9cc6..b2175c9 100644 --- a/php5/parser.go +++ b/php5/parser.go @@ -56,9 +56,6 @@ func (l *Parser) Error(msg string) { // Parse the php7 Parser entrypoint func (l *Parser) Parse() int { - yyDebug = 0 - yyErrorVerbose = true - // init l.errors = nil l.rootNode = nil diff --git a/php5/php5.go b/php5/php5.go index c248a3f..2e14e0c 100644 --- a/php5/php5.go +++ b/php5/php5.go @@ -1968,7 +1968,7 @@ var yyErrorMessages = [...]struct { var ( yyDebug = 0 - yyErrorVerbose = false + yyErrorVerbose = true ) type yyLexer interface { diff --git a/php7/parser.go b/php7/parser.go index a8d3bd2..62f9de7 100644 --- a/php7/parser.go +++ b/php7/parser.go @@ -56,9 +56,6 @@ func (l *Parser) Error(msg string) { // Parse the php7 Parser entrypoint func (l *Parser) Parse() int { - yyDebug = 0 - yyErrorVerbose = true - // init l.errors = nil l.rootNode = nil diff --git a/php7/php7.go b/php7/php7.go index 891ad31..8f1d4b2 100644 --- a/php7/php7.go +++ b/php7/php7.go @@ -1758,7 +1758,7 @@ var yyErrorMessages = [...]struct { var ( yyDebug = 0 - yyErrorVerbose = false + yyErrorVerbose = true ) type yyLexer interface {