Commit f3b9933b authored by POTTIER Francois's avatar POTTIER Francois

Documented [get].

parent d5dd4089
...@@ -2536,6 +2536,18 @@ is done via \verb+i+ successive invocations of \verb+pop+. Thus, ...@@ -2536,6 +2536,18 @@ is done via \verb+i+ successive invocations of \verb+pop+. Thus,
\verb+pop_many 1+ is \verb+pop+. The index \verb+i+ must be nonnegative. The \verb+pop_many 1+ is \verb+pop+. The index \verb+i+ must be nonnegative. The
time complexity is $O(i)$. time complexity is $O(i)$.
%% val get
\begin{verbatim}
val get: int -> 'a env -> element option
\end{verbatim}
\verb+get i env+ returns the parser's \verb+i+-th stack element. The index
\verb+i+ is 0-based: thus, \verb+get 0+ is \verb+top+. If \verb+i+ is greater
than or equal to the number of elements in the stack, \verb+None+ is returned.
\verb+get+ is implemented using \verb+pop_many+ and \verb+top+: its time
complexity is $O(i)$.
%% val positions %% val positions
\begin{verbatim} \begin{verbatim}
......
...@@ -275,7 +275,7 @@ module type INCREMENTAL_ENGINE = sig ...@@ -275,7 +275,7 @@ module type INCREMENTAL_ENGINE = sig
val pop_many: int -> 'a env -> 'a env option val pop_many: int -> 'a env -> 'a env option
(* [get i env] returns the parser's [i]-th stack cell. The index [i] is (* [get i env] returns the parser's [i]-th stack element. The index [i] is
0-based: thus, [get 0] is [top]. If [i] is greater than or equal to the 0-based: thus, [get 0] is [top]. If [i] is greater than or equal to the
number of elements in the stack, [None] is returned. The time complexity number of elements in the stack, [None] is returned. The time complexity
is O(i). *) is O(i). *)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment