goodmami / pe

Fastest general-purpose parsing library for Python with a familiar API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Arbitrary memo access

goodmami opened this issue · comments

This sounds like it might be a bad idea, but it could be very useful for an expression or an action to have direct access to the memo for storing or retrieving arbitrary information. The purpose is for expressions that accumulate information across different branches. It's something like persistent bound values.

I can imagine some expression like foo@Bar (syntax undecided) that stores the values of Bar in the memo at key foo, but that might not be enough. Perhaps the Action class can take the memo as another argument, then some Memo action does the same as the expression. Users could create subclasses of Action or Memo to do more than just store the value.

This would need some restrictions, such as only allowing string keys so they don't overwrite actual memo data.