From 8bc1036256f42c305197ef57be089bb72f4ca531 Mon Sep 17 00:00:00 2001
From: Taehwan Kim <ehwank98@gmail.com>
Date: Sat, 9 Aug 2025 10:23:52 +0900
Subject: [PATCH 01/11] DataStack trait

---
 rusty_lr_core/src/nonterminal.rs              | 33 +++++-----
 .../src/parser/deterministic/context.rs       | 56 ++++++++---------
 .../src/parser/deterministic/error.rs         | 10 +--
 .../src/parser/nondeterministic/context.rs    | 62 ++++++++++---------
 .../src/parser/nondeterministic/error.rs      | 10 +--
 .../src/parser/nondeterministic/node.rs       | 16 ++---
 6 files changed, 95 insertions(+), 92 deletions(-)

diff --git a/rusty_lr_core/src/nonterminal.rs b/rusty_lr_core/src/nonterminal.rs
index 2a158653..c3e6953b 100644
--- a/rusty_lr_core/src/nonterminal.rs
+++ b/rusty_lr_core/src/nonterminal.rs
@@ -54,7 +54,7 @@ pub enum NonTerminalType {
 
 /// A trait for token that holds data.
 /// This will be used for data stack in the parser.
-pub trait TokenData: Sized {
+pub trait DataStack: Sized + Default {
     /// Type for terminal symbols
     type Term;
     /// Type for non-terminal symbols - this must be enum type that was auto-generated by rusty_lr
@@ -68,11 +68,27 @@ pub trait TokenData: Sized {
     /// Type for location of the token
     type Location: crate::Location;
 
+    fn pop_start(&mut self) -> Option<Self::StartType>;
+    fn pop(&mut self);
+    fn push_terminal(&mut self, term: Self::Term);
+    fn push_empty(&mut self);
+
+    fn clear(&mut self);
+    fn reserve(&mut self, additional: usize);
+    fn with_capacity(capacity: usize) -> Self {
+        let mut self_: Self = Default::default();
+        self_.reserve(capacity);
+        self_
+    }
+
+    fn split_off(&mut self, at: usize) -> Self;
+    fn append(&mut self, other: &mut Self);
+
     /// performs a reduce action with the given rule index
     fn reduce_action(
         // the child tokens for the reduction
         // the caller (usually from generated code) must pops all of the tokens used for this reduce_action
-        data_stack: &mut Vec<Self>,
+        &mut self,
         location_stack: &mut Vec<Self::Location>,
 
         // the index of the production rule to reduce
@@ -87,16 +103,5 @@ pub trait TokenData: Sized {
         userdata: &mut Self::UserData,
         // location of this non-terminal, e.g. `@$`
         location0: &mut Self::Location,
-    ) -> Result<Self, Self::ReduceActionError>;
-
-    /// create new token data for error recovery
-    fn new_error() -> Self;
-
-    /// create new token data that is empty.
-    fn new_empty() -> Self {
-        Self::new_error()
-    }
-
-    /// create new terminal variant
-    fn new_terminal(term: Self::Term) -> Self;
+    ) -> Result<(), Self::ReduceActionError>;
 }
diff --git a/rusty_lr_core/src/parser/deterministic/context.rs b/rusty_lr_core/src/parser/deterministic/context.rs
index 9245eb2d..e2bde42a 100644
--- a/rusty_lr_core/src/parser/deterministic/context.rs
+++ b/rusty_lr_core/src/parser/deterministic/context.rs
@@ -3,8 +3,8 @@ use std::hash::Hash;
 
 use super::ParseError;
 
+use crate::nonterminal::DataStack;
 use crate::nonterminal::NonTerminal;
-use crate::nonterminal::TokenData;
 use crate::parser::state::Index;
 use crate::parser::Parser;
 use crate::parser::Precedence;
@@ -12,10 +12,10 @@ use crate::parser::State;
 use crate::TerminalSymbol;
 
 /// A struct that maintains the current state and the values associated with each symbol.
-pub struct Context<Data: TokenData, StateIndex> {
+pub struct Context<Data: DataStack, StateIndex> {
     /// stacks hold the values associated with each shifted symbol.
     pub state_stack: Vec<StateIndex>,
-    pub(crate) data_stack: Vec<Data>,
+    pub(crate) data_stack: Data,
     pub(crate) location_stack: Vec<Data::Location>,
     pub(crate) precedence_stack: Vec<Precedence>,
     /// Tree stack for tree representation of the parse.
@@ -23,14 +23,14 @@ pub struct Context<Data: TokenData, StateIndex> {
     pub(crate) tree_stack: crate::tree::TreeList<Data::Term, Data::NonTerm>,
 }
 
-impl<Data: TokenData, StateIndex: Index + Copy> Context<Data, StateIndex> {
+impl<Data: DataStack, StateIndex: Index + Copy> Context<Data, StateIndex> {
     /// Create a new context.
     /// `state_stack` is initialized with [0] (root state).
     pub fn new() -> Self {
         Context {
             state_stack: vec![StateIndex::from_usize_unchecked(0)],
 
-            data_stack: Vec::new(),
+            data_stack: Default::default(),
             location_stack: Vec::new(),
             precedence_stack: Vec::new(),
 
@@ -48,7 +48,7 @@ impl<Data: TokenData, StateIndex: Index + Copy> Context<Data, StateIndex> {
         Context {
             state_stack,
 
-            data_stack: Vec::with_capacity(capacity),
+            data_stack: Data::with_capacity(capacity),
             location_stack: Vec::with_capacity(capacity),
             precedence_stack: Vec::with_capacity(capacity),
 
@@ -70,12 +70,8 @@ impl<Data: TokenData, StateIndex: Index + Copy> Context<Data, StateIndex> {
         self.feed_eof(parser, userdata)?;
 
         // data_stack must be <Start> <EOF> in this point
-        self.data_stack.pop();
-        if let Ok(start) = self.data_stack.pop().unwrap().try_into() {
-            Ok(start)
-        } else {
-            unreachable!("data stack must have start symbol at this point");
-        }
+        // Since <EOF> does not have ruletype, no need to pop
+        Ok(self.data_stack.pop_start().unwrap())
     }
 
     /// Check if current context can be terminated and get the value of the start symbol.
@@ -289,8 +285,7 @@ impl<Data: TokenData, StateIndex: Index + Copy> Context<Data, StateIndex> {
                         .push(crate::tree::Tree::new_terminal(term.clone()));
 
                     // shift with `error` token
-                    self.data_stack
-                        .push(Data::new_terminal(term.into_term().unwrap()));
+                    self.data_stack.push_terminal(term.into_term().unwrap());
                     self.location_stack.push(location.unwrap());
                     self.precedence_stack.push(shift_prec);
                     self.state_stack
@@ -406,8 +401,7 @@ impl<Data: TokenData, StateIndex: Index + Copy> Context<Data, StateIndex> {
                     Data::Location::new(self.location_stack.iter().rev(), tokens_len);
 
                 // call reduce action
-                let new_data = match Data::reduce_action(
-                    &mut self.data_stack,
+                match self.data_stack.reduce_action(
                     &mut self.location_stack,
                     reduce_rule,
                     &mut shift,
@@ -415,12 +409,11 @@ impl<Data: TokenData, StateIndex: Index + Copy> Context<Data, StateIndex> {
                     userdata,
                     &mut new_location,
                 ) {
-                    Ok(new_data) => new_data,
+                    Ok(_) => {}
                     Err(err) => {
                         return Err(ParseError::ReduceAction(term, location, err));
                     }
                 };
-                self.data_stack.push(new_data);
                 self.location_stack.push(new_location);
 
                 // construct tree
@@ -463,12 +456,15 @@ impl<Data: TokenData, StateIndex: Index + Copy> Context<Data, StateIndex> {
             self.tree_stack
                 .push(crate::tree::Tree::new_terminal(term.clone()));
 
-            let data = match term {
-                TerminalSymbol::Term(term) => Data::new_terminal(term),
-                TerminalSymbol::Error => Data::new_error(),
-                TerminalSymbol::Eof => Data::new_empty(),
-            };
-            self.data_stack.push(data);
+            match term {
+                TerminalSymbol::Term(term) => {
+                    self.data_stack.push_terminal(term);
+                }
+                TerminalSymbol::Error | TerminalSymbol::Eof => {
+                    self.data_stack.push_empty();
+                }
+            }
+            // location is `Some` if it is not `Eof`
             if let Some(location) = location {
                 self.location_stack.push(location);
             }
@@ -859,13 +855,13 @@ impl<Data: TokenData, StateIndex: Index + Copy> Context<Data, StateIndex> {
     }
 }
 
-impl<Data: TokenData, StateIndex: Index + Copy> Default for Context<Data, StateIndex> {
+impl<Data: DataStack, StateIndex: Index + Copy> Default for Context<Data, StateIndex> {
     fn default() -> Self {
         Self::new()
     }
 }
 
-impl<Data: TokenData, StateIndex: Index + Copy> Clone for Context<Data, StateIndex>
+impl<Data: DataStack, StateIndex: Index + Copy> Clone for Context<Data, StateIndex>
 where
     Data: Clone,
     Data::Term: Clone,
@@ -885,7 +881,7 @@ where
 }
 
 #[cfg(feature = "tree")]
-impl<Data: TokenData, StateIndex: Index + Copy> std::fmt::Display for Context<Data, StateIndex>
+impl<Data: DataStack, StateIndex: Index + Copy> std::fmt::Display for Context<Data, StateIndex>
 where
     Data::Term: std::fmt::Display + Clone,
     Data::NonTerm: std::fmt::Display + Clone + crate::nonterminal::NonTerminal,
@@ -895,7 +891,7 @@ where
     }
 }
 #[cfg(feature = "tree")]
-impl<Data: TokenData, StateIndex: Index + Copy> std::fmt::Debug for Context<Data, StateIndex>
+impl<Data: DataStack, StateIndex: Index + Copy> std::fmt::Debug for Context<Data, StateIndex>
 where
     Data::Term: std::fmt::Debug + Clone,
     Data::NonTerm: std::fmt::Debug + Clone + crate::nonterminal::NonTerminal,
@@ -906,7 +902,7 @@ where
 }
 
 #[cfg(feature = "tree")]
-impl<Data: TokenData, StateIndex: Index + Copy> std::ops::Deref for Context<Data, StateIndex> {
+impl<Data: DataStack, StateIndex: Index + Copy> std::ops::Deref for Context<Data, StateIndex> {
     type Target = crate::tree::TreeList<Data::Term, Data::NonTerm>;
     fn deref(&self) -> &Self::Target {
         &self.tree_stack
@@ -914,7 +910,7 @@ impl<Data: TokenData, StateIndex: Index + Copy> std::ops::Deref for Context<Data
 }
 
 #[cfg(feature = "tree")]
-impl<Data: TokenData, StateIndex: Index + Copy> std::ops::DerefMut for Context<Data, StateIndex> {
+impl<Data: DataStack, StateIndex: Index + Copy> std::ops::DerefMut for Context<Data, StateIndex> {
     fn deref_mut(&mut self) -> &mut Self::Target {
         &mut self.tree_stack
     }
diff --git a/rusty_lr_core/src/parser/deterministic/error.rs b/rusty_lr_core/src/parser/deterministic/error.rs
index 48979832..24168bbe 100644
--- a/rusty_lr_core/src/parser/deterministic/error.rs
+++ b/rusty_lr_core/src/parser/deterministic/error.rs
@@ -1,12 +1,12 @@
 use std::fmt::Debug;
 use std::fmt::Display;
 
-use crate::nonterminal::TokenData;
+use crate::nonterminal::DataStack;
 use crate::TerminalSymbol;
 
 /// Error type for feed()
 #[derive(Clone)]
-pub enum ParseError<Data: TokenData> {
+pub enum ParseError<Data: DataStack> {
     /// No action defined for the given terminal in the parser table.
     /// location will be `None` if the terminal was eof.
     NoAction(TerminalSymbol<Data::Term>, Option<Data::Location>),
@@ -25,7 +25,7 @@ pub enum ParseError<Data: TokenData> {
     NoPrecedence(TerminalSymbol<Data::Term>, Option<Data::Location>, usize),
 }
 
-impl<Data: TokenData> ParseError<Data> {
+impl<Data: DataStack> ParseError<Data> {
     /// location will be `None` if the terminal was eof.
     pub fn location(&self) -> &Option<Data::Location> {
         match self {
@@ -44,7 +44,7 @@ impl<Data: TokenData> ParseError<Data> {
     }
 }
 
-impl<Data: TokenData> Display for ParseError<Data>
+impl<Data: DataStack> Display for ParseError<Data>
 where
     Data::Term: Display,
     Data::ReduceActionError: Display,
@@ -64,7 +64,7 @@ where
     }
 }
 
-impl<Data: TokenData> Debug for ParseError<Data>
+impl<Data: DataStack> Debug for ParseError<Data>
 where
     Data::Term: Debug,
     Data::ReduceActionError: Debug,
diff --git a/rusty_lr_core/src/parser/nondeterministic/context.rs b/rusty_lr_core/src/parser/nondeterministic/context.rs
index f9c01cc5..9ffbabaf 100644
--- a/rusty_lr_core/src/parser/nondeterministic/context.rs
+++ b/rusty_lr_core/src/parser/nondeterministic/context.rs
@@ -3,8 +3,8 @@ use std::hash::Hash;
 use super::Node;
 use super::ParseError;
 
+use crate::nonterminal::DataStack;
 use crate::nonterminal::NonTerminal;
-use crate::nonterminal::TokenData;
 use crate::parser::state::Index;
 use crate::parser::Parser;
 use crate::parser::Precedence;
@@ -16,11 +16,11 @@ type SmallVecNode = smallvec::SmallVec<[usize; 3]>;
 /// Iterator for traverse node to root.
 /// Note that root node is not included in this iterator.
 #[derive(Clone)]
-pub struct NodeRefIterator<'a, Data: TokenData, StateIndex> {
+pub struct NodeRefIterator<'a, Data: DataStack, StateIndex> {
     context: &'a Context<Data, StateIndex>,
     node: Option<usize>,
 }
-impl<'a, Data: TokenData, StateIndex: Index + Copy> Iterator
+impl<'a, Data: DataStack, StateIndex: Index + Copy> Iterator
     for NodeRefIterator<'a, Data, StateIndex>
 {
     type Item = &'a Node<Data, StateIndex>;
@@ -34,7 +34,7 @@ impl<'a, Data: TokenData, StateIndex: Index + Copy> Iterator
 
 /// A struct that maintains the current state and the values associated with each symbol.
 /// This handles the divergence and merging of the parser.
-pub struct Context<Data: TokenData, StateIndex> {
+pub struct Context<Data: DataStack, StateIndex> {
     pub(crate) nodes_pool: Vec<Node<Data, StateIndex>>,
     pub(crate) empty_node_indices: std::collections::BTreeSet<usize>,
 
@@ -56,7 +56,7 @@ pub struct Context<Data: TokenData, StateIndex> {
     pub(crate) no_precedences: Vec<usize>,
 }
 
-impl<Data: TokenData, StateIndex: Index + Copy> Context<Data, StateIndex> {
+impl<Data: DataStack, StateIndex: Index + Copy> Context<Data, StateIndex> {
     /// Create a new context.
     /// `current_nodes` is initialized with a root node.
     pub fn new() -> Self {
@@ -444,8 +444,7 @@ impl<Data: TokenData, StateIndex: Index + Copy> Context<Data, StateIndex> {
         #[cfg(feature = "tree")]
         let trees = node.tree_stack.split_off(node.tree_stack.len() - count);
 
-        match Data::reduce_action(
-            &mut node.data_stack,
+        match node.data_stack.reduce_action(
             &mut node.location_stack,
             reduce_rule,
             shift,
@@ -453,13 +452,12 @@ impl<Data: TokenData, StateIndex: Index + Copy> Context<Data, StateIndex> {
             userdata,
             &mut new_location,
         ) {
-            Ok(new_data) => {
+            Ok(_) => {
                 if let Some(nonterm_shift_state) =
                     parser.get_states()[state].shift_goto_nonterm(&rule.name)
                 {
                     node.state_stack
                         .push(StateIndex::from_usize_unchecked(nonterm_shift_state));
-                    node.data_stack.push(new_data);
                     node.location_stack.push(new_location);
                     node.precedence_stack.push(precedence);
                     #[cfg(feature = "tree")]
@@ -515,12 +513,8 @@ impl<Data: TokenData, StateIndex: Index + Copy> Context<Data, StateIndex> {
         let nodes = std::mem::take(&mut self.current_nodes);
         Ok(nodes.into_iter().map(move |eof_node| {
             let node = self.pop(eof_node).unwrap();
-            let data = self.nodes_pool[node].data_stack.pop().unwrap();
-
-            match data.try_into() {
-                Ok(start) => start,
-                Err(_) => unreachable!("data stack must have start symbol at this point"),
-            }
+            // Since <EOF> does not have ruletype, no need to pop
+            self.nodes_pool[node].data_stack.pop_start().unwrap()
         }))
     }
 
@@ -1065,11 +1059,15 @@ impl<Data: TokenData, StateIndex: Index + Copy> Context<Data, StateIndex> {
                 node_
                     .tree_stack
                     .push(crate::tree::Tree::new_terminal(term.clone()));
-                node_.data_stack.push(match term {
-                    TerminalSymbol::Term(term) => Data::new_terminal(term),
-                    TerminalSymbol::Eof => Data::new_empty(),
-                    TerminalSymbol::Error => Data::new_error(),
-                });
+
+                match term {
+                    TerminalSymbol::Term(term) => {
+                        node_.data_stack.push_terminal(term);
+                    }
+                    TerminalSymbol::Eof | TerminalSymbol::Error => {
+                        node_.data_stack.push_empty();
+                    }
+                }
 
                 self.next_nodes.push(node);
                 Ok(())
@@ -1093,11 +1091,15 @@ impl<Data: TokenData, StateIndex: Index + Copy> Context<Data, StateIndex> {
             node_
                 .tree_stack
                 .push(crate::tree::Tree::new_terminal(term.clone()));
-            node_.data_stack.push(match term {
-                TerminalSymbol::Term(term) => Data::new_terminal(term),
-                TerminalSymbol::Eof => Data::new_empty(),
-                TerminalSymbol::Error => Data::new_error(),
-            });
+
+            match term {
+                TerminalSymbol::Term(term) => {
+                    node_.data_stack.push_terminal(term);
+                }
+                TerminalSymbol::Eof | TerminalSymbol::Error => {
+                    node_.data_stack.push_empty();
+                }
+            }
 
             self.next_nodes.push(node);
             Ok(())
@@ -1247,7 +1249,7 @@ impl<Data: TokenData, StateIndex: Index + Copy> Context<Data, StateIndex> {
                         node.tree_stack.push(crate::tree::Tree::new_terminal(
                             TerminalSymbol::Term(term.clone()),
                         ));
-                        node.data_stack.push(Data::new_terminal(term.clone()));
+                        node.data_stack.push_terminal(term.clone());
 
                         self.current_nodes.push(error_node);
                     } else {
@@ -1458,7 +1460,7 @@ impl<Data: TokenData, StateIndex: Index + Copy> Context<Data, StateIndex> {
     }
 }
 
-impl<Data: TokenData, StateIndex: Index + Copy> Default for Context<Data, StateIndex> {
+impl<Data: DataStack, StateIndex: Index + Copy> Default for Context<Data, StateIndex> {
     fn default() -> Self {
         let mut context = Context {
             nodes_pool: Default::default(),
@@ -1475,7 +1477,7 @@ impl<Data: TokenData, StateIndex: Index + Copy> Default for Context<Data, StateI
     }
 }
 
-impl<Data: TokenData, StateIndex: Index + Copy> Clone for Context<Data, StateIndex>
+impl<Data: DataStack, StateIndex: Index + Copy> Clone for Context<Data, StateIndex>
 where
     Node<Data, StateIndex>: Clone,
 {
@@ -1490,7 +1492,7 @@ where
 }
 
 #[cfg(feature = "tree")]
-impl<Data: TokenData, StateIndex: Index + Copy> std::fmt::Display for Context<Data, StateIndex>
+impl<Data: DataStack, StateIndex: Index + Copy> std::fmt::Display for Context<Data, StateIndex>
 where
     Data::Term: std::fmt::Display + Clone,
     Data::NonTerm: std::fmt::Display + Clone + crate::nonterminal::NonTerminal,
@@ -1504,7 +1506,7 @@ where
     }
 }
 #[cfg(feature = "tree")]
-impl<Data: TokenData, StateIndex: Index + Copy> std::fmt::Debug for Context<Data, StateIndex>
+impl<Data: DataStack, StateIndex: Index + Copy> std::fmt::Debug for Context<Data, StateIndex>
 where
     Data::Term: std::fmt::Debug + Clone,
     Data::NonTerm: std::fmt::Debug + Clone + crate::nonterminal::NonTerminal,
diff --git a/rusty_lr_core/src/parser/nondeterministic/error.rs b/rusty_lr_core/src/parser/nondeterministic/error.rs
index e09aebb9..cb55c58a 100644
--- a/rusty_lr_core/src/parser/nondeterministic/error.rs
+++ b/rusty_lr_core/src/parser/nondeterministic/error.rs
@@ -1,11 +1,11 @@
 use std::fmt::Debug;
 use std::fmt::Display;
 
-use crate::nonterminal::TokenData;
+use crate::nonterminal::DataStack;
 
 /// Error type for feed()
 #[derive(Clone)]
-pub struct ParseError<Data: TokenData> {
+pub struct ParseError<Data: DataStack> {
     /// The terminal symbol that caused the error.
     pub term: crate::TerminalSymbol<Data::Term>,
     /// Location of the terminal symbol.
@@ -18,7 +18,7 @@ pub struct ParseError<Data: TokenData> {
     pub no_precedences: Vec<usize>,
 }
 
-impl<Data: TokenData> ParseError<Data> {
+impl<Data: DataStack> ParseError<Data> {
     /// location will be `None` if the terminal was eof.
     pub fn location(&self) -> &Option<Data::Location> {
         &self.location
@@ -28,7 +28,7 @@ impl<Data: TokenData> ParseError<Data> {
     }
 }
 
-impl<Data: TokenData> Display for ParseError<Data>
+impl<Data: DataStack> Display for ParseError<Data>
 where
     Data::Term: Display,
     Data::ReduceActionError: Display,
@@ -38,7 +38,7 @@ where
     }
 }
 
-impl<Data: TokenData> Debug for ParseError<Data>
+impl<Data: DataStack> Debug for ParseError<Data>
 where
     Data::Term: Debug,
     Data::ReduceActionError: Debug,
diff --git a/rusty_lr_core/src/parser/nondeterministic/node.rs b/rusty_lr_core/src/parser/nondeterministic/node.rs
index bd8e73ae..a0127b81 100644
--- a/rusty_lr_core/src/parser/nondeterministic/node.rs
+++ b/rusty_lr_core/src/parser/nondeterministic/node.rs
@@ -1,11 +1,11 @@
-use crate::nonterminal::TokenData;
+use crate::nonterminal::DataStack;
 use crate::parser::Precedence;
 
 /// To handle multiple paths in the non-deterministic GLR parsing,
 /// this node represents a subrange in stack of the parser.
 /// this constructs LinkedList tree of nodes, where parent node is the previous token in the parse tree.
 #[derive(Clone)]
-pub struct Node<Data: TokenData, StateIndex> {
+pub struct Node<Data: DataStack, StateIndex> {
     /// parent node
     pub parent: Option<usize>,
 
@@ -13,20 +13,20 @@ pub struct Node<Data: TokenData, StateIndex> {
 
     /// index of state in parser
     pub state_stack: Vec<StateIndex>,
-    pub data_stack: Vec<Data>,
+    pub data_stack: Data,
     pub location_stack: Vec<Data::Location>,
     pub precedence_stack: Vec<Precedence>,
     #[cfg(feature = "tree")]
     pub(crate) tree_stack: Vec<crate::tree::Tree<Data::Term, Data::NonTerm>>,
 }
 
-impl<Data: TokenData, StateIndex> Default for Node<Data, StateIndex> {
+impl<Data: DataStack, StateIndex> Default for Node<Data, StateIndex> {
     fn default() -> Self {
         Node {
             parent: None,
             child_count: 0,
             state_stack: Vec::new(),
-            data_stack: Vec::new(),
+            data_stack: Data::default(),
             location_stack: Vec::new(),
             precedence_stack: Vec::new(),
             #[cfg(feature = "tree")]
@@ -35,7 +35,7 @@ impl<Data: TokenData, StateIndex> Default for Node<Data, StateIndex> {
     }
 }
 
-impl<Data: TokenData, StateIndex> Node<Data, StateIndex> {
+impl<Data: DataStack, StateIndex> Node<Data, StateIndex> {
     /// Clear this node to `Default::default()`.
     pub fn clear(&mut self) {
         self.parent = None;
@@ -48,7 +48,7 @@ impl<Data: TokenData, StateIndex> Node<Data, StateIndex> {
         self.tree_stack.clear();
     }
     pub fn len(&self) -> usize {
-        self.data_stack.len()
+        self.state_stack.len()
     }
     pub fn is_leaf(&self) -> bool {
         self.child_count == 0
@@ -59,7 +59,7 @@ impl<Data: TokenData, StateIndex> Node<Data, StateIndex> {
             parent: None,
             child_count: 0,
             state_stack: Vec::with_capacity(capacity),
-            data_stack: Vec::with_capacity(capacity),
+            data_stack: Data::with_capacity(capacity),
             location_stack: Vec::with_capacity(capacity),
             precedence_stack: Vec::with_capacity(capacity),
             #[cfg(feature = "tree")]

From 8f48b63edb4e8f5eac41114d030126d6452a584f Mon Sep 17 00:00:00 2001
From: Taehwan Kim <ehwank98@gmail.com>
Date: Sat, 9 Aug 2025 12:09:58 +0900
Subject: [PATCH 02/11] move DataStack to parser mod

---
 rusty_lr_core/src/nonterminal.rs              | 54 -------------------
 rusty_lr_core/src/parser/data_stack.rs        | 53 ++++++++++++++++++
 .../src/parser/deterministic/context.rs       |  2 +-
 .../src/parser/deterministic/error.rs         |  2 +-
 rusty_lr_core/src/parser/mod.rs               |  2 +
 .../src/parser/nondeterministic/context.rs    |  2 +-
 .../src/parser/nondeterministic/error.rs      |  2 +-
 .../src/parser/nondeterministic/node.rs       |  2 +-
 8 files changed, 60 insertions(+), 59 deletions(-)
 create mode 100644 rusty_lr_core/src/parser/data_stack.rs

diff --git a/rusty_lr_core/src/nonterminal.rs b/rusty_lr_core/src/nonterminal.rs
index c3e6953b..0eb55865 100644
--- a/rusty_lr_core/src/nonterminal.rs
+++ b/rusty_lr_core/src/nonterminal.rs
@@ -51,57 +51,3 @@ pub enum NonTerminalType {
     /// "abc" or b"abc"
     LiteralString,
 }
-
-/// A trait for token that holds data.
-/// This will be used for data stack in the parser.
-pub trait DataStack: Sized + Default {
-    /// Type for terminal symbols
-    type Term;
-    /// Type for non-terminal symbols - this must be enum type that was auto-generated by rusty_lr
-    type NonTerm;
-    /// Type for user data that is passed to the parser from the user.
-    type UserData;
-    /// Type for `Err` variant returned by reduce action
-    type ReduceActionError;
-    /// The value of the start symbol
-    type StartType;
-    /// Type for location of the token
-    type Location: crate::Location;
-
-    fn pop_start(&mut self) -> Option<Self::StartType>;
-    fn pop(&mut self);
-    fn push_terminal(&mut self, term: Self::Term);
-    fn push_empty(&mut self);
-
-    fn clear(&mut self);
-    fn reserve(&mut self, additional: usize);
-    fn with_capacity(capacity: usize) -> Self {
-        let mut self_: Self = Default::default();
-        self_.reserve(capacity);
-        self_
-    }
-
-    fn split_off(&mut self, at: usize) -> Self;
-    fn append(&mut self, other: &mut Self);
-
-    /// performs a reduce action with the given rule index
-    fn reduce_action(
-        // the child tokens for the reduction
-        // the caller (usually from generated code) must pops all of the tokens used for this reduce_action
-        &mut self,
-        location_stack: &mut Vec<Self::Location>,
-
-        // the index of the production rule to reduce
-        rule_index: usize,
-
-        // for runtime-conflict-resolve.
-        // if this variable is set to false in the action, the shift action will not be performed. (GLR parser)
-        shift: &mut bool,
-        // the lookahead token that caused this reduce action
-        lookahead: &crate::TerminalSymbol<Self::Term>,
-        // user input data
-        userdata: &mut Self::UserData,
-        // location of this non-terminal, e.g. `@$`
-        location0: &mut Self::Location,
-    ) -> Result<(), Self::ReduceActionError>;
-}
diff --git a/rusty_lr_core/src/parser/data_stack.rs b/rusty_lr_core/src/parser/data_stack.rs
new file mode 100644
index 00000000..1f19e65a
--- /dev/null
+++ b/rusty_lr_core/src/parser/data_stack.rs
@@ -0,0 +1,53 @@
+/// A trait for token that holds data.
+/// This will be used for data stack in the parser.
+pub trait DataStack: Sized + Default {
+    /// Type for terminal symbols
+    type Term;
+    /// Type for non-terminal symbols - this must be enum type that was auto-generated by rusty_lr
+    type NonTerm;
+    /// Type for user data that is passed to the parser from the user.
+    type UserData;
+    /// Type for `Err` variant returned by reduce action
+    type ReduceActionError;
+    /// The value of the start symbol
+    type StartType;
+    /// Type for location of the token
+    type Location: crate::Location;
+
+    fn pop_start(&mut self) -> Option<Self::StartType>;
+    fn pop(&mut self);
+    fn push_terminal(&mut self, term: Self::Term);
+    fn push_empty(&mut self);
+
+    fn clear(&mut self);
+    fn reserve(&mut self, additional: usize);
+    fn with_capacity(capacity: usize) -> Self {
+        let mut self_: Self = Default::default();
+        self_.reserve(capacity);
+        self_
+    }
+
+    fn split_off(&mut self, at: usize) -> Self;
+    fn append(&mut self, other: &mut Self);
+
+    /// performs a reduce action with the given rule index
+    fn reduce_action(
+        // the child tokens for the reduction
+        // the caller (usually from generated code) must pops all of the tokens used for this reduce_action
+        &mut self,
+        location_stack: &mut Vec<Self::Location>,
+
+        // the index of the production rule to reduce
+        rule_index: usize,
+
+        // for runtime-conflict-resolve.
+        // if this variable is set to false in the action, the shift action will not be performed. (GLR parser)
+        shift: &mut bool,
+        // the lookahead token that caused this reduce action
+        lookahead: &crate::TerminalSymbol<Self::Term>,
+        // user input data
+        userdata: &mut Self::UserData,
+        // location of this non-terminal, e.g. `@$`
+        location0: &mut Self::Location,
+    ) -> Result<(), Self::ReduceActionError>;
+}
diff --git a/rusty_lr_core/src/parser/deterministic/context.rs b/rusty_lr_core/src/parser/deterministic/context.rs
index e2bde42a..248dc3a9 100644
--- a/rusty_lr_core/src/parser/deterministic/context.rs
+++ b/rusty_lr_core/src/parser/deterministic/context.rs
@@ -3,8 +3,8 @@ use std::hash::Hash;
 
 use super::ParseError;
 
-use crate::nonterminal::DataStack;
 use crate::nonterminal::NonTerminal;
+use crate::parser::data_stack::DataStack;
 use crate::parser::state::Index;
 use crate::parser::Parser;
 use crate::parser::Precedence;
diff --git a/rusty_lr_core/src/parser/deterministic/error.rs b/rusty_lr_core/src/parser/deterministic/error.rs
index 24168bbe..2de61a92 100644
--- a/rusty_lr_core/src/parser/deterministic/error.rs
+++ b/rusty_lr_core/src/parser/deterministic/error.rs
@@ -1,7 +1,7 @@
 use std::fmt::Debug;
 use std::fmt::Display;
 
-use crate::nonterminal::DataStack;
+use crate::parser::data_stack::DataStack;
 use crate::TerminalSymbol;
 
 /// Error type for feed()
diff --git a/rusty_lr_core/src/parser/mod.rs b/rusty_lr_core/src/parser/mod.rs
index 3b19372b..8ffc46de 100644
--- a/rusty_lr_core/src/parser/mod.rs
+++ b/rusty_lr_core/src/parser/mod.rs
@@ -4,6 +4,8 @@ pub mod deterministic;
 /// Core parser functionality for non-deterministic parsers
 pub mod nondeterministic;
 
+pub mod data_stack;
+
 pub mod state;
 pub use state::State;
 
diff --git a/rusty_lr_core/src/parser/nondeterministic/context.rs b/rusty_lr_core/src/parser/nondeterministic/context.rs
index 9ffbabaf..7afec3cc 100644
--- a/rusty_lr_core/src/parser/nondeterministic/context.rs
+++ b/rusty_lr_core/src/parser/nondeterministic/context.rs
@@ -3,8 +3,8 @@ use std::hash::Hash;
 use super::Node;
 use super::ParseError;
 
-use crate::nonterminal::DataStack;
 use crate::nonterminal::NonTerminal;
+use crate::parser::data_stack::DataStack;
 use crate::parser::state::Index;
 use crate::parser::Parser;
 use crate::parser::Precedence;
diff --git a/rusty_lr_core/src/parser/nondeterministic/error.rs b/rusty_lr_core/src/parser/nondeterministic/error.rs
index cb55c58a..f7a4b07c 100644
--- a/rusty_lr_core/src/parser/nondeterministic/error.rs
+++ b/rusty_lr_core/src/parser/nondeterministic/error.rs
@@ -1,7 +1,7 @@
 use std::fmt::Debug;
 use std::fmt::Display;
 
-use crate::nonterminal::DataStack;
+use crate::parser::data_stack::DataStack;
 
 /// Error type for feed()
 #[derive(Clone)]
diff --git a/rusty_lr_core/src/parser/nondeterministic/node.rs b/rusty_lr_core/src/parser/nondeterministic/node.rs
index a0127b81..1fe1c063 100644
--- a/rusty_lr_core/src/parser/nondeterministic/node.rs
+++ b/rusty_lr_core/src/parser/nondeterministic/node.rs
@@ -1,4 +1,4 @@
-use crate::nonterminal::DataStack;
+use crate::parser::data_stack::DataStack;
 use crate::parser::Precedence;
 
 /// To handle multiple paths in the non-deterministic GLR parsing,

From f776b415791c13ffbf490eb3daa899dabd2a5336 Mon Sep 17 00:00:00 2001
From: Taehwan Kim <ehwank98@gmail.com>
Date: Sat, 9 Aug 2025 13:25:13 +0900
Subject: [PATCH 03/11] [WIP] emit

---
 rusty_lr_core/src/parser/data_stack.rs        |   2 +-
 .../src/parser/deterministic/context.rs       |   4 +-
 .../src/parser/nondeterministic/context.rs    |   5 +-
 rusty_lr_parser/src/emit.rs                   | 506 +++++++++++++-----
 4 files changed, 369 insertions(+), 148 deletions(-)

diff --git a/rusty_lr_core/src/parser/data_stack.rs b/rusty_lr_core/src/parser/data_stack.rs
index 1f19e65a..64213148 100644
--- a/rusty_lr_core/src/parser/data_stack.rs
+++ b/rusty_lr_core/src/parser/data_stack.rs
@@ -34,7 +34,7 @@ pub trait DataStack: Sized + Default {
     fn reduce_action(
         // the child tokens for the reduction
         // the caller (usually from generated code) must pops all of the tokens used for this reduce_action
-        &mut self,
+        data_stack: &mut Self,
         location_stack: &mut Vec<Self::Location>,
 
         // the index of the production rule to reduce
diff --git a/rusty_lr_core/src/parser/deterministic/context.rs b/rusty_lr_core/src/parser/deterministic/context.rs
index 248dc3a9..09191d54 100644
--- a/rusty_lr_core/src/parser/deterministic/context.rs
+++ b/rusty_lr_core/src/parser/deterministic/context.rs
@@ -63,7 +63,6 @@ impl<Data: DataStack, StateIndex: Index + Copy> Context<Data, StateIndex> {
         userdata: &mut Data::UserData,
     ) -> Result<Data::StartType, ParseError<Data>>
     where
-        Data: TryInto<Data::StartType>,
         Data::Term: Clone,
         Data::NonTerm: Hash + Eq + Copy + NonTerminal,
     {
@@ -401,7 +400,8 @@ impl<Data: DataStack, StateIndex: Index + Copy> Context<Data, StateIndex> {
                     Data::Location::new(self.location_stack.iter().rev(), tokens_len);
 
                 // call reduce action
-                match self.data_stack.reduce_action(
+                match Data::reduce_action(
+                    &mut self.data_stack,
                     &mut self.location_stack,
                     reduce_rule,
                     &mut shift,
diff --git a/rusty_lr_core/src/parser/nondeterministic/context.rs b/rusty_lr_core/src/parser/nondeterministic/context.rs
index 7afec3cc..c2a2c8c2 100644
--- a/rusty_lr_core/src/parser/nondeterministic/context.rs
+++ b/rusty_lr_core/src/parser/nondeterministic/context.rs
@@ -444,7 +444,8 @@ impl<Data: DataStack, StateIndex: Index + Copy> Context<Data, StateIndex> {
         #[cfg(feature = "tree")]
         let trees = node.tree_stack.split_off(node.tree_stack.len() - count);
 
-        match node.data_stack.reduce_action(
+        match Data::reduce_action(
+            &mut node.data_stack,
             &mut node.location_stack,
             reduce_rule,
             shift,
@@ -502,7 +503,7 @@ impl<Data: DataStack, StateIndex: Index + Copy> Context<Data, StateIndex> {
         userdata: &mut Data::UserData,
     ) -> Result<impl Iterator<Item = Data::StartType>, ParseError<Data>>
     where
-        Data: Clone + TryInto<Data::StartType>,
+        Data: Clone,
         P::Term: Clone,
         P::NonTerm: Hash + Eq + Clone + std::fmt::Debug + NonTerminal,
     {
diff --git a/rusty_lr_parser/src/emit.rs b/rusty_lr_parser/src/emit.rs
index ec54687d..b280f88f 100644
--- a/rusty_lr_parser/src/emit.rs
+++ b/rusty_lr_parser/src/emit.rs
@@ -20,7 +20,7 @@ impl Grammar {
         let enum_name = format_ident!("{}NonTerminals", start_rule_name);
         let parse_error_typename = format_ident!("{}ParseError", start_rule_name);
         let context_struct_name = format_ident!("{}Context", start_rule_name);
-        let token_data_typename = format_ident!("{}TokenData", start_rule_name);
+        let data_stack_typename = format_ident!("{}DataStack", start_rule_name);
 
         let state_structname = if self.emit_dense {
             format_ident!("DenseState")
@@ -63,7 +63,7 @@ impl Grammar {
             quote! {
                     /// type alias for `Context`
                     #[allow(non_camel_case_types,dead_code)]
-                    pub type #context_struct_name = #module_prefix::parser::nondeterministic::Context<#token_data_typename, #state_index_typename>;
+                    pub type #context_struct_name = #module_prefix::parser::nondeterministic::Context<#data_stack_typename, #state_index_typename>;
                     /// type alias for CFG production rule
                     #[allow(non_camel_case_types,dead_code)]
                     pub type #rule_typename = #module_prefix::rule::ProductionRule<&'static str, #enum_name>;
@@ -72,7 +72,7 @@ impl Grammar {
                     pub type #state_typename = #module_prefix::parser::state::#state_structname<#class_index_typename, #enum_name, #rule_container_type, #state_index_typename>;
                     /// type alias for `InvalidTerminalError`
                     #[allow(non_camel_case_types,dead_code)]
-                    pub type #parse_error_typename = #module_prefix::parser::nondeterministic::ParseError<#token_data_typename>;
+                    pub type #parse_error_typename = #module_prefix::parser::nondeterministic::ParseError<#data_stack_typename>;
                 }
             );
         } else {
@@ -80,7 +80,7 @@ impl Grammar {
         quote! {
                 /// type alias for `Context`
                 #[allow(non_camel_case_types,dead_code)]
-                pub type #context_struct_name = #module_prefix::parser::deterministic::Context<#token_data_typename, #state_index_typename>;
+                pub type #context_struct_name = #module_prefix::parser::deterministic::Context<#data_stack_typename, #state_index_typename>;
                 /// type alias for CFG production rule
                 #[allow(non_camel_case_types,dead_code)]
                 pub type #rule_typename = #module_prefix::rule::ProductionRule<&'static str, #enum_name>;
@@ -89,7 +89,7 @@ impl Grammar {
                 pub type #state_typename = #module_prefix::parser::state::#state_structname<#class_index_typename, #enum_name, usize, #state_index_typename>;
                 /// type alias for `ParseError`
                 #[allow(non_camel_case_types,dead_code)]
-                pub type #parse_error_typename = #module_prefix::parser::deterministic::ParseError<#token_data_typename>;
+                pub type #parse_error_typename = #module_prefix::parser::deterministic::ParseError<#data_stack_typename>;
             }
             );
         }
@@ -1150,11 +1150,11 @@ impl Grammar {
         }
     }
 
-    fn emit_token_data(&self, stream: &mut TokenStream) {
+    fn emit_data_stack(&self, stream: &mut TokenStream) {
         let module_prefix = &self.module_prefix;
         let nonterminals_enum_name = format_ident!("{}NonTerminals", &self.start_rule_name);
         let reduce_error_typename = &self.error_typename;
-        let token_data_typename = format_ident!("{}TokenData", self.start_rule_name);
+        let data_stack_typename = format_ident!("{}DataStack", self.start_rule_name);
         let token_typename = &self.token_typename;
         let user_data_parameter_name =
             Ident::new(utils::USER_DATA_PARAMETER_NAME, Span::call_site());
@@ -1165,31 +1165,35 @@ impl Grammar {
             .cloned()
             .unwrap_or_else(|| quote! { #module_prefix::DefaultLocation });
 
-        // variant name for terminal symbol
-        let terminal_variant_name = Ident::new("Terminals", Span::call_site());
-        // enum variant name for each non-terminal
-        let mut variant_names_for_nonterm = Vec::with_capacity(self.nonterminals.len());
+        // stack name for tags
+        let tag_stack_name = format_ident!("__tags");
+        let tag_enum_name = format_ident!("{}Tags", &self.start_rule_name);
 
-        // (<RuleType as ToString>, variant_name) map
-        let mut ruletype_variant_map: rusty_lr_core::hash::HashMap<String, Ident> =
+        // empty tag
+        let empty_tag_name = format_ident!("Empty");
+
+        // stack name for terminal symbol
+        let terminal_stack_name = format_ident!("__terminals");
+        // stack name for each non-terminal
+        let mut stack_names_for_nonterm = Vec::with_capacity(self.nonterminals.len());
+
+        // (<RuleType as ToString>, stack_name) map
+        let mut ruletype_stack_map: rusty_lr_core::hash::HashMap<String, Option<Ident>> =
             Default::default();
 
-        // (variant_name, TokenStream for typename) sorted in insertion order
+        // (stack_name, TokenStream for typename) sorted in insertion order
         // for consistent output
-        let mut variant_names_in_order = Vec::new();
+        let mut stack_names_in_order = Vec::new();
 
-        // insert variant for terminal token type
-        ruletype_variant_map.insert(
+        // insert stack for empty
+        ruletype_stack_map.insert("".to_string(), None);
+
+        // insert stack for terminal token type
+        ruletype_stack_map.insert(
             self.token_typename.to_string(),
-            terminal_variant_name.clone(),
+            Some(terminal_stack_name.clone()),
         );
-        variant_names_in_order.push((terminal_variant_name.clone(), self.token_typename.clone()));
-
-        // insert variant for empty-ruletype
-        let empty_ruletype_variant_name = Ident::new("Empty", Span::call_site());
-        ruletype_variant_map.insert("".to_string(), empty_ruletype_variant_name.clone());
-        // ruletype_variant_map.insert(quote! {()}.to_string(), empty_ruletype_variant_name.clone());
-        variant_names_in_order.push((empty_ruletype_variant_name.clone(), quote! {}));
+        stack_names_in_order.push((terminal_stack_name.clone(), self.token_typename.clone()));
 
         fn remove_whitespaces(s: String) -> String {
             s.chars().filter(|c| !c.is_whitespace()).collect()
@@ -1198,20 +1202,17 @@ impl Grammar {
         for nonterm in self.nonterminals.iter() {
             let ruletype_stream = nonterm.ruletype.as_ref().cloned().unwrap_or_default();
 
-            let cur_len = ruletype_variant_map.len();
-            let variant_name = ruletype_variant_map
+            let cur_len = ruletype_stack_map.len();
+            let stack_name = ruletype_stack_map
                 .entry(remove_whitespaces(ruletype_stream.to_string()))
                 .or_insert_with(|| {
-                    let new_variant_name =
-                        Ident::new(&format!("Variant{}", cur_len), Span::call_site());
-                    variant_names_in_order
-                        .push((new_variant_name.clone(), ruletype_stream.clone()));
-                    new_variant_name
+                    let new_stack_name = format_ident!("__stack{}", cur_len);
+                    stack_names_in_order.push((new_stack_name.clone(), ruletype_stream.clone()));
+                    Some(new_stack_name)
                 })
                 .clone();
-            variant_names_for_nonterm.push(variant_name);
+            stack_names_for_nonterm.push(stack_name);
         }
-        drop(ruletype_variant_map);
 
         let mut case_streams = quote! {};
 
@@ -1255,17 +1256,18 @@ impl Grammar {
                                         match term {
                                             TerminalSymbol::Term(_) => {
                                                 extract_token_data_from_args.extend(quote! {
-                                                let #token_data_typename::#terminal_variant_name(mut #mapto) = __data_stack.pop().unwrap() else {
-                                                    unreachable!()
-                                                };
-                                                let #location_varname = __location_stack.pop().unwrap();
-                                            });
+                                                    let __tag = __data_stack.#tag_stack_name.pop();
+                                                    debug_assert!(__tag == Some(#tag_enum_name::#terminal_stack_name));
+                                                    let mut #mapto = __data_stack.#terminal_stack_name.pop().unwrap();
+                                                    let #location_varname = __location_stack.pop().unwrap();
+                                                });
                                             }
                                             TerminalSymbol::Error => {
                                                 extract_token_data_from_args.extend(quote! {
-                                                __data_stack.pop();
-                                                let #location_varname = __location_stack.pop().unwrap();
-                                            });
+                                                    let __tag = __data_stack.#tag_stack_name.pop();
+                                                    debug_assert!(__tag == Some(#tag_enum_name::#empty_tag_name));
+                                                    let #location_varname = __location_stack.pop().unwrap();
+                                                });
                                             }
                                             TerminalSymbol::Eof => {
                                                 unreachable!(
@@ -1276,38 +1278,53 @@ impl Grammar {
                                     }
                                     None => {
                                         extract_token_data_from_args.extend(quote! {
-                                            __data_stack.pop();
+                                            let __tag = __data_stack.#tag_stack_name.pop();
+                                            debug_assert!(__tag == Some(#tag_enum_name::#terminal_stack_name));
+                                            __data_stack.#terminal_stack_name.pop();
                                             __location_stack.pop();
                                         });
                                     }
                                 },
                                 Token::NonTerm(nonterm_idx) => {
+                                    let stack_name = stack_names_for_nonterm[*nonterm_idx].as_ref();
+
                                     match &token.mapto {
                                         Some(mapto) => {
                                             let location_varname =
                                                 format_ident!("__rustylr_location_{}", mapto);
-                                            let variant_name =
-                                                &variant_names_for_nonterm[*nonterm_idx];
-                                            if variant_name == &empty_ruletype_variant_name {
+
+                                            if let Some(stack_name) = stack_name {
+                                                // extract token data from args
                                                 extract_token_data_from_args.extend(quote! {
-                                                __data_stack.pop();
-                                                let #location_varname = __location_stack.pop().unwrap();
-                                            });
+                                                    let __tag = __data_stack.#tag_stack_name.pop();
+                                                    debug_assert!(__tag == Some(#tag_enum_name::#stack_name));
+                                                    let mut #mapto = __data_stack.#stack_name.pop().unwrap();
+                                                    let #location_varname = __location_stack.pop().unwrap();
+                                                });
                                             } else {
-                                                // extract token data from args
                                                 extract_token_data_from_args.extend(quote! {
-                                                let #token_data_typename::#variant_name(mut #mapto) = __data_stack.pop().unwrap() else {
-                                                    unreachable!()
-                                                };
-                                                let #location_varname = __location_stack.pop().unwrap();
-                                            });
+                                                    let __tag = __data_stack.#tag_stack_name.pop();
+                                                    debug_assert!(__tag == Some(#tag_enum_name::#stack_name));
+                                                    __data_stack.#stack_name.pop();
+                                                    let #location_varname = __location_stack.pop().unwrap();
+                                                });
                                             }
                                         }
                                         None => {
-                                            extract_token_data_from_args.extend(quote! {
-                                                __data_stack.pop();
-                                                __location_stack.pop();
-                                            });
+                                            if let Some(stack_name) = stack_name {
+                                                extract_token_data_from_args.extend(quote! {
+                                                    let __tag = __data_stack.#tag_stack_name.pop();
+                                                    debug_assert!(__tag == Some(#tag_enum_name::#stack_name));
+                                                    __data_stack.#stack_name.pop();
+                                                    __location_stack.pop();
+                                                });
+                                            } else {
+                                                extract_token_data_from_args.extend(quote! {
+                                                    let __tag = __data_stack.#tag_stack_name.pop();
+                                                    debug_assert!(__tag == Some(#tag_enum_name::#empty_tag_name));
+                                                    __location_stack.pop();
+                                                });
+                                            }
                                         }
                                     }
                                 }
@@ -1318,60 +1335,137 @@ impl Grammar {
                             #rule_index => Self::#reduce_fn_ident( data_stack, location_stack, shift, lookahead, user_data, location0 ),
                         });
 
-                        // if typename is defined for this rule, push result of action to stack
-                        // else, just execute action
-                        if nonterm.ruletype.is_some() {
-                            // typename is defined, reduce action must be defined
-                            let variant_name = &variant_names_for_nonterm[nonterm_idx];
+                        // typename is defined, reduce action must be defined
+                        if let Some(stack_name) = &stack_names_for_nonterm[nonterm_idx] {
                             fn_reduce_for_each_rule_stream.extend(quote! {
                                 #[doc = #rule_debug_str]
                                 #[inline]
                                 fn #reduce_fn_ident(
-                                    __data_stack: &mut Vec<Self>,
+                                    __data_stack: &mut Self,
                                     __location_stack: &mut Vec<#location_typename>,
                                     shift: &mut bool,
                                     lookahead: &#module_prefix::TerminalSymbol<#token_typename>,
                                     #user_data_parameter_name: &mut #user_data_typename,
                                     __rustylr_location0: &mut #location_typename,
-                                ) -> Result<#token_data_typename, #reduce_error_typename> {
+                                ) -> Result<(), #reduce_error_typename> {
                                     #extract_token_data_from_args
 
-                                    Ok( #token_data_typename::#variant_name(#reduce_action) )
+                                    let res = #reduce_action ;
+                                    __data_stack.#stack_name.push(res);
+                                    __data_stack.#tag_stack_name.push(#tag_enum_name::#stack_name);
+
+                                    Ok(())
                                 }
                             });
                         } else {
-                            // <RuleType> is not defined,
-                            // just execute action
-
-                            let variant_name = &variant_names_for_nonterm[nonterm_idx];
                             fn_reduce_for_each_rule_stream.extend(quote! {
                                 #[doc = #rule_debug_str]
                                 #[inline]
                                 fn #reduce_fn_ident(
-                                    __data_stack: &mut Vec<Self>,
+                                    __data_stack: &mut Self,
                                     __location_stack: &mut Vec<#location_typename>,
                                     shift: &mut bool,
                                     lookahead: &#module_prefix::TerminalSymbol<#token_typename>,
                                     #user_data_parameter_name: &mut #user_data_typename,
                                     __rustylr_location0: &mut #location_typename,
-                                ) -> Result<#token_data_typename, #reduce_error_typename> {
+                                ) -> Result<(), #reduce_error_typename> {
                                     #extract_token_data_from_args
+
                                     #reduce_action
+                                    __data_stack.#tag_stack_name.push(#tag_enum_name::#empty_tag_name);
 
-                                    Ok( #token_data_typename::#variant_name )
+                                    Ok(())
                                 }
                             });
                         }
                     }
                     &Some(ReduceAction::Identity(identity_token_idx)) => {
                         case_streams.extend(quote! {
-                            #rule_index => Ok(Self::#reduce_fn_ident( data_stack, location_stack )),
+                            #rule_index => { Self::#reduce_fn_ident( data_stack, location_stack ); Ok(()) }
                         });
 
-                        let tokens_len = rule.tokens.len();
+                        let mut stack_count_map = std::collections::BTreeMap::new();
+                        let mut pop_stack_idx_pair = None;
+                        for (token_idx, token) in rule.tokens.iter().enumerate().rev() {
+                            let token = token.token;
+                            if token_idx == identity_token_idx {
+                                match token {
+                                    Token::Term(TerminalSymbol::Term(_)) => {
+                                        let idx_from_back = stack_count_map
+                                            .get(&terminal_stack_name)
+                                            .copied()
+                                            .unwrap_or(0);
+                                        pop_stack_idx_pair =
+                                            Some((&terminal_stack_name, idx_from_back));
+                                    }
+                                    Token::Term(TerminalSymbol::Error) => {}
+                                    Token::Term(TerminalSymbol::Eof) => {}
+                                    Token::NonTerm(nonterm_idx) => {
+                                        if let Some(stack_name) =
+                                            &stack_names_for_nonterm[nonterm_idx]
+                                        {
+                                            let idx_from_back = stack_count_map
+                                                .get(stack_name)
+                                                .copied()
+                                                .unwrap_or(0);
+                                            pop_stack_idx_pair = Some((stack_name, idx_from_back));
+                                        }
+                                    }
+                                }
+                            } else {
+                                match token {
+                                    Token::Term(TerminalSymbol::Term(_)) => {
+                                        *stack_count_map
+                                            .entry(&terminal_stack_name)
+                                            .or_insert(0usize) += 1;
+                                    }
+                                    Token::Term(TerminalSymbol::Error) => {}
+                                    Token::Term(TerminalSymbol::Eof) => {}
+                                    Token::NonTerm(nonterm_idx) => {
+                                        if let Some(stack_name) =
+                                            &stack_names_for_nonterm[nonterm_idx]
+                                        {
+                                            *stack_count_map.entry(stack_name).or_insert(0usize) +=
+                                                1;
+                                        }
+                                    }
+                                }
+                            }
+                        }
 
-                        let truncate_data_stack = if tokens_len > 1 {
-                            quote! { __data_stack.truncate(__data_stack.len() - #tokens_len + 1); }
+                        let (stack_pop_stream, stack_push_stream) = if let Some((
+                            pop_stack,
+                            pop_index_from_back,
+                        )) = pop_stack_idx_pair
+                        {
+                            (
+                                quote! { let __ret = __data_stack.#pop_stack.swap_remove( __data_stack.#pop_stack.len() - 1  - #pop_index_from_back ); },
+                                quote! { __data_stack.#pop_stack.push(__ret); __data_stack.#tag_stack_name.push(#tag_enum_name::#pop_stack); },
+                            )
+                        } else {
+                            (
+                                quote! {},
+                                quote! {
+                                    __data_stack.#tag_stack_name.push(#tag_enum_name::#empty_tag_name);
+                                },
+                            )
+                        };
+                        let mut stack_truncate_stream = TokenStream::new();
+                        for (stack_name, count) in stack_count_map {
+                            debug_assert!(count > 0);
+                            stack_truncate_stream.extend(quote! {
+                                __data_stack.#stack_name.truncate(__data_stack.#stack_name.len() - #count);
+                            });
+                        }
+                        let location_truncate_stream = if rule.tokens.len() > 0 {
+                            let len = rule.tokens.len();
+                            quote! { __location_stack.truncate(__location_stack.len() - #len); }
+                        } else {
+                            quote! {}
+                        };
+                        let tags_truncate_stream = if rule.tokens.len() > 0 {
+                            let len = rule.tokens.len();
+                            quote! { __data_stack.#tag_stack_name.truncate(__data_stack.#tag_stack_name.len() - #len); }
                         } else {
                             quote! {}
                         };
@@ -1380,43 +1474,71 @@ impl Grammar {
                             #[doc = #rule_debug_str]
                             #[inline]
                             fn #reduce_fn_ident(
-                                __data_stack: &mut Vec<Self>,
+                                __data_stack: &mut Self,
                                 __location_stack: &mut Vec<#location_typename>,
-                            ) -> #token_data_typename {
-                                let ret = __data_stack.swap_remove( __data_stack.len() - #tokens_len + #identity_token_idx );
-                                #truncate_data_stack
-                                __location_stack.truncate(__location_stack.len() - #tokens_len);
-                                ret
+                            ) {
+                                #stack_pop_stream
+                                #stack_truncate_stream
+                                #location_truncate_stream
+                                #tags_truncate_stream
+                                #stack_push_stream
                             }
                         });
                     }
                     None => {
                         case_streams.extend(quote! {
-                            #rule_index => Ok(Self::#reduce_fn_ident( data_stack, location_stack )),
+                            #rule_index => { Self::#reduce_fn_ident( data_stack, location_stack ); Ok(()) }
                         });
 
-                        let tokens_len = rule.tokens.len();
-
-                        let (truncate_data_stack, truncate_location_stack) = if tokens_len > 0 {
-                            (
-                                quote! { __data_stack.truncate(__data_stack.len() - #tokens_len); },
-                                quote! { __location_stack.truncate(__location_stack.len() - #tokens_len); },
-                            )
+                        let mut stack_count_map = std::collections::BTreeMap::new();
+                        for token in rule.tokens.iter() {
+                            let token = token.token;
+                            match token {
+                                Token::Term(TerminalSymbol::Term(_)) => {
+                                    *stack_count_map
+                                        .entry(&terminal_stack_name)
+                                        .or_insert(0usize) += 1;
+                                }
+                                Token::Term(TerminalSymbol::Error) => {}
+                                Token::Term(TerminalSymbol::Eof) => {}
+                                Token::NonTerm(nonterm_idx) => {
+                                    if let Some(stack_name) = &stack_names_for_nonterm[nonterm_idx]
+                                    {
+                                        *stack_count_map.entry(stack_name).or_insert(0usize) += 1;
+                                    }
+                                }
+                            }
+                        }
+                        let mut stack_truncate_stream = TokenStream::new();
+                        for (stack_name, count) in stack_count_map {
+                            debug_assert!(count > 0);
+                            stack_truncate_stream.extend(quote! {
+                                __data_stack.#stack_name.truncate(__data_stack.#stack_name.len() - #count);
+                            });
+                        }
+                        let location_truncate_stream = if rule.tokens.len() > 0 {
+                            let len = rule.tokens.len();
+                            quote! { __location_stack.truncate(__location_stack.len() - #len); }
                         } else {
-                            (quote! {}, quote! {})
+                            quote! {}
+                        };
+                        let tags_truncate_stream = if rule.tokens.len() > 0 {
+                            let len = rule.tokens.len();
+                            quote! { __data_stack.#tag_stack_name.truncate(__data_stack.#tag_stack_name.len() - #len); }
+                        } else {
+                            quote! {}
                         };
-
                         fn_reduce_for_each_rule_stream.extend(quote! {
                             #[doc = #rule_debug_str]
                             #[inline]
                             fn #reduce_fn_ident(
-                                __data_stack: &mut Vec<Self>,
+                                __data_stack: &mut Self,
                                 __location_stack: &mut Vec<#location_typename>,
-                            ) -> #token_data_typename {
-                                #truncate_data_stack
-                                #truncate_location_stack
-
-                                #token_data_typename::#empty_ruletype_variant_name
+                            ) {
+                                #stack_truncate_stream
+                                #location_truncate_stream
+                                #tags_truncate_stream
+                                __data_stack.#tag_stack_name.push(#tag_enum_name::#empty_tag_name);
                             }
                         });
                     }
@@ -1426,30 +1548,81 @@ impl Grammar {
         }
 
         let start_idx = *self.nonterminals_index.get(&self.start_rule_name).unwrap();
-        let start_variant_name = &variant_names_for_nonterm[start_idx];
-        let (start_typename, extract_start) = match &self.nonterminals[start_idx].ruletype {
-            Some(typename) => (
-                typename.clone(),
-                quote! { #token_data_typename::#start_variant_name(data) => Ok(data) },
-            ),
+        let start_stack_name = &stack_names_for_nonterm[start_idx];
+        let (start_typename, pop_start) = match start_stack_name {
+            Some(stack_name) => {
+                let ruletype = self.nonterminals[start_idx]
+                    .ruletype
+                    .as_ref()
+                    .unwrap()
+                    .clone();
+                (
+                    ruletype,
+                    quote! {
+                        let tag = self.#tag_stack_name.pop();
+                        debug_assert!(tag == Some(#tag_enum_name::#stack_name));
+                        self.#stack_name.pop()
+                    },
+                )
+            }
             None => (
                 quote! {()},
-                quote! { #token_data_typename::#start_variant_name => Ok(())},
+                quote! {
+                    let tag = self.#tag_stack_name.pop();
+                    debug_assert!(tag == Some(#tag_enum_name::#empty_tag_name));
+                    Some(())
+                },
             ),
         };
 
-        // enum data type
-        let mut enum_variants_stream = TokenStream::new();
-        for (variant_name, typename) in variant_names_in_order.into_iter() {
-            if typename.is_empty() {
-                enum_variants_stream.extend(quote! {
-                    #variant_name,
-                });
-            } else {
-                enum_variants_stream.extend(quote! {
-                    #variant_name(#typename),
-                });
-            }
+        let mut tag_definition_stream = TokenStream::new();
+        for (stack_name, _) in &stack_names_in_order {
+            tag_definition_stream.extend(quote! {
+                #stack_name,
+            });
+        }
+
+        let mut stack_definition_stream = TokenStream::new();
+        let mut stack_default_stream = TokenStream::new();
+        let mut pop_match_stream = TokenStream::new();
+        let mut stack_clear_stream = TokenStream::new();
+        let mut stack_append_stream = TokenStream::new();
+        let mut split_off_count_init_stream = TokenStream::new();
+        let mut split_off_count_match_stream = TokenStream::new();
+        let mut split_off_split_stream = TokenStream::new();
+        let mut split_off_ctor_stream = TokenStream::new();
+        for (stack_name, typename) in &stack_names_in_order {
+            stack_definition_stream.extend(quote! {
+                #stack_name: Vec<#typename>,
+            });
+            stack_default_stream.extend(quote! {
+                #stack_name: Vec::new(),
+            });
+            pop_match_stream.extend(quote! {
+                #tag_enum_name::#stack_name => { self.#stack_name.pop(); }
+            });
+            stack_clear_stream.extend(quote! {
+                self.#stack_name.clear();
+            });
+            stack_append_stream.extend(quote! {
+                self.#stack_name.append(&mut other.#stack_name);
+            });
+
+            let count_var_name = format_ident!("__count_{stack_name}");
+            let other_stack_name = format_ident!("__other_{}", stack_name);
+
+            split_off_count_init_stream.extend(quote! {
+                let mut #count_var_name = 0;
+            });
+            split_off_count_match_stream.extend(quote! {
+                #tag_enum_name::#stack_name => { #count_var_name += 1; }
+            });
+            split_off_split_stream.extend(quote! {
+                let #other_stack_name = self.#stack_name.split_off( self.#stack_name.len() - #count_var_name );
+            });
+            split_off_ctor_stream.extend(quote! {
+                #stack_name: #other_stack_name,
+            });
         }
 
         let derive_clone_for_glr = if self.glr {
@@ -1459,21 +1632,39 @@ impl Grammar {
         };
 
         stream.extend(quote! {
+        /// tag for token that represents which stack a token is using
+        #[allow(unused_braces, unused_parens, non_snake_case, non_camel_case_types)]
+        #[derive(Clone, Copy, PartialEq, Eq)]
+        pub enum #tag_enum_name {
+            #empty_tag_name,
+            #tag_definition_stream
+        }
+        
         /// enum for each non-terminal and terminal symbol, that actually hold data
         #[allow(unused_braces, unused_parens, non_snake_case, non_camel_case_types)]
         #derive_clone_for_glr
-        pub enum #token_data_typename {
-            #enum_variants_stream
+        pub struct #data_stack_typename {
+            pub #tag_stack_name: Vec<#tag_enum_name>,
+            #stack_definition_stream
+        }
+
+        impl Default for #data_stack_typename {
+            fn default() -> Self {
+                Self {
+                    #tag_stack_name: Vec::new(),
+                    #stack_default_stream
+                }
+            }
         }
 
         #[allow(unused_braces, unused_parens, unused_variables, non_snake_case, unused_mut, dead_code)]
-        impl #token_data_typename {
+        impl #data_stack_typename {
             #fn_reduce_for_each_rule_stream
         }
 
 
         #[allow(unused_braces, unused_parens, non_snake_case, non_camel_case_types, unused_variables)]
-        impl #module_prefix::nonterminal::TokenData for #token_data_typename {
+        impl #module_prefix::parser::data_stack::DataStack for #data_stack_typename {
             type Term = #token_typename;
             type NonTerm = #nonterminals_enum_name;
             type ReduceActionError = #reduce_error_typename;
@@ -1481,15 +1672,61 @@ impl Grammar {
             type StartType = #start_typename;
             type Location = #location_typename;
 
+            fn pop_start(&mut self) -> Option<Self::StartType> {
+                #pop_start
+            }
+            fn pop(&mut self) {
+                match self.#tag_stack_name.pop().unwrap() {
+                    #pop_match_stream
+                    _ => {}
+                }
+            }
+            fn push_terminal(&mut self, term: Self::Term) {
+                self.#tag_stack_name.push(#tag_enum_name::#terminal_stack_name);
+                self.#terminal_stack_name.push( term );
+            }
+            fn push_empty(&mut self) {
+                self.#tag_stack_name.push(#tag_enum_name::#empty_tag_name);
+            }
+
+            fn clear(&mut self) {
+                self.#tag_stack_name.clear();
+                #stack_clear_stream
+            }
+            fn reserve(&mut self, additional: usize) {
+                self.#tag_stack_name.reserve(additional);
+            }
+
+            fn split_off(&mut self, at: usize) -> Self {
+                let other_tag_stack = self.#tag_stack_name.split_off(at);
+
+                #split_off_count_init_stream
+                for tag in &other_tag_stack {
+                    match tag {
+                        #split_off_count_match_stream
+                        _ => {}
+                    }
+                }
+                #split_off_split_stream
+                Self {
+                    #tag_stack_name: other_tag_stack,
+                    #split_off_ctor_stream
+                }
+            }
+            fn append(&mut self, other: &mut Self) {
+                self.#tag_stack_name.append(&mut other.#tag_stack_name);
+                #stack_append_stream
+            }
+
             fn reduce_action(
-                data_stack: &mut Vec<Self>,
+                data_stack: &mut Self,
                 location_stack: &mut Vec<#location_typename>,
                 rule_index: usize,
                 shift: &mut bool,
                 lookahead: &#module_prefix::TerminalSymbol<Self::Term>,
                 user_data: &mut Self::UserData,
                 location0: &mut Self::Location,
-            ) -> Result<Self, Self::ReduceActionError> {
+            ) -> Result<(), Self::ReduceActionError> {
                 match rule_index {
                     #case_streams
                     _ => {
@@ -1497,25 +1734,8 @@ impl Grammar {
                     }
                 }
             }
-            fn new_error() -> Self {
-                #token_data_typename::#empty_ruletype_variant_name
-            }
-            fn new_terminal(term: #token_typename) -> Self {
-                #token_data_typename::#terminal_variant_name(term)
-            }
         }
 
-        #[allow(unused_braces, unused_parens, non_snake_case, non_camel_case_types, unused_variables)]
-        impl TryFrom<#token_data_typename> for #start_typename {
-            type Error = ();
-
-            fn try_from(token: #token_data_typename) -> Result<Self, Self::Error> {
-                match token {
-                    #extract_start,
-                    _ => Err(()),
-                }
-            }
-        }
         });
     }
 
@@ -1523,7 +1743,7 @@ impl Grammar {
         let mut stream = TokenStream::new();
         self.emit_type_alises(&mut stream);
         self.emit_nonterm_enum(&mut stream);
-        self.emit_token_data(&mut stream);
+        self.emit_data_stack(&mut stream);
         self.emit_parser(&mut stream);
 
         stream

From ccc329bbf0834bc042d1aee6e731866fe9b3d01b Mon Sep 17 00:00:00 2001
From: Taehwan Kim <ehwank98@gmail.com>
Date: Sat, 9 Aug 2025 15:18:52 +0900
Subject: [PATCH 04/11] bootstrap

---
 rusty_lr_parser/src/parser/parser_expanded.rs | 4457 ++++++++++-------
 1 file changed, 2664 insertions(+), 1793 deletions(-)

diff --git a/rusty_lr_parser/src/parser/parser_expanded.rs b/rusty_lr_parser/src/parser/parser_expanded.rs
index 081a5ef1..c08b4d04 100644
--- a/rusty_lr_parser/src/parser/parser_expanded.rs
+++ b/rusty_lr_parser/src/parser/parser_expanded.rs
@@ -195,7 +195,7 @@ Augmented -> Grammar eof
 /// type alias for `Context`
 #[allow(non_camel_case_types, dead_code)]
 pub type GrammarContext = ::rusty_lr_core::parser::deterministic::Context<
-    GrammarTokenData,
+    GrammarDataStack,
     u8,
 >;
 /// type alias for CFG production rule
@@ -215,7 +215,7 @@ pub type GrammarState = ::rusty_lr_core::parser::state::SparseState<
 /// type alias for `ParseError`
 #[allow(non_camel_case_types, dead_code)]
 pub type GrammarParseError = ::rusty_lr_core::parser::deterministic::ParseError<
-    GrammarTokenData,
+    GrammarDataStack,
 >;
 /// An enum that represents non-terminal symbols
 #[allow(non_camel_case_types, dead_code)]
@@ -427,30 +427,83 @@ impl ::rusty_lr_core::nonterminal::NonTerminal for GrammarNonTerminals {
         *self as usize
     }
 }
-/// enum for each non-terminal and terminal symbol, that actually hold data
+/// tag for token that represents which stack a token is using
 #[allow(unused_braces, unused_parens, non_snake_case, non_camel_case_types)]
-pub enum GrammarTokenData {
-    Terminals(Lexed),
+#[derive(Clone, Copy, PartialEq, Eq)]
+pub enum GrammarTags {
     Empty,
-    Variant2(RuleDefArgs),
-    Variant3(Option<Group>),
-    Variant4(Vec<RuleLineArgs>),
-    Variant5(RuleLineArgs),
-    Variant6(PrecDPrecArgs),
-    Variant7((Option<Ident>, PatternArgs)),
-    Variant8(TerminalSetItem),
-    Variant9(TerminalSet),
-    Variant10(PatternArgs),
-    Variant11(IdentOrLiteral),
-    Variant12(TokenStream),
-    Variant13(Vec<(Option<Ident>, PatternArgs)>),
-    Variant14(Vec<PrecDPrecArgs>),
-    Variant15(Option<Lexed>),
-    Variant16(Vec<TerminalSetItem>),
-    Variant17(Vec<PatternArgs>),
-    Variant18(Vec<Vec<PatternArgs>>),
-    Variant19(Vec<Lexed>),
-    Variant20(Vec<IdentOrLiteral>),
+    __terminals,
+    __stack2,
+    __stack3,
+    __stack4,
+    __stack5,
+    __stack6,
+    __stack7,
+    __stack8,
+    __stack9,
+    __stack10,
+    __stack11,
+    __stack12,
+    __stack13,
+    __stack14,
+    __stack15,
+    __stack16,
+    __stack17,
+    __stack18,
+    __stack19,
+    __stack20,
+}
+/// enum for each non-terminal and terminal symbol, that actually hold data
+#[allow(unused_braces, unused_parens, non_snake_case, non_camel_case_types)]
+pub struct GrammarDataStack {
+    pub __tags: Vec<GrammarTags>,
+    __terminals: Vec<Lexed>,
+    __stack2: Vec<RuleDefArgs>,
+    __stack3: Vec<Option<Group>>,
+    __stack4: Vec<Vec<RuleLineArgs>>,
+    __stack5: Vec<RuleLineArgs>,
+    __stack6: Vec<PrecDPrecArgs>,
+    __stack7: Vec<(Option<Ident>, PatternArgs)>,
+    __stack8: Vec<TerminalSetItem>,
+    __stack9: Vec<TerminalSet>,
+    __stack10: Vec<PatternArgs>,
+    __stack11: Vec<IdentOrLiteral>,
+    __stack12: Vec<TokenStream>,
+    __stack13: Vec<Vec<(Option<Ident>, PatternArgs)>>,
+    __stack14: Vec<Vec<PrecDPrecArgs>>,
+    __stack15: Vec<Option<Lexed>>,
+    __stack16: Vec<Vec<TerminalSetItem>>,
+    __stack17: Vec<Vec<PatternArgs>>,
+    __stack18: Vec<Vec<Vec<PatternArgs>>>,
+    __stack19: Vec<Vec<Lexed>>,
+    __stack20: Vec<Vec<IdentOrLiteral>>,
+}
+impl Default for GrammarDataStack {
+    fn default() -> Self {
+        Self {
+            __tags: Vec::new(),
+            __terminals: Vec::new(),
+            __stack2: Vec::new(),
+            __stack3: Vec::new(),
+            __stack4: Vec::new(),
+            __stack5: Vec::new(),
+            __stack6: Vec::new(),
+            __stack7: Vec::new(),
+            __stack8: Vec::new(),
+            __stack9: Vec::new(),
+            __stack10: Vec::new(),
+            __stack11: Vec::new(),
+            __stack12: Vec::new(),
+            __stack13: Vec::new(),
+            __stack14: Vec::new(),
+            __stack15: Vec::new(),
+            __stack16: Vec::new(),
+            __stack17: Vec::new(),
+            __stack18: Vec::new(),
+            __stack19: Vec::new(),
+            __stack20: Vec::new(),
+        }
+    }
 }
 #[allow(
     unused_braces,
@@ -460,1371 +513,1409 @@ pub enum GrammarTokenData {
     unused_mut,
     dead_code
 )]
-impl GrammarTokenData {
+impl GrammarDataStack {
     ///Rule -> ident RuleType colon RuleLines semicolon
     #[inline]
     fn reduce_Rule_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant4(mut RuleLines) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack4));
+        let mut RuleLines = __data_stack.__stack4.pop().unwrap();
         let __rustylr_location_RuleLines = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut colon) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut colon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_colon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant3(mut RuleType) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack3));
+        let mut RuleType = __data_stack.__stack3.pop().unwrap();
         let __rustylr_location_RuleType = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut ident) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant2({
-                let Lexed::Ident(ident) = ident else {
-                    unreachable!("Rule-Ident");
-                };
-                let span = __rustylr_location_colon.span();
-                if let Some(fisrt) = RuleLines.first_mut() {
-                    fisrt.separator_span = span;
-                }
-                RuleDefArgs {
-                    name: ident,
-                    typename: RuleType.map(|t| t.stream()),
-                    rule_lines: RuleLines,
-                }
-            }),
-        )
+        let res = {
+            let Lexed::Ident(ident) = ident else {
+                unreachable!("Rule-Ident");
+            };
+            let span = __rustylr_location_colon.span();
+            if let Some(fisrt) = RuleLines.first_mut() {
+                fisrt.separator_span = span;
+            }
+            RuleDefArgs {
+                name: ident,
+                typename: RuleType.map(|t| t.stream()),
+                rule_lines: RuleLines,
+            }
+        };
+        __data_stack.__stack2.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack2);
+        Ok(())
     }
     ///RuleType -> parengroup
     #[inline]
     fn reduce_RuleType_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut parengroup) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut parengroup = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_parengroup = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant3({
-                let Lexed::ParenGroup(group) = parengroup else {
-                    unreachable!("RuleType - Group");
-                };
-                Some(group)
-            }),
-        )
+        let res = {
+            let Lexed::ParenGroup(group) = parengroup else {
+                unreachable!("RuleType - Group");
+            };
+            Some(group)
+        };
+        __data_stack.__stack3.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack3);
+        Ok(())
     }
     ///RuleType ->
     #[inline]
     fn reduce_RuleType_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        Ok(GrammarTokenData::Variant3({ None }))
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let res = { None };
+        __data_stack.__stack3.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack3);
+        Ok(())
     }
     ///RuleLines -> RuleLines pipe RuleLine
     #[inline]
     fn reduce_RuleLines_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant5(mut RuleLine) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack5));
+        let mut RuleLine = __data_stack.__stack5.pop().unwrap();
         let __rustylr_location_RuleLine = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut pipe) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut pipe = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_pipe = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant4(mut RuleLines) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack4));
+        let mut RuleLines = __data_stack.__stack4.pop().unwrap();
         let __rustylr_location_RuleLines = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant4({
-                RuleLine.separator_span = __rustylr_location_pipe.span();
-                RuleLines.push(RuleLine);
-                RuleLines
-            }),
-        )
+        let res = {
+            RuleLine.separator_span = __rustylr_location_pipe.span();
+            RuleLines.push(RuleLine);
+            RuleLines
+        };
+        __data_stack.__stack4.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack4);
+        Ok(())
     }
     ///RuleLines -> RuleLine
     #[inline]
     fn reduce_RuleLines_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant5(mut RuleLine) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack5));
+        let mut RuleLine = __data_stack.__stack5.pop().unwrap();
         let __rustylr_location_RuleLine = __location_stack.pop().unwrap();
-        Ok(GrammarTokenData::Variant4({ vec![RuleLine] }))
+        let res = { vec![RuleLine] };
+        __data_stack.__stack4.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack4);
+        Ok(())
     }
     ///RuleLine -> TokenMapped* PrecDef* Action
     #[inline]
     fn reduce_RuleLine_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant3(mut Action) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack3));
+        let mut Action = __data_stack.__stack3.pop().unwrap();
         let __rustylr_location_Action = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant14(mut PrecDef) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack14));
+        let mut PrecDef = __data_stack.__stack14.pop().unwrap();
         let __rustylr_location_PrecDef = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant13(mut TokenMapped) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack13));
+        let mut TokenMapped = __data_stack.__stack13.pop().unwrap();
         let __rustylr_location_TokenMapped = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant5({
-                RuleLineArgs {
-                    tokens: TokenMapped,
-                    reduce_action: Action.map(|action| action.to_token_stream()),
-                    separator_span: Span::call_site(),
-                    precs: PrecDef,
-                    prec: None,
-                    dprec: None,
-                }
-            }),
-        )
+        let res = {
+            RuleLineArgs {
+                tokens: TokenMapped,
+                reduce_action: Action.map(|action| action.to_token_stream()),
+                separator_span: Span::call_site(),
+                precs: PrecDef,
+                prec: None,
+                dprec: None,
+            }
+        };
+        __data_stack.__stack5.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack5);
+        Ok(())
     }
     ///PrecDef -> percent prec IdentOrLiteral
     #[inline]
     fn reduce_PrecDef_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant11(mut IdentOrLiteral) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack11));
+        let mut IdentOrLiteral = __data_stack.__stack11.pop().unwrap();
         let __rustylr_location_IdentOrLiteral = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut prec) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut prec = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_prec = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
-        Ok(GrammarTokenData::Variant6({ PrecDPrecArgs::Prec(IdentOrLiteral) }))
+        let res = { PrecDPrecArgs::Prec(IdentOrLiteral) };
+        __data_stack.__stack6.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack6);
+        Ok(())
     }
     ///PrecDef -> percent prec error
     #[inline]
     fn reduce_PrecDef_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        __data_stack.pop();
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut prec) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut prec = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_prec = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant6({
-                data.error_recovered
-                    .push(RecoveredError {
-                        message: "Expected <ident> to token or <literal>".to_string(),
-                        link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#operator-precedence"
-                            .to_string(),
-                        span: __rustylr_location_error,
-                    });
-                PrecDPrecArgs::None
-            }),
-        )
+        let res = {
+            data.error_recovered
+                .push(RecoveredError {
+                    message: "Expected <ident> to token or <literal>".to_string(),
+                    link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#operator-precedence"
+                        .to_string(),
+                    span: __rustylr_location_error,
+                });
+            PrecDPrecArgs::None
+        };
+        __data_stack.__stack6.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack6);
+        Ok(())
     }
     ///PrecDef -> percent dprec literal
     #[inline]
     fn reduce_PrecDef_2(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut literal) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut literal = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_literal = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut dprec) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut dprec = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_dprec = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant6({
-                let Lexed::Literal(literal) = literal else {
-                    unreachable!("PrecDPrecArgs-DPrec");
-                };
-                PrecDPrecArgs::DPrec(literal)
-            }),
-        )
+        let res = {
+            let Lexed::Literal(literal) = literal else {
+                unreachable!("PrecDPrecArgs-DPrec");
+            };
+            PrecDPrecArgs::DPrec(literal)
+        };
+        __data_stack.__stack6.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack6);
+        Ok(())
     }
     ///PrecDef -> percent dprec error
     #[inline]
     fn reduce_PrecDef_3(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        __data_stack.pop();
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut dprec) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut dprec = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_dprec = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant6({
-                data.error_recovered
-                    .push(RecoveredError {
-                        message: "Expected integer literal".to_string(),
-                        link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#rule-priority"
-                            .to_string(),
-                        span: __rustylr_location_error,
-                    });
-                PrecDPrecArgs::None
-            }),
-        )
+        let res = {
+            data.error_recovered
+                .push(RecoveredError {
+                    message: "Expected integer literal".to_string(),
+                    link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#rule-priority"
+                        .to_string(),
+                    span: __rustylr_location_error,
+                });
+            PrecDPrecArgs::None
+        };
+        __data_stack.__stack6.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack6);
+        Ok(())
     }
     ///PrecDef -> percent error
     #[inline]
     fn reduce_PrecDef_4(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        __data_stack.pop();
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant6({
-                data.error_recovered
-                    .push(RecoveredError {
-                        message: "Expected %prec or %dprec".to_string(),
-                        link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#operator-precedence"
-                            .to_string(),
-                        span: __rustylr_location_error,
-                    });
-                PrecDPrecArgs::None
-            }),
-        )
+        let res = {
+            data.error_recovered
+                .push(RecoveredError {
+                    message: "Expected %prec or %dprec".to_string(),
+                    link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#operator-precedence"
+                        .to_string(),
+                    span: __rustylr_location_error,
+                });
+            PrecDPrecArgs::None
+        };
+        __data_stack.__stack6.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack6);
+        Ok(())
     }
     ///TokenMapped -> Pattern
     #[inline]
     fn reduce_TokenMapped_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant10(mut Pattern) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        let mut Pattern = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_Pattern = __location_stack.pop().unwrap();
-        Ok(GrammarTokenData::Variant7({ (None, Pattern) }))
+        let res = { (None, Pattern) };
+        __data_stack.__stack7.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack7);
+        Ok(())
     }
     ///TokenMapped -> ident equal Pattern
     #[inline]
     fn reduce_TokenMapped_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant10(mut Pattern) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        let mut Pattern = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_Pattern = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut equal) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut equal = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_equal = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut ident) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant7({
-                let Lexed::Ident(ident) = ident else {
-                    unreachable!("Token-Ident");
-                };
-                (Some(ident), Pattern)
-            }),
-        )
+        let res = {
+            let Lexed::Ident(ident) = ident else {
+                unreachable!("Token-Ident");
+            };
+            (Some(ident), Pattern)
+        };
+        __data_stack.__stack7.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack7);
+        Ok(())
     }
     ///TerminalSetItem -> ident
     #[inline]
     fn reduce_TerminalSetItem_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut ident) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant8({
-                let Lexed::Ident(ident) = ident else {
-                    unreachable!("TerminalSetItem-Range1");
-                };
-                TerminalSetItem::Terminal(ident)
-            }),
-        )
+        let res = {
+            let Lexed::Ident(ident) = ident else {
+                unreachable!("TerminalSetItem-Range1");
+            };
+            TerminalSetItem::Terminal(ident)
+        };
+        __data_stack.__stack8.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack8);
+        Ok(())
     }
     ///TerminalSetItem -> ident minus ident
     #[inline]
     fn reduce_TerminalSetItem_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut last) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut last = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_last = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut minus) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut minus = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_minus = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut first) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut first = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_first = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant8({
-                let Lexed::Ident(first) = first else {
-                    unreachable!("TerminalSetItem-Range1");
-                };
-                let Lexed::Ident(last) = last else {
-                    unreachable!("TerminalSetItem-Range3");
-                };
-                TerminalSetItem::Range(first, last)
-            }),
-        )
+        let res = {
+            let Lexed::Ident(first) = first else {
+                unreachable!("TerminalSetItem-Range1");
+            };
+            let Lexed::Ident(last) = last else {
+                unreachable!("TerminalSetItem-Range3");
+            };
+            TerminalSetItem::Range(first, last)
+        };
+        __data_stack.__stack8.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack8);
+        Ok(())
     }
     ///TerminalSetItem -> ident minus error
     #[inline]
     fn reduce_TerminalSetItem_2(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        __data_stack.pop();
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut minus) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut minus = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_minus = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut ident) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant8({
-                data.error_recovered
-                    .push(RecoveredError {
-                        message: "Expected ident for terminal set".to_string(),
-                        link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#patterns"
-                            .to_string(),
-                        span: __rustylr_location_error,
-                    });
-                TerminalSetItem::Terminal(format_ident!("dummy"))
-            }),
-        )
+        let res = {
+            data.error_recovered
+                .push(RecoveredError {
+                    message: "Expected ident for terminal set".to_string(),
+                    link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#patterns"
+                        .to_string(),
+                    span: __rustylr_location_error,
+                });
+            TerminalSetItem::Terminal(format_ident!("dummy"))
+        };
+        __data_stack.__stack8.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack8);
+        Ok(())
     }
     ///TerminalSetItem -> literal
     #[inline]
     fn reduce_TerminalSetItem_3(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut literal) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut literal = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_literal = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant8({
-                let Lexed::Literal(literal) = literal else {
-                    unreachable!("TerminalSetItem-Literal");
-                };
-                TerminalSetItem::Literal(literal)
-            }),
-        )
+        let res = {
+            let Lexed::Literal(literal) = literal else {
+                unreachable!("TerminalSetItem-Literal");
+            };
+            TerminalSetItem::Literal(literal)
+        };
+        __data_stack.__stack8.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack8);
+        Ok(())
     }
     ///TerminalSetItem -> literal minus literal
     #[inline]
     fn reduce_TerminalSetItem_4(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut last) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut last = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_last = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut minus) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut minus = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_minus = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut first) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut first = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_first = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant8({
-                let Lexed::Literal(first) = first else {
-                    unreachable!("TerminalSetItem-Range1");
-                };
-                let Lexed::Literal(last) = last else {
-                    unreachable!("TerminalSetItem-Range3");
-                };
-                TerminalSetItem::LiteralRange(first, last)
-            }),
-        )
+        let res = {
+            let Lexed::Literal(first) = first else {
+                unreachable!("TerminalSetItem-Range1");
+            };
+            let Lexed::Literal(last) = last else {
+                unreachable!("TerminalSetItem-Range3");
+            };
+            TerminalSetItem::LiteralRange(first, last)
+        };
+        __data_stack.__stack8.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack8);
+        Ok(())
     }
     ///TerminalSetItem -> literal minus error
     #[inline]
     fn reduce_TerminalSetItem_5(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        __data_stack.pop();
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut minus) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut minus = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_minus = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut literal) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut literal = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_literal = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant8({
-                data.error_recovered
-                    .push(RecoveredError {
-                        message: "Expected literal for terminal set".to_string(),
-                        link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#patterns"
-                            .to_string(),
-                        span: __rustylr_location_error,
-                    });
-                TerminalSetItem::Terminal(format_ident!("dummy"))
-            }),
-        )
+        let res = {
+            data.error_recovered
+                .push(RecoveredError {
+                    message: "Expected literal for terminal set".to_string(),
+                    link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#patterns"
+                        .to_string(),
+                    span: __rustylr_location_error,
+                });
+            TerminalSetItem::Terminal(format_ident!("dummy"))
+        };
+        __data_stack.__stack8.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack8);
+        Ok(())
     }
     ///TerminalSet -> lbracket caret? TerminalSetItem* rbracket
     #[inline]
     fn reduce_TerminalSet_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut rbracket) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut rbracket = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_rbracket = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant16(mut TerminalSetItem) = __data_stack
