goccmack / gocc

Parser / Scanner Generator
Other
622 stars 48 forks source link

Why can not use -o and -p at the same time? #94

Open OhYee opened 5 years ago

OhYee commented 5 years ago

I find that when I use gocc -p xxxx/xxxx -o ./analysis xxx.bnf, the package is still the default value.

It seems that because these lines. https://github.com/goccmack/gocc/blob/19e54f37e2bc8b72e65fef4a5a484070a404ad53/internal/config/config.go#L183-L186

If I use -o and -p together, is there any possiable problems?

I just want to put the .bnf file in a single folder.

tsal commented 4 years ago

I think it's possible this would break in a non-vGo / Go Modules context if both were allowed; the code generated could potentially reference packages that didn't exist.

However, since vGo is the default now, it might be better to check the environment first (for vGo), then react to the options.

It makes sense that both should be possible, but with a warning about the issues with older versions of Go.

awalterschulze commented 4 years ago

We are not the familiar with vGo, so a pull request to help people use gocc with vGo would be much appreciated.