Closed RadhiFadlillah closed 2 months ago
For other person who also found this issue, as workaround we can simply put an optional character and it will work nicely:
func re2goCounter(input string) int {
...
for { /*!re2c
...
pattern = _?([^0-9]);
{pattern} { count++; continue }
* { continue }
$ { return count }
*/
}
}
This has been fixed in master, now re2go no longer generates chained assignments. The fix will be part of release 4.0. It's would be very hard to backport as it's based on top of a complete rewrite of the codegen subsystem, so I'm not backporting it in 3.x.
(For benchmarking it's better to use master, as the workaround _?
adds one more tag with some runtime overhead on transitions.)
Yes, I can confirm it's been fixed in master.
It's would be very hard to backport as it's based on top of a complete rewrite of the codegen subsystem.
No worries, fortunately re2c is pretty easy to build.
Thanks!
As title said, I found a bug where re2go generates chained assignment. Given the following template:
When compiled with the following command:
Will generate the following code:
Unfortunately chained assignment like
yypmatch[0] = yypmatch[2] = yyt1
is not supported by Go.