-            .pop()
-            .unwrap() else { unreachable!() };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack16));
+        let mut TerminalSetItem = __data_stack.__stack16.pop().unwrap();
         let __rustylr_location_TerminalSetItem = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant15(mut caret) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack15));
+        let mut caret = __data_stack.__stack15.pop().unwrap();
         let __rustylr_location_caret = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut lbracket) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut lbracket = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_lbracket = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant9({
-                TerminalSet {
-                    negate: caret.is_some(),
-                    items: TerminalSetItem,
-                    open_span: __rustylr_location_lbracket.span(),
-                    close_span: __rustylr_location_rbracket.span(),
-                }
-            }),
-        )
+        let res = {
+            TerminalSet {
+                negate: caret.is_some(),
+                items: TerminalSetItem,
+                open_span: __rustylr_location_lbracket.span(),
+                close_span: __rustylr_location_rbracket.span(),
+            }
+        };
+        __data_stack.__stack9.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack9);
+        Ok(())
     }
     ///TerminalSet -> dot
     #[inline]
     fn reduce_TerminalSet_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut dot) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut dot = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_dot = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant9({
-                let span = __rustylr_location_dot.span();
-                TerminalSet {
-                    negate: true,
-                    items: vec![],
-                    open_span: span,
-                    close_span: span,
-                }
-            }),
-        )
+        let res = {
+            let span = __rustylr_location_dot.span();
+            TerminalSet {
+                negate: true,
+                items: vec![],
+                open_span: span,
+                close_span: span,
+            }
+        };
+        __data_stack.__stack9.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack9);
+        Ok(())
     }
     ///Pattern -> ident
     #[inline]
     fn reduce_Pattern_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut ident) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant10({
-                let Lexed::Ident(ident) = ident else {
-                    unreachable!("Pattern-Ident");
-                };
-                PatternArgs::Ident(ident)
-            }),
-        )
+        let res = {
+            let Lexed::Ident(ident) = ident else {
+                unreachable!("Pattern-Ident");
+            };
+            PatternArgs::Ident(ident)
+        };
+        __data_stack.__stack10.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack10);
+        Ok(())
     }
     ///Pattern -> Pattern plus
     #[inline]
     fn reduce_Pattern_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut plus) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut plus = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_plus = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant10(mut Pattern) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        let mut Pattern = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_Pattern = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant10({
-                let Lexed::Plus(plus) = plus else {
-                    unreachable!("Pattern-Plus");
-                };
-                PatternArgs::Plus(Box::new(Pattern), __rustylr_location_plus.span())
-            }),
-        )
+        let res = {
+            let Lexed::Plus(plus) = plus else {
+                unreachable!("Pattern-Plus");
+            };
+            PatternArgs::Plus(Box::new(Pattern), __rustylr_location_plus.span())
+        };
+        __data_stack.__stack10.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack10);
+        Ok(())
     }
     ///Pattern -> Pattern star
     #[inline]
     fn reduce_Pattern_2(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut star) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut star = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_star = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant10(mut Pattern) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        let mut Pattern = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_Pattern = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant10({
-                PatternArgs::Star(Box::new(Pattern), __rustylr_location_star.span())
-            }),
-        )
+        let res = {
+            PatternArgs::Star(Box::new(Pattern), __rustylr_location_star.span())
+        };
+        __data_stack.__stack10.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack10);
+        Ok(())
     }
     ///Pattern -> Pattern question
     #[inline]
     fn reduce_Pattern_3(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut question) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut question = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_question = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant10(mut Pattern) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        let mut Pattern = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_Pattern = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant10({
-                PatternArgs::Question(
-                    Box::new(Pattern),
-                    __rustylr_location_question.span(),
-                )
-            }),
-        )
+        let res = {
+            PatternArgs::Question(Box::new(Pattern), __rustylr_location_question.span())
+        };
+        __data_stack.__stack10.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack10);
+        Ok(())
     }
     ///Pattern -> Pattern exclamation
     #[inline]
     fn reduce_Pattern_4(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut exclamation) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut exclamation = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_exclamation = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant10(mut Pattern) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        let mut Pattern = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_Pattern = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant10({
-                PatternArgs::Exclamation(
-                    Box::new(Pattern),
-                    __rustylr_location_exclamation.span(),
-                )
-            }),
-        )
+        let res = {
+            PatternArgs::Exclamation(
+                Box::new(Pattern),
+                __rustylr_location_exclamation.span(),
+            )
+        };
+        __data_stack.__stack10.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack10);
+        Ok(())
     }
     ///Pattern -> TerminalSet
     #[inline]
     fn reduce_Pattern_5(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant9(mut TerminalSet) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack9));
