re2c
re2c copied to clipboard
Example is not C
This example https://github.com/skvadrik/re2c/blob/f2395c299886cfc5639f841f6445ab9ad0fa26f9/examples/c/conditions/parse_u32_conditions.re is transpiled as C but it contains C++ templates.
It can be trivially translated into C e.g. with
uint64_t add(uint64_t u, unsigned d, unsigned base) {
u = u * base + d;
if (u > UINT32_MAX) {
return UINT64_MAX;
} else {
return u;
}
}
and if it stays as C++ the template is excessive for this simple example and should probably be converted to the function above. If C++ stays, the deprecated C headers should be converted, e.g. <limits.h>
should be converted to <climits>
.