summaryrefslogtreecommitdiff
path: root/grammar/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'grammar/src/lib.rs')
-rw-r--r--grammar/src/lib.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/grammar/src/lib.rs b/grammar/src/lib.rs
index a8e0fd7..ab0f693 100644
--- a/grammar/src/lib.rs
+++ b/grammar/src/lib.rs
@@ -538,6 +538,15 @@ impl Grammar {
Ok(self.reduction_map.get(&(pos1, pos2)).map(AsRef::as_ref))
}
+ /// Set the reduction information.
+ ///
+ /// This is used to set the reduction information for the virtual
+ /// nodes that are added after the left closure has been computed.
+ #[inline]
+ pub fn set_reduction(&mut self, pos1: usize, pos2: usize, info: Vec<usize>) {
+ self.reduction_map.insert((pos1, pos2), info);
+ }
+
// REVIEW: Do we have a better way to record expansion and
// reduction information than to compute the transitive closure?