+        let mut TerminalSet = __data_stack.__stack9.pop().unwrap();
         let __rustylr_location_TerminalSet = __location_stack.pop().unwrap();
-        Ok(GrammarTokenData::Variant10({ PatternArgs::TerminalSet(TerminalSet) }))
+        let res = { PatternArgs::TerminalSet(TerminalSet) };
+        __data_stack.__stack10.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack10);
+        Ok(())
     }
     ///Pattern -> Pattern slash Pattern
     #[inline]
     fn reduce_Pattern_6(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant10(mut lh) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        let mut lh = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_lh = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut slash) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut slash = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_slash = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant10(mut p1) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        let mut p1 = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_p1 = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant10({
-                PatternArgs::Lookaheads(Box::new(p1), Box::new(lh))
-            }),
-        )
+        let res = { PatternArgs::Lookaheads(Box::new(p1), Box::new(lh)) };
+        __data_stack.__stack10.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack10);
+        Ok(())
     }
     ///Pattern -> lparen $sep(Pattern*, pipe, +) rparen
     #[inline]
     fn reduce_Pattern_7(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut rparen) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut rparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_rparen = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant18(mut Pattern) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack18));
+        let mut Pattern = __data_stack.__stack18.pop().unwrap();
         let __rustylr_location_Pattern = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut lparen) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut lparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_lparen = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant10({
-                PatternArgs::Group(
-                    Pattern,
-                    __rustylr_location_lparen.span(),
-                    __rustylr_location_rparen.span(),
-                )
-            }),
-        )
+        let res = {
+            PatternArgs::Group(
+                Pattern,
+                __rustylr_location_lparen.span(),
+                __rustylr_location_rparen.span(),
+            )
+        };
+        __data_stack.__stack10.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack10);
+        Ok(())
     }
     ///Pattern -> lparen error rparen
     #[inline]
     fn reduce_Pattern_8(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut rparen) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut rparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_rparen = __location_stack.pop().unwrap();
