@@ -87,9 +87,13 @@ newtype Parser m a b = MkParser
87 -- it is done. The used element count is a count of elements
87 -- it is done. The used element count is a count of elements
88 -- consumed by the Alternative. If the Alternative fails we need to
88 -- consumed by the Alternative. If the Alternative fails we need to
89 -- backtrack by this amount.
89 -- backtrack by this amount.
91+ -- The nesting level is used in parseDToK to optimize the case when
92+ -- we are not in an alternative, in that case we do not need to
93+ -- maintain the element count for backtracking.
90 -> (Int, Int)
94 -> (Int, Int)
91 -- The first argument is the (nest level, used count) tuple as
95 -- The first argument is the (nest level, used count) tuple as
92− -- described above. The leftover element count carried as part of
96+ -- described above. The leftover element count is carried as part of
93 -- 'Done' constructor of 'Parse'.
97 -- 'Done' constructor of 'Parse'.
94 -> ((Int, Int) -> Parse b -> m (Driver m a r))
98 -> ((Int, Int) -> Parse b -> m (Driver m a r))
95 -> m (Driver m a r)
99 -> m (Driver m a r)