252 lines
3.5 KiB
HTML
252 lines
3.5 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of Stdlib.Parsing</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>Stdlib.Parsing</H1>
|
|
Section: OCaml library (3o)<BR>Updated: 2020-01-30<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
Stdlib.Parsing - no description
|
|
<A NAME="lbAC"> </A>
|
|
<H2>Module</H2>
|
|
|
|
Module Stdlib.Parsing
|
|
<A NAME="lbAD"> </A>
|
|
<H2>Documentation</H2>
|
|
|
|
<P>
|
|
Module
|
|
<B>Parsing</B>
|
|
|
|
<BR> :
|
|
<B>(module Stdlib__parsing)</B>
|
|
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val symbol_start </I>
|
|
|
|
:
|
|
<B>unit -> int</B>
|
|
|
|
<P>
|
|
<P>
|
|
<B>symbol_start</B>
|
|
|
|
and
|
|
<B>Parsing.symbol_end</B>
|
|
|
|
are to be called in the
|
|
action part of a grammar rule only. They return the offset of the
|
|
string that matches the left-hand side of the rule:
|
|
<B>symbol_start()</B>
|
|
|
|
returns the offset of the first character;
|
|
<B>symbol_end()</B>
|
|
|
|
returns the
|
|
offset after the last character. The first character in a file is at
|
|
offset 0.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val symbol_end </I>
|
|
|
|
:
|
|
<B>unit -> int</B>
|
|
|
|
<P>
|
|
See
|
|
<B>Parsing.symbol_start</B>
|
|
|
|
.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val rhs_start </I>
|
|
|
|
:
|
|
<B>int -> int</B>
|
|
|
|
<P>
|
|
Same as
|
|
<B>Parsing.symbol_start</B>
|
|
|
|
and
|
|
<B>Parsing.symbol_end</B>
|
|
|
|
, but
|
|
return the offset of the string matching the
|
|
<B>n</B>
|
|
|
|
th item on the
|
|
right-hand side of the rule, where
|
|
<B>n</B>
|
|
|
|
is the integer parameter
|
|
to
|
|
<B>rhs_start</B>
|
|
|
|
and
|
|
<B>rhs_end</B>
|
|
|
|
.
|
|
<B>n</B>
|
|
|
|
is 1 for the leftmost item.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val rhs_end </I>
|
|
|
|
:
|
|
<B>int -> int</B>
|
|
|
|
<P>
|
|
See
|
|
<B>Parsing.rhs_start</B>
|
|
|
|
.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val symbol_start_pos </I>
|
|
|
|
:
|
|
<B>unit -> Lexing.position</B>
|
|
|
|
<P>
|
|
Same as
|
|
<B>symbol_start</B>
|
|
|
|
, but return a
|
|
<B>position</B>
|
|
|
|
instead of an offset.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val symbol_end_pos </I>
|
|
|
|
:
|
|
<B>unit -> Lexing.position</B>
|
|
|
|
<P>
|
|
Same as
|
|
<B>symbol_end</B>
|
|
|
|
, but return a
|
|
<B>position</B>
|
|
|
|
instead of an offset.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val rhs_start_pos </I>
|
|
|
|
:
|
|
<B>int -> Lexing.position</B>
|
|
|
|
<P>
|
|
Same as
|
|
<B>rhs_start</B>
|
|
|
|
, but return a
|
|
<B>position</B>
|
|
|
|
instead of an offset.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val rhs_end_pos </I>
|
|
|
|
:
|
|
<B>int -> Lexing.position</B>
|
|
|
|
<P>
|
|
Same as
|
|
<B>rhs_end</B>
|
|
|
|
, but return a
|
|
<B>position</B>
|
|
|
|
instead of an offset.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val clear_parser </I>
|
|
|
|
:
|
|
<B>unit -> unit</B>
|
|
|
|
<P>
|
|
Empty the parser stack. Call it just after a parsing function
|
|
has returned, to remove all pointers from the parser stack
|
|
to structures that were built by semantic actions during parsing.
|
|
This is optional, but lowers the memory requirements of the
|
|
programs.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>exception Parse_error </I>
|
|
|
|
<P>
|
|
<P>
|
|
Raised when a parser encounters a syntax error.
|
|
Can also be raised from the action part of a grammar rule,
|
|
to initiate error recovery.
|
|
<P>
|
|
<P>
|
|
<P>
|
|
<I>val set_trace </I>
|
|
|
|
:
|
|
<B>bool -> bool</B>
|
|
|
|
<P>
|
|
Control debugging support for
|
|
<B>ocamlyacc</B>
|
|
|
|
-generated parsers.
|
|
After
|
|
<B>Parsing.set_trace true</B>
|
|
|
|
, the pushdown automaton that
|
|
executes the parsers prints a trace of its actions (reading a token,
|
|
shifting a state, reducing by a rule) on standard output.
|
|
<B>Parsing.set_trace false</B>
|
|
|
|
turns this debugging trace off.
|
|
The boolean returned is the previous state of the trace flag.
|
|
<P>
|
|
<P>
|
|
<B>Since</B>
|
|
|
|
3.11.0
|
|
<P>
|
|
<P>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="2"><A HREF="#lbAC">Module</A><DD>
|
|
<DT id="3"><A HREF="#lbAD">Documentation</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:57 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|