-        __data_stack.pop();
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut lparen) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut lparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_lparen = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant10({
-                data.error_recovered
-                    .push(RecoveredError {
-                        message: "syntax error when parsing GROUP".to_string(),
-                        link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#patterns"
-                            .to_string(),
-                        span: __rustylr_location_error,
-                    });
-                PatternArgs::Ident(format_ident!("dummy"))
-            }),
-        )
+        let res = {
+            data.error_recovered
+                .push(RecoveredError {
+                    message: "syntax error when parsing GROUP".to_string(),
+                    link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#patterns"
+                        .to_string(),
+                    span: __rustylr_location_error,
+                });
+            PatternArgs::Ident(format_ident!("dummy"))
+        };
+        __data_stack.__stack10.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack10);
+        Ok(())
     }
     ///Pattern -> literal
     #[inline]
     fn reduce_Pattern_9(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut literal) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut literal = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_literal = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant10({
-                let Lexed::Literal(literal) = literal else {
-                    unreachable!("Pattern-Literal");
-                };
-                PatternArgs::Literal(literal)
-            }),
-        )
+        let res = {
+            let Lexed::Literal(literal) = literal else {
+                unreachable!("Pattern-Literal");
+            };
+            PatternArgs::Literal(literal)
+        };
+        __data_stack.__stack10.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack10);
+        Ok(())
     }
     ///Pattern -> Pattern minus Pattern
     #[inline]
     fn reduce_Pattern_10(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant10(mut p2) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        let mut p2 = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_p2 = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut minus) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut minus = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_minus = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant10(mut p1) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        let mut p1 = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_p1 = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant10({
-                PatternArgs::Minus(Box::new(p1), Box::new(p2))
-            }),
-        )
+        let res = { PatternArgs::Minus(Box::new(p1), Box::new(p2)) };
+        __data_stack.__stack10.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack10);
+        Ok(())
     }
     ///Pattern -> dollar ident lparen Pattern comma Pattern comma? rparen
     #[inline]
     fn reduce_Pattern_11(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut rparen) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut rparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_rparen = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant15(mut comma) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack15));
+        let mut comma = __data_stack.__stack15.pop().unwrap();
         let __rustylr_location_comma = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant10(mut del) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        let mut del = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_del = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut comma) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut comma = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_comma = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant10(mut base) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        let mut base = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_base = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut lparen) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut lparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_lparen = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut ident) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut dollar) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut dollar = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_dollar = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant10({
-                let Lexed::Ident(ident) = ident else {
-                    unreachable!("Pattern-Sep-Ident");
-                };
-                if ident != "sep" {
-                    data.error_recovered
-                        .push(RecoveredError {
-                            message: "Expected $sep".to_string(),
-                            link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#patterns"
-                                .to_string(),
-                            span: __rustylr_location_ident,
-                        });
-                }
-                PatternArgs::Sep(
-                    Box::new(base),
-                    Box::new(del),
-                    false,
-                    *__rustylr_location0,
-                )
-            }),
-        )
+        let res = {
+            let Lexed::Ident(ident) = ident else {
+                unreachable!("Pattern-Sep-Ident");
+            };
+            if ident != "sep" {
+                data.error_recovered
+                    .push(RecoveredError {
+                        message: "Expected $sep".to_string(),
+                        link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#patterns"
+                            .to_string(),
+                        span: __rustylr_location_ident,
+                    });
+            }
+            PatternArgs::Sep(Box::new(base), Box::new(del), false, *__rustylr_location0)
+        };
+        __data_stack.__stack10.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack10);
+        Ok(())
     }
     ///Pattern -> dollar ident lparen Pattern comma Pattern comma plus rparen
     #[inline]
     fn reduce_Pattern_12(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut rparen) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut rparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_rparen = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut plus) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut plus = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_plus = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut comma) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut comma = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_comma = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant10(mut del) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        let mut del = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_del = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut comma) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut comma = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_comma = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant10(mut base) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        let mut base = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_base = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut lparen) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut lparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_lparen = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut ident) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut dollar) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut dollar = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_dollar = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant10({
-                let Lexed::Ident(ident) = ident else {
-                    unreachable!("Pattern-Sep-Ident");
-                };
-                if ident != "sep" {
-                    data.error_recovered
-                        .push(RecoveredError {
-                            message: "Expected $sep".to_string(),
-                            link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#patterns"
-                                .to_string(),
-                            span: __rustylr_location_ident,
-                        });
-                }
-                PatternArgs::Sep(
-                    Box::new(base),
-                    Box::new(del),
-                    true,
-                    *__rustylr_location0,
-                )
-            }),
-        )
+        let res = {
+            let Lexed::Ident(ident) = ident else {
+                unreachable!("Pattern-Sep-Ident");
+            };
+            if ident != "sep" {
+                data.error_recovered
+                    .push(RecoveredError {
+                        message: "Expected $sep".to_string(),
+                        link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#patterns"
+                            .to_string(),
+                        span: __rustylr_location_ident,
+                    });
+            }
+            PatternArgs::Sep(Box::new(base), Box::new(del), true, *__rustylr_location0)
+        };
+        __data_stack.__stack10.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack10);
+        Ok(())
     }
     ///Pattern -> dollar ident lparen Pattern comma Pattern comma star rparen
     #[inline]
     fn reduce_Pattern_13(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut rparen) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut rparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_rparen = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut star) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut star = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_star = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut comma) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut comma = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_comma = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant10(mut del) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        let mut del = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_del = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut comma) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut comma = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_comma = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant10(mut base) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        let mut base = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_base = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut lparen) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut lparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_lparen = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut ident) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut dollar) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut dollar = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_dollar = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant10({
-                let Lexed::Ident(ident) = ident else {
-                    unreachable!("Pattern-Sep-Ident");
-                };
-                if ident != "sep" {
-                    data.error_recovered
-                        .push(RecoveredError {
-                            message: "Expected $sep".to_string(),
-                            link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#patterns"
-                                .to_string(),
-                            span: __rustylr_location_ident,
-                        });
-                }
-                PatternArgs::Sep(
-                    Box::new(base),
-                    Box::new(del),
-                    false,
-                    *__rustylr_location0,
-                )
-            }),
-        )
+        let res = {
+            let Lexed::Ident(ident) = ident else {
+                unreachable!("Pattern-Sep-Ident");
+            };
+            if ident != "sep" {
+                data.error_recovered
+                    .push(RecoveredError {
+                        message: "Expected $sep".to_string(),
+                        link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#patterns"
+                            .to_string(),
+                        span: __rustylr_location_ident,
+                    });
+            }
+            PatternArgs::Sep(Box::new(base), Box::new(del), false, *__rustylr_location0)
+        };
+        __data_stack.__stack10.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack10);
+        Ok(())
     }
     ///Pattern -> dollar ident lparen Pattern comma Pattern error rparen
     #[inline]
     fn reduce_Pattern_14(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut rparen) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut rparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_rparen = __location_stack.pop().unwrap();
-        __data_stack.pop();
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant10(mut del) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        let mut del = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_del = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut comma) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut comma = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_comma = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant10(mut base) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        let mut base = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_base = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut lparen) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut lparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_lparen = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut ident) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut dollar) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut dollar = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_dollar = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant10({
-                let Lexed::Ident(ident) = ident else {
-                    unreachable!("Pattern-Sep-Ident");
-                };
-                if ident != "sep" {
-                    data.error_recovered
-                        .push(RecoveredError {
-                            message: "Expected $sep".to_string(),
-                            link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#patterns"
-                                .to_string(),
-                            span: __rustylr_location_ident,
-                        });
-                }
+        let res = {
+            let Lexed::Ident(ident) = ident else {
+                unreachable!("Pattern-Sep-Ident");
+            };
+            if ident != "sep" {
                 data.error_recovered
                     .push(RecoveredError {
-                        message: "Unexpected $sep arguments".to_string(),
+                        message: "Expected $sep".to_string(),
                         link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#patterns"
                             .to_string(),
-                        span: __rustylr_location_error,
+                        span: __rustylr_location_ident,
                     });
-                PatternArgs::Sep(
-                    Box::new(base),
-                    Box::new(del),
-                    false,
-                    *__rustylr_location0,
-                )
-            }),
-        )
+            }
+            data.error_recovered
+                .push(RecoveredError {
+                    message: "Unexpected $sep arguments".to_string(),
+                    link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#patterns"
+                        .to_string(),
+                    span: __rustylr_location_error,
+                });
+            PatternArgs::Sep(Box::new(base), Box::new(del), false, *__rustylr_location0)
+        };
+        __data_stack.__stack10.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack10);
+        Ok(())
     }
     ///Pattern -> dollar ident lparen Pattern comma Pattern comma error rparen
     #[inline]
     fn reduce_Pattern_15(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut rparen) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut rparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_rparen = __location_stack.pop().unwrap();
-        __data_stack.pop();
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut comma) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut comma = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_comma = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant10(mut del) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        let mut del = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_del = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut comma) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut comma = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_comma = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant10(mut base) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        let mut base = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_base = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut lparen) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut lparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_lparen = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut ident) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut dollar) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut dollar = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_dollar = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant10({
-                let Lexed::Ident(ident) = ident else {
-                    unreachable!("Pattern-Sep-Ident");
-                };
-                if ident != "sep" {
-                    data.error_recovered
-                        .push(RecoveredError {
-                            message: "Expected $sep".to_string(),
-                            link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#patterns"
-                                .to_string(),
-                            span: __rustylr_location_ident,
-                        });
-                }
+        let res = {
+            let Lexed::Ident(ident) = ident else {
+                unreachable!("Pattern-Sep-Ident");
+            };
+            if ident != "sep" {
                 data.error_recovered
                     .push(RecoveredError {
-                        message: "Expected '+' or '*' repetition".to_string(),
+                        message: "Expected $sep".to_string(),
                         link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#patterns"
                             .to_string(),
-                        span: __rustylr_location_error,
+                        span: __rustylr_location_ident,
                     });
-                PatternArgs::Sep(
-                    Box::new(base),
-                    Box::new(del),
-                    false,
-                    *__rustylr_location0,
-                )
-            }),
-        )
+            }
+            data.error_recovered
+                .push(RecoveredError {
+                    message: "Expected '+' or '*' repetition".to_string(),
+                    link: "https://github.com/ehwan/RustyLR/blob/main/SYNTAX.md#patterns"
+                        .to_string(),
+                    span: __rustylr_location_error,
+                });
+            PatternArgs::Sep(Box::new(base), Box::new(del), false, *__rustylr_location0)
+        };
+        __data_stack.__stack10.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack10);
+        Ok(())
     }
     ///Action -> bracegroup
     #[inline]
     fn reduce_Action_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut bracegroup) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut bracegroup = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_bracegroup = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant3({
-                let Lexed::BraceGroup(group) = bracegroup else {
-                    unreachable!("Action0");
-                };
-                Some(group)
-            }),
-        )
+        let res = {
+            let Lexed::BraceGroup(group) = bracegroup else {
+                unreachable!("Action0");
+            };
+            Some(group)
+        };
+        __data_stack.__stack3.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack3);
+        Ok(())
     }
     ///Action ->
     #[inline]
     fn reduce_Action_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        Ok(GrammarTokenData::Variant3({ None }))
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let res = { None };
+        __data_stack.__stack3.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack3);
+        Ok(())
     }
     ///IdentOrLiteral -> ident
     #[inline]
     fn reduce_IdentOrLiteral_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut ident) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant11({
-                let Lexed::Ident(ident) = ident else {
-                    unreachable!("IdentOrLiteral-Ident");
-                };
-                IdentOrLiteral::Ident(ident)
-            }),
-        )
+        let res = {
+            let Lexed::Ident(ident) = ident else {
+                unreachable!("IdentOrLiteral-Ident");
+            };
+            IdentOrLiteral::Ident(ident)
+        };
+        __data_stack.__stack11.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack11);
+        Ok(())
     }
     ///IdentOrLiteral -> literal
     #[inline]
     fn reduce_IdentOrLiteral_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut literal) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut literal = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_literal = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant11({
-                let Lexed::Literal(literal) = literal else {
-                    unreachable!("IdentOrLiteral-Literal");
-                };
-                IdentOrLiteral::Literal(literal)
-            }),
-        )
+        let res = {
+            let Lexed::Literal(literal) = literal else {
+                unreachable!("IdentOrLiteral-Literal");
+            };
+            IdentOrLiteral::Literal(literal)
+        };
+        __data_stack.__stack11.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack11);
+        Ok(())
     }
     ///RustCode -> [^semicolon]+
     #[inline]
     fn reduce_RustCode_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant19(mut t) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack19));
+        let mut t = __data_stack.__stack19.pop().unwrap();
         let __rustylr_location_t = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant12({
-                let mut tokens = TokenStream::new();
-                for token in t.into_iter() {
-                    token.append_to_stream(&mut tokens);
-                }
-                tokens
-            }),
-        )
+        let res = {
+            let mut tokens = TokenStream::new();
+            for token in t.into_iter() {
+                token.append_to_stream(&mut tokens);
+            }
+            tokens
+        };
+        __data_stack.__stack12.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack12);
+        Ok(())
     }
     ///Directive -> percent token ident RustCode semicolon
     #[inline]
     fn reduce_Directive_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant12(mut RustCode) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack12));
+        let mut RustCode = __data_stack.__stack12.pop().unwrap();
         let __rustylr_location_RustCode = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut ident) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut token) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut token = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_token = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             let Lexed::Ident(ident) = ident else {
@@ -1832,32 +1923,34 @@ impl GrammarTokenData {
             };
             data.terminals.push((ident, RustCode));
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent token ident semicolon
     #[inline]
     fn reduce_Directive_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut ident) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut token) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut token = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_token = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -1868,30 +1961,33 @@ impl GrammarTokenData {
                     span: __rustylr_location_ident,
                 });
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent token error semicolon
     #[inline]
     fn reduce_Directive_2(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        __data_stack.pop();
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut token) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut token = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_token = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -1902,32 +1998,34 @@ impl GrammarTokenData {
                     span: __rustylr_location_error,
                 });
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent start ident semicolon
     #[inline]
     fn reduce_Directive_3(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut ident) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut start) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut start = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_start = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             let Lexed::Ident(ident) = ident else {
@@ -1935,30 +2033,33 @@ impl GrammarTokenData {
             };
             data.start_rule_name.push(ident);
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent start error semicolon
     #[inline]
     fn reduce_Directive_4(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        __data_stack.pop();
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut start) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut start = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_start = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -1969,30 +2070,33 @@ impl GrammarTokenData {
                     span: __rustylr_location_error,
                 });
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent eofdef error semicolon
     #[inline]
     fn reduce_Directive_5(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        __data_stack.pop();
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut eofdef) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut eofdef = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_eofdef = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2004,56 +2108,62 @@ impl GrammarTokenData {
                     span: __rustylr_location_eofdef,
                 });
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent tokentype RustCode semicolon
     #[inline]
     fn reduce_Directive_6(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant12(mut RustCode) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack12));
+        let mut RustCode = __data_stack.__stack12.pop().unwrap();
         let __rustylr_location_RustCode = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut tokentype) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut tokentype = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_tokentype = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.token_typename.push((__rustylr_location_tokentype.span(), RustCode));
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent tokentype semicolon
     #[inline]
     fn reduce_Directive_7(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut tokentype) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut tokentype = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_tokentype = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2064,58 +2174,62 @@ impl GrammarTokenData {
                     span: __rustylr_location_tokentype,
                 });
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent userdata RustCode semicolon
     #[inline]
     fn reduce_Directive_8(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant12(mut RustCode) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack12));
+        let mut RustCode = __data_stack.__stack12.pop().unwrap();
         let __rustylr_location_RustCode = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut userdata) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut userdata = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_userdata = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.userdata_typename.push((__rustylr_location_userdata.span(), RustCode));
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent userdata semicolon
     #[inline]
     fn reduce_Directive_9(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut userdata) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut userdata = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_userdata = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2126,31 +2240,34 @@ impl GrammarTokenData {
                     span: __rustylr_location_userdata,
                 });
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent left IdentOrLiteral+ semicolon
     #[inline]
     fn reduce_Directive_10(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant20(mut IdentOrLiteral) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack20));
+        let mut IdentOrLiteral = __data_stack.__stack20.pop().unwrap();
         let __rustylr_location_IdentOrLiteral = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut left) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut left = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_left = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.precedences
@@ -2160,30 +2277,33 @@ impl GrammarTokenData {
                     IdentOrLiteral,
                 ));
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent left error semicolon
     #[inline]
     fn reduce_Directive_11(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        __data_stack.pop();
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut left) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut left = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_left = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2194,31 +2314,34 @@ impl GrammarTokenData {
                     span: __rustylr_location_error,
                 });
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent right IdentOrLiteral+ semicolon
     #[inline]
     fn reduce_Directive_12(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant20(mut IdentOrLiteral) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack20));
+        let mut IdentOrLiteral = __data_stack.__stack20.pop().unwrap();
         let __rustylr_location_IdentOrLiteral = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut right) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut right = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_right = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.precedences
@@ -2228,30 +2351,33 @@ impl GrammarTokenData {
                     IdentOrLiteral,
                 ));
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent right error semicolon
     #[inline]
     fn reduce_Directive_13(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        __data_stack.pop();
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut right) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut right = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_right = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2262,58 +2388,66 @@ impl GrammarTokenData {
                     span: __rustylr_location_error,
                 });
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent precedence IdentOrLiteral+ semicolon
     #[inline]
     fn reduce_Directive_14(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant20(mut IdentOrLiteral) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack20));
+        let mut IdentOrLiteral = __data_stack.__stack20.pop().unwrap();
         let __rustylr_location_IdentOrLiteral = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut precedence) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut precedence = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_precedence = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.precedences
                 .push((__rustylr_location_precedence.span(), None, IdentOrLiteral));
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent precedence error semicolon
     #[inline]
     fn reduce_Directive_15(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        __data_stack.pop();
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut precedence) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut precedence = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_precedence = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2324,56 +2458,62 @@ impl GrammarTokenData {
                     span: __rustylr_location_error,
                 });
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent errortype RustCode semicolon
     #[inline]
     fn reduce_Directive_16(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant12(mut RustCode) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack12));
+        let mut RustCode = __data_stack.__stack12.pop().unwrap();
         let __rustylr_location_RustCode = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut errortype) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut errortype = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_errortype = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_typename.push((__rustylr_location_errortype.span(), RustCode));
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent errortype semicolon
     #[inline]
     fn reduce_Directive_17(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut errortype) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut errortype = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_errortype = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2384,56 +2524,62 @@ impl GrammarTokenData {
                     span: __rustylr_location_errortype,
                 });
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent moduleprefix RustCode semicolon
     #[inline]
     fn reduce_Directive_18(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant12(mut RustCode) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack12));
+        let mut RustCode = __data_stack.__stack12.pop().unwrap();
         let __rustylr_location_RustCode = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut moduleprefix) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut moduleprefix = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_moduleprefix = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.module_prefix.push((__rustylr_location_moduleprefix.span(), RustCode));
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent moduleprefix semicolon
     #[inline]
     fn reduce_Directive_19(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut moduleprefix) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut moduleprefix = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_moduleprefix = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2444,56 +2590,61 @@ impl GrammarTokenData {
                     span: __rustylr_location_moduleprefix,
                 });
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent glr semicolon
     #[inline]
     fn reduce_Directive_20(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut glr) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut glr = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_glr = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.glr = true;
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent glr error semicolon
     #[inline]
     fn reduce_Directive_21(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        __data_stack.pop();
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut glr) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut glr = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_glr = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2504,56 +2655,61 @@ impl GrammarTokenData {
                     span: __rustylr_location_error,
                 });
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent lalr semicolon
     #[inline]
     fn reduce_Directive_22(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut lalr) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut lalr = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_lalr = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.lalr = true;
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent lalr error semicolon
     #[inline]
     fn reduce_Directive_23(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        __data_stack.pop();
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut lalr) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut lalr = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_lalr = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2564,56 +2720,61 @@ impl GrammarTokenData {
                     span: __rustylr_location_error,
                 });
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent nooptim semicolon
     #[inline]
     fn reduce_Directive_24(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut nooptim) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut nooptim = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_nooptim = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.no_optim = true;
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent nooptim error semicolon
     #[inline]
     fn reduce_Directive_25(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        __data_stack.pop();
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut nooptim) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut nooptim = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_nooptim = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2624,56 +2785,61 @@ impl GrammarTokenData {
                     span: __rustylr_location_error,
                 });
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent dense semicolon
     #[inline]
     fn reduce_Directive_26(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut dense) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut dense = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_dense = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.dense = true;
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent dense error semicolon
     #[inline]
     fn reduce_Directive_27(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        __data_stack.pop();
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut dense) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut dense = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_dense = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2684,32 +2850,34 @@ impl GrammarTokenData {
                     span: __rustylr_location_error,
                 });
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent trace ident* semicolon
     #[inline]
     fn reduce_Directive_28(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant19(mut ident) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack19));
+        let mut ident = __data_stack.__stack19.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut trace) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut trace = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_trace = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             let idents = ident
@@ -2722,30 +2890,33 @@ impl GrammarTokenData {
                 });
             data.traces.extend(idents);
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent trace error semicolon
     #[inline]
     fn reduce_Directive_29(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        __data_stack.pop();
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut trace) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut trace = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_trace = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2756,58 +2927,62 @@ impl GrammarTokenData {
                     span: __rustylr_location_error,
                 });
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent filter RustCode semicolon
     #[inline]
     fn reduce_Directive_30(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant12(mut RustCode) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack12));
+        let mut RustCode = __data_stack.__stack12.pop().unwrap();
         let __rustylr_location_RustCode = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut filter) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut filter = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_filter = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.filter = Some(RustCode);
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent filter semicolon
     #[inline]
     fn reduce_Directive_31(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut filter) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut filter = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_filter = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2818,56 +2993,61 @@ impl GrammarTokenData {
                     span: __rustylr_location_filter,
                 });
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent runtime semicolon
     #[inline]
     fn reduce_Directive_32(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut runtime) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut runtime = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_runtime = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.compiled = false;
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent runtime error semicolon
     #[inline]
     fn reduce_Directive_33(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        __data_stack.pop();
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut runtime) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut runtime = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_runtime = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2878,58 +3058,62 @@ impl GrammarTokenData {
                     span: __rustylr_location_error,
                 });
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent location RustCode semicolon
     #[inline]
     fn reduce_Directive_34(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant12(mut RustCode) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack12));
+        let mut RustCode = __data_stack.__stack12.pop().unwrap();
         let __rustylr_location_RustCode = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut location) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut location = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_location = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.location_typename = Some(RustCode);
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent location semicolon
     #[inline]
     fn reduce_Directive_35(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut location) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut location = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_location = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2940,26 +3124,29 @@ impl GrammarTokenData {
                     span: __rustylr_location_location,
                 });
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///Directive -> percent error semicolon
     #[inline]
     fn reduce_Directive_36(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut semicolon) = __data_stack.pop().unwrap()
-        else { unreachable!() };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut semicolon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        __data_stack.pop();
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let GrammarTokenData::Terminals(mut percent) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2970,1002 +3157,1254 @@ impl GrammarTokenData {
                     span: __rustylr_location_error,
                 });
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///GrammarLine -> Rule
     #[inline]
     fn reduce_GrammarLine_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant2(mut Rule) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack2));
+        let mut Rule = __data_stack.__stack2.pop().unwrap();
         let __rustylr_location_Rule = __location_stack.pop().unwrap();
         {
             data.rules.push(Rule);
         }
-        Ok(GrammarTokenData::Empty)
+        __data_stack.__tags.push(GrammarTags::Empty);
+        Ok(())
     }
     ///GrammarLine -> Directive
     #[inline]
     fn reduce_GrammarLine_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        __data_stack.truncate(__data_stack.len() - 1usize);
+    ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        GrammarTokenData::Empty
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__tags.push(GrammarTags::Empty);
     }
     ///Grammar -> GrammarLine+
     #[inline]
-    fn reduce_Grammar_0(
-        __data_stack: &mut Vec<Self>,
-        __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        __data_stack.truncate(__data_stack.len() - 1usize);
+    fn reduce_Grammar_0(__data_stack: &mut Self, __location_stack: &mut Vec<SpanPair>) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        GrammarTokenData::Empty
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__tags.push(GrammarTags::Empty);
     }
     ///TokenMapped+ -> TokenMapped
     #[inline]
     fn reduce__TokenMappedPlus15_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant7(mut A) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack7));
+        let mut A = __data_stack.__stack7.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        Ok(GrammarTokenData::Variant13({ vec![A] }))
+        let res = { vec![A] };
+        __data_stack.__stack13.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack13);
+        Ok(())
     }
     ///TokenMapped+ -> TokenMapped+ TokenMapped
     #[inline]
     fn reduce__TokenMappedPlus15_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant7(mut A) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack7));
+        let mut A = __data_stack.__stack7.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant13(mut Ap) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack13));
+        let mut Ap = __data_stack.__stack13.pop().unwrap();
         let __rustylr_location_Ap = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant13({
-                Ap.push(A);
-                Ap
-            }),
-        )
+        let res = {
+            Ap.push(A);
+            Ap
+        };
+        __data_stack.__stack13.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack13);
+        Ok(())
     }
     ///TokenMapped* -> TokenMapped+
     #[inline]
     fn reduce__TokenMappedStar16_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__stack13
+            .swap_remove(__data_stack.__stack13.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__stack13.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__stack13);
     }
     ///TokenMapped* ->
     #[inline]
     fn reduce__TokenMappedStar16_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        Ok(GrammarTokenData::Variant13({ vec![] }))
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let res = { vec![] };
+        __data_stack.__stack13.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack13);
+        Ok(())
     }
     ///PrecDef+ -> PrecDef
     #[inline]
     fn reduce__PrecDefPlus17_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant6(mut A) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack6));
+        let mut A = __data_stack.__stack6.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        Ok(GrammarTokenData::Variant14({ vec![A] }))
+        let res = { vec![A] };
+        __data_stack.__stack14.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack14);
+        Ok(())
     }
     ///PrecDef+ -> PrecDef+ PrecDef
     #[inline]
     fn reduce__PrecDefPlus17_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant6(mut A) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack6));
+        let mut A = __data_stack.__stack6.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant14(mut Ap) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack14));
+        let mut Ap = __data_stack.__stack14.pop().unwrap();
         let __rustylr_location_Ap = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant14({
-                Ap.push(A);
-                Ap
-            }),
-        )
+        let res = {
+            Ap.push(A);
+            Ap
+        };
+        __data_stack.__stack14.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack14);
+        Ok(())
     }
     ///PrecDef* -> PrecDef+
     #[inline]
     fn reduce__PrecDefStar18_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__stack14
+            .swap_remove(__data_stack.__stack14.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__stack14.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__stack14);
     }
     ///PrecDef* ->
     #[inline]
     fn reduce__PrecDefStar18_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        Ok(GrammarTokenData::Variant14({ vec![] }))
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let res = { vec![] };
+        __data_stack.__stack14.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack14);
+        Ok(())
     }
     ///caret? -> caret
     #[inline]
     fn reduce__caretQuestion19_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut A) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut A = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        Ok(GrammarTokenData::Variant15(Some(A)))
+        let res = Some(A);
+        __data_stack.__stack15.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack15);
+        Ok(())
     }
     ///caret? ->
     #[inline]
     fn reduce__caretQuestion19_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        Ok(GrammarTokenData::Variant15({ None }))
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let res = { None };
+        __data_stack.__stack15.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack15);
+        Ok(())
     }
     ///TerminalSetItem+ -> TerminalSetItem
     #[inline]
     fn reduce__TerminalSetItemPlus20_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant8(mut A) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack8));
+        let mut A = __data_stack.__stack8.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        Ok(GrammarTokenData::Variant16({ vec![A] }))
+        let res = { vec![A] };
+        __data_stack.__stack16.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack16);
+        Ok(())
     }
     ///TerminalSetItem+ -> TerminalSetItem+ TerminalSetItem
     #[inline]
     fn reduce__TerminalSetItemPlus20_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant8(mut A) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack8));
+        let mut A = __data_stack.__stack8.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant16(mut Ap) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack16));
+        let mut Ap = __data_stack.__stack16.pop().unwrap();
         let __rustylr_location_Ap = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant16({
-                Ap.push(A);
-                Ap
-            }),
-        )
+        let res = {
+            Ap.push(A);
+            Ap
+        };
+        __data_stack.__stack16.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack16);
+        Ok(())
     }
     ///TerminalSetItem* -> TerminalSetItem+
     #[inline]
     fn reduce__TerminalSetItemStar21_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__stack16
+            .swap_remove(__data_stack.__stack16.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__stack16.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__stack16);
     }
     ///TerminalSetItem* ->
     #[inline]
     fn reduce__TerminalSetItemStar21_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        Ok(GrammarTokenData::Variant16({ vec![] }))
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let res = { vec![] };
+        __data_stack.__stack16.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack16);
+        Ok(())
     }
     ///Pattern+ -> Pattern
     #[inline]
     fn reduce__PatternPlus22_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant10(mut A) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        let mut A = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        Ok(GrammarTokenData::Variant17({ vec![A] }))
+        let res = { vec![A] };
+        __data_stack.__stack17.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack17);
+        Ok(())
     }
     ///Pattern+ -> Pattern+ Pattern
     #[inline]
     fn reduce__PatternPlus22_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant10(mut A) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        let mut A = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant17(mut Ap) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack17));
+        let mut Ap = __data_stack.__stack17.pop().unwrap();
         let __rustylr_location_Ap = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant17({
-                Ap.push(A);
-                Ap
-            }),
-        )
+        let res = {
+            Ap.push(A);
+            Ap
+        };
+        __data_stack.__stack17.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack17);
+        Ok(())
     }
     ///Pattern* -> Pattern+
     #[inline]
     fn reduce__PatternStar23_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__stack17
+            .swap_remove(__data_stack.__stack17.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__stack17.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__stack17);
     }
     ///Pattern* ->
     #[inline]
     fn reduce__PatternStar23_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        Ok(GrammarTokenData::Variant17({ vec![] }))
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let res = { vec![] };
+        __data_stack.__stack17.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack17);
+        Ok(())
     }
     ///$sep(Pattern*, pipe, +) -> Pattern*
     #[inline]
     fn reduce___PatternStar23SepPlus24_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant17(mut __token0) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack17));
+        let mut __token0 = __data_stack.__stack17.pop().unwrap();
         let __rustylr_location___token0 = __location_stack.pop().unwrap();
-        Ok(GrammarTokenData::Variant18({ vec![__token0] }))
+        let res = { vec![__token0] };
+        __data_stack.__stack18.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack18);
+        Ok(())
     }
     ///$sep(Pattern*, pipe, +) -> $sep(Pattern*, pipe, +) pipe Pattern*
     #[inline]
     fn reduce___PatternStar23SepPlus24_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant17(mut __token1) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack17));
+        let mut __token1 = __data_stack.__stack17.pop().unwrap();
         let __rustylr_location___token1 = __location_stack.pop().unwrap();
-        __data_stack.pop();
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        __data_stack.__terminals.pop();
         __location_stack.pop();
-        let GrammarTokenData::Variant18(mut __token0) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack18));
+        let mut __token0 = __data_stack.__stack18.pop().unwrap();
         let __rustylr_location___token0 = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant18({
-                __token0.push(__token1);
-                __token0
-            }),
-        )
+        let res = {
+            __token0.push(__token1);
+            __token0
+        };
+        __data_stack.__stack18.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack18);
+        Ok(())
     }
     ///comma? -> comma
     #[inline]
     fn reduce__commaQuestion25_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut A) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut A = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        Ok(GrammarTokenData::Variant15(Some(A)))
