step :: Token a => Table a -> Shunt a -> Shunt a

-- There is a complete Closed or Postifx operator on the top of the stack.
step _ (S tt (s@(Part y):ss) oo@(os:oss) _) | end y && not (rightOpen y)
  = if discard y
  then let (o:os') = os in S (o:tt) ss (os':oss) MatchedR
  else let ((o:os'):oss') = apply s oo in S (o:tt) ss (os':oss') MatchedR
step :: Token a => Table a -> Shunt a -> Shunt a
step _ (S tt (s@(Part y):ss) oo@(os:oss) _) | end y && not (rightOpen y)
  = if discard y
  then let (o:os') = os in S (o:tt) ss (os':oss) MatchedR
  else let ((o:os'):oss') = apply s oo in S (o:tt) ss (os':oss') MatchedR
step _ (S tt (s@(Part y):ss) oo@(os:oss) _) | end y && not (rightOpen y)
  = if discard y
  then let (o:os') = os in S (o:tt) ss (os':oss) MatchedR
  else let ((o:os'):oss') = apply s oo in S (o:tt) ss (os':oss') MatchedR