Struct stack_graphs::partial::SymbolStackBindings [−][src]
pub struct SymbolStackBindings { /* fields omitted */ }
Expand description
The portion of the symbol stack that was not consumed by a partial path’s precondition.
For scope stacks, we have actual variables, since there are many places in a partial path’s
precondition where we need to match against scope stacks. So ScopeStackBindings
is an
actual map from variables to the scope stacks that they match against.
The story is different for the symbol stack. In theory, a partial path’s symbol stack precondition does have an implicit variable at the end, which matches against whatever portion of the symbol stack is not consumed by the list of symbols in the precondition. However, because there is only ever one symbol stack variable, we don’t currently reify that in our data model anywhere. Instead the “bindings” just keeps track of that unmatched portion of the symbol stack.
Implementations
Creates a new, empty set of symbol stack bindings.
Returns the symbol stack that the (unnamed) symbol stack variable matched. Returns an error if that variable didn’t match anything.
Adds a new binding from the (unnamed) symbol stack variable to the symbol stack that it matched. Returns an error if you try to bind the (unnamed) symbol stack variable more than once.