+        let res = Some(A);
+        __data_stack.__stack15.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack15);
+        Ok(())
     }
     ///comma? ->
     #[inline]
     fn reduce__commaQuestion25_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        Ok(GrammarTokenData::Variant15({ None }))
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let res = { None };
+        __data_stack.__stack15.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack15);
+        Ok(())
     }
     ///[^semicolon] -> ident
     #[inline]
     fn reduce__TermSet26_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> colon
     #[inline]
     fn reduce__TermSet26_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> pipe
     #[inline]
     fn reduce__TermSet26_2(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> percent
     #[inline]
     fn reduce__TermSet26_3(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> equal
     #[inline]
     fn reduce__TermSet26_4(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> plus
     #[inline]
     fn reduce__TermSet26_5(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> star
     #[inline]
     fn reduce__TermSet26_6(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> question
     #[inline]
     fn reduce__TermSet26_7(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> caret
     #[inline]
     fn reduce__TermSet26_8(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> minus
     #[inline]
     fn reduce__TermSet26_9(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> exclamation
     #[inline]
     fn reduce__TermSet26_10(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> slash
     #[inline]
     fn reduce__TermSet26_11(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> dot
     #[inline]
     fn reduce__TermSet26_12(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> dollar
     #[inline]
     fn reduce__TermSet26_13(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> comma
     #[inline]
     fn reduce__TermSet26_14(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> literal
     #[inline]
     fn reduce__TermSet26_15(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> parengroup
     #[inline]
     fn reduce__TermSet26_16(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> bracegroup
     #[inline]
     fn reduce__TermSet26_17(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> lparen
     #[inline]
     fn reduce__TermSet26_18(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> rparen
     #[inline]
     fn reduce__TermSet26_19(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> lbracket
     #[inline]
     fn reduce__TermSet26_20(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> rbracket
     #[inline]
     fn reduce__TermSet26_21(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> left
     #[inline]
     fn reduce__TermSet26_22(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> right
     #[inline]
     fn reduce__TermSet26_23(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> token
     #[inline]
     fn reduce__TermSet26_24(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> start
     #[inline]
     fn reduce__TermSet26_25(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> eofdef
     #[inline]
     fn reduce__TermSet26_26(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> tokentype
     #[inline]
     fn reduce__TermSet26_27(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> userdata
     #[inline]
     fn reduce__TermSet26_28(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> errortype
     #[inline]
     fn reduce__TermSet26_29(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> moduleprefix
     #[inline]
     fn reduce__TermSet26_30(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> lalr
     #[inline]
     fn reduce__TermSet26_31(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> glr
     #[inline]
     fn reduce__TermSet26_32(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> prec
     #[inline]
     fn reduce__TermSet26_33(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> precedence
     #[inline]
     fn reduce__TermSet26_34(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> nooptim
     #[inline]
     fn reduce__TermSet26_35(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> dense
     #[inline]
     fn reduce__TermSet26_36(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> trace
     #[inline]
     fn reduce__TermSet26_37(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> dprec
     #[inline]
     fn reduce__TermSet26_38(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> filter
     #[inline]
     fn reduce__TermSet26_39(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> runtime
     #[inline]
     fn reduce__TermSet26_40(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> location
     #[inline]
     fn reduce__TermSet26_41(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> <Others>
     #[inline]
     fn reduce__TermSet26_42(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__terminals
+            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__terminals.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon]+ -> [^semicolon]
     #[inline]
     fn reduce___TermSet26Plus27_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut A) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut A = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        Ok(GrammarTokenData::Variant19({ vec![A] }))
+        let res = { vec![A] };
+        __data_stack.__stack19.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack19);
+        Ok(())
     }
     ///[^semicolon]+ -> [^semicolon]+ [^semicolon]
     #[inline]
     fn reduce___TermSet26Plus27_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut A) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut A = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant19(mut Ap) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack19));
+        let mut Ap = __data_stack.__stack19.pop().unwrap();
         let __rustylr_location_Ap = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant19({
-                Ap.push(A);
-                Ap
-            }),
-        )
+        let res = {
+            Ap.push(A);
+            Ap
+        };
+        __data_stack.__stack19.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack19);
+        Ok(())
     }
     ///IdentOrLiteral+ -> IdentOrLiteral
     #[inline]
     fn reduce__IdentOrLiteralPlus28_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant11(mut A) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack11));
+        let mut A = __data_stack.__stack11.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        Ok(GrammarTokenData::Variant20({ vec![A] }))
+        let res = { vec![A] };
+        __data_stack.__stack20.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack20);
+        Ok(())
     }
     ///IdentOrLiteral+ -> IdentOrLiteral+ IdentOrLiteral
     #[inline]
     fn reduce__IdentOrLiteralPlus28_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Variant11(mut A) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack11));
+        let mut A = __data_stack.__stack11.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant20(mut Ap) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack20));
+        let mut Ap = __data_stack.__stack20.pop().unwrap();
         let __rustylr_location_Ap = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant20({
-                Ap.push(A);
-                Ap
-            }),
-        )
+        let res = {
+            Ap.push(A);
+            Ap
+        };
+        __data_stack.__stack20.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack20);
+        Ok(())
     }
     ///ident+ -> ident
     #[inline]
     fn reduce__identPlus29_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut A) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut A = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        Ok(GrammarTokenData::Variant19({ vec![A] }))
+        let res = { vec![A] };
+        __data_stack.__stack19.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack19);
+        Ok(())
     }
     ///ident+ -> ident+ ident
     #[inline]
     fn reduce__identPlus29_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        let GrammarTokenData::Terminals(mut A) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut A = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        let GrammarTokenData::Variant19(mut Ap) = __data_stack.pop().unwrap() else {
-            unreachable!()
-        };
+        let __tag = __data_stack.__tags.pop();
+        debug_assert!(__tag == Some(GrammarTags::__stack19));
+        let mut Ap = __data_stack.__stack19.pop().unwrap();
         let __rustylr_location_Ap = __location_stack.pop().unwrap();
-        Ok(
-            GrammarTokenData::Variant19({
-                Ap.push(A);
-                Ap
-            }),
-        )
+        let res = {
+            Ap.push(A);
+            Ap
+        };
+        __data_stack.__stack19.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack19);
+        Ok(())
     }
     ///ident* -> ident+
     #[inline]
     fn reduce__identStar30_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        let ret = __data_stack.swap_remove(__data_stack.len() - 1usize + 0usize);
+    ) {
+        let __ret = __data_stack
+            .__stack19
+            .swap_remove(__data_stack.__stack19.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
-        ret
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__stack19.push(__ret);
+        __data_stack.__tags.push(GrammarTags::__stack19);
     }
     ///ident* ->
     #[inline]
     fn reduce__identStar30_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Lexed>,
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
-    ) -> Result<GrammarTokenData, ::rusty_lr_core::DefaultReduceActionError> {
-        Ok(GrammarTokenData::Variant19({ vec![] }))
+    ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        let res = { vec![] };
+        __data_stack.__stack19.push(res);
+        __data_stack.__tags.push(GrammarTags::__stack19);
+        Ok(())
     }
     ///GrammarLine+ -> GrammarLine
     #[inline]
     fn reduce__GrammarLinePlus31_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        __data_stack.truncate(__data_stack.len() - 1usize);
+    ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        GrammarTokenData::Empty
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
+        __data_stack.__tags.push(GrammarTags::Empty);
     }
     ///GrammarLine+ -> GrammarLine GrammarLine+
     #[inline]
     fn reduce__GrammarLinePlus31_1(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        __data_stack.truncate(__data_stack.len() - 2usize);
+    ) {
         __location_stack.truncate(__location_stack.len() - 2usize);
-        GrammarTokenData::Empty
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 2usize);
+        __data_stack.__tags.push(GrammarTags::Empty);
     }
     ///Augmented -> Grammar eof
     #[inline]
     fn reduce_Augmented_0(
-        __data_stack: &mut Vec<Self>,
+        __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
-    ) -> GrammarTokenData {
-        __data_stack.truncate(__data_stack.len() - 2usize);
+    ) {
         __location_stack.truncate(__location_stack.len() - 2usize);
-        GrammarTokenData::Empty
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 2usize);
+        __data_stack.__tags.push(GrammarTags::Empty);
     }
 }
 #[allow(
@@ -3975,22 +4414,319 @@ impl GrammarTokenData {
     non_camel_case_types,
     unused_variables
 )]
-impl ::rusty_lr_core::nonterminal::TokenData for GrammarTokenData {
+impl ::rusty_lr_core::parser::data_stack::DataStack for GrammarDataStack {
     type Term = Lexed;
     type NonTerm = GrammarNonTerminals;
     type ReduceActionError = ::rusty_lr_core::DefaultReduceActionError;
     type UserData = GrammarArgs;
     type StartType = ();
     type Location = SpanPair;
+    fn pop_start(&mut self) -> Option<Self::StartType> {
+        let tag = self.__tags.pop();
+        debug_assert!(tag == Some(GrammarTags::Empty));
+        Some(())
+    }
+    fn pop(&mut self) {
+        match self.__tags.pop().unwrap() {
+            GrammarTags::__terminals => {
+                self.__terminals.pop();
+            }
+            GrammarTags::__stack2 => {
+                self.__stack2.pop();
+            }
+            GrammarTags::__stack3 => {
+                self.__stack3.pop();
+            }
+            GrammarTags::__stack4 => {
+                self.__stack4.pop();
+            }
+            GrammarTags::__stack5 => {
+                self.__stack5.pop();
+            }
+            GrammarTags::__stack6 => {
+                self.__stack6.pop();
+            }
+            GrammarTags::__stack7 => {
+                self.__stack7.pop();
+            }
+            GrammarTags::__stack8 => {
+                self.__stack8.pop();
+            }
+            GrammarTags::__stack9 => {
+                self.__stack9.pop();
+            }
+            GrammarTags::__stack10 => {
+                self.__stack10.pop();
+            }
+            GrammarTags::__stack11 => {
+                self.__stack11.pop();
+            }
+            GrammarTags::__stack12 => {
+                self.__stack12.pop();
+            }
+            GrammarTags::__stack13 => {
+                self.__stack13.pop();
+            }
+            GrammarTags::__stack14 => {
+                self.__stack14.pop();
+            }
+            GrammarTags::__stack15 => {
+                self.__stack15.pop();
+            }
+            GrammarTags::__stack16 => {
+                self.__stack16.pop();
+            }
+            GrammarTags::__stack17 => {
+                self.__stack17.pop();
+            }
+            GrammarTags::__stack18 => {
+                self.__stack18.pop();
+            }
+            GrammarTags::__stack19 => {
+                self.__stack19.pop();
+            }
+            GrammarTags::__stack20 => {
+                self.__stack20.pop();
+            }
+            _ => {}
+        }
+    }
+    fn push_terminal(&mut self, term: Self::Term) {
+        self.__tags.push(GrammarTags::__terminals);
+        self.__terminals.push(term);
+    }
+    fn push_empty(&mut self) {
+        self.__tags.push(GrammarTags::Empty);
+    }
+    fn clear(&mut self) {
+        self.__tags.clear();
+        self.__terminals.clear();
+        self.__stack2.clear();
+        self.__stack3.clear();
+        self.__stack4.clear();
+        self.__stack5.clear();
+        self.__stack6.clear();
+        self.__stack7.clear();
+        self.__stack8.clear();
+        self.__stack9.clear();
+        self.__stack10.clear();
+        self.__stack11.clear();
+        self.__stack12.clear();
+        self.__stack13.clear();
+        self.__stack14.clear();
+        self.__stack15.clear();
+        self.__stack16.clear();
+        self.__stack17.clear();
+        self.__stack18.clear();
+        self.__stack19.clear();
+        self.__stack20.clear();
+    }
+    fn reserve(&mut self, additional: usize) {
+        self.__tags.reserve(additional);
+    }
+    fn split_off(&mut self, at: usize) -> Self {
+        let other_tag_stack = self.__tags.split_off(at);
+        let mut __count___terminals = 0;
+        let mut __count___stack2 = 0;
+        let mut __count___stack3 = 0;
+        let mut __count___stack4 = 0;
+        let mut __count___stack5 = 0;
+        let mut __count___stack6 = 0;
+        let mut __count___stack7 = 0;
+        let mut __count___stack8 = 0;
+        let mut __count___stack9 = 0;
+        let mut __count___stack10 = 0;
+        let mut __count___stack11 = 0;
+        let mut __count___stack12 = 0;
+        let mut __count___stack13 = 0;
+        let mut __count___stack14 = 0;
+        let mut __count___stack15 = 0;
+        let mut __count___stack16 = 0;
+        let mut __count___stack17 = 0;
+        let mut __count___stack18 = 0;
+        let mut __count___stack19 = 0;
+        let mut __count___stack20 = 0;
+        for tag in &other_tag_stack {
+            match tag {
+                GrammarTags::__terminals => {
+                    __count___terminals += 1;
+                }
+                GrammarTags::__stack2 => {
+                    __count___stack2 += 1;
+                }
+                GrammarTags::__stack3 => {
+                    __count___stack3 += 1;
+                }
+                GrammarTags::__stack4 => {
+                    __count___stack4 += 1;
+                }
+                GrammarTags::__stack5 => {
+                    __count___stack5 += 1;
+                }
+                GrammarTags::__stack6 => {
+                    __count___stack6 += 1;
+                }
+                GrammarTags::__stack7 => {
+                    __count___stack7 += 1;
+                }
+                GrammarTags::__stack8 => {
+                    __count___stack8 += 1;
+                }
+                GrammarTags::__stack9 => {
+                    __count___stack9 += 1;
+                }
+                GrammarTags::__stack10 => {
+                    __count___stack10 += 1;
+                }
+                GrammarTags::__stack11 => {
+                    __count___stack11 += 1;
+                }
+                GrammarTags::__stack12 => {
+                    __count___stack12 += 1;
+                }
+                GrammarTags::__stack13 => {
+                    __count___stack13 += 1;
+                }
+                GrammarTags::__stack14 => {
+                    __count___stack14 += 1;
+                }
+                GrammarTags::__stack15 => {
+                    __count___stack15 += 1;
+                }
+                GrammarTags::__stack16 => {
+                    __count___stack16 += 1;
+                }
+                GrammarTags::__stack17 => {
+                    __count___stack17 += 1;
+                }
+                GrammarTags::__stack18 => {
+                    __count___stack18 += 1;
+                }
+                GrammarTags::__stack19 => {
+                    __count___stack19 += 1;
+                }
+                GrammarTags::__stack20 => {
+                    __count___stack20 += 1;
+                }
+                _ => {}
+            }
+        }
+        let __other___terminals = self
+            .__terminals
+            .split_off(self.__terminals.len() - __count___terminals);
+        let __other___stack2 = self
+            .__stack2
+            .split_off(self.__stack2.len() - __count___stack2);
+        let __other___stack3 = self
+            .__stack3
+            .split_off(self.__stack3.len() - __count___stack3);
+        let __other___stack4 = self
+            .__stack4
+            .split_off(self.__stack4.len() - __count___stack4);
+        let __other___stack5 = self
+            .__stack5
+            .split_off(self.__stack5.len() - __count___stack5);
+        let __other___stack6 = self
+            .__stack6
+            .split_off(self.__stack6.len() - __count___stack6);
+        let __other___stack7 = self
+            .__stack7
+            .split_off(self.__stack7.len() - __count___stack7);
+        let __other___stack8 = self
+            .__stack8
+            .split_off(self.__stack8.len() - __count___stack8);
+        let __other___stack9 = self
+            .__stack9
+            .split_off(self.__stack9.len() - __count___stack9);
+        let __other___stack10 = self
+            .__stack10
+            .split_off(self.__stack10.len() - __count___stack10);
+        let __other___stack11 = self
+            .__stack11
+            .split_off(self.__stack11.len() - __count___stack11);
+        let __other___stack12 = self
+            .__stack12
+            .split_off(self.__stack12.len() - __count___stack12);
+        let __other___stack13 = self
+            .__stack13
+            .split_off(self.__stack13.len() - __count___stack13);
+        let __other___stack14 = self
+            .__stack14
+            .split_off(self.__stack14.len() - __count___stack14);
+        let __other___stack15 = self
+            .__stack15
+            .split_off(self.__stack15.len() - __count___stack15);
+        let __other___stack16 = self
+            .__stack16
+            .split_off(self.__stack16.len() - __count___stack16);
+        let __other___stack17 = self
+            .__stack17
+            .split_off(self.__stack17.len() - __count___stack17);
+        let __other___stack18 = self
+            .__stack18
+            .split_off(self.__stack18.len() - __count___stack18);
+        let __other___stack19 = self
+            .__stack19
+            .split_off(self.__stack19.len() - __count___stack19);
+        let __other___stack20 = self
+            .__stack20
+            .split_off(self.__stack20.len() - __count___stack20);
+        Self {
+            __tags: other_tag_stack,
+            __terminals: __other___terminals,
+            __stack2: __other___stack2,
+            __stack3: __other___stack3,
+            __stack4: __other___stack4,
+            __stack5: __other___stack5,
+            __stack6: __other___stack6,
+            __stack7: __other___stack7,
+            __stack8: __other___stack8,
+            __stack9: __other___stack9,
+            __stack10: __other___stack10,
+            __stack11: __other___stack11,
+            __stack12: __other___stack12,
+            __stack13: __other___stack13,
+            __stack14: __other___stack14,
+            __stack15: __other___stack15,
+            __stack16: __other___stack16,
+            __stack17: __other___stack17,
+            __stack18: __other___stack18,
+            __stack19: __other___stack19,
+            __stack20: __other___stack20,
+        }
+    }
+    fn append(&mut self, other: &mut Self) {
+        self.__tags.append(&mut other.__tags);
+        self.__terminals.append(&mut other.__terminals);
+        self.__stack2.append(&mut other.__stack2);
+        self.__stack3.append(&mut other.__stack3);
+        self.__stack4.append(&mut other.__stack4);
+        self.__stack5.append(&mut other.__stack5);
+        self.__stack6.append(&mut other.__stack6);
+        self.__stack7.append(&mut other.__stack7);
+        self.__stack8.append(&mut other.__stack8);
+        self.__stack9.append(&mut other.__stack9);
+        self.__stack10.append(&mut other.__stack10);
+        self.__stack11.append(&mut other.__stack11);
+        self.__stack12.append(&mut other.__stack12);
+        self.__stack13.append(&mut other.__stack13);
+        self.__stack14.append(&mut other.__stack14);
+        self.__stack15.append(&mut other.__stack15);
+        self.__stack16.append(&mut other.__stack16);
+        self.__stack17.append(&mut other.__stack17);
+        self.__stack18.append(&mut other.__stack18);
+        self.__stack19.append(&mut other.__stack19);
+        self.__stack20.append(&mut other.__stack20);
+    }
     fn reduce_action(
-        data_stack: &mut Vec<Self>,
+        data_stack: &mut Self,
         location_stack: &mut Vec<SpanPair>,
         rule_index: usize,
         shift: &mut bool,
         lookahead: &::rusty_lr_core::TerminalSymbol<Self::Term>,
         user_data: &mut Self::UserData,
         location0: &mut Self::Location,
-    ) -> Result<Self, Self::ReduceActionError> {
+    ) -> Result<(), Self::ReduceActionError> {
         match rule_index {
             0usize => {
                 Self::reduce_Rule_0(
@@ -4792,8 +5528,14 @@ impl ::rusty_lr_core::nonterminal::TokenData for GrammarTokenData {
                     location0,
                 )
             }
-            80usize => Ok(Self::reduce_GrammarLine_1(data_stack, location_stack)),
-            81usize => Ok(Self::reduce_Grammar_0(data_stack, location_stack)),
+            80usize => {
+                Self::reduce_GrammarLine_1(data_stack, location_stack);
+                Ok(())
+            }
+            81usize => {
+                Self::reduce_Grammar_0(data_stack, location_stack);
+                Ok(())
+            }
             82usize => {
                 Self::reduce__TokenMappedPlus15_0(
                     data_stack,
@@ -4814,7 +5556,10 @@ impl ::rusty_lr_core::nonterminal::TokenData for GrammarTokenData {
                     location0,
                 )
             }
-            84usize => Ok(Self::reduce__TokenMappedStar16_0(data_stack, location_stack)),
+            84usize => {
+                Self::reduce__TokenMappedStar16_0(data_stack, location_stack);
+                Ok(())
+            }
             85usize => {
                 Self::reduce__TokenMappedStar16_1(
                     data_stack,
@@ -4845,7 +5590,10 @@ impl ::rusty_lr_core::nonterminal::TokenData for GrammarTokenData {
                     location0,
                 )
             }
-            88usize => Ok(Self::reduce__PrecDefStar18_0(data_stack, location_stack)),
+            88usize => {
+                Self::reduce__PrecDefStar18_0(data_stack, location_stack);
+                Ok(())
+            }
             89usize => {
                 Self::reduce__PrecDefStar18_1(
                     data_stack,
@@ -4897,7 +5645,8 @@ impl ::rusty_lr_core::nonterminal::TokenData for GrammarTokenData {
                 )
             }
             94usize => {
-                Ok(Self::reduce__TerminalSetItemStar21_0(data_stack, location_stack))
+                Self::reduce__TerminalSetItemStar21_0(data_stack, location_stack);
+                Ok(())
             }
             95usize => {
                 Self::reduce__TerminalSetItemStar21_1(
@@ -4929,7 +5678,10 @@ impl ::rusty_lr_core::nonterminal::TokenData for GrammarTokenData {
                     location0,
                 )
             }
-            98usize => Ok(Self::reduce__PatternStar23_0(data_stack, location_stack)),
+            98usize => {
+                Self::reduce__PatternStar23_0(data_stack, location_stack);
+                Ok(())
+            }
             99usize => {
                 Self::reduce__PatternStar23_1(
                     data_stack,
@@ -4980,49 +5732,178 @@ impl ::rusty_lr_core::nonterminal::TokenData for GrammarTokenData {
                     location0,
                 )
             }
-            104usize => Ok(Self::reduce__TermSet26_0(data_stack, location_stack)),
-            105usize => Ok(Self::reduce__TermSet26_1(data_stack, location_stack)),
-            106usize => Ok(Self::reduce__TermSet26_2(data_stack, location_stack)),
-            107usize => Ok(Self::reduce__TermSet26_3(data_stack, location_stack)),
-            108usize => Ok(Self::reduce__TermSet26_4(data_stack, location_stack)),
-            109usize => Ok(Self::reduce__TermSet26_5(data_stack, location_stack)),
-            110usize => Ok(Self::reduce__TermSet26_6(data_stack, location_stack)),
-            111usize => Ok(Self::reduce__TermSet26_7(data_stack, location_stack)),
-            112usize => Ok(Self::reduce__TermSet26_8(data_stack, location_stack)),
-            113usize => Ok(Self::reduce__TermSet26_9(data_stack, location_stack)),
-            114usize => Ok(Self::reduce__TermSet26_10(data_stack, location_stack)),
-            115usize => Ok(Self::reduce__TermSet26_11(data_stack, location_stack)),
-            116usize => Ok(Self::reduce__TermSet26_12(data_stack, location_stack)),
-            117usize => Ok(Self::reduce__TermSet26_13(data_stack, location_stack)),
-            118usize => Ok(Self::reduce__TermSet26_14(data_stack, location_stack)),
-            119usize => Ok(Self::reduce__TermSet26_15(data_stack, location_stack)),
-            120usize => Ok(Self::reduce__TermSet26_16(data_stack, location_stack)),
-            121usize => Ok(Self::reduce__TermSet26_17(data_stack, location_stack)),
-            122usize => Ok(Self::reduce__TermSet26_18(data_stack, location_stack)),
-            123usize => Ok(Self::reduce__TermSet26_19(data_stack, location_stack)),
-            124usize => Ok(Self::reduce__TermSet26_20(data_stack, location_stack)),
-            125usize => Ok(Self::reduce__TermSet26_21(data_stack, location_stack)),
-            126usize => Ok(Self::reduce__TermSet26_22(data_stack, location_stack)),
-            127usize => Ok(Self::reduce__TermSet26_23(data_stack, location_stack)),
-            128usize => Ok(Self::reduce__TermSet26_24(data_stack, location_stack)),
-            129usize => Ok(Self::reduce__TermSet26_25(data_stack, location_stack)),
-            130usize => Ok(Self::reduce__TermSet26_26(data_stack, location_stack)),
-            131usize => Ok(Self::reduce__TermSet26_27(data_stack, location_stack)),
-            132usize => Ok(Self::reduce__TermSet26_28(data_stack, location_stack)),
-            133usize => Ok(Self::reduce__TermSet26_29(data_stack, location_stack)),
-            134usize => Ok(Self::reduce__TermSet26_30(data_stack, location_stack)),
-            135usize => Ok(Self::reduce__TermSet26_31(data_stack, location_stack)),
-            136usize => Ok(Self::reduce__TermSet26_32(data_stack, location_stack)),
-            137usize => Ok(Self::reduce__TermSet26_33(data_stack, location_stack)),
-            138usize => Ok(Self::reduce__TermSet26_34(data_stack, location_stack)),
-            139usize => Ok(Self::reduce__TermSet26_35(data_stack, location_stack)),
-            140usize => Ok(Self::reduce__TermSet26_36(data_stack, location_stack)),
-            141usize => Ok(Self::reduce__TermSet26_37(data_stack, location_stack)),
-            142usize => Ok(Self::reduce__TermSet26_38(data_stack, location_stack)),
-            143usize => Ok(Self::reduce__TermSet26_39(data_stack, location_stack)),
-            144usize => Ok(Self::reduce__TermSet26_40(data_stack, location_stack)),
-            145usize => Ok(Self::reduce__TermSet26_41(data_stack, location_stack)),
-            146usize => Ok(Self::reduce__TermSet26_42(data_stack, location_stack)),
+            104usize => {
+                Self::reduce__TermSet26_0(data_stack, location_stack);
+                Ok(())
+            }
+            105usize => {
+                Self::reduce__TermSet26_1(data_stack, location_stack);
+                Ok(())
+            }
+            106usize => {
+                Self::reduce__TermSet26_2(data_stack, location_stack);
+                Ok(())
+            }
+            107usize => {
+                Self::reduce__TermSet26_3(data_stack, location_stack);
+                Ok(())
+            }
+            108usize => {
+                Self::reduce__TermSet26_4(data_stack, location_stack);
+                Ok(())
+            }
+            109usize => {
+                Self::reduce__TermSet26_5(data_stack, location_stack);
+                Ok(())
+            }
+            110usize => {
+                Self::reduce__TermSet26_6(data_stack, location_stack);
+                Ok(())
+            }
+            111usize => {
+                Self::reduce__TermSet26_7(data_stack, location_stack);
+                Ok(())
+            }
+            112usize => {
+                Self::reduce__TermSet26_8(data_stack, location_stack);
+                Ok(())
+            }
+            113usize => {
+                Self::reduce__TermSet26_9(data_stack, location_stack);
+                Ok(())
+            }
+            114usize => {
+                Self::reduce__TermSet26_10(data_stack, location_stack);
+                Ok(())
+            }
+            115usize => {
+                Self::reduce__TermSet26_11(data_stack, location_stack);
+                Ok(())
+            }
+            116usize => {
+                Self::reduce__TermSet26_12(data_stack, location_stack);
+                Ok(())
+            }
+            117usize => {
+                Self::reduce__TermSet26_13(data_stack, location_stack);
+                Ok(())
+            }
+            118usize => {
+                Self::reduce__TermSet26_14(data_stack, location_stack);
+                Ok(())
+            }
+            119usize => {
+                Self::reduce__TermSet26_15(data_stack, location_stack);
+                Ok(())
+            }
+            120usize => {
+                Self::reduce__TermSet26_16(data_stack, location_stack);
+                Ok(())
+            }
+            121usize => {
+                Self::reduce__TermSet26_17(data_stack, location_stack);
+                Ok(())
+            }
+            122usize => {
+                Self::reduce__TermSet26_18(data_stack, location_stack);
+                Ok(())
+            }
+            123usize => {
+                Self::reduce__TermSet26_19(data_stack, location_stack);
+                Ok(())
+            }
+            124usize => {
+                Self::reduce__TermSet26_20(data_stack, location_stack);
+                Ok(())
+            }
+            125usize => {
+                Self::reduce__TermSet26_21(data_stack, location_stack);
+                Ok(())
+            }
+            126usize => {
+                Self::reduce__TermSet26_22(data_stack, location_stack);
+                Ok(())
+            }
+            127usize => {
+                Self::reduce__TermSet26_23(data_stack, location_stack);
+                Ok(())
+            }
+            128usize => {
+                Self::reduce__TermSet26_24(data_stack, location_stack);
+                Ok(())
+            }
+            129usize => {
+                Self::reduce__TermSet26_25(data_stack, location_stack);
+                Ok(())
+            }
+            130usize => {
+                Self::reduce__TermSet26_26(data_stack, location_stack);
+                Ok(())
+            }
+            131usize => {
+                Self::reduce__TermSet26_27(data_stack, location_stack);
+                Ok(())
+            }
+            132usize => {
+                Self::reduce__TermSet26_28(data_stack, location_stack);
+                Ok(())
+            }
+            133usize => {
+                Self::reduce__TermSet26_29(data_stack, location_stack);
+                Ok(())
+            }
+            134usize => {
+                Self::reduce__TermSet26_30(data_stack, location_stack);
+                Ok(())
+            }
+            135usize => {
+                Self::reduce__TermSet26_31(data_stack, location_stack);
+                Ok(())
+            }
+            136usize => {
+                Self::reduce__TermSet26_32(data_stack, location_stack);
+                Ok(())
+            }
+            137usize => {
+                Self::reduce__TermSet26_33(data_stack, location_stack);
+                Ok(())
+            }
+            138usize => {
+                Self::reduce__TermSet26_34(data_stack, location_stack);
+                Ok(())
+            }
+            139usize => {
+                Self::reduce__TermSet26_35(data_stack, location_stack);
+                Ok(())
+            }
+            140usize => {
+                Self::reduce__TermSet26_36(data_stack, location_stack);
+                Ok(())
+            }
+            141usize => {
+                Self::reduce__TermSet26_37(data_stack, location_stack);
+                Ok(())
+            }
+            142usize => {
+                Self::reduce__TermSet26_38(data_stack, location_stack);
+                Ok(())
+            }
+            143usize => {
+                Self::reduce__TermSet26_39(data_stack, location_stack);
+                Ok(())
+            }
+            144usize => {
+                Self::reduce__TermSet26_40(data_stack, location_stack);
+                Ok(())
+            }
+            145usize => {
+                Self::reduce__TermSet26_41(data_stack, location_stack);
+                Ok(())
+            }
+            146usize => {
+                Self::reduce__TermSet26_42(data_stack, location_stack);
+                Ok(())
+            }
             147usize => {
                 Self::reduce___TermSet26Plus27_0(
                     data_stack,
@@ -5083,7 +5964,10 @@ impl ::rusty_lr_core::nonterminal::TokenData for GrammarTokenData {
                     location0,
                 )
             }
-            153usize => Ok(Self::reduce__identStar30_0(data_stack, location_stack)),
+            153usize => {
+                Self::reduce__identStar30_0(data_stack, location_stack);
+                Ok(())
+            }
             154usize => {
                 Self::reduce__identStar30_1(
                     data_stack,
@@ -5094,36 +5978,23 @@ impl ::rusty_lr_core::nonterminal::TokenData for GrammarTokenData {
                     location0,
                 )
             }
-            155usize => Ok(Self::reduce__GrammarLinePlus31_0(data_stack, location_stack)),
-            156usize => Ok(Self::reduce__GrammarLinePlus31_1(data_stack, location_stack)),
-            157usize => Ok(Self::reduce_Augmented_0(data_stack, location_stack)),
+            155usize => {
+                Self::reduce__GrammarLinePlus31_0(data_stack, location_stack);
+                Ok(())
+            }
+            156usize => {
+                Self::reduce__GrammarLinePlus31_1(data_stack, location_stack);
+                Ok(())
+            }
+            157usize => {
+                Self::reduce_Augmented_0(data_stack, location_stack);
+                Ok(())
+            }
             _ => {
                 unreachable!("Invalid Rule: {}", rule_index);
             }
         }
     }
-    fn new_error() -> Self {
-        GrammarTokenData::Empty
-    }
-    fn new_terminal(term: Lexed) -> Self {
-        GrammarTokenData::Terminals(term)
-    }
-}
-#[allow(
-    unused_braces,
-    unused_parens,
-    non_snake_case,
-    non_camel_case_types,
-    unused_variables
-)]
-impl TryFrom<GrammarTokenData> for () {
-    type Error = ();
-    fn try_from(token: GrammarTokenData) -> Result<Self, Self::Error> {
-        match token {
-            GrammarTokenData::Empty => Ok(()),
-            _ => Err(()),
-        }
-    }
 }
 /// A struct that holds the entire parser table and production rules.
 #[allow(unused_braces, unused_parens, unused_variables, non_snake_case, unused_mut)]

From 5d45df69600bb0ccc116241eda4fc4a6dd5d53a1 Mon Sep 17 00:00:00 2001
From: Taehwan Kim <ehwank98@gmail.com>
Date: Sat, 9 Aug 2025 15:47:47 +0900
Subject: [PATCH 05/11] fix empty_stack_name

---
 rusty_lr_parser/src/emit.rs | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/rusty_lr_parser/src/emit.rs b/rusty_lr_parser/src/emit.rs
index b280f88f..14d0d380 100644
--- a/rusty_lr_parser/src/emit.rs
+++ b/rusty_lr_parser/src/emit.rs
@@ -1304,8 +1304,7 @@ impl Grammar {
                                             } else {
                                                 extract_token_data_from_args.extend(quote! {
                                                     let __tag = __data_stack.#tag_stack_name.pop();
-                                                    debug_assert!(__tag == Some(#tag_enum_name::#stack_name));
-                                                    __data_stack.#stack_name.pop();
+                                                    debug_assert!(__tag == Some(#tag_enum_name::#empty_tag_name));
                                                     let #location_varname = __location_stack.pop().unwrap();
                                                 });
                                             }

From a92cef5bde7c9ad247321314cfe57797ef517900 Mon Sep 17 00:00:00 2001
From: Taehwan Kim <ehwank98@gmail.com>
Date: Sat, 9 Aug 2025 16:13:36 +0900
Subject: [PATCH 06/11] optimize identity reduce action

---
 rusty_lr_parser/src/emit.rs                   |  35 ++--
 rusty_lr_parser/src/parser/parser_expanded.rs | 192 ------------------
 2 files changed, 22 insertions(+), 205 deletions(-)

diff --git a/rusty_lr_parser/src/emit.rs b/rusty_lr_parser/src/emit.rs
index 14d0d380..a2ef6a9f 100644
--- a/rusty_lr_parser/src/emit.rs
+++ b/rusty_lr_parser/src/emit.rs
@@ -1432,21 +1432,29 @@ impl Grammar {
                             }
                         }
 
-                        let (stack_pop_stream, stack_push_stream) = if let Some((
+                        let (stack_pop_stream, stack_push_stream, tag_push_stream) = if let Some((
                             pop_stack,
                             pop_index_from_back,
                         )) = pop_stack_idx_pair
                         {
-                            (
-                                quote! { let __ret = __data_stack.#pop_stack.swap_remove( __data_stack.#pop_stack.len() - 1  - #pop_index_from_back ); },
-                                quote! { __data_stack.#pop_stack.push(__ret); __data_stack.#tag_stack_name.push(#tag_enum_name::#pop_stack); },
-                            )
+                            if pop_index_from_back == stack_count_map.get(pop_stack).copied().unwrap_or(0) {
+                                (
+                                    quote!{},
+                                    quote!{},
+                                    quote!{ __data_stack.#tag_stack_name.push(#tag_enum_name::#pop_stack); }
+                                )
+                            } else {
+                                (
+                                    quote! { let __ret = __data_stack.#pop_stack.swap_remove( __data_stack.#pop_stack.len() - 1  - #pop_index_from_back ); },
+                                    quote! { __data_stack.#pop_stack.push(__ret); },
+                                    quote! { __data_stack.#tag_stack_name.push(#tag_enum_name::#pop_stack); }
+                                )
+                            }
                         } else {
                             (
                                 quote! {},
-                                quote! {
-                                    __data_stack.#tag_stack_name.push(#tag_enum_name::#empty_tag_name);
-                                },
+                                quote! {},
+                                quote! {__data_stack.#tag_stack_name.push(#tag_enum_name::#empty_tag_name); }
                             )
                         };
                         let mut stack_truncate_stream = TokenStream::new();
@@ -1476,11 +1484,12 @@ impl Grammar {
                                 __data_stack: &mut Self,
                                 __location_stack: &mut Vec<#location_typename>,
                             ) {
-                                #stack_pop_stream
-                                #stack_truncate_stream
-                                #location_truncate_stream
-                                #tags_truncate_stream
-                                #stack_push_stream
+                                #stack_pop_stream // __ret = stack.swap_remove(i);
+                                #stack_truncate_stream // stack.truncate( ... );
+                                #location_truncate_stream // location.truncate( ... );
+                                #tags_truncate_stream // tags.truncate( ... );
+                                #stack_push_stream // stack.push( __ret );
+                                #tag_push_stream // tag.push( ... );
                             }
                         });
                     }
diff --git a/rusty_lr_parser/src/parser/parser_expanded.rs b/rusty_lr_parser/src/parser/parser_expanded.rs
index c08b4d04..9f319a74 100644
--- a/rusty_lr_parser/src/parser/parser_expanded.rs
+++ b/rusty_lr_parser/src/parser/parser_expanded.rs
@@ -3248,12 +3248,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__stack13
-            .swap_remove(__data_stack.__stack13.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__stack13.push(__ret);
         __data_stack.__tags.push(GrammarTags::__stack13);
     }
     ///TokenMapped* ->
@@ -3322,12 +3318,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__stack14
-            .swap_remove(__data_stack.__stack14.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__stack14.push(__ret);
         __data_stack.__tags.push(GrammarTags::__stack14);
     }
     ///PrecDef* ->
@@ -3430,12 +3422,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__stack16
-            .swap_remove(__data_stack.__stack16.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__stack16.push(__ret);
         __data_stack.__tags.push(GrammarTags::__stack16);
     }
     ///TerminalSetItem* ->
@@ -3504,12 +3492,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__stack17
-            .swap_remove(__data_stack.__stack17.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__stack17.push(__ret);
         __data_stack.__tags.push(GrammarTags::__stack17);
     }
     ///Pattern* ->
@@ -3616,12 +3600,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> colon
@@ -3630,12 +3610,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> pipe
@@ -3644,12 +3620,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> percent
@@ -3658,12 +3630,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> equal
@@ -3672,12 +3640,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> plus
@@ -3686,12 +3650,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> star
@@ -3700,12 +3660,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> question
@@ -3714,12 +3670,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> caret
@@ -3728,12 +3680,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> minus
@@ -3742,12 +3690,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> exclamation
@@ -3756,12 +3700,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> slash
@@ -3770,12 +3710,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> dot
@@ -3784,12 +3720,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> dollar
@@ -3798,12 +3730,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> comma
@@ -3812,12 +3740,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> literal
@@ -3826,12 +3750,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> parengroup
@@ -3840,12 +3760,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> bracegroup
@@ -3854,12 +3770,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> lparen
@@ -3868,12 +3780,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> rparen
@@ -3882,12 +3790,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> lbracket
@@ -3896,12 +3800,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> rbracket
@@ -3910,12 +3810,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> left
@@ -3924,12 +3820,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> right
@@ -3938,12 +3830,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> token
@@ -3952,12 +3840,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> start
@@ -3966,12 +3850,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> eofdef
@@ -3980,12 +3860,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> tokentype
@@ -3994,12 +3870,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> userdata
@@ -4008,12 +3880,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> errortype
@@ -4022,12 +3890,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> moduleprefix
@@ -4036,12 +3900,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> lalr
@@ -4050,12 +3910,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> glr
@@ -4064,12 +3920,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> prec
@@ -4078,12 +3930,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> precedence
@@ -4092,12 +3940,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> nooptim
@@ -4106,12 +3950,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> dense
@@ -4120,12 +3960,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> trace
@@ -4134,12 +3970,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> dprec
@@ -4148,12 +3980,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> filter
@@ -4162,12 +3990,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> runtime
@@ -4176,12 +4000,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> location
@@ -4190,12 +4010,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> <Others>
@@ -4204,12 +4020,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__terminals
-            .swap_remove(__data_stack.__terminals.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__terminals.push(__ret);
         __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon]+ -> [^semicolon]
@@ -4353,12 +4165,8 @@ impl GrammarDataStack {
         __data_stack: &mut Self,
         __location_stack: &mut Vec<SpanPair>,
     ) {
-        let __ret = __data_stack
-            .__stack19
-            .swap_remove(__data_stack.__stack19.len() - 1 - 0usize);
         __location_stack.truncate(__location_stack.len() - 1usize);
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__stack19.push(__ret);
         __data_stack.__tags.push(GrammarTags::__stack19);
     }
     ///ident* ->

From a3420940328ff48be256a3bdbe6fa86c912a0bea Mon Sep 17 00:00:00 2001
From: Taehwan Kim <ehwank98@gmail.com>
Date: Sat, 9 Aug 2025 16:39:49 +0900
Subject: [PATCH 07/11] extract reduce args from same stack sequentially

---
 rusty_lr_parser/src/emit.rs                   |  186 +-
 rusty_lr_parser/src/parser/parser_expanded.rs | 2545 +++++++++++------
 2 files changed, 1848 insertions(+), 883 deletions(-)

diff --git a/rusty_lr_parser/src/emit.rs b/rusty_lr_parser/src/emit.rs
index a2ef6a9f..64438a0c 100644
--- a/rusty_lr_parser/src/emit.rs
+++ b/rusty_lr_parser/src/emit.rs
@@ -1245,8 +1245,10 @@ impl Grammar {
 
                 match &rule.reduce_action {
                     Some(ReduceAction::Custom(reduce_action)) => {
-                        let mut extract_token_data_from_args = TokenStream::new();
-                        for token in rule.tokens.iter().rev() {
+                        let mut debug_tag_check_stream = TokenStream::new();
+                        let mut extract_location_stream = TokenStream::new();
+                        let mut stack_mapto_map = std::collections::BTreeMap::new();
+                        for (idx_from_back, token) in rule.tokens.iter().rev().enumerate() {
                             match &token.token {
                                 Token::Term(term) => match &token.mapto {
                                     Some(mapto) => {
@@ -1255,19 +1257,30 @@ impl Grammar {
 
                                         match term {
                                             TerminalSymbol::Term(_) => {
-                                                extract_token_data_from_args.extend(quote! {
-                                                    let __tag = __data_stack.#tag_stack_name.pop();
-                                                    debug_assert!(__tag == Some(#tag_enum_name::#terminal_stack_name));
-                                                    let mut #mapto = __data_stack.#terminal_stack_name.pop().unwrap();
+                                                stack_mapto_map.entry(&terminal_stack_name).or_insert_with(Vec::new)
+                                                .push(Some(mapto.clone()));
+                                                extract_location_stream.extend(quote! {
                                                     let #location_varname = __location_stack.pop().unwrap();
                                                 });
+                                                debug_tag_check_stream.extend(quote! {
+                                                    debug_assert!(
+                                                        __data_stack.#tag_stack_name.get(
+                                                            __data_stack.#tag_stack_name.len()-1-#idx_from_back
+                                                        ) == Some( &#tag_enum_name::#terminal_stack_name )
+                                                    );
+                                                });
                                             }
                                             TerminalSymbol::Error => {
-                                                extract_token_data_from_args.extend(quote! {
-                                                    let __tag = __data_stack.#tag_stack_name.pop();
-                                                    debug_assert!(__tag == Some(#tag_enum_name::#empty_tag_name));
+                                                extract_location_stream.extend(quote! {
                                                     let #location_varname = __location_stack.pop().unwrap();
                                                 });
+                                                debug_tag_check_stream.extend(quote! {
+                                                    debug_assert!(
+                                                        __data_stack.#tag_stack_name.get(
+                                                            __data_stack.#tag_stack_name.len()-1-#idx_from_back
+                                                        ) == Some( &#tag_enum_name::#empty_tag_name )
+                                                    );
+                                                });
                                             }
                                             TerminalSymbol::Eof => {
                                                 unreachable!(
@@ -1277,12 +1290,18 @@ impl Grammar {
                                         }
                                     }
                                     None => {
-                                        extract_token_data_from_args.extend(quote! {
-                                            let __tag = __data_stack.#tag_stack_name.pop();
-                                            debug_assert!(__tag == Some(#tag_enum_name::#terminal_stack_name));
-                                            __data_stack.#terminal_stack_name.pop();
+                                        stack_mapto_map.entry(&terminal_stack_name).or_insert_with(Vec::new)
+                                            .push(None);
+                                        extract_location_stream.extend(quote! {
                                             __location_stack.pop();
                                         });
+                                        debug_tag_check_stream.extend(quote! {
+                                            debug_assert!(
+                                                __data_stack.#tag_stack_name.get(
+                                                    __data_stack.#tag_stack_name.len()-1-#idx_from_back
+                                                ) == Some( &#tag_enum_name::#terminal_stack_name )
+                                            );
+                                        });
                                     }
                                 },
                                 Token::NonTerm(nonterm_idx) => {
@@ -1295,34 +1314,58 @@ impl Grammar {
 
                                             if let Some(stack_name) = stack_name {
                                                 // extract token data from args
-                                                extract_token_data_from_args.extend(quote! {
-                                                    let __tag = __data_stack.#tag_stack_name.pop();
-                                                    debug_assert!(__tag == Some(#tag_enum_name::#stack_name));
-                                                    let mut #mapto = __data_stack.#stack_name.pop().unwrap();
+                                                stack_mapto_map.entry(&stack_name).or_insert_with(Vec::new)
+                                                    .push(Some(mapto.clone()));
+                                                extract_location_stream.extend(quote! {
                                                     let #location_varname = __location_stack.pop().unwrap();
                                                 });
+                                                debug_tag_check_stream.extend(quote! {
+                                                    debug_assert!(
+                                                        __data_stack.#tag_stack_name.get(
+                                                            __data_stack.#tag_stack_name.len()-1-#idx_from_back
+                                                        ) == Some( &#tag_enum_name::#stack_name )
+                                                    );
+                                                });
+
                                             } else {
-                                                extract_token_data_from_args.extend(quote! {
-                                                    let __tag = __data_stack.#tag_stack_name.pop();
-                                                    debug_assert!(__tag == Some(#tag_enum_name::#empty_tag_name));
+                                                extract_location_stream.extend(quote! {
                                                     let #location_varname = __location_stack.pop().unwrap();
                                                 });
+                                                debug_tag_check_stream.extend(quote! {
+                                                    debug_assert!(
+                                                        __data_stack.#tag_stack_name.get(
+                                                            __data_stack.#tag_stack_name.len()-1-#idx_from_back
+                                                        ) == Some( &#tag_enum_name::#empty_tag_name )
+                                                    );
+                                                });
+
                                             }
                                         }
                                         None => {
                                             if let Some(stack_name) = stack_name {
-                                                extract_token_data_from_args.extend(quote! {
-                                                    let __tag = __data_stack.#tag_stack_name.pop();
-                                                    debug_assert!(__tag == Some(#tag_enum_name::#stack_name));
-                                                    __data_stack.#stack_name.pop();
+                                                stack_mapto_map.entry(&stack_name).or_insert_with(Vec::new)
+                                                    .push(None);
+                                                extract_location_stream.extend(quote! {
                                                     __location_stack.pop();
                                                 });
+                                                debug_tag_check_stream.extend(quote! {
+                                                    debug_assert!(
+                                                        __data_stack.#tag_stack_name.get(
+                                                            __data_stack.#tag_stack_name.len()-1-#idx_from_back
+                                                        ) == Some( &#tag_enum_name::#stack_name )
+                                                    );
+                                                });
                                             } else {
-                                                extract_token_data_from_args.extend(quote! {
-                                                    let __tag = __data_stack.#tag_stack_name.pop();
-                                                    debug_assert!(__tag == Some(#tag_enum_name::#empty_tag_name));
+                                                extract_location_stream.extend(quote! {
                                                     __location_stack.pop();
                                                 });
+                                                debug_tag_check_stream.extend(quote! {
+                                                    debug_assert!(
+                                                        __data_stack.#tag_stack_name.get(
+                                                            __data_stack.#tag_stack_name.len()-1-#idx_from_back
+                                                        ) == Some( &#tag_enum_name::#empty_tag_name )
+                                                    );
+                                                });
                                             }
                                         }
                                     }
@@ -1330,6 +1373,42 @@ impl Grammar {
                             }
                         }
 
+                        let mut truncate_tag_stream = TokenStream::new();
+                        if rule.tokens.len() > 0 {
+                            let len = rule.tokens.len();
+                            truncate_tag_stream.extend(quote! {
+                                __data_stack.#tag_stack_name.truncate(__data_stack.#tag_stack_name.len() - #len);
+                            });
+                        }
+
+                        let mut extract_data_stream= TokenStream::new();
+                        for (stack_name, maptos) in stack_mapto_map {
+                            for mapto in maptos {
+                                match mapto {
+                                    Some(mapto) => {
+                                        extract_data_stream.extend(quote! {
+                                            let mut #mapto = __data_stack.#stack_name.pop().unwrap();
+                                        });
+                                    }
+                                    None => {
+                                        extract_data_stream.extend(quote!{ 
+                                                __data_stack.#stack_name.pop();
+                                        });
+                                    }
+                                }
+                            }
+                        }
+
+                        let extract_token_data_from_args = quote! {
+                            #[cfg(debug_assertions)]
+                            {
+                                #debug_tag_check_stream
+                            }
+                            #truncate_tag_stream
+                            #extract_data_stream
+                            #extract_location_stream
+                        };
+
                         case_streams.extend(quote! {
                             #rule_index => Self::#reduce_fn_ident( data_stack, location_stack, shift, lookahead, user_data, location0 ),
                         });
@@ -1432,7 +1511,9 @@ impl Grammar {
                             }
                         }
 
-                        let (stack_pop_stream, stack_push_stream, tag_push_stream) = if let Some((
+                        let len = rule.tokens.len();
+                        debug_assert!( len > 0 );
+                        let (stack_pop_stream, stack_push_stream) = if let Some((
                             pop_stack,
                             pop_index_from_back,
                         )) = pop_stack_idx_pair
@@ -1441,22 +1522,50 @@ impl Grammar {
                                 (
                                     quote!{},
                                     quote!{},
-                                    quote!{ __data_stack.#tag_stack_name.push(#tag_enum_name::#pop_stack); }
                                 )
                             } else {
                                 (
                                     quote! { let __ret = __data_stack.#pop_stack.swap_remove( __data_stack.#pop_stack.len() - 1  - #pop_index_from_back ); },
                                     quote! { __data_stack.#pop_stack.push(__ret); },
-                                    quote! { __data_stack.#tag_stack_name.push(#tag_enum_name::#pop_stack); }
                                 )
                             }
                         } else {
                             (
                                 quote! {},
                                 quote! {},
-                                quote! {__data_stack.#tag_stack_name.push(#tag_enum_name::#empty_tag_name); }
                             )
                         };
+
+                        let (tags_truncate_stream, tag_push_stream) = if identity_token_idx == 0 {
+                            let truncate_len = len - 1;
+                            if truncate_len > 0 {
+                                (
+                                    quote!{ __data_stack.#tag_stack_name.truncate(__data_stack.#tag_stack_name.len() - #truncate_len); },
+                                    quote!{}
+                                )
+                            } else {
+                                (
+                                    quote!{},
+                                    quote!{}
+                                )
+                            }
+                        } else {
+                            let tag_push_stream = if let Some((
+                                pop_stack,
+                                _,
+                            )) = pop_stack_idx_pair
+                            {
+                                quote!{ __data_stack.#tag_stack_name.push(#tag_enum_name::#pop_stack); }
+                            } else {
+                                quote! {__data_stack.#tag_stack_name.push(#tag_enum_name::#empty_tag_name); }
+                            };
+
+                            let tags_truncate_stream = quote! { __data_stack.#tag_stack_name.truncate(__data_stack.#tag_stack_name.len() - #len); };
+
+                            (tags_truncate_stream, tag_push_stream)
+                        };
+
+
                         let mut stack_truncate_stream = TokenStream::new();
                         for (stack_name, count) in stack_count_map {
                             debug_assert!(count > 0);
@@ -1464,18 +1573,7 @@ impl Grammar {
                                 __data_stack.#stack_name.truncate(__data_stack.#stack_name.len() - #count);
                             });
                         }
-                        let location_truncate_stream = if rule.tokens.len() > 0 {
-                            let len = rule.tokens.len();
-                            quote! { __location_stack.truncate(__location_stack.len() - #len); }
-                        } else {
-                            quote! {}
-                        };
-                        let tags_truncate_stream = if rule.tokens.len() > 0 {
-                            let len = rule.tokens.len();
-                            quote! { __data_stack.#tag_stack_name.truncate(__data_stack.#tag_stack_name.len() - #len); }
-                        } else {
-                            quote! {}
-                        };
+                        let location_truncate_stream = quote! { __location_stack.truncate(__location_stack.len() - #len); };
 
                         fn_reduce_for_each_rule_stream.extend(quote! {
                             #[doc = #rule_debug_str]
@@ -1486,9 +1584,9 @@ impl Grammar {
                             ) {
                                 #stack_pop_stream // __ret = stack.swap_remove(i);
                                 #stack_truncate_stream // stack.truncate( ... );
+                                #stack_push_stream // stack.push( __ret );
                                 #location_truncate_stream // location.truncate( ... );
                                 #tags_truncate_stream // tags.truncate( ... );
-                                #stack_push_stream // stack.push( __ret );
                                 #tag_push_stream // tag.push( ... );
                             }
                         });
diff --git a/rusty_lr_parser/src/parser/parser_expanded.rs b/rusty_lr_parser/src/parser/parser_expanded.rs
index 9f319a74..0c206971 100644
--- a/rusty_lr_parser/src/parser/parser_expanded.rs
+++ b/rusty_lr_parser/src/parser/parser_expanded.rs
@@ -524,25 +524,39 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack4)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__stack3)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 4usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 5usize);
+        let mut RuleType = __data_stack.__stack3.pop().unwrap();
+        let mut RuleLines = __data_stack.__stack4.pop().unwrap();
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut colon = __data_stack.__terminals.pop().unwrap();
+        let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack4));
-        let mut RuleLines = __data_stack.__stack4.pop().unwrap();
         let __rustylr_location_RuleLines = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut colon = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_colon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack3));
-        let mut RuleType = __data_stack.__stack3.pop().unwrap();
         let __rustylr_location_RuleType = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
         let res = {
             let Lexed::Ident(ident) = ident else {
@@ -572,8 +586,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut parengroup = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_parengroup = __location_stack.pop().unwrap();
         let res = {
@@ -596,6 +616,7 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        #[cfg(debug_assertions)] {}
         let res = { None };
         __data_stack.__stack3.push(res);
         __data_stack.__tags.push(GrammarTags::__stack3);
@@ -611,17 +632,27 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack5));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack5)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__stack4)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
+        let mut RuleLines = __data_stack.__stack4.pop().unwrap();
         let mut RuleLine = __data_stack.__stack5.pop().unwrap();
-        let __rustylr_location_RuleLine = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut pipe = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_RuleLine = __location_stack.pop().unwrap();
         let __rustylr_location_pipe = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack4));
-        let mut RuleLines = __data_stack.__stack4.pop().unwrap();
         let __rustylr_location_RuleLines = __location_stack.pop().unwrap();
         let res = {
             RuleLine.separator_span = __rustylr_location_pipe.span();
@@ -642,8 +673,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack5));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack5)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut RuleLine = __data_stack.__stack5.pop().unwrap();
         let __rustylr_location_RuleLine = __location_stack.pop().unwrap();
         let res = { vec![RuleLine] };
@@ -661,17 +698,27 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack3));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack3)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack14)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__stack13)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
+        let mut TokenMapped = __data_stack.__stack13.pop().unwrap();
+        let mut PrecDef = __data_stack.__stack14.pop().unwrap();
         let mut Action = __data_stack.__stack3.pop().unwrap();
         let __rustylr_location_Action = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack14));
-        let mut PrecDef = __data_stack.__stack14.pop().unwrap();
         let __rustylr_location_PrecDef = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack13));
-        let mut TokenMapped = __data_stack.__stack13.pop().unwrap();
         let __rustylr_location_TokenMapped = __location_stack.pop().unwrap();
         let res = {
             RuleLineArgs {
@@ -697,17 +744,27 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack11));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack11)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut IdentOrLiteral = __data_stack.__stack11.pop().unwrap();
-        let __rustylr_location_IdentOrLiteral = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut prec = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_prec = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut percent = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_IdentOrLiteral = __location_stack.pop().unwrap();
+        let __rustylr_location_prec = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         let res = { PrecDPrecArgs::Prec(IdentOrLiteral) };
         __data_stack.__stack6.push(res);
@@ -724,16 +781,26 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::Empty));
-        let __rustylr_location_error = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::Empty)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut prec = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_prec = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut percent = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_error = __location_stack.pop().unwrap();
+        let __rustylr_location_prec = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         let res = {
             data.error_recovered
@@ -759,17 +826,27 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut literal = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_literal = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut dprec = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_dprec = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut percent = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_literal = __location_stack.pop().unwrap();
+        let __rustylr_location_dprec = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         let res = {
             let Lexed::Literal(literal) = literal else {
@@ -791,16 +868,26 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::Empty));
-        let __rustylr_location_error = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::Empty)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut dprec = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_dprec = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut percent = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_error = __location_stack.pop().unwrap();
+        let __rustylr_location_dprec = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         let res = {
             data.error_recovered
@@ -826,12 +913,20 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::Empty));
-        let __rustylr_location_error = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::Empty)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 2usize);
         let mut percent = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_error = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         let res = {
             data.error_recovered
@@ -857,8 +952,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack10)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut Pattern = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_Pattern = __location_stack.pop().unwrap();
         let res = { (None, Pattern) };
@@ -876,17 +977,27 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack10)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut Pattern = __data_stack.__stack10.pop().unwrap();
-        let __rustylr_location_Pattern = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut equal = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_equal = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut ident = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_Pattern = __location_stack.pop().unwrap();
+        let __rustylr_location_equal = __location_stack.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
         let res = {
             let Lexed::Ident(ident) = ident else {
@@ -908,8 +1019,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
         let res = {
@@ -932,17 +1049,27 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut last = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_last = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut minus = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_minus = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut first = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_last = __location_stack.pop().unwrap();
+        let __rustylr_location_minus = __location_stack.pop().unwrap();
         let __rustylr_location_first = __location_stack.pop().unwrap();
         let res = {
             let Lexed::Ident(first) = first else {
@@ -967,16 +1094,26 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::Empty));
-        let __rustylr_location_error = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::Empty)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut minus = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_minus = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut ident = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_error = __location_stack.pop().unwrap();
+        let __rustylr_location_minus = __location_stack.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
         let res = {
             data.error_recovered
@@ -1002,8 +1139,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut literal = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_literal = __location_stack.pop().unwrap();
         let res = {
@@ -1026,17 +1169,27 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut last = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_last = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut minus = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_minus = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut first = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_last = __location_stack.pop().unwrap();
+        let __rustylr_location_minus = __location_stack.pop().unwrap();
         let __rustylr_location_first = __location_stack.pop().unwrap();
         let res = {
             let Lexed::Literal(first) = first else {
@@ -1061,16 +1214,26 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::Empty));
-        let __rustylr_location_error = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::Empty)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut minus = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_minus = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut literal = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_error = __location_stack.pop().unwrap();
+        let __rustylr_location_minus = __location_stack.pop().unwrap();
         let __rustylr_location_literal = __location_stack.pop().unwrap();
         let res = {
             data.error_recovered
@@ -1096,21 +1259,33 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack16)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__stack15)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
+        let mut caret = __data_stack.__stack15.pop().unwrap();
+        let mut TerminalSetItem = __data_stack.__stack16.pop().unwrap();
         let mut rbracket = __data_stack.__terminals.pop().unwrap();
+        let mut lbracket = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_rbracket = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack16));
-        let mut TerminalSetItem = __data_stack.__stack16.pop().unwrap();
         let __rustylr_location_TerminalSetItem = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack15));
-        let mut caret = __data_stack.__stack15.pop().unwrap();
         let __rustylr_location_caret = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut lbracket = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_lbracket = __location_stack.pop().unwrap();
         let res = {
             TerminalSet {
@@ -1134,8 +1309,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut dot = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_dot = __location_stack.pop().unwrap();
         let res = {
@@ -1161,8 +1342,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
         let res = {
@@ -1185,13 +1372,21 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack10)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 2usize);
+        let mut Pattern = __data_stack.__stack10.pop().unwrap();
         let mut plus = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_plus = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack10));
-        let mut Pattern = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_Pattern = __location_stack.pop().unwrap();
         let res = {
             let Lexed::Plus(plus) = plus else {
@@ -1213,13 +1408,21 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack10)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 2usize);
+        let mut Pattern = __data_stack.__stack10.pop().unwrap();
         let mut star = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_star = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack10));
-        let mut Pattern = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_Pattern = __location_stack.pop().unwrap();
         let res = {
             PatternArgs::Star(Box::new(Pattern), __rustylr_location_star.span())
@@ -1238,13 +1441,21 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack10)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 2usize);
+        let mut Pattern = __data_stack.__stack10.pop().unwrap();
         let mut question = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_question = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack10));
-        let mut Pattern = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_Pattern = __location_stack.pop().unwrap();
         let res = {
             PatternArgs::Question(Box::new(Pattern), __rustylr_location_question.span())
@@ -1263,13 +1474,21 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack10)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 2usize);
+        let mut Pattern = __data_stack.__stack10.pop().unwrap();
         let mut exclamation = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_exclamation = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack10));
-        let mut Pattern = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_Pattern = __location_stack.pop().unwrap();
         let res = {
             PatternArgs::Exclamation(
@@ -1291,8 +1510,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack9));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack9)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut TerminalSet = __data_stack.__stack9.pop().unwrap();
         let __rustylr_location_TerminalSet = __location_stack.pop().unwrap();
         let res = { PatternArgs::TerminalSet(TerminalSet) };
@@ -1310,17 +1535,27 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack10)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__stack10)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut lh = __data_stack.__stack10.pop().unwrap();
-        let __rustylr_location_lh = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut p1 = __data_stack.__stack10.pop().unwrap();
         let mut slash = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_lh = __location_stack.pop().unwrap();
         let __rustylr_location_slash = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack10));
-        let mut p1 = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_p1 = __location_stack.pop().unwrap();
         let res = { PatternArgs::Lookaheads(Box::new(p1), Box::new(lh)) };
         __data_stack.__stack10.push(res);
@@ -1337,17 +1572,27 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack18)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
+        let mut Pattern = __data_stack.__stack18.pop().unwrap();
         let mut rparen = __data_stack.__terminals.pop().unwrap();
+        let mut lparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_rparen = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack18));
-        let mut Pattern = __data_stack.__stack18.pop().unwrap();
         let __rustylr_location_Pattern = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut lparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_lparen = __location_stack.pop().unwrap();
         let res = {
             PatternArgs::Group(
@@ -1370,16 +1615,26 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::Empty)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut rparen = __data_stack.__terminals.pop().unwrap();
+        let mut lparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_rparen = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut lparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_lparen = __location_stack.pop().unwrap();
         let res = {
             data.error_recovered
@@ -1405,8 +1660,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut literal = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_literal = __location_stack.pop().unwrap();
         let res = {
@@ -1429,17 +1690,27 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack10)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__stack10)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut p2 = __data_stack.__stack10.pop().unwrap();
-        let __rustylr_location_p2 = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut p1 = __data_stack.__stack10.pop().unwrap();
         let mut minus = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_p2 = __location_stack.pop().unwrap();
         let __rustylr_location_minus = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack10));
-        let mut p1 = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_p1 = __location_stack.pop().unwrap();
         let res = { PatternArgs::Minus(Box::new(p1), Box::new(p2)) };
         __data_stack.__stack10.push(res);
@@ -1456,37 +1727,57 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack15)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__stack10)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 4usize) == Some(&
+                GrammarTags::__stack10)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 5usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 6usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 7usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 8usize);
+        let mut del = __data_stack.__stack10.pop().unwrap();
+        let mut base = __data_stack.__stack10.pop().unwrap();
+        let mut comma = __data_stack.__stack15.pop().unwrap();
         let mut rparen = __data_stack.__terminals.pop().unwrap();
+        let mut comma = __data_stack.__terminals.pop().unwrap();
+        let mut lparen = __data_stack.__terminals.pop().unwrap();
+        let mut ident = __data_stack.__terminals.pop().unwrap();
+        let mut dollar = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_rparen = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack15));
-        let mut comma = __data_stack.__stack15.pop().unwrap();
         let __rustylr_location_comma = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack10));
-        let mut del = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_del = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut comma = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_comma = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack10));
-        let mut base = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_base = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut lparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_lparen = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut dollar = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_dollar = __location_stack.pop().unwrap();
         let res = {
             let Lexed::Ident(ident) = ident else {
@@ -1517,41 +1808,63 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__stack10)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 4usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 5usize) == Some(&
+                GrammarTags::__stack10)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 6usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 7usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 8usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 9usize);
+        let mut del = __data_stack.__stack10.pop().unwrap();
+        let mut base = __data_stack.__stack10.pop().unwrap();
         let mut rparen = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_rparen = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut plus = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_plus = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut comma = __data_stack.__terminals.pop().unwrap();
+        let mut comma = __data_stack.__terminals.pop().unwrap();
+        let mut lparen = __data_stack.__terminals.pop().unwrap();
+        let mut ident = __data_stack.__terminals.pop().unwrap();
+        let mut dollar = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_rparen = __location_stack.pop().unwrap();
+        let __rustylr_location_plus = __location_stack.pop().unwrap();
         let __rustylr_location_comma = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack10));
-        let mut del = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_del = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut comma = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_comma = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack10));
-        let mut base = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_base = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut lparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_lparen = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut dollar = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_dollar = __location_stack.pop().unwrap();
         let res = {
             let Lexed::Ident(ident) = ident else {
@@ -1582,41 +1895,63 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__stack10)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 4usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 5usize) == Some(&
+                GrammarTags::__stack10)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 6usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 7usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 8usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 9usize);
+        let mut del = __data_stack.__stack10.pop().unwrap();
+        let mut base = __data_stack.__stack10.pop().unwrap();
         let mut rparen = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_rparen = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut star = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_star = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut comma = __data_stack.__terminals.pop().unwrap();
+        let mut comma = __data_stack.__terminals.pop().unwrap();
+        let mut lparen = __data_stack.__terminals.pop().unwrap();
+        let mut ident = __data_stack.__terminals.pop().unwrap();
+        let mut dollar = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_rparen = __location_stack.pop().unwrap();
+        let __rustylr_location_star = __location_stack.pop().unwrap();
         let __rustylr_location_comma = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack10));
-        let mut del = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_del = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut comma = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_comma = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack10));
-        let mut base = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_base = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut lparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_lparen = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut dollar = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_dollar = __location_stack.pop().unwrap();
         let res = {
             let Lexed::Ident(ident) = ident else {
@@ -1647,36 +1982,56 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::Empty)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__stack10)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 4usize) == Some(&
+                GrammarTags::__stack10)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 5usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 6usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 7usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 8usize);
+        let mut del = __data_stack.__stack10.pop().unwrap();
+        let mut base = __data_stack.__stack10.pop().unwrap();
         let mut rparen = __data_stack.__terminals.pop().unwrap();
+        let mut comma = __data_stack.__terminals.pop().unwrap();
+        let mut lparen = __data_stack.__terminals.pop().unwrap();
+        let mut ident = __data_stack.__terminals.pop().unwrap();
+        let mut dollar = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_rparen = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack10));
-        let mut del = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_del = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut comma = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_comma = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack10));
-        let mut base = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_base = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut lparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_lparen = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut dollar = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_dollar = __location_stack.pop().unwrap();
         let res = {
             let Lexed::Ident(ident) = ident else {
@@ -1714,40 +2069,62 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::Empty)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__stack10)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 4usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 5usize) == Some(&
+                GrammarTags::__stack10)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 6usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 7usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 8usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 9usize);
+        let mut del = __data_stack.__stack10.pop().unwrap();
+        let mut base = __data_stack.__stack10.pop().unwrap();
         let mut rparen = __data_stack.__terminals.pop().unwrap();
