-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
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.
Metadata
Metadata
Assignees
Labels
No labels