gavinhoward / bc

An implementation of the POSIX bc calculator with GNU extensions and dc, moved away from GitHub. Finished, but well-maintained.
https://git.gavinhoward.com/gavin/bc
Other
145 stars 29 forks source link

Divergence from grammar defined by POSIX #48

Closed oguz-ismail closed 2 years ago

oguz-ismail commented 2 years ago

Observe:

$ bc -s <<x
define a(){
}define b(){
}
x

Parse error: bad token
    <stdin>:2

$ bc -s <<x
define a(){
};define b(){
}
x
$

As per POSIX, the first one should work fine, and the second should fail as a newline is required after a semicolon_list production. No other bc implementation exhibits this behavior except busybox bc, which is a fork of this one if I recall correctly.

gavinhoward commented 2 years ago

This has (hopefully) been fixed in commits 5b2fe303c8c7d85d299b6576f62c8191e492fdb0, 81f838f657a2b942a76c1240d1107a4d358fd2a2, and 9ffdd5ec6915bc01fa0ceb7f5b5e9e4327615044.

Could you please pull down those commits and test? If they work, I'll release an update soon.

gavinhoward commented 2 years ago

Oh, I meant to say that I looked at the standard, and I agree with you on the interpretation of it.

oguz-ismail commented 2 years ago

@gavinhoward Yeah, it works fine now. Thanks for the fix

gavinhoward commented 2 years ago

Thank you!

I'll run my release process and put out 5.2.1 as soon as it passes.

gavinhoward commented 2 years ago

5.2.1 is out. I believe that solves this issue, so I am going to close. Feel free to reopen if you need to.

Thank you for your report!