+        let mut comma = __data_stack.__terminals.pop().unwrap();
+        let mut comma = __data_stack.__terminals.pop().unwrap();
+        let mut lparen = __data_stack.__terminals.pop().unwrap();
+        let mut ident = __data_stack.__terminals.pop().unwrap();
+        let mut dollar = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_rparen = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut comma = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_comma = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack10));
-        let mut del = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_del = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut comma = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_comma = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack10));
-        let mut base = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_base = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut lparen = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_lparen = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut dollar = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_dollar = __location_stack.pop().unwrap();
         let res = {
             let Lexed::Ident(ident) = ident else {
@@ -1785,8 +2162,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut bracegroup = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_bracegroup = __location_stack.pop().unwrap();
         let res = {
@@ -1809,6 +2192,7 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        #[cfg(debug_assertions)] {}
         let res = { None };
         __data_stack.__stack3.push(res);
         __data_stack.__tags.push(GrammarTags::__stack3);
@@ -1824,8 +2208,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
         let res = {
@@ -1848,8 +2238,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut literal = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_literal = __location_stack.pop().unwrap();
         let res = {
@@ -1872,8 +2268,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack19));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack19)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut t = __data_stack.__stack19.pop().unwrap();
         let __rustylr_location_t = __location_stack.pop().unwrap();
         let res = {
@@ -1897,25 +2299,39 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack12)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 4usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 5usize);
+        let mut RustCode = __data_stack.__stack12.pop().unwrap();
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut ident = __data_stack.__terminals.pop().unwrap();
+        let mut token = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack12));
-        let mut RustCode = __data_stack.__stack12.pop().unwrap();
         let __rustylr_location_RustCode = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut token = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_token = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             let Lexed::Ident(ident) = ident else {
@@ -1936,21 +2352,33 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut ident = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut token = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_token = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut percent = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
+        let __rustylr_location_ident = __location_stack.pop().unwrap();
+        let __rustylr_location_token = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -1974,20 +2402,32 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::Empty)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut token = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut token = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_token = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2011,21 +2451,33 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut ident = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut start = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_start = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut percent = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
+        let __rustylr_location_ident = __location_stack.pop().unwrap();
+        let __rustylr_location_start = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             let Lexed::Ident(ident) = ident else {
@@ -2046,20 +2498,32 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::Empty)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut start = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut start = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_start = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2083,20 +2547,32 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::Empty)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut eofdef = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut eofdef = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_eofdef = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2121,21 +2597,33 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack12)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
+        let mut RustCode = __data_stack.__stack12.pop().unwrap();
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut tokentype = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack12));
-        let mut RustCode = __data_stack.__stack12.pop().unwrap();
         let __rustylr_location_RustCode = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut tokentype = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_tokentype = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.token_typename.push((__rustylr_location_tokentype.span(), RustCode));
