RangeError: Maximum call stack size exceeded

Hello, I’m working on a relatively large statement for an SQL dialect, when trying to compile, the below error is occurring.

RangeError: Maximum call stack size exceeded
    at explore (/dir/lezer-snowsql/node_modules/lezer-generator/dist/index.cjs:544:25)
    at explore (/dir/lezer-snowsql/node_modules/lezer-generator/dist/index.cjs:555:21)
    at explore (/dir/lezer-snowsql/node_modules/lezer-generator/dist/index.cjs:555:21)
    at explore (/dir/lezer-snowsql/node_modules/lezer-generator/dist/index.cjs:555:21)
    at explore (/dir/lezer-snowsql/node_modules/lezer-generator/dist/index.cjs:555:21)
    at explore (/dir/lezer-snowsql/node_modules/lezer-generator/dist/index.cjs:555:21)
    at explore (/dir/lezer-snowsql/node_modules/lezer-generator/dist/index.cjs:555:21)
    at explore (/dir/lezer-snowsql/node_modules/lezer-generator/dist/index.cjs:555:21)
    at explore (/dir/lezer-snowsql/node_modules/lezer-generator/dist/index.cjs:555:21)
    at explore (/dir/lezer-snowsql/node_modules/lezer-generator/dist/index.cjs:555:21)

It appears that these are usually caused by infinite recursion. Is there a way to pin-point to a specific definition that the explore function is processing?

Going by the function name, this is happening somewhere in the code that compiles the tokens to a state machine. Can you try to reduce your tokens to the minimum complexity that still produces this error, and post the resulting code so that I can reproduce it?

1 Like