igordejanovic / parglare

A pure Python LR/GLR parser - http://www.igordejanovic.net/parglare/
MIT License
135 stars 32 forks source link

Store node reference in visitor's cache. #138

Closed vladaindjic closed 2 years ago

vladaindjic commented 2 years ago

Code review checklist

Hi, @igordejanovic ,

I've made the fix according to our today's discussion.

It may not be guaranteed that the node is always preserved during the whole visitor execution (e.g. if the node is not the AST node, but the tuple containing it). This is the rationale for keeping the reference to the node object in cache.

Best, Vladimir

igordejanovic commented 2 years ago

@vladaindjic Looks good. Thanks!