goccmack / gocc

Parser / Scanner Generator
Other
622 stars 48 forks source link

Add -profile option, remove unnecessary type conversion and output more detailed error messages #60

Closed mewmew closed 6 years ago

mewmew commented 6 years ago

The -profile option was present before but has since been commented out, add the option back to enable profiling of gocc.

An unnecessary type conversion was located by unconvert in the generated code of parser/parser.go

-               errorSymbols := p.stack.popN(int(p.stack.topIndex() - rs))
+               errorSymbols := p.stack.popN(p.stack.topIndex() - rs)

Last but not least, change the error handling so that extended error values don't lose extra information when reporting errors. For instance, using errors from the errors now reports the full context of the error.

awalterschulze commented 6 years ago

Looks good, except for:

errcheck ./...
main.go:203:23: pprof.StartCPUProfile(f)
make[1]: *** [errcheck] Error 1
make[1]: Leaving directory `/home/travis/gopath/src/github.com/goccmack/gocc'
make: *** [travis] Error 2

Do you think we should maybe even delete the profiling, or do you want to use it?

mewmew commented 6 years ago

Do you think we should maybe even delete the profiling, or do you want to use it?

We can delete it, and I'll add it locally when playing with performance tuning.

mewmew commented 6 years ago

There we go, the -profile flag has now been removed.

awalterschulze commented 6 years ago

Could you regenerate?

And maybe its time to upgrade the go version that is being tested in travis?

mewmew commented 6 years ago

Could you regenerate?

Done.

And maybe its time to upgrade the go version that is being tested in travis?

Also done.

awalterschulze commented 6 years ago

Thanks, this is a nice cleanup :)