@@ -2153,17 +2641,27 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut tokentype = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_tokentype = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut percent = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
+        let __rustylr_location_tokentype = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2187,21 +2685,33 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack12)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
+        let mut RustCode = __data_stack.__stack12.pop().unwrap();
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut userdata = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack12));
-        let mut RustCode = __data_stack.__stack12.pop().unwrap();
         let __rustylr_location_RustCode = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut userdata = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_userdata = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.userdata_typename.push((__rustylr_location_userdata.span(), RustCode));
@@ -2219,17 +2729,27 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut userdata = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_userdata = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut percent = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
+        let __rustylr_location_userdata = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2253,21 +2773,33 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack20)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
+        let mut IdentOrLiteral = __data_stack.__stack20.pop().unwrap();
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut left = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack20));
-        let mut IdentOrLiteral = __data_stack.__stack20.pop().unwrap();
         let __rustylr_location_IdentOrLiteral = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut left = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_left = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.precedences
@@ -2290,20 +2822,32 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::Empty)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut left = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut left = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_left = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2327,21 +2871,33 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack20)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
+        let mut IdentOrLiteral = __data_stack.__stack20.pop().unwrap();
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut right = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack20));
-        let mut IdentOrLiteral = __data_stack.__stack20.pop().unwrap();
         let __rustylr_location_IdentOrLiteral = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut right = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_right = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.precedences
@@ -2364,20 +2920,32 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::Empty)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut right = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut right = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_right = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2401,21 +2969,33 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack20)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
+        let mut IdentOrLiteral = __data_stack.__stack20.pop().unwrap();
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut precedence = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack20));
-        let mut IdentOrLiteral = __data_stack.__stack20.pop().unwrap();
         let __rustylr_location_IdentOrLiteral = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut precedence = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_precedence = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.precedences
@@ -2434,20 +3014,32 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::Empty)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut precedence = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut precedence = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_precedence = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2471,21 +3063,33 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack12)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
+        let mut RustCode = __data_stack.__stack12.pop().unwrap();
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut errortype = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack12));
-        let mut RustCode = __data_stack.__stack12.pop().unwrap();
         let __rustylr_location_RustCode = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut errortype = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_errortype = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_typename.push((__rustylr_location_errortype.span(), RustCode));
@@ -2503,17 +3107,27 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut errortype = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_errortype = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut percent = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
+        let __rustylr_location_errortype = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2537,21 +3151,33 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack12)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
+        let mut RustCode = __data_stack.__stack12.pop().unwrap();
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut moduleprefix = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack12));
-        let mut RustCode = __data_stack.__stack12.pop().unwrap();
         let __rustylr_location_RustCode = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut moduleprefix = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_moduleprefix = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.module_prefix.push((__rustylr_location_moduleprefix.span(), RustCode));
@@ -2569,17 +3195,27 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut moduleprefix = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_moduleprefix = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut percent = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
+        let __rustylr_location_moduleprefix = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2603,17 +3239,27 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut glr = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_glr = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut percent = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
+        let __rustylr_location_glr = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.glr = true;
@@ -2631,20 +3277,32 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::Empty)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut glr = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut glr = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_glr = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2668,17 +3326,27 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut lalr = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_lalr = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut percent = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
+        let __rustylr_location_lalr = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.lalr = true;
@@ -2696,20 +3364,32 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::Empty)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut lalr = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut lalr = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_lalr = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2733,17 +3413,27 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut nooptim = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_nooptim = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut percent = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
+        let __rustylr_location_nooptim = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.no_optim = true;
@@ -2761,20 +3451,32 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::Empty)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut nooptim = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut nooptim = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_nooptim = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2798,17 +3500,27 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut dense = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_dense = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut percent = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
+        let __rustylr_location_dense = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.dense = true;
@@ -2826,20 +3538,32 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::Empty)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut dense = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut dense = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_dense = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2863,21 +3587,33 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack19)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
+        let mut ident = __data_stack.__stack19.pop().unwrap();
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut trace = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack19));
-        let mut ident = __data_stack.__stack19.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut trace = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_trace = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             let idents = ident
@@ -2903,20 +3639,32 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::Empty)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut trace = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut trace = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_trace = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -2940,21 +3688,33 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack12)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
+        let mut RustCode = __data_stack.__stack12.pop().unwrap();
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut filter = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack12));
-        let mut RustCode = __data_stack.__stack12.pop().unwrap();
         let __rustylr_location_RustCode = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut filter = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_filter = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.filter = Some(RustCode);
@@ -2972,17 +3732,27 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut filter = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_filter = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut percent = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
+        let __rustylr_location_filter = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -3006,17 +3776,27 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut runtime = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_runtime = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut percent = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
+        let __rustylr_location_runtime = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.compiled = false;
@@ -3034,20 +3814,32 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::Empty)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut runtime = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut runtime = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_runtime = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -3071,21 +3863,33 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack12)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 3usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 4usize);
+        let mut RustCode = __data_stack.__stack12.pop().unwrap();
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut location = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack12));
-        let mut RustCode = __data_stack.__stack12.pop().unwrap();
         let __rustylr_location_RustCode = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut location = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_location = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.location_typename = Some(RustCode);
@@ -3103,17 +3907,27 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut location = __data_stack.__terminals.pop().unwrap();
-        let __rustylr_location_location = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
         let mut percent = __data_stack.__terminals.pop().unwrap();
+        let __rustylr_location_semicolon = __location_stack.pop().unwrap();
+        let __rustylr_location_location = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -3137,16 +3951,26 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::Empty)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut semicolon = __data_stack.__terminals.pop().unwrap();
+        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_semicolon = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::Empty));
         let __rustylr_location_error = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
-        let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
         {
             data.error_recovered
@@ -3170,8 +3994,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack2));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack2)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut Rule = __data_stack.__stack2.pop().unwrap();
         let __rustylr_location_Rule = __location_stack.pop().unwrap();
         {
@@ -3207,8 +4037,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack7));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack7)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut A = __data_stack.__stack7.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
         let res = { vec![A] };
@@ -3226,13 +4062,21 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack7));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack7)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack13)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 2usize);
+        let mut Ap = __data_stack.__stack13.pop().unwrap();
         let mut A = __data_stack.__stack7.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack13));
-        let mut Ap = __data_stack.__stack13.pop().unwrap();
         let __rustylr_location_Ap = __location_stack.pop().unwrap();
         let res = {
             Ap.push(A);
@@ -3249,8 +4093,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__stack13);
     }
     ///TokenMapped* ->
     #[inline]
@@ -3262,6 +4104,7 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        #[cfg(debug_assertions)] {}
         let res = { vec![] };
         __data_stack.__stack13.push(res);
         __data_stack.__tags.push(GrammarTags::__stack13);
@@ -3277,8 +4120,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack6));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack6)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut A = __data_stack.__stack6.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
         let res = { vec![A] };
@@ -3296,13 +4145,21 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack6));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack6)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack14)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 2usize);
+        let mut Ap = __data_stack.__stack14.pop().unwrap();
         let mut A = __data_stack.__stack6.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack14));
-        let mut Ap = __data_stack.__stack14.pop().unwrap();
         let __rustylr_location_Ap = __location_stack.pop().unwrap();
         let res = {
             Ap.push(A);
@@ -3319,8 +4176,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__stack14);
     }
     ///PrecDef* ->
     #[inline]
@@ -3332,6 +4187,7 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        #[cfg(debug_assertions)] {}
         let res = { vec![] };
         __data_stack.__stack14.push(res);
         __data_stack.__tags.push(GrammarTags::__stack14);
@@ -3347,8 +4203,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut A = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
         let res = Some(A);
@@ -3366,6 +4228,7 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        #[cfg(debug_assertions)] {}
         let res = { None };
         __data_stack.__stack15.push(res);
         __data_stack.__tags.push(GrammarTags::__stack15);
@@ -3381,8 +4244,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack8));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack8)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut A = __data_stack.__stack8.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
         let res = { vec![A] };
@@ -3400,13 +4269,21 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack8));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack8)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack16)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 2usize);
+        let mut Ap = __data_stack.__stack16.pop().unwrap();
         let mut A = __data_stack.__stack8.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack16));
-        let mut Ap = __data_stack.__stack16.pop().unwrap();
         let __rustylr_location_Ap = __location_stack.pop().unwrap();
         let res = {
             Ap.push(A);
@@ -3423,8 +4300,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__stack16);
     }
     ///TerminalSetItem* ->
     #[inline]
@@ -3436,6 +4311,7 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        #[cfg(debug_assertions)] {}
         let res = { vec![] };
         __data_stack.__stack16.push(res);
         __data_stack.__tags.push(GrammarTags::__stack16);
@@ -3451,8 +4327,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack10)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut A = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
         let res = { vec![A] };
@@ -3470,13 +4352,21 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack10));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack10)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack17)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 2usize);
         let mut A = __data_stack.__stack10.pop().unwrap();
-        let __rustylr_location_A = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack17));
         let mut Ap = __data_stack.__stack17.pop().unwrap();
+        let __rustylr_location_A = __location_stack.pop().unwrap();
         let __rustylr_location_Ap = __location_stack.pop().unwrap();
         let res = {
             Ap.push(A);
@@ -3493,8 +4383,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__stack17);
     }
     ///Pattern* ->
     #[inline]
@@ -3506,6 +4394,7 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        #[cfg(debug_assertions)] {}
         let res = { vec![] };
         __data_stack.__stack17.push(res);
         __data_stack.__tags.push(GrammarTags::__stack17);
@@ -3521,8 +4410,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack17));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack17)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut __token0 = __data_stack.__stack17.pop().unwrap();
         let __rustylr_location___token0 = __location_stack.pop().unwrap();
         let res = { vec![__token0] };
@@ -3540,17 +4435,27 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack17));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack17)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 2usize) == Some(&
+                GrammarTags::__stack18)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 3usize);
         let mut __token1 = __data_stack.__stack17.pop().unwrap();
-        let __rustylr_location___token1 = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        let mut __token0 = __data_stack.__stack18.pop().unwrap();
         __data_stack.__terminals.pop();
+        let __rustylr_location___token1 = __location_stack.pop().unwrap();
         __location_stack.pop();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack18));
-        let mut __token0 = __data_stack.__stack18.pop().unwrap();
         let __rustylr_location___token0 = __location_stack.pop().unwrap();
         let res = {
             __token0.push(__token1);
@@ -3570,8 +4475,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut A = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
         let res = Some(A);
@@ -3589,6 +4500,7 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        #[cfg(debug_assertions)] {}
         let res = { None };
         __data_stack.__stack15.push(res);
         __data_stack.__tags.push(GrammarTags::__stack15);
@@ -3601,8 +4513,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> colon
     #[inline]
@@ -3611,8 +4521,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> pipe
     #[inline]
@@ -3621,8 +4529,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> percent
     #[inline]
@@ -3631,8 +4537,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> equal
     #[inline]
@@ -3641,8 +4545,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> plus
     #[inline]
@@ -3651,8 +4553,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> star
     #[inline]
@@ -3661,8 +4561,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> question
     #[inline]
@@ -3671,8 +4569,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> caret
     #[inline]
@@ -3681,8 +4577,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> minus
     #[inline]
@@ -3691,8 +4585,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> exclamation
     #[inline]
@@ -3701,8 +4593,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> slash
     #[inline]
@@ -3711,8 +4601,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> dot
     #[inline]
@@ -3721,8 +4609,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> dollar
     #[inline]
@@ -3731,8 +4617,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> comma
     #[inline]
@@ -3741,8 +4625,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> literal
     #[inline]
@@ -3751,8 +4633,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> parengroup
     #[inline]
@@ -3761,8 +4641,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> bracegroup
     #[inline]
@@ -3771,8 +4649,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> lparen
     #[inline]
@@ -3781,8 +4657,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> rparen
     #[inline]
@@ -3791,8 +4665,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> lbracket
     #[inline]
@@ -3801,8 +4673,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> rbracket
     #[inline]
@@ -3811,8 +4681,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> left
     #[inline]
@@ -3821,8 +4689,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> right
     #[inline]
@@ -3831,8 +4697,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> token
     #[inline]
@@ -3841,8 +4705,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> start
     #[inline]
@@ -3851,8 +4713,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> eofdef
     #[inline]
@@ -3861,8 +4721,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> tokentype
     #[inline]
@@ -3871,8 +4729,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> userdata
     #[inline]
@@ -3881,8 +4737,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> errortype
     #[inline]
@@ -3891,8 +4745,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> moduleprefix
     #[inline]
@@ -3901,8 +4753,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> lalr
     #[inline]
@@ -3911,8 +4761,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> glr
     #[inline]
@@ -3921,8 +4769,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> prec
     #[inline]
@@ -3931,8 +4777,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> precedence
     #[inline]
@@ -3941,8 +4785,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> nooptim
     #[inline]
@@ -3951,8 +4793,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> dense
     #[inline]
@@ -3961,8 +4801,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> trace
     #[inline]
@@ -3971,8 +4809,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> dprec
     #[inline]
@@ -3981,8 +4817,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> filter
     #[inline]
@@ -3991,8 +4825,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> runtime
     #[inline]
@@ -4001,8 +4833,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> location
     #[inline]
@@ -4011,8 +4841,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon] -> <Others>
     #[inline]
@@ -4021,8 +4849,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__terminals);
     }
     ///[^semicolon]+ -> [^semicolon]
     #[inline]
@@ -4034,8 +4860,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut A = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
         let res = { vec![A] };
@@ -4053,13 +4885,21 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack19)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 2usize);
+        let mut Ap = __data_stack.__stack19.pop().unwrap();
         let mut A = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack19));
-        let mut Ap = __data_stack.__stack19.pop().unwrap();
         let __rustylr_location_Ap = __location_stack.pop().unwrap();
         let res = {
             Ap.push(A);
@@ -4079,8 +4919,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack11));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack11)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut A = __data_stack.__stack11.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
         let res = { vec![A] };
@@ -4098,13 +4944,21 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack11));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__stack11)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack20)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 2usize);
         let mut A = __data_stack.__stack11.pop().unwrap();
-        let __rustylr_location_A = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack20));
         let mut Ap = __data_stack.__stack20.pop().unwrap();
+        let __rustylr_location_A = __location_stack.pop().unwrap();
         let __rustylr_location_Ap = __location_stack.pop().unwrap();
         let res = {
             Ap.push(A);
@@ -4124,8 +4978,14 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut A = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
         let res = { vec![A] };
@@ -4143,13 +5003,21 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__terminals));
+        #[cfg(debug_assertions)]
+        {
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 0usize) == Some(&
+                GrammarTags::__terminals)
+            );
+            debug_assert!(
+                __data_stack.__tags.get(__data_stack.__tags.len() - 1 - 1usize) == Some(&
+                GrammarTags::__stack19)
+            );
+        }
+        __data_stack.__tags.truncate(__data_stack.__tags.len() - 2usize);
+        let mut Ap = __data_stack.__stack19.pop().unwrap();
         let mut A = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        let __tag = __data_stack.__tags.pop();
-        debug_assert!(__tag == Some(GrammarTags::__stack19));
-        let mut Ap = __data_stack.__stack19.pop().unwrap();
         let __rustylr_location_Ap = __location_stack.pop().unwrap();
         let res = {
             Ap.push(A);
@@ -4166,8 +5034,6 @@ impl GrammarDataStack {
         __location_stack: &mut Vec<SpanPair>,
     ) {
         __location_stack.truncate(__location_stack.len() - 1usize);
-        __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
-        __data_stack.__tags.push(GrammarTags::__stack19);
     }
     ///ident* ->
     #[inline]
@@ -4179,6 +5045,7 @@ impl GrammarDataStack {
         data: &mut GrammarArgs,
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
+        #[cfg(debug_assertions)] {}
         let res = { vec![] };
         __data_stack.__stack19.push(res);
         __data_stack.__tags.push(GrammarTags::__stack19);

From fb532d7c9c5c4d73d96819b0e08868521a1e0f24 Mon Sep 17 00:00:00 2001
From: Taehwan Kim <ehwank98@gmail.com>
Date: Sat, 9 Aug 2025 17:01:41 +0900
Subject: [PATCH 08/11] rename temp res var name from res to __res

---
 rusty_lr_parser/src/emit.rs                   |   4 +-
 rusty_lr_parser/src/parser/parser_expanded.rs | 268 +++++++++---------
 2 files changed, 136 insertions(+), 136 deletions(-)

diff --git a/rusty_lr_parser/src/emit.rs b/rusty_lr_parser/src/emit.rs
index 64438a0c..7a237adf 100644
--- a/rusty_lr_parser/src/emit.rs
+++ b/rusty_lr_parser/src/emit.rs
@@ -1428,8 +1428,8 @@ impl Grammar {
                                 ) -> Result<(), #reduce_error_typename> {
                                     #extract_token_data_from_args
 
-                                    let res = #reduce_action ;
-                                    __data_stack.#stack_name.push(res);
+                                    let __res = #reduce_action ;
+                                    __data_stack.#stack_name.push(__res);
                                     __data_stack.#tag_stack_name.push(#tag_enum_name::#stack_name);
 
                                     Ok(())
diff --git a/rusty_lr_parser/src/parser/parser_expanded.rs b/rusty_lr_parser/src/parser/parser_expanded.rs
index 0c206971..3c6763ff 100644
--- a/rusty_lr_parser/src/parser/parser_expanded.rs
+++ b/rusty_lr_parser/src/parser/parser_expanded.rs
@@ -558,7 +558,7 @@ impl GrammarDataStack {
         let __rustylr_location_colon = __location_stack.pop().unwrap();
         let __rustylr_location_RuleType = __location_stack.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             let Lexed::Ident(ident) = ident else {
                 unreachable!("Rule-Ident");
             };
@@ -572,7 +572,7 @@ impl GrammarDataStack {
                 rule_lines: RuleLines,
             }
         };
-        __data_stack.__stack2.push(res);
+        __data_stack.__stack2.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack2);
         Ok(())
     }
@@ -596,13 +596,13 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut parengroup = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_parengroup = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             let Lexed::ParenGroup(group) = parengroup else {
                 unreachable!("RuleType - Group");
             };
             Some(group)
         };
-        __data_stack.__stack3.push(res);
+        __data_stack.__stack3.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack3);
         Ok(())
     }
@@ -617,8 +617,8 @@ impl GrammarDataStack {
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
         #[cfg(debug_assertions)] {}
-        let res = { None };
-        __data_stack.__stack3.push(res);
+        let __res = { None };
+        __data_stack.__stack3.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack3);
         Ok(())
     }
@@ -654,12 +654,12 @@ impl GrammarDataStack {
         let __rustylr_location_RuleLine = __location_stack.pop().unwrap();
         let __rustylr_location_pipe = __location_stack.pop().unwrap();
         let __rustylr_location_RuleLines = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             RuleLine.separator_span = __rustylr_location_pipe.span();
             RuleLines.push(RuleLine);
             RuleLines
         };
-        __data_stack.__stack4.push(res);
+        __data_stack.__stack4.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack4);
         Ok(())
     }
@@ -683,8 +683,8 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut RuleLine = __data_stack.__stack5.pop().unwrap();
         let __rustylr_location_RuleLine = __location_stack.pop().unwrap();
-        let res = { vec![RuleLine] };
-        __data_stack.__stack4.push(res);
+        let __res = { vec![RuleLine] };
+        __data_stack.__stack4.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack4);
         Ok(())
     }
@@ -720,7 +720,7 @@ impl GrammarDataStack {
         let __rustylr_location_Action = __location_stack.pop().unwrap();
         let __rustylr_location_PrecDef = __location_stack.pop().unwrap();
         let __rustylr_location_TokenMapped = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             RuleLineArgs {
                 tokens: TokenMapped,
                 reduce_action: Action.map(|action| action.to_token_stream()),
@@ -730,7 +730,7 @@ impl GrammarDataStack {
                 dprec: None,
             }
         };
-        __data_stack.__stack5.push(res);
+        __data_stack.__stack5.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack5);
         Ok(())
     }
@@ -766,8 +766,8 @@ impl GrammarDataStack {
         let __rustylr_location_IdentOrLiteral = __location_stack.pop().unwrap();
         let __rustylr_location_prec = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
-        let res = { PrecDPrecArgs::Prec(IdentOrLiteral) };
-        __data_stack.__stack6.push(res);
+        let __res = { PrecDPrecArgs::Prec(IdentOrLiteral) };
+        __data_stack.__stack6.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack6);
         Ok(())
     }
@@ -802,7 +802,7 @@ impl GrammarDataStack {
         let __rustylr_location_error = __location_stack.pop().unwrap();
         let __rustylr_location_prec = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             data.error_recovered
                 .push(RecoveredError {
                     message: "Expected <ident> to token or <literal>".to_string(),
@@ -812,7 +812,7 @@ impl GrammarDataStack {
                 });
             PrecDPrecArgs::None
         };
-        __data_stack.__stack6.push(res);
+        __data_stack.__stack6.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack6);
         Ok(())
     }
@@ -848,13 +848,13 @@ impl GrammarDataStack {
         let __rustylr_location_literal = __location_stack.pop().unwrap();
         let __rustylr_location_dprec = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             let Lexed::Literal(literal) = literal else {
                 unreachable!("PrecDPrecArgs-DPrec");
             };
             PrecDPrecArgs::DPrec(literal)
         };
-        __data_stack.__stack6.push(res);
+        __data_stack.__stack6.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack6);
         Ok(())
     }
@@ -889,7 +889,7 @@ impl GrammarDataStack {
         let __rustylr_location_error = __location_stack.pop().unwrap();
         let __rustylr_location_dprec = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             data.error_recovered
                 .push(RecoveredError {
                     message: "Expected integer literal".to_string(),
@@ -899,7 +899,7 @@ impl GrammarDataStack {
                 });
             PrecDPrecArgs::None
         };
-        __data_stack.__stack6.push(res);
+        __data_stack.__stack6.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack6);
         Ok(())
     }
@@ -928,7 +928,7 @@ impl GrammarDataStack {
         let mut percent = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_error = __location_stack.pop().unwrap();
         let __rustylr_location_percent = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             data.error_recovered
                 .push(RecoveredError {
                     message: "Expected %prec or %dprec".to_string(),
@@ -938,7 +938,7 @@ impl GrammarDataStack {
                 });
             PrecDPrecArgs::None
         };
-        __data_stack.__stack6.push(res);
+        __data_stack.__stack6.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack6);
         Ok(())
     }
@@ -962,8 +962,8 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut Pattern = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_Pattern = __location_stack.pop().unwrap();
-        let res = { (None, Pattern) };
-        __data_stack.__stack7.push(res);
+        let __res = { (None, Pattern) };
+        __data_stack.__stack7.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack7);
         Ok(())
     }
@@ -999,13 +999,13 @@ impl GrammarDataStack {
         let __rustylr_location_Pattern = __location_stack.pop().unwrap();
         let __rustylr_location_equal = __location_stack.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             let Lexed::Ident(ident) = ident else {
                 unreachable!("Token-Ident");
             };
             (Some(ident), Pattern)
         };
-        __data_stack.__stack7.push(res);
+        __data_stack.__stack7.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack7);
         Ok(())
     }
@@ -1029,13 +1029,13 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             let Lexed::Ident(ident) = ident else {
                 unreachable!("TerminalSetItem-Range1");
             };
             TerminalSetItem::Terminal(ident)
         };
-        __data_stack.__stack8.push(res);
+        __data_stack.__stack8.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack8);
         Ok(())
     }
@@ -1071,7 +1071,7 @@ impl GrammarDataStack {
         let __rustylr_location_last = __location_stack.pop().unwrap();
         let __rustylr_location_minus = __location_stack.pop().unwrap();
         let __rustylr_location_first = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             let Lexed::Ident(first) = first else {
                 unreachable!("TerminalSetItem-Range1");
             };
@@ -1080,7 +1080,7 @@ impl GrammarDataStack {
             };
             TerminalSetItem::Range(first, last)
         };
-        __data_stack.__stack8.push(res);
+        __data_stack.__stack8.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack8);
         Ok(())
     }
@@ -1115,7 +1115,7 @@ impl GrammarDataStack {
         let __rustylr_location_error = __location_stack.pop().unwrap();
         let __rustylr_location_minus = __location_stack.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             data.error_recovered
                 .push(RecoveredError {
                     message: "Expected ident for terminal set".to_string(),
@@ -1125,7 +1125,7 @@ impl GrammarDataStack {
                 });
             TerminalSetItem::Terminal(format_ident!("dummy"))
         };
-        __data_stack.__stack8.push(res);
+        __data_stack.__stack8.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack8);
         Ok(())
     }
@@ -1149,13 +1149,13 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut literal = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_literal = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             let Lexed::Literal(literal) = literal else {
                 unreachable!("TerminalSetItem-Literal");
             };
             TerminalSetItem::Literal(literal)
         };
-        __data_stack.__stack8.push(res);
+        __data_stack.__stack8.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack8);
         Ok(())
     }
@@ -1191,7 +1191,7 @@ impl GrammarDataStack {
         let __rustylr_location_last = __location_stack.pop().unwrap();
         let __rustylr_location_minus = __location_stack.pop().unwrap();
         let __rustylr_location_first = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             let Lexed::Literal(first) = first else {
                 unreachable!("TerminalSetItem-Range1");
             };
@@ -1200,7 +1200,7 @@ impl GrammarDataStack {
             };
             TerminalSetItem::LiteralRange(first, last)
         };
