Hi, me again.
It looks like the dunder __copy__ methods are not carried over to Javascript:
Presumably, other dunder methods like __eq__ are not available, though I haven't checked.
In practice, this results in different outcomes when running accepts. Specifically, parser_state.state_stack grows with the previous token IDs instead of maintaining independent copies.
A fix for my specific issue here looks like this:
const copiedParserState = new ParserState(
this.parser_state.parse_conf,
this.parser_state.lexer,
[...this.parser_state.state_stack],
[...this.parser_state.value_stack],
)
new_cursor = new InteractiveParser(this.parser, copiedParserState, copy(this.lexer_thread));
Which successfully maintains independent state_stack copies.
However, this wouldn't solve other outstanding references to dunder methods.
Hi, me again.
It looks like the dunder
__copy__methods are not carried over to Javascript:lalr_interactive_parser.py:61lalr_parser_state.py:56Presumably, other dunder methods like
__eq__are not available, though I haven't checked.In practice, this results in different outcomes when running
accepts. Specifically,parser_state.state_stackgrows with the previous token IDs instead of maintaining independent copies.A fix for my specific issue here looks like this:
Which successfully maintains independent
state_stackcopies.However, this wouldn't solve other outstanding references to dunder methods.