On 02/08/23 11:43, Stefano Zacchiroli wrote:
> Heya, I'm hitting this error in the beancount v2 C parser (quoting from
> beancount/parser/tokens.c):
>
> if (lines > LONG_STRING_LINES_MAX) {
> PyErr_Format(PyExc_ValueError, "String too long (%d lines)", lines);
> free(unescaped);
> return NULL;
> }
>
> What's the reason for that test/check?
The idea is to detect instances where the user forgot a closing quote.
However, for how a beancount ledger is usually structured, it is very
hard to hit the line count limit before the ledger contains an unrelated
quote character that get interpreted as the closing quote.
IIRC I wanted to remove the check when I restructured the parser, but
Martin wanted to keep it. The compromise was to set the line count limit
to a relatively large number, 64, which makes hitting the limit in case
of a syntax error even less likely, and thus the check less useful.
Lately the limit as been increased again to 256, but a version of
beancount with the limit raised has not been released yet. The limit in
v3 is still there and set to 256.
Probably installing v2 from source solves your immediate need, but I
think we should just remove the limit.
Cheers,
Dan