-        __data_stack.__stack8.push(res);
+        __data_stack.__stack8.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack8);
         Ok(())
     }
@@ -1235,7 +1235,7 @@ impl GrammarDataStack {
         let __rustylr_location_error = __location_stack.pop().unwrap();
         let __rustylr_location_minus = __location_stack.pop().unwrap();
         let __rustylr_location_literal = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             data.error_recovered
                 .push(RecoveredError {
                     message: "Expected literal for terminal set".to_string(),
@@ -1245,7 +1245,7 @@ impl GrammarDataStack {
                 });
             TerminalSetItem::Terminal(format_ident!("dummy"))
         };
-        __data_stack.__stack8.push(res);
+        __data_stack.__stack8.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack8);
         Ok(())
     }
@@ -1287,7 +1287,7 @@ impl GrammarDataStack {
         let __rustylr_location_TerminalSetItem = __location_stack.pop().unwrap();
         let __rustylr_location_caret = __location_stack.pop().unwrap();
         let __rustylr_location_lbracket = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             TerminalSet {
                 negate: caret.is_some(),
                 items: TerminalSetItem,
@@ -1295,7 +1295,7 @@ impl GrammarDataStack {
                 close_span: __rustylr_location_rbracket.span(),
             }
         };
-        __data_stack.__stack9.push(res);
+        __data_stack.__stack9.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack9);
         Ok(())
     }
@@ -1319,7 +1319,7 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut dot = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_dot = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             let span = __rustylr_location_dot.span();
             TerminalSet {
                 negate: true,
@@ -1328,7 +1328,7 @@ impl GrammarDataStack {
                 close_span: span,
             }
         };
-        __data_stack.__stack9.push(res);
+        __data_stack.__stack9.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack9);
         Ok(())
     }
@@ -1352,13 +1352,13 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             let Lexed::Ident(ident) = ident else {
                 unreachable!("Pattern-Ident");
             };
             PatternArgs::Ident(ident)
         };
-        __data_stack.__stack10.push(res);
+        __data_stack.__stack10.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack10);
         Ok(())
     }
@@ -1388,13 +1388,13 @@ impl GrammarDataStack {
         let mut plus = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_plus = __location_stack.pop().unwrap();
         let __rustylr_location_Pattern = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             let Lexed::Plus(plus) = plus else {
                 unreachable!("Pattern-Plus");
             };
             PatternArgs::Plus(Box::new(Pattern), __rustylr_location_plus.span())
         };
-        __data_stack.__stack10.push(res);
+        __data_stack.__stack10.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack10);
         Ok(())
     }
@@ -1424,10 +1424,10 @@ impl GrammarDataStack {
         let mut star = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_star = __location_stack.pop().unwrap();
         let __rustylr_location_Pattern = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             PatternArgs::Star(Box::new(Pattern), __rustylr_location_star.span())
         };
-        __data_stack.__stack10.push(res);
+        __data_stack.__stack10.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack10);
         Ok(())
     }
@@ -1457,10 +1457,10 @@ impl GrammarDataStack {
         let mut question = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_question = __location_stack.pop().unwrap();
         let __rustylr_location_Pattern = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             PatternArgs::Question(Box::new(Pattern), __rustylr_location_question.span())
         };
-        __data_stack.__stack10.push(res);
+        __data_stack.__stack10.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack10);
         Ok(())
     }
@@ -1490,13 +1490,13 @@ impl GrammarDataStack {
         let mut exclamation = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_exclamation = __location_stack.pop().unwrap();
         let __rustylr_location_Pattern = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             PatternArgs::Exclamation(
                 Box::new(Pattern),
                 __rustylr_location_exclamation.span(),
             )
         };
-        __data_stack.__stack10.push(res);
+        __data_stack.__stack10.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack10);
         Ok(())
     }
@@ -1520,8 +1520,8 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut TerminalSet = __data_stack.__stack9.pop().unwrap();
         let __rustylr_location_TerminalSet = __location_stack.pop().unwrap();
-        let res = { PatternArgs::TerminalSet(TerminalSet) };
-        __data_stack.__stack10.push(res);
+        let __res = { PatternArgs::TerminalSet(TerminalSet) };
+        __data_stack.__stack10.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack10);
         Ok(())
     }
@@ -1557,8 +1557,8 @@ impl GrammarDataStack {
         let __rustylr_location_lh = __location_stack.pop().unwrap();
         let __rustylr_location_slash = __location_stack.pop().unwrap();
         let __rustylr_location_p1 = __location_stack.pop().unwrap();
-        let res = { PatternArgs::Lookaheads(Box::new(p1), Box::new(lh)) };
-        __data_stack.__stack10.push(res);
+        let __res = { PatternArgs::Lookaheads(Box::new(p1), Box::new(lh)) };
+        __data_stack.__stack10.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack10);
         Ok(())
     }
@@ -1594,14 +1594,14 @@ impl GrammarDataStack {
         let __rustylr_location_rparen = __location_stack.pop().unwrap();
         let __rustylr_location_Pattern = __location_stack.pop().unwrap();
         let __rustylr_location_lparen = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             PatternArgs::Group(
                 Pattern,
                 __rustylr_location_lparen.span(),
                 __rustylr_location_rparen.span(),
             )
         };
-        __data_stack.__stack10.push(res);
+        __data_stack.__stack10.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack10);
         Ok(())
     }
@@ -1636,7 +1636,7 @@ impl GrammarDataStack {
         let __rustylr_location_rparen = __location_stack.pop().unwrap();
         let __rustylr_location_error = __location_stack.pop().unwrap();
         let __rustylr_location_lparen = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             data.error_recovered
                 .push(RecoveredError {
                     message: "syntax error when parsing GROUP".to_string(),
@@ -1646,7 +1646,7 @@ impl GrammarDataStack {
                 });
             PatternArgs::Ident(format_ident!("dummy"))
         };
-        __data_stack.__stack10.push(res);
+        __data_stack.__stack10.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack10);
         Ok(())
     }
@@ -1670,13 +1670,13 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut literal = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_literal = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             let Lexed::Literal(literal) = literal else {
                 unreachable!("Pattern-Literal");
             };
             PatternArgs::Literal(literal)
         };
-        __data_stack.__stack10.push(res);
+        __data_stack.__stack10.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack10);
         Ok(())
     }
@@ -1712,8 +1712,8 @@ impl GrammarDataStack {
         let __rustylr_location_p2 = __location_stack.pop().unwrap();
         let __rustylr_location_minus = __location_stack.pop().unwrap();
         let __rustylr_location_p1 = __location_stack.pop().unwrap();
-        let res = { PatternArgs::Minus(Box::new(p1), Box::new(p2)) };
-        __data_stack.__stack10.push(res);
+        let __res = { PatternArgs::Minus(Box::new(p1), Box::new(p2)) };
+        __data_stack.__stack10.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack10);
         Ok(())
     }
@@ -1779,7 +1779,7 @@ impl GrammarDataStack {
         let __rustylr_location_lparen = __location_stack.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
         let __rustylr_location_dollar = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             let Lexed::Ident(ident) = ident else {
                 unreachable!("Pattern-Sep-Ident");
             };
@@ -1794,7 +1794,7 @@ impl GrammarDataStack {
             }
             PatternArgs::Sep(Box::new(base), Box::new(del), false, *__rustylr_location0)
         };
-        __data_stack.__stack10.push(res);
+        __data_stack.__stack10.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack10);
         Ok(())
     }
@@ -1866,7 +1866,7 @@ impl GrammarDataStack {
         let __rustylr_location_lparen = __location_stack.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
         let __rustylr_location_dollar = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             let Lexed::Ident(ident) = ident else {
                 unreachable!("Pattern-Sep-Ident");
             };
@@ -1881,7 +1881,7 @@ impl GrammarDataStack {
             }
             PatternArgs::Sep(Box::new(base), Box::new(del), true, *__rustylr_location0)
         };
-        __data_stack.__stack10.push(res);
+        __data_stack.__stack10.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack10);
         Ok(())
     }
@@ -1953,7 +1953,7 @@ impl GrammarDataStack {
         let __rustylr_location_lparen = __location_stack.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
         let __rustylr_location_dollar = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             let Lexed::Ident(ident) = ident else {
                 unreachable!("Pattern-Sep-Ident");
             };
@@ -1968,7 +1968,7 @@ impl GrammarDataStack {
             }
             PatternArgs::Sep(Box::new(base), Box::new(del), false, *__rustylr_location0)
         };
-        __data_stack.__stack10.push(res);
+        __data_stack.__stack10.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack10);
         Ok(())
     }
@@ -2033,7 +2033,7 @@ impl GrammarDataStack {
         let __rustylr_location_lparen = __location_stack.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
         let __rustylr_location_dollar = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             let Lexed::Ident(ident) = ident else {
                 unreachable!("Pattern-Sep-Ident");
             };
@@ -2055,7 +2055,7 @@ impl GrammarDataStack {
                 });
             PatternArgs::Sep(Box::new(base), Box::new(del), false, *__rustylr_location0)
         };
-        __data_stack.__stack10.push(res);
+        __data_stack.__stack10.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack10);
         Ok(())
     }
@@ -2126,7 +2126,7 @@ impl GrammarDataStack {
         let __rustylr_location_lparen = __location_stack.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
         let __rustylr_location_dollar = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             let Lexed::Ident(ident) = ident else {
                 unreachable!("Pattern-Sep-Ident");
             };
@@ -2148,7 +2148,7 @@ impl GrammarDataStack {
                 });
             PatternArgs::Sep(Box::new(base), Box::new(del), false, *__rustylr_location0)
         };
-        __data_stack.__stack10.push(res);
+        __data_stack.__stack10.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack10);
         Ok(())
     }
@@ -2172,13 +2172,13 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut bracegroup = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_bracegroup = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             let Lexed::BraceGroup(group) = bracegroup else {
                 unreachable!("Action0");
             };
             Some(group)
         };
-        __data_stack.__stack3.push(res);
+        __data_stack.__stack3.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack3);
         Ok(())
     }
@@ -2193,8 +2193,8 @@ impl GrammarDataStack {
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
         #[cfg(debug_assertions)] {}
-        let res = { None };
-        __data_stack.__stack3.push(res);
+        let __res = { None };
+        __data_stack.__stack3.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack3);
         Ok(())
     }
@@ -2218,13 +2218,13 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut ident = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_ident = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             let Lexed::Ident(ident) = ident else {
                 unreachable!("IdentOrLiteral-Ident");
             };
             IdentOrLiteral::Ident(ident)
         };
-        __data_stack.__stack11.push(res);
+        __data_stack.__stack11.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack11);
         Ok(())
     }
@@ -2248,13 +2248,13 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut literal = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_literal = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             let Lexed::Literal(literal) = literal else {
                 unreachable!("IdentOrLiteral-Literal");
             };
             IdentOrLiteral::Literal(literal)
         };
-        __data_stack.__stack11.push(res);
+        __data_stack.__stack11.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack11);
         Ok(())
     }
@@ -2278,14 +2278,14 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut t = __data_stack.__stack19.pop().unwrap();
         let __rustylr_location_t = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             let mut tokens = TokenStream::new();
             for token in t.into_iter() {
                 token.append_to_stream(&mut tokens);
             }
             tokens
         };
-        __data_stack.__stack12.push(res);
+        __data_stack.__stack12.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack12);
         Ok(())
     }
@@ -4047,8 +4047,8 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut A = __data_stack.__stack7.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        let res = { vec![A] };
-        __data_stack.__stack13.push(res);
+        let __res = { vec![A] };
+        __data_stack.__stack13.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack13);
         Ok(())
     }
@@ -4078,11 +4078,11 @@ impl GrammarDataStack {
         let mut A = __data_stack.__stack7.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
         let __rustylr_location_Ap = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             Ap.push(A);
             Ap
         };
-        __data_stack.__stack13.push(res);
+        __data_stack.__stack13.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack13);
         Ok(())
     }
@@ -4105,8 +4105,8 @@ impl GrammarDataStack {
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
         #[cfg(debug_assertions)] {}
-        let res = { vec![] };
-        __data_stack.__stack13.push(res);
+        let __res = { vec![] };
+        __data_stack.__stack13.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack13);
         Ok(())
     }
@@ -4130,8 +4130,8 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut A = __data_stack.__stack6.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        let res = { vec![A] };
-        __data_stack.__stack14.push(res);
+        let __res = { vec![A] };
+        __data_stack.__stack14.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack14);
         Ok(())
     }
@@ -4161,11 +4161,11 @@ impl GrammarDataStack {
         let mut A = __data_stack.__stack6.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
         let __rustylr_location_Ap = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             Ap.push(A);
             Ap
         };
-        __data_stack.__stack14.push(res);
+        __data_stack.__stack14.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack14);
         Ok(())
     }
@@ -4188,8 +4188,8 @@ impl GrammarDataStack {
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
         #[cfg(debug_assertions)] {}
-        let res = { vec![] };
-        __data_stack.__stack14.push(res);
+        let __res = { vec![] };
+        __data_stack.__stack14.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack14);
         Ok(())
     }
@@ -4213,8 +4213,8 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut A = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        let res = Some(A);
-        __data_stack.__stack15.push(res);
+        let __res = Some(A);
+        __data_stack.__stack15.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack15);
         Ok(())
     }
@@ -4229,8 +4229,8 @@ impl GrammarDataStack {
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
         #[cfg(debug_assertions)] {}
-        let res = { None };
-        __data_stack.__stack15.push(res);
+        let __res = { None };
+        __data_stack.__stack15.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack15);
         Ok(())
     }
@@ -4254,8 +4254,8 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut A = __data_stack.__stack8.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        let res = { vec![A] };
-        __data_stack.__stack16.push(res);
+        let __res = { vec![A] };
+        __data_stack.__stack16.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack16);
         Ok(())
     }
@@ -4285,11 +4285,11 @@ impl GrammarDataStack {
         let mut A = __data_stack.__stack8.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
         let __rustylr_location_Ap = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             Ap.push(A);
             Ap
         };
-        __data_stack.__stack16.push(res);
+        __data_stack.__stack16.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack16);
         Ok(())
     }
@@ -4312,8 +4312,8 @@ impl GrammarDataStack {
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
         #[cfg(debug_assertions)] {}
-        let res = { vec![] };
-        __data_stack.__stack16.push(res);
+        let __res = { vec![] };
+        __data_stack.__stack16.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack16);
         Ok(())
     }
@@ -4337,8 +4337,8 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut A = __data_stack.__stack10.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        let res = { vec![A] };
-        __data_stack.__stack17.push(res);
+        let __res = { vec![A] };
+        __data_stack.__stack17.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack17);
         Ok(())
     }
@@ -4368,11 +4368,11 @@ impl GrammarDataStack {
         let mut Ap = __data_stack.__stack17.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
         let __rustylr_location_Ap = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             Ap.push(A);
             Ap
         };
-        __data_stack.__stack17.push(res);
+        __data_stack.__stack17.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack17);
         Ok(())
     }
@@ -4395,8 +4395,8 @@ impl GrammarDataStack {
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
         #[cfg(debug_assertions)] {}
-        let res = { vec![] };
-        __data_stack.__stack17.push(res);
+        let __res = { vec![] };
+        __data_stack.__stack17.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack17);
         Ok(())
     }
@@ -4420,8 +4420,8 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut __token0 = __data_stack.__stack17.pop().unwrap();
         let __rustylr_location___token0 = __location_stack.pop().unwrap();
-        let res = { vec![__token0] };
-        __data_stack.__stack18.push(res);
+        let __res = { vec![__token0] };
+        __data_stack.__stack18.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack18);
         Ok(())
     }
@@ -4457,11 +4457,11 @@ impl GrammarDataStack {
         let __rustylr_location___token1 = __location_stack.pop().unwrap();
         __location_stack.pop();
         let __rustylr_location___token0 = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             __token0.push(__token1);
             __token0
         };
-        __data_stack.__stack18.push(res);
+        __data_stack.__stack18.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack18);
         Ok(())
     }
@@ -4485,8 +4485,8 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut A = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        let res = Some(A);
-        __data_stack.__stack15.push(res);
+        let __res = Some(A);
+        __data_stack.__stack15.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack15);
         Ok(())
     }
@@ -4501,8 +4501,8 @@ impl GrammarDataStack {
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
         #[cfg(debug_assertions)] {}
-        let res = { None };
-        __data_stack.__stack15.push(res);
+        let __res = { None };
+        __data_stack.__stack15.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack15);
         Ok(())
     }
@@ -4870,8 +4870,8 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut A = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        let res = { vec![A] };
-        __data_stack.__stack19.push(res);
+        let __res = { vec![A] };
+        __data_stack.__stack19.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack19);
         Ok(())
     }
@@ -4901,11 +4901,11 @@ impl GrammarDataStack {
         let mut A = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
         let __rustylr_location_Ap = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             Ap.push(A);
             Ap
         };
-        __data_stack.__stack19.push(res);
+        __data_stack.__stack19.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack19);
         Ok(())
     }
@@ -4929,8 +4929,8 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut A = __data_stack.__stack11.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        let res = { vec![A] };
-        __data_stack.__stack20.push(res);
+        let __res = { vec![A] };
+        __data_stack.__stack20.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack20);
         Ok(())
     }
@@ -4960,11 +4960,11 @@ impl GrammarDataStack {
         let mut Ap = __data_stack.__stack20.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
         let __rustylr_location_Ap = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             Ap.push(A);
             Ap
         };
-        __data_stack.__stack20.push(res);
+        __data_stack.__stack20.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack20);
         Ok(())
     }
@@ -4988,8 +4988,8 @@ impl GrammarDataStack {
         __data_stack.__tags.truncate(__data_stack.__tags.len() - 1usize);
         let mut A = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
-        let res = { vec![A] };
-        __data_stack.__stack19.push(res);
+        let __res = { vec![A] };
+        __data_stack.__stack19.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack19);
         Ok(())
     }
@@ -5019,11 +5019,11 @@ impl GrammarDataStack {
         let mut A = __data_stack.__terminals.pop().unwrap();
         let __rustylr_location_A = __location_stack.pop().unwrap();
         let __rustylr_location_Ap = __location_stack.pop().unwrap();
-        let res = {
+        let __res = {
             Ap.push(A);
             Ap
         };
-        __data_stack.__stack19.push(res);
+        __data_stack.__stack19.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack19);
         Ok(())
     }
@@ -5046,8 +5046,8 @@ impl GrammarDataStack {
         __rustylr_location0: &mut SpanPair,
     ) -> Result<(), ::rusty_lr_core::DefaultReduceActionError> {
         #[cfg(debug_assertions)] {}
-        let res = { vec![] };
-        __data_stack.__stack19.push(res);
+        let __res = { vec![] };
+        __data_stack.__stack19.push(__res);
         __data_stack.__tags.push(GrammarTags::__stack19);
         Ok(())
     }

From f96c1f7fe697ddcce0b1f5f7be9c9d8e20cb26cf Mon Sep 17 00:00:00 2001
From: Taehwan Kim <ehwank98@gmail.com>
Date: Sat, 9 Aug 2025 17:14:51 +0900
Subject: [PATCH 09/11] fix comments

---
 rusty_lr_core/src/parser/data_stack.rs | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/rusty_lr_core/src/parser/data_stack.rs b/rusty_lr_core/src/parser/data_stack.rs
index 64213148..afbf03e6 100644
--- a/rusty_lr_core/src/parser/data_stack.rs
+++ b/rusty_lr_core/src/parser/data_stack.rs
@@ -1,5 +1,4 @@
-/// A trait for token that holds data.
-/// This will be used for data stack in the parser.
+/// A trait for data stack in the parser.
 pub trait DataStack: Sized + Default {
     /// Type for terminal symbols
     type Term;

From 7ec20d2848f830b2032278872b49d426244922d9 Mon Sep 17 00:00:00 2001
From: Taehwan Kim <ehwank98@gmail.com>
Date: Sat, 9 Aug 2025 17:16:55 +0900
Subject: [PATCH 10/11] rustfmt emit.rs

---
 rusty_lr_parser/src/emit.rs | 63 +++++++++++++++++--------------------
 1 file changed, 29 insertions(+), 34 deletions(-)

diff --git a/rusty_lr_parser/src/emit.rs b/rusty_lr_parser/src/emit.rs
index 7a237adf..90a49977 100644
--- a/rusty_lr_parser/src/emit.rs
+++ b/rusty_lr_parser/src/emit.rs
@@ -1257,8 +1257,10 @@ impl Grammar {
 
                                         match term {
                                             TerminalSymbol::Term(_) => {
-                                                stack_mapto_map.entry(&terminal_stack_name).or_insert_with(Vec::new)
-                                                .push(Some(mapto.clone()));
+                                                stack_mapto_map
+                                                    .entry(&terminal_stack_name)
+                                                    .or_insert_with(Vec::new)
+                                                    .push(Some(mapto.clone()));
                                                 extract_location_stream.extend(quote! {
                                                     let #location_varname = __location_stack.pop().unwrap();
                                                 });
@@ -1290,7 +1292,9 @@ impl Grammar {
                                         }
                                     }
                                     None => {
-                                        stack_mapto_map.entry(&terminal_stack_name).or_insert_with(Vec::new)
+                                        stack_mapto_map
+                                            .entry(&terminal_stack_name)
+                                            .or_insert_with(Vec::new)
                                             .push(None);
                                         extract_location_stream.extend(quote! {
                                             __location_stack.pop();
@@ -1314,7 +1318,9 @@ impl Grammar {
 
                                             if let Some(stack_name) = stack_name {
                                                 // extract token data from args
-                                                stack_mapto_map.entry(&stack_name).or_insert_with(Vec::new)
+                                                stack_mapto_map
+                                                    .entry(&stack_name)
+                                                    .or_insert_with(Vec::new)
                                                     .push(Some(mapto.clone()));
                                                 extract_location_stream.extend(quote! {
                                                     let #location_varname = __location_stack.pop().unwrap();
@@ -1326,7 +1332,6 @@ impl Grammar {
                                                         ) == Some( &#tag_enum_name::#stack_name )
                                                     );
                                                 });
-
                                             } else {
                                                 extract_location_stream.extend(quote! {
                                                     let #location_varname = __location_stack.pop().unwrap();
@@ -1338,12 +1343,13 @@ impl Grammar {
                                                         ) == Some( &#tag_enum_name::#empty_tag_name )
                                                     );
                                                 });
-
                                             }
                                         }
                                         None => {
                                             if let Some(stack_name) = stack_name {
-                                                stack_mapto_map.entry(&stack_name).or_insert_with(Vec::new)
+                                                stack_mapto_map
+                                                    .entry(&stack_name)
+                                                    .or_insert_with(Vec::new)
                                                     .push(None);
                                                 extract_location_stream.extend(quote! {
                                                     __location_stack.pop();
@@ -1381,7 +1387,7 @@ impl Grammar {
                             });
                         }
 
-                        let mut extract_data_stream= TokenStream::new();
+                        let mut extract_data_stream = TokenStream::new();
                         for (stack_name, maptos) in stack_mapto_map {
                             for mapto in maptos {
                                 match mapto {
@@ -1391,7 +1397,7 @@ impl Grammar {
                                         });
                                     }
                                     None => {
-                                        extract_data_stream.extend(quote!{ 
+                                        extract_data_stream.extend(quote! {
                                                 __data_stack.#stack_name.pop();
                                         });
                                     }
@@ -1512,17 +1518,16 @@ impl Grammar {
                         }
 
                         let len = rule.tokens.len();
-                        debug_assert!( len > 0 );
+                        debug_assert!(len > 0);
                         let (stack_pop_stream, stack_push_stream) = if let Some((
                             pop_stack,
                             pop_index_from_back,
                         )) = pop_stack_idx_pair
                         {
-                            if pop_index_from_back == stack_count_map.get(pop_stack).copied().unwrap_or(0) {
-                                (
-                                    quote!{},
-                                    quote!{},
-                                )
+                            if pop_index_from_back
+                                == stack_count_map.get(pop_stack).copied().unwrap_or(0)
+                            {
+                                (quote! {}, quote! {})
                             } else {
                                 (
                                     quote! { let __ret = __data_stack.#pop_stack.swap_remove( __data_stack.#pop_stack.len() - 1  - #pop_index_from_back ); },
@@ -1530,32 +1535,22 @@ impl Grammar {
                                 )
                             }
                         } else {
-                            (
-                                quote! {},
-                                quote! {},
-                            )
+                            (quote! {}, quote! {})
                         };
 
                         let (tags_truncate_stream, tag_push_stream) = if identity_token_idx == 0 {
                             let truncate_len = len - 1;
                             if truncate_len > 0 {
                                 (
-                                    quote!{ __data_stack.#tag_stack_name.truncate(__data_stack.#tag_stack_name.len() - #truncate_len); },
-                                    quote!{}
+                                    quote! { __data_stack.#tag_stack_name.truncate(__data_stack.#tag_stack_name.len() - #truncate_len); },
+                                    quote! {},
                                 )
                             } else {
-                                (
-                                    quote!{},
-                                    quote!{}
-                                )
+                                (quote! {}, quote! {})
                             }
                         } else {
-                            let tag_push_stream = if let Some((
-                                pop_stack,
-                                _,
-                            )) = pop_stack_idx_pair
-                            {
-                                quote!{ __data_stack.#tag_stack_name.push(#tag_enum_name::#pop_stack); }
+                            let tag_push_stream = if let Some((pop_stack, _)) = pop_stack_idx_pair {
+                                quote! { __data_stack.#tag_stack_name.push(#tag_enum_name::#pop_stack); }
                             } else {
                                 quote! {__data_stack.#tag_stack_name.push(#tag_enum_name::#empty_tag_name); }
                             };
@@ -1565,7 +1560,6 @@ impl Grammar {
                             (tags_truncate_stream, tag_push_stream)
                         };
 
-
                         let mut stack_truncate_stream = TokenStream::new();
                         for (stack_name, count) in stack_count_map {
                             debug_assert!(count > 0);
@@ -1573,7 +1567,8 @@ impl Grammar {
                                 __data_stack.#stack_name.truncate(__data_stack.#stack_name.len() - #count);
                             });
                         }
-                        let location_truncate_stream = quote! { __location_stack.truncate(__location_stack.len() - #len); };
+                        let location_truncate_stream =
+                            quote! { __location_stack.truncate(__location_stack.len() - #len); };
 
                         fn_reduce_for_each_rule_stream.extend(quote! {
                             #[doc = #rule_debug_str]
@@ -1745,7 +1740,7 @@ impl Grammar {
             #empty_tag_name,
             #tag_definition_stream
         }
-        
+
         /// enum for each non-terminal and terminal symbol, that actually hold data
         #[allow(unused_braces, unused_parens, non_snake_case, non_camel_case_types)]
         #derive_clone_for_glr

From 22102ba78a7a8b52d10430110a408ccd8eb1277c Mon Sep 17 00:00:00 2001
From: Taehwan Kim <ehwank98@gmail.com>
Date: Sat, 9 Aug 2025 17:45:07 +0900
Subject: [PATCH 11/11] fix suggestions

---
 rusty_lr_core/src/parser/data_stack.rs |  6 ++++++
 rusty_lr_parser/src/emit.rs            | 16 ++++++++--------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/rusty_lr_core/src/parser/data_stack.rs b/rusty_lr_core/src/parser/data_stack.rs
index afbf03e6..96e55298 100644
--- a/rusty_lr_core/src/parser/data_stack.rs
+++ b/rusty_lr_core/src/parser/data_stack.rs
@@ -1,4 +1,10 @@
 /// A trait for data stack in the parser.
+///
+/// Since each non-terminal could have different ruletypes,
+/// this effectively handles those rule types into separated `Vec` stack,
+/// instead of using enum of rule types (since it would be costful at memory aspects if the size differs significantly).
+/// For people who is curious about the implementation details,
+/// you should see the actual generated `DataStack` structs, like `GrammarDataStack` in `rusty_lr_parser/src/parser/parser_expanded.rs`.
 pub trait DataStack: Sized + Default {
     /// Type for terminal symbols
     type Term;
diff --git a/rusty_lr_parser/src/emit.rs b/rusty_lr_parser/src/emit.rs
index 90a49977..da2b3371 100644
--- a/rusty_lr_parser/src/emit.rs
+++ b/rusty_lr_parser/src/emit.rs
@@ -1248,7 +1248,7 @@ impl Grammar {
                         let mut debug_tag_check_stream = TokenStream::new();
                         let mut extract_location_stream = TokenStream::new();
                         let mut stack_mapto_map = std::collections::BTreeMap::new();
-                        for (idx_from_back, token) in rule.tokens.iter().rev().enumerate() {
+                        for (token_index_from_end, token) in rule.tokens.iter().rev().enumerate() {
                             match &token.token {
                                 Token::Term(term) => match &token.mapto {
                                     Some(mapto) => {
@@ -1267,7 +1267,7 @@ impl Grammar {
                                                 debug_tag_check_stream.extend(quote! {
                                                     debug_assert!(
                                                         __data_stack.#tag_stack_name.get(
-                                                            __data_stack.#tag_stack_name.len()-1-#idx_from_back
+                                                            __data_stack.#tag_stack_name.len()-1-#token_index_from_end
                                                         ) == Some( &#tag_enum_name::#terminal_stack_name )
                                                     );
                                                 });
@@ -1279,7 +1279,7 @@ impl Grammar {
                                                 debug_tag_check_stream.extend(quote! {
                                                     debug_assert!(
                                                         __data_stack.#tag_stack_name.get(
-                                                            __data_stack.#tag_stack_name.len()-1-#idx_from_back
+                                                            __data_stack.#tag_stack_name.len()-1-#token_index_from_end
                                                         ) == Some( &#tag_enum_name::#empty_tag_name )
                                                     );
                                                 });
@@ -1302,7 +1302,7 @@ impl Grammar {
                                         debug_tag_check_stream.extend(quote! {
                                             debug_assert!(
                                                 __data_stack.#tag_stack_name.get(
-                                                    __data_stack.#tag_stack_name.len()-1-#idx_from_back
+                                                    __data_stack.#tag_stack_name.len()-1-#token_index_from_end
                                                 ) == Some( &#tag_enum_name::#terminal_stack_name )
                                             );
                                         });
@@ -1328,7 +1328,7 @@ impl Grammar {
                                                 debug_tag_check_stream.extend(quote! {
                                                     debug_assert!(
                                                         __data_stack.#tag_stack_name.get(
-                                                            __data_stack.#tag_stack_name.len()-1-#idx_from_back
+                                                            __data_stack.#tag_stack_name.len()-1-#token_index_from_end
                                                         ) == Some( &#tag_enum_name::#stack_name )
                                                     );
                                                 });
@@ -1339,7 +1339,7 @@ impl Grammar {
                                                 debug_tag_check_stream.extend(quote! {
                                                     debug_assert!(
                                                         __data_stack.#tag_stack_name.get(
-                                                            __data_stack.#tag_stack_name.len()-1-#idx_from_back
+                                                            __data_stack.#tag_stack_name.len()-1-#token_index_from_end
                                                         ) == Some( &#tag_enum_name::#empty_tag_name )
                                                     );
                                                 });
@@ -1357,7 +1357,7 @@ impl Grammar {
                                                 debug_tag_check_stream.extend(quote! {
                                                     debug_assert!(
                                                         __data_stack.#tag_stack_name.get(
-                                                            __data_stack.#tag_stack_name.len()-1-#idx_from_back
+                                                            __data_stack.#tag_stack_name.len()-1-#token_index_from_end
                                                         ) == Some( &#tag_enum_name::#stack_name )
                                                     );
                                                 });
@@ -1368,7 +1368,7 @@ impl Grammar {
                                                 debug_tag_check_stream.extend(quote! {
                                                     debug_assert!(
                                                         __data_stack.#tag_stack_name.get(
-                                                            __data_stack.#tag_stack_name.len()-1-#idx_from_back
+                                                            __data_stack.#tag_stack_name.len()-1-#token_index_from_end
                                                         ) == Some( &#tag_enum_name::#empty_tag_name )
                                                     );
                                                 });
