aftermath of PR#5497

git-svn-id: http://caml.inria.fr/svn/ocamldoc/trunk@12182 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Damien Doligez 2012-02-23 19:10:33 +00:00
parent 85e10f36c0
commit 53a3bd934e
16 changed files with 273 additions and 496 deletions

View File

@ -1,6 +1,6 @@
# $Id$
FILES=allfiles.tex biblio.tex foreword.tex version.tex warnings.tex
FILES=allfiles.tex biblio.tex foreword.tex version.tex warnings.etex
TEXINPUTS=.:..:../refman:../library:../cmds:../tutorials:../../styles:
TEXFONTS=../../styles:
RELEASE=$$HOME/release/$${RELEASENAME}
@ -102,7 +102,7 @@ clean:
cd htmlman; rm -rf libref index.html manual*.html *.haux *.hind
cd textman; rm -f manual.txt *.haux *.hind
cd infoman; rm -f ocaml.info ocaml.info-* *.haux *.hind
rm -f warnings.tex
rm -f warnings.etex
release:
gzip < texstuff/manual.dvi > $(RELEASE)refman.dvi.gz
@ -124,5 +124,5 @@ release:
version.tex: $(SRC)/VERSION
sed -n -e '1s/^\([0-9]*\.[0-9]*\).*$$/\\def\\ocamlversion{\1}/p' $(SRC)/VERSION > version.tex
warnings.tex: $(SRC)/utils/warnings.ml $(SRC)/ocamlc
$(SRC)/boot/ocamlrun $(SRC)/ocamlc -warn-help | sed -e 's/^ *\([0-9A-Z][0-9]*\)\(.*\)/\\item[\1] \2/' > warnings.tex
warnings.etex: $(SRC)/utils/warnings.ml $(SRC)/ocamlc
$(SRC)/boot/ocamlrun $(SRC)/ocamlc -warn-help | sed -e 's/^ *\([0-9A-Z][0-9]*\)\(.*\)/\\item[\1] \2/' > warnings.etex

View File

@ -17,6 +17,9 @@ clean:
.etex.tex:
$(TEXQUOTE) < $*.etex > $*.tex
ocamldoc.tex: ocamldoc.etex $(TRANSF)
$(TRANSF) < ocamldoc.etex | $(TEXQUOTE) > ocamldoc.tex
top.tex: top.etex $(TRANSF)
$(TRANSF) < top.etex | $(TEXQUOTE) > top.tex
@ -26,5 +29,5 @@ lexyacc.tex: lexyacc.etex $(TRANSF)
debugger.tex: debugger.etex $(TRANSF)
$(TRANSF) < debugger.etex | $(TEXQUOTE) > debugger.tex
warnings.tex: ../warnings.tex
cp ../warnings.tex .
warnings.etex: ../warnings.etex
cp ../warnings.etex .

View File

@ -432,7 +432,7 @@ Show description for all available warning numbers.
Print the location of the standard library, then exit.
\item["-" \var{file}]
Process \var{file} as a file name, even if it starts with a dash (-)
Process \var{file} as a file name, even if it starts with a dash ("-")
character.
\item["-help" or "--help"]

View File

@ -32,7 +32,7 @@ The OCaml debugger is invoked by running the program
"ocamldebug" with the name of the bytecode executable file as first
argument:
\begin{alltt}
ocamldebug [\var{options}] \var{program} [\var{arguments}]
ocamldebug \optvar{options} \var{program} \optvar{arguments}
\end{alltt}
The arguments following \var{program} are optional, and are passed as
command-line arguments to the program being debugged. (See also the

View File

@ -1,291 +0,0 @@
\chapter{Installation instructions} \label{c:install}
This chapter explains how to install Caml Light on your machine.
\section{The Unix version}
\begin{requirements}
Any machine that runs under one of the various flavors of the Unix
operating system, and that has a flat, non-segmented, 32-bit or 64-bit
address space. 4M of RAM, 2M of free disk space. The graphics library
requires X11 release 4 or later.
\end{requirements}
\begin{installation}
The Unix version is distributed in source format, as a compressed
"tar" file named "cl7unix.tar.Z". To extract, move to the directory
where you want the source files to reside, transfer "cl7unix.tar.Z"
to that directory, and execute
\begin{verbatim}
zcat cl7unix.tar.Z | tar xBf -
\end{verbatim}
This extracts the source files in the current directory. The file
"INSTALL" contains complete instructions on how to configure, compile
and install Caml Light. Read it and follow the instructions.
\end{installation}
\begin{troubleshooting}
See the file "INSTALL".
\end{troubleshooting}
\section{The Macintosh version}
\begin{requirements}
Any Macintosh with at least 1M of RAM (2M is recommended), running
System 6~or~7. About 850K of free space on the disk. The parts of the
Caml Light system that support batch compilation currently require the
Macintosh Programmer's Workshop (MPW) version 3.2. MPW is
Apple's development environment, and it is distributed by APDA,
Apple's Programmers and Developers Association. See the file "READ ME"
in the distribution for APDA's address.
\end{requirements}
\begin{installation}
Create the folder where the Caml Light files will reside. Double-click
on the file "cl7macbin.sea" from the distribution. This displays
a file dialog box. Open the folder where the Caml Light files will
reside, and click on the "Extract" button. This will re-create all
files from the distribution in the Caml Light folder.
To test the installation, double-click on the application
{\tt Caml Light}. The ``Caml Light output'' window should display
something like
\begin{verbatim}
> Caml Light version 0.7
#
\end{verbatim}
In the ``Caml Light input'' window, enter \verb"1+2;;" and
press the "Return" key. The ``Caml Light output'' window should
display:
\begin{verbatim}
> Caml Light version 0.7
#1+2;;
- : int = 3
#
\end{verbatim}
Select ``Quit'' from the ``File'' menu to return to the Finder.
\medskip
If you have MPW, you can install the batch compilation tools as
follows. The tools and scripts from the "tools" folder must reside in a
place where MPW will find them as commands. There are two ways to
achieve this result: either copy the files in the "tools" folder to the
"Tools" or the "Scripts" folder in your MPW folder; or keep the files
in the "tools" folder and add the following line to your "UserStartup"
file (assuming Caml Light resides in folder "Caml Light" on the disk
named "My HD"):
\begin{verbatim}
Set Commands "{Commands},My HD:Caml Light:tools:"
\end{verbatim}
In either case, you now have to edit the "camlc"
script, and replace the string
\begin{verbatim}
Macintosh HD:Caml Light:lib:
\end{verbatim}
(in the first line) with the actual pathname of the "lib" folder. For
example, if you put Caml Light in folder "Caml Light" on the disk
named "My HD", the first line of "camlc" should read:
\begin{verbatim}
Set stdlib "My HD:Caml Light:lib:"
\end{verbatim}
\end{installation}
\begin{troubleshooting}
Here is one commonly encountered problem.
\begin{options}
\item["Cannot find file stream.zi"]
(Displayed in the ``Caml Light output'' window, with an alert box telling
you that Caml Light has terminated abnormally.) This is an
installation error. The folder named "lib" in the distribution must
always be in the same folder as the "Caml Light" application. It's OK
to move the application to another folder; but remember to move the "lib"
directory to the same folder. (To return to the Finder, first select
``Quit'' from the ``File'' menu.)
\end{options}
\end{troubleshooting}
\section{The PC version}
\begin{requirements} A PC equipped with a 80386, 80486 or Pentium
processor, running MS-DOS version 3.3 or later. Older Intel processors
(8086, 80286) are no longer supported. 2M of RAM. About 1.2M of free
space on the disk. The graphics primitives require a VGA or SuperVGA
video card.
\end{requirements}
\begin{installation}
In the following, we assume that the distribution files resides in
drive "A:", and that the hard disk on which you are installing Caml
Light is drive "C:". If this is not the case, replace "A:" and "C:" by
the appropriate drives.
Create a directory on the hard disk where Caml Light will reside. In
the following, we assume that this directory is named
\verb"C:\caml". If you choose a different directory, replace
\verb"C:\caml" in the following by the appropriate absolute path
name. Then, execute the following commands:
\begin{verbatim}
cd C:\caml
A:pkunzip -d A:cl7pc
\end{verbatim}
(Be careful not to omit the "-d" option to "pkunzip".) This extracts
all files in the \verb"C:\caml" directory.
Select or create a directory where Caml Light will put its temporary
files. Many machines already have a \verb"C:\tmp" directory for
that purpose. If it does not exist, create it.
For the remainder of the configuration process, you will have to
determine two things:
\begin{itemize}
\item does your machine contain floating-point hardware --- that is,
a 387 coprocessor, a 486DX or Pentium processor, or a 487SX
(co-)processor? (If you really don't know, assume no floating-point
hardware.)
\item what kind of SuperVGA card do you have? Caml Light has graphics
primitives that work on any VGA card in 320x200 pixels, 256 colors,
but it can take advantage of the extra possibilities of various
SuperVGA cards to work at higher resolution. To do so, you must
determine which chipset is used in your SuperVGA card. Re-read the
documentation for the card, then look at the files with extension
".GRD" or ".GRN" (the graphics drivers) in directory
\verb"C:\caml\dev", and find one whose name seems to match the name
of the chipset. If you can't determine which graphics driver to use,
don't worry: you'll stick with the default VGA graphics, that's all.
\end{itemize}
%
Now, edit the \verb"C:\autoexec.bat" file, in order to:
\begin{itemize}
\item Add \verb"C:\caml\bin" to the "PATH" variable; that is, transform
the line that reads
\begin{verbatim}
SET PATH=C:\dos;...
\end{verbatim}
into
\begin{verbatim}
SET PATH=C:\dos;...;C:\caml\bin
\end{verbatim}
\item Insert the following lines
\begin{verbatim}
SET CAMLLIB=C:\caml\lib
SET GO32TMP=C:\tmp
\end{verbatim}
\item If your machine has floating-point hardware, insert the
following line:
\begin{verbatim}
SET GO32=driver C:\caml\dev\graph.grd gw 640 gh 480
\end{verbatim}
where "graph.grd" stands for the name of the graphics driver for your
SuperVGA card, as determined above. The "640" and "480" specify the
default graphics resolution to use; you can put "800" and "600", or
"1024" and "768" instead, depending on your taste and the capabilities
of your card.
If you were unable to determine the correct graphics driver, do not
insert anything, leaving the "GO32" variable undefined.
\item If your machine has no floating-point hardware, insert the
following line:
\begin{verbatim}
SET GO32=emu C:\caml\dev\emu387 driver C:\caml\dev\graph.grd gw 640 gh 480
\end{verbatim}
%% (on a single line; we had to fold the line above for typesetting)
where "graph.grd" stands for the name of the graphics driver for your
SuperVGA card, as determined above. As explained in the previous item,
you can choose another default graphics resolution instead of "640" and
"480".
If you were unable to determine the correct graphics driver, insert
the following line instead:
\begin{verbatim}
SET GO32=emu C:\caml\dev\emu387
\end{verbatim}
\end{itemize}
Then, save the "autoexec.bat" file and restart the machine. To test
the installation, execute:
\begin{verbatim}
camlc -v
\end{verbatim}
The "camlc" command should print something like:
\begin{verbatim}
The Caml Light system for the 80386 PC, version 0.7
(standard library from C:\caml\lib)
The Caml Light runtime system, version 0.7
The Caml Light compiler, version 0.7
The Caml Light linker, version 0.7
\end{verbatim}
Then, execute:
\begin{verbatim}
caml
\end{verbatim}
The "caml" command should print something like:
\begin{verbatim}
> Caml Light version 0.7
#
\end{verbatim}
In response to the \verb"#" prompt, type:
\begin{verbatim}
quit();;
\end{verbatim}
This should get you back to the DOS command interpreter.
\end{installation}
\begin{troubleshooting}
Here are some commonly encountered problems.
\begin{options}
\item["Cannot find the bytecode file" or "camlrun.exe: No such file"]
The installation has been performed incorrectly. Double-check the
"autoexec.bat" file for errors in setting the "PATH" and "CAMLLIB"
variables.
\item["CPU must be a 386 to run this program"]
Self-explanatory. It's about time you buy a 386 PC or better.
\item["CPU must be in REAL mode (not V86 mode) to run this program"]
Ah. That's a tricky one. A number of utility programs switch the 80386
processor to a particular mode, called ``Virtual 86'' or ``V86'' mode,
that prevents 32-bit protected-mode applications like the 80386 PC
version of Caml Light from starting. These programs include:
\begin{itemize}
\item device drivers that provide memory management services
\item device drivers that provide enhanced debugging possibilities,
such as "tdh386.sys" from Turbo Debugger.
\end{itemize}
The 80386 PC version cannot start when any of these programs is
active. To solve the problem, remove the guilty device drivers from
your "config.sys" file.
On the other hand, the 80386 PC version knows how to cohabit with
DPMI-compliant or VCPI-compliant environments and memory managers.
These include Windows 3, Desqview, and the "EMM386", "QEMM386" and "386MAX"
memory managers. In the case of "EMM386.EXE" from the MS-DOS
distribution, EMS must be enabled (do not give it the "NOEMS" option).
If you run the 80386 PC under a VCPI-compliant memory manager,
configure the memory manager so that it allocates at least 1M of EMS,
and preferably 2M or more.
\item[Caml Light runs slowly and does a lot of disk accesses]
When Caml Light cannot allocate the RAM it requires, it starts paging
to a disk file, which considerably slows down execution. To avoid
this, make sure that at least 1M or memory is available to Caml Light,
and preferably 2M. Caml Light uses XMS memory if you are not running
under a VCPI-compliant memory manager, and EMS memory if you are
running under a VCPI-compliant memory manager. In the latter case,
make sure to configure the memory manager so that it can allocate
enough EMS.
\end{options}
\end{troubleshooting}

View File

@ -588,10 +588,10 @@ containing "hash_variant(\"VConstr\")" and field number 1 containing
Unlike constructed values, polymorphic variant values taking several
arguments are not flattened.
That is, "`VConstr("\var{v}", "\var{v'}")" is represented by a block
That is, "`VConstr("\var{v}", "\var{w}")" is represented by a block
of size 2, whose field number 1 contains the representation of the
pair "("\var{v}", "\var{v'}")", rather than a block of size 3
containing \var{v} and \var{v'} in fields 1 and 2.
pair "("\var{v}", "\var{w}")", rather than a block of size 3
containing \var{v} and \var{w} in fields 1 and 2.
\section{Operations on values}
\pdfsection{Operations on values}
@ -1044,7 +1044,7 @@ value alloc_list_int(int i1, int i2)
CAMLparam0 ();
CAMLlocal2 (result, r);
r = caml_alloc_small(2, 0); /* Allocate a cons cell */
r = caml_alloc_small(2, 0); /* Allocate a cons cell */
Field(r, 0) = Val_int(i2); /* car = the integer i2 */
Field(r, 1) = Val_int(0); /* cdr = the empty list [] */
result = caml_alloc_small(2, 0); /* Allocate the other cons cell */
@ -1482,7 +1482,7 @@ just like any C functions. The OCaml functions are defined in the
following "mod.ml" OCaml source:
\begin{verbatim}
(* File mod.ml -- some ``useful'' OCaml functions *)
(* File mod.ml -- some "useful" OCaml functions *)
let rec fib n = if n < 2 then 1 else fib(n-1) + fib(n-2)

View File

@ -77,25 +77,18 @@ Display a short usage summary and exit.
\section{Syntax of lexer definitions}
The format of lexer definitions is as follows:
\begingroup%
\newcommand{\sub}[1]{$_{#1}$}%
\renewcommand{\{}{\char`\{}%
\renewcommand{\}}{\char`\}}%
\renewcommand{\\}{\char`\\}%
\renewcommand{\%}{\char`\%}%
\begin{alltt}
\{ \var{header} \}
let \var{ident} = \var{regexp} \ldots
rule \var{entrypoint} [\var{arg\sub{1}}\ldots{} \var{arg\sub{n}}] =
rule \var{entrypoint} [\nth{arg}{1}\ldots{} \nth{arg}{n}] =
parse \var{regexp} \{ \var{action} \}
| \ldots
| \var{regexp} \{ \var{action} \}
and \var{entrypoint} [\var{arg\sub{1}}\ldots{} \var{arg\sub{n}}] =
and \var{entrypoint} [\nth{arg}{1}\ldots{} \nth{arg}{n}] =
parse \ldots
and \ldots
\{ \var{trailer} \}
\end{alltt}
\endgroup
Comments are delimited by "(*" and "*)", as in OCaml.
The "parse" keyword, can be replaced by the "shortest" keyword, with
the semantic consequences explained below.
@ -162,7 +155,7 @@ A character constant, with the same syntax as OCaml character
constants. Match the denoted character.
\item["_"]
(Underscore.) Match any character.
(underscore) Match any character.
\item[@"eof"@]
Match the end of the lexer input.\\
@ -188,7 +181,7 @@ Match any single character not belonging to the given character set.
\item[@regexp_1 '#' regexp_2@]
(Difference of character sets).
(difference of character sets)
Regular expressions @regexp_1@ and @regexp_2@ must be character sets
defined with @'['\ldots ']'@ (or a a single character expression or
underscore "_").
@ -196,21 +189,21 @@ Match the difference of the two specified character sets.
\item[@regexp '*'@]
(Repetition.) Match the concatenation of zero or more
(repetition) Match the concatenation of zero or more
strings that match @regexp@.
\item[@regexp '+'@]
(Strict repetition.) Match the concatenation of one or more
(strict repetition) Match the concatenation of one or more
strings that match @regexp@.
\item[@regexp '?'@]
(Option.) Match either the empty string, or a string matching @regexp@.
(option) Match the empty string, or a string matching @regexp@.
\item[@regexp_1 '|' regexp_2@]
(Alternative.) Match any string that matches either @regexp_1@ or @regexp_2@
(alternative) Match any string that matches @regexp_1@ or @regexp_2@
\item[@regexp_1 regexp_2@]
(Concatenation.) Match the concatenation of two strings, the first
(concatenation) Match the concatenation of two strings, the first
matching @regexp_1@, the second matching @regexp_2@.
\item[@'(' regexp ')'@]
@ -344,11 +337,6 @@ the concrete type "token", defined in the interface file
\section{Syntax of grammar definitions}
Grammar definitions have the following format:
\begingroup%
\renewcommand{\{}{\char`\{}%
\renewcommand{\}}{\char`\}}%
\renewcommand{\\}{\char`\\}%
\renewcommand{\%}{\char`\%}%
\begin{alltt}
\%\{
\var{header}
@ -359,7 +347,6 @@ Grammar definitions have the following format:
\%\%
\var{trailer}
\end{alltt}
\endgroup
Comments are enclosed between \verb|/*| and \verb|*/| (as in C) in the
``declarations'' and ``rules'' sections, and between \verb|(*| and
@ -459,12 +446,6 @@ resolve reduce/reduce and shift/reduce conflicts:
\subsection{Rules}
The syntax for rules is as usual:
\begingroup%
\newcommand{\sub}[1]{$_{#1}$}%
\renewcommand{\{}{\char`\{}%
\renewcommand{\}}{\char`\}}%
\renewcommand{\\}{\char`\\}%
\renewcommand{\%}{\char`\%}%
\begin{alltt}
\var{nonterminal} :
\var{symbol} \ldots \var{symbol} \{ \var{semantic-action} \}
@ -472,7 +453,6 @@ The syntax for rules is as usual:
| \var{symbol} \ldots \var{symbol} \{ \var{semantic-action} \}
;
\end{alltt}
\endgroup
%
Rules can also contain the \verb"%prec "{\it symbol} directive in the
right-hand side part, to override the default precedence and
@ -674,7 +654,7 @@ rule token = parse
\end{verbatim}
\item[ocamllex: Position memory overflow, too many bindings]
The deterministic automata generated by "ocamllex" maintains a table of
The deterministic automata generated by "ocamllex" maintain a table of
positions inside the scanned lexer buffer. The size of this table is
limited to at most 255 cells. This error should not show up in normal
situations.

View File

@ -97,7 +97,7 @@ read with the "-load" option in a subsequent invocation of "ocamldoc".
\item["-hide" \var{modules}]
Hide the given complete module names in the generated documentation.
\var{modules} is a list of complete module names are separated
\var{modules} is a list of complete module names separated
by '","', without blanks. For instance: "Pervasives,M2.M3".
\item["-inv-merge-ml-mli"]
@ -124,20 +124,20 @@ Specify merge options between interfaces and implementations.
\var{flags} can be one or several of the following characters:
\begin{options}
\item["d"] merge description
\item["a"] merge @author
\item["v"] merge @version
\item["l"] merge @see
\item["s"] merge @since
\item["b"] merge @before
\item["o"] merge @deprecated
\item["p"] merge @param
\item["e"] merge @raise
\item["r"] merge @return
\item["a"] merge "\@author"
\item["v"] merge "\@version"
\item["l"] merge "\@see"
\item["s"] merge "\@since"
\item["b"] merge "\@before"
\item["o"] merge "\@deprecated"
\item["p"] merge "\@param"
\item["e"] merge "\@raise"
\item["r"] merge "\@return"
\item["A"] merge everything
\end{options}
\item["-no-custom-tags"]
Do not allow custom @-tags (see section \ref{s:ocamldoc-tags}).
Do not allow custom \@-tags (see section \ref{s:ocamldoc-tags}).
\item["-no-stop"]
Keep elements placed after/between the "(**/**)" special comment(s)
@ -174,7 +174,8 @@ line of comments.
Use \var{title} as the title for the generated documentation.
\item["-intro" \var{file}]
Use content of \var{file} as ocamldoc text to use as introduction (HTML, \LaTeX and TeXinfo only).
Use content of \var{file} as ocamldoc text to use as introduction (HTML,
\LaTeX{} and TeXinfo only).
For HTML, the file is used to create the whole "index.html" file.
\item["-v"]
@ -229,7 +230,7 @@ Display the complete list of parameters for functions and methods.
Use \var{filename} as the Cascading Style Sheet file.
\item["-colorize-code"]
Colorize the OCaml code enclosed in "[ ]" and "\{[ ]\}", using colors
Colorize the OCaml code enclosed in "[ ]" and "{[ ]}", using colors
to emphasize keywords, etc. If the code fragments are not
syntactically correct, no color is added.
@ -367,9 +368,9 @@ following rules:
\item Only elements (values, types, classes, ...) declared in the ".mli"
file are kept. In other terms, definitions from the ".ml" file that are
not exported in the ".mli" file are not documented.
\item Descriptions of elements and descriptions in @-tags are handled
\item Descriptions of elements and descriptions in \@-tags are handled
as follows. If a description for the same element or in the same
@-tag of the same element is present in both files, then the
\@-tag of the same element is present in both files, then the
description of the ".ml" file is concatenated to the one in the ".mli" file,
if the corresponding "-m" flag is given on the command line.
If a description is present in the ".ml" file and not in the
@ -440,11 +441,11 @@ A special comment after an element is associated to this element if
there is no blank line or comment between the special comment and the
element.
There are two exceptions: for type constructors and record fields in
There are two exceptions: for constructors and record fields in
type definitions, the associated comment can only be placed after the
constructor or field definition, without blank lines or other comments
between them. The special comment for a type constructor
with another type constructor following must be placed before the '|'
between them. The special comment for a constructor
with another constructor following must be placed before the '"|"'
character separating the two constructors.
The following sample interface file "foo.mli" illustrates the
@ -566,11 +567,11 @@ module type my_module_type =
A special comment is associated to an element if it is placed before
the element and there is no blank line between the comment and the
element. Meanwhile, there can be a simple comment between the special
comment and the element. There are two exceptions, for type
comment and the element. There are two exceptions, for
constructors and record fields in type definitions, whose associated
comment must be placed after the constructor or field definition,
without blank line between them. The special comment for a type constructor
with another type constructor following must be placed before the '|'
without blank line between them. The special comment for a constructor
with another constructor following must be placed before the '"|"'
character separating the two constructors.
The following example of file "toto.ml" shows where to place comments
@ -578,7 +579,7 @@ in a ".ml" file.
\begin{verbatim}
(** The first special comment of the file is the comment associated
to the whole module.*)
to the whole module. *)
(** The comment for function f *)
let f x y = x + y
@ -686,7 +687,7 @@ comments to be ignored.
The inside of documentation comments "(**"\ldots"*)" consists of
free-form text with optional formatting annotations, followed by
optional {\em tags} giving more specific information about parameters,
version, authors, \ldots\ The tags are distinguished by a leading @
version, authors, \ldots\ The tags are distinguished by a leading "\@"
character. Thus, a documentation comment has the following shape:
\begin{verbatim}
(** The comment begins with a description, which is text formatted
@ -696,10 +697,10 @@ character. Thus, a documentation comment has the following shape:
@param x description for parameter x
*)
\end{verbatim}
Some elements support only a subset of all @-tags. Tags that are not
Some elements support only a subset of all \@-tags. Tags that are not
relevant to the documented element are simply ignored. For instance,
all tags are ignored when documenting type constructors, record
fields, and class inheritance clauses. Similarly, a "@param" tag on a
fields, and class inheritance clauses. Similarly, a "\@param" tag on a
class instance variable is ignored.
At last, "(**)" is the empty documentation comment.
@ -712,54 +713,59 @@ text descriptions.
\newpage
\noindent{\it text} ::= ({\it text\_element})"+"\\
\begin{syntax}
text: {{text-element}}
;
\end{syntax}
\noindent{}@text-element@ ::= \\
\noindent{\it text\_element} ::= \\
\begin{tabular}{@{}lp{10cm}}
{\tt | \{[0-9]+ {\it text}\}} & format {\it text} as a section header;
\begin{tabular}{rlp{10cm}}
@||@&@ '{' {{ "0" \ldots "9" }} text '}' @ & format @text@ as a section header;
the integer following "{" indicates the sectioning level. \\
{\tt | \{[0-9]+:{\it label} {\it text}\}} &
same, but also associate the name {\it label} to the current point.
@||@&@ '{' {{ "0" \ldots "9" }} ':' lbl text '}' @ &
same, but also associate the name @lbl@ to the current point.
This point can be referenced by its fully-qualified label in a
"{!" command, just like any other element. \\
{\tt | \{b {\it text}\}} & set {\it text} in bold. \\
{\tt | \{i {\it text}\}} & set {\it text} in italic. \\
{\tt | \{e {\it text}\}} & emphasize {\it text}. \\
{\tt | \{C {\it text}\}} & center {\it text}. \\
{\tt | \{L {\it text}\}} & left align {\it text}. \\
{\tt | \{R {\it text}\}} & right align {\it text}. \\
{\tt | \{ul {\it list}\}} & build a list. \\
{\tt | \{ol {\it list}\}} & build an enumerated list. \\
{\tt | \{\{:{\it string}\}{\it text}\}} & put a link to the given address
(given as a string) on the given text. \\
{\tt | [{\it string}]} & set the given {\it string} in source code style. \\
{\tt | \{[{\it string}]\}} & set the given {\it string} in preformatted
@||@&@ '{b' text '}' @ & set @text@ in bold. \\
@||@&@ '{i' text '}' @ & set @text@ in italic. \\
@||@&@ '{e' text '}' @ & emphasize @text@. \\
@||@&@ '{C' text '}' @ & center @text@. \\
@||@&@ '{L' text '}' @ & left align @text@. \\
@||@&@ '{R' text '}' @ & right align @text@. \\
@||@&@ '{ul' list '}' @ & build a list. \\
@||@&@ '{ol' list '}' @ & build an enumerated list. \\
@||@&@ '{{:' string '}' text '}' @ & put a link to the given address
(given as @string@) on the given @text@. \\
@||@&@ '[' string ']' @ & set the given @string@ in source code style. \\
@||@&@ '{[' string ']}' @ & set the given @string@ in preformatted
source code style.\\
{\tt | \{v {\it string} v\}} & set the given {\it string} in verbatim style. \\
{\tt | \{\% {\it string} \%\}} & take the given {\it string}
as raw \LaTeX\ code.\\
{\tt | \{!{\it string}\}} & insert a reference to the element named
{\it string}. {\it string} must be a fully qualified element name,
for example {\tt Foo.Bar.t}. The kind of the referenced element can be forced
@||@&@ '{v' string 'v}' @ & set the given @string@ in verbatim style. \\
@||@&@ '{%' string '%}' @ & take the given @string@ as raw \LaTeX\ code.\\
@||@&@ '{!' string '}' @ & insert a reference to the element named
@string@. @string@ must be a fully qualified element name,
for example "Foo.Bar.t". The kind of the referenced element can be forced
(useful when various elements have the same qualified name) with the following
syntax: {\tt\{!{\it kind}: Foo.Bar.t\}} where {\tt \it kind} can be
{\tt module}, {\tt modtype}, {\tt class}, {\tt classtype}, {\tt val},
{\tt type}, {\tt exception}, {\tt attribute}, {\tt method} or {\tt section}.\\
{\tt | \{!modules: {\it string} {\it string} ...\}} & insert an index table
syntax: @ '{!' kind ':' string '}' @ where @kind@ can be
"module", "modtype", "class", "classtype", "val",
"type", "exception", "attribute", "method" or "section".\\
@||@&@ '{!modules:' string string ... '}' @ & insert an index table
for the given module names. Used in HTML only.\\
{\tt | \{!indexlist\}} & insert a table of links to the various indexes
@||@&@ '{!indexlist}' @ & insert a table of links to the various indexes
(types, values, modules, ...). Used in HTML only.\\
{\tt | \{\^{} {\it text}\}} & set text in superscript.\\
{\tt | \{\_ {\it text}\}} & set text in subscript.\\
{\tt | {\it escaped\_string}} & typeset the given string as is;
special characters ('{\tt \{}', '{\tt \}}', '{\tt [}', '{\tt ]}' and '{\tt @}')
must be escaped by a '{\tt \textbackslash}'\\
{\tt | {\it blank\_line} } & force a new line.
@||@&@ '{^' text '}' @ & set text in superscript.\\
@||@&@ '{_' text '}' @ & set text in subscript.\\
@||@&@ escaped-string @ & typeset the given string as is;
special characters ('"{"', '"}"', '"["', '"]"' and '"\@"')
must be escaped by a '"\\"'\\
@||@&@ blank-line @ & force a new line.
\end{tabular} \\
\noindent{\it list} ::= \\
{}~~{\tt | (\{- {\it text}\})+}\\
{}~~{\tt | (\{li {\it text}\})+}\\
\begin{syntax}
list:
| {{ '{-' text '}' }}
| {{ '{li' text '}' }}
\end{syntax}
A shortcut syntax exists for lists and enumerated lists:
\begin{verbatim}
@ -792,66 +798,67 @@ is composed of the first characters of the description, until
\item the first blank line
\end{itemize}
outside of the following text formatting :
{\tt \{ul {\em list}\}},
{\tt \{ol {\em list}\}},
{\tt [{\em string}]},
{\tt \{[{\em string}]\}},
{\tt \{v {\em string} v\}},
{\tt \{\% {\em string}\%\}},
{\tt \{!{\em string}\}},
{\tt \{\^{} {\em text}\}},
{\tt \{\_ {\em text}\}}.
@ '{ul' list '}' @,
@ '{ol' list '}' @,
@ '[' string ']' @,
@ '{[' string ']}' @,
@ '{v' string 'v}' @,
@ '{%' string '%}' @,
@ '{!' string '}' @,
@ '{^' text '}' @,
@ '{_' text '}' @.
%%%%%%%%%%%%%
\subsection{Documentation tags (@-tags)}
\subsection{Documentation tags (\@-tags)}
\label{s:ocamldoc-tags}
\subsubsection{Predefined tags}
The folowing table gives the list of predefined @-tags, with their
The following table gives the list of predefined \@-tags, with their
syntax and meaning.\\
\begin{tabular}{|p{5cm}|p{10cm}|}\hline
"@author "{\em string} & The author of the element. One author by "@author" tag.
There may be several "@author" tags for the same element. \\ \hline
@ "@author" string @ & The author of the element. One author per
"\@author" tag.
There may be several "\@author" tags for the same element. \\ \hline
"@deprecated "{\em text} & The {\em text} should describe when the element was
@ "@deprecated" text @ & The @text@ should describe when the element was
deprecated, what to use as a replacement, and possibly the reason
for deprecation. \\ \hline
"@param "{\em id text} & Associate the given description ({\em text}) to the
given parameter name {\em id}. This tag is used for functions,
@ "@param" id text @ & Associate the given description (@text@) to the
given parameter name @id@. This tag is used for functions,
methods, classes and functors. \\ \hline
"@raise Exc "{\em text} & Explain that the element may raise
the exception "Exc". \\ \hline
@ "@raise" Exc text @ & Explain that the element may raise
the exception @Exc@. \\ \hline
"@return "{\em text} & Describe the return value and
@ "@return" text @ & Describe the return value and
its possible values. This tag is used for functions
and methods. \\ \hline
"@see <url> "{\em text} & Add a reference to the URL between '"<"' and '">"'
with the given text as comment. \\ \hline
@ "@see" '<' URL '>' text @ & Add a reference to the @URL@
with the given @text@ as comment. \\ \hline
"@see 'filename' "{\em text} & Add a reference to the given file name
(written between single quotes), with the given text as comment. \\ \hline
@ "@see" "'" filename "'" text @ & Add a reference to the given file name
(written between single quotes), with the given @text@ as comment. \\ \hline
"@see \"document name\" "{\em text} & Add a reference to the given
document name (written between double quotes), with the given text
@ "@see" '"' document-name '"' text @ & Add a reference to the given
document name (written between double quotes), with the given @text@
as comment. \\ \hline
"@since "{\em string} & Indicate when the element was introduced. \\ \hline
@ "@since" string @ & Indicate when the element was introduced. \\ \hline
"@before "{\em v text} & Associate the given description ({\em text}) to the
given version {\em v} in order to document compatibility issues. \\ \hline
@ "@before" v text @ & Associate the given description (@text@) to the
given version @v@ in order to document compatibility issues. \\ \hline
"@version "{\em string} & The version number for the element. \\ \hline
@ "@version" string @ & The version number for the element. \\ \hline
\end{tabular}
\subsubsection{Custom tags}
\label{s:ocamldoc-custom-tags}
You can use custom tags in the documentation comments, but they will
have no effect if the generator used does not handle them. To use a
custom tag, for example "foo", just put "@foo" with some text in your
custom tag, for example "foo", just put "\@foo" with some text in your
comment, as in:
\begin{verbatim}
(** My comment to show you a custom tag.
@ -885,15 +892,19 @@ The files you can used to define custom generators are installed in the
%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{The generator class}
A generator class is a class of type "Odoc_args.doc_generator".
It has only one method\\
"generator : Odoc_info.Module.t_module list -> unit"\\
This method will be called with the list of analysed and possibly
It has only one method
\begin{verbatim}
generator : Odoc_info.Module.t_module list -> unit
\end{verbatim}
\noindent{}This method will be called with the list of analysed and possibly
merged "Odoc_info.t_module" structures.
Of course the class can have other methods, but the object of this
class must be coerced to "Odoc_args.doc_generator" before being
passed to the function\\
"Odoc_args.set_doc_generator : Odoc_args.doc_generator -> unit"\\
which installs the new documentation generator.
passed to the function
\begin{verbatim}
Odoc_args.set_doc_generator : Odoc_args.doc_generator -> unit
\end{verbatim}
\noindent{}which installs the new documentation generator.
The following example shows how to define and install a new documentation generator.
See the "odoc_fhtml" generator (in the Ocamldoc Hump) for a complete example.
@ -929,8 +940,8 @@ Here is how to develop a HTML generator handling your custom tags.
The class "Odoc_html.html" inherits
from the class "Odoc_html.info", containing a field "tag_functions" which is a
list pairs composed of a custom tag (e.g. 'foo') and a function taking a "text"
and returning HTML code (of type "string").
list pairs composed of a custom tag (e.g. "\"foo\"") and a function taking
a "text" and returning HTML code (of type "string").
To handle a new tag "bar", create a HTML generator class from the existing one
and complete the "tag_functions" field:
\begin{verbatim}
@ -961,9 +972,12 @@ adding your own tag handler to the field "tag_functions".
\section{Adding command line options}
The command line analysis is performed after loading the module containing the
documentation generator, thus allowing command line options to be added to the
list of existing ones. Adding an option can be done with the function\\
"Odoc_args.add_option : string * Arg.spec * string -> unit"\\
Note: Existing command line options can be redefined using this function.
list of existing ones. Adding an option can be done with the function
\begin{verbatim}
Odoc_args.add_option : string * Arg.spec * string -> unit
\end{verbatim}
\noindent{}Note: Existing command line options can be redefined using
this function.
%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Compilation and usage}
@ -972,30 +986,38 @@ Note: Existing command line options can be redefined using this function.
%%%%%%%%%%%%%%
\subsubsection{Defining a custom generator class in one file}
Let "custom.ml" be the file defining a new generator class.
Compilation of "custom.ml" can be performed by the following command~:\\
"ocamlc -I +ocamldoc -c custom.ml"\\
The file "custom.cmo" is created and can be used this way~:\\
{\tt ocamldoc -g custom.cmo {\em other-options} {\em source-files}}\\
It is important not to give the {\bf\tt -html} or any other option selecting a
built in generator to {\tt ocamldoc},
Compilation of "custom.ml" can be performed by the following command~:
\begin{alltt}
ocamlc -I +ocamldoc -c custom.ml
\end{alltt}
\noindent{}The file "custom.cmo" is created and can be used this way~:
\begin{alltt}
ocamldoc -g custom.cmo \var{other-options} \var{source-files}
\end{alltt}
\noindent{}It is important not to give the "-html" or any other option
selecting a built-in generator to "ocamldoc",
which would result in using this generator instead of the one you just loaded.
%%%%%%%%%%%%%%
\subsubsection{Defining a custom generator class in several files}
It is possible to define a generator class in several modules, which
are defined in several files "file1.ml[i]", "file2.ml[i]", ...,
"fileN.ml[i]". A ".cma" library file must
be created, including all these files.\\
The following commands create the "custom.cma" file from files "file1.ml[i]", ...,
"fileN.ml[i]"~:\\
{\tt
ocamlc -I +ocamldoc -c file1.ml[i]\\
ocamlc -I +ocamldoc -c file2.ml[i]\\
...\\
ocamlc -I +ocamldoc -c fileN.ml[i]\\
ocamlc -o custom.cma -a file1.cmo file2.cmo ... fileN.cmo}\\
Then, the following command uses {\tt custom.cma} as custom generator:\\
{\tt ocamldoc -g custom.cma {\em other-options} {\em source-files}}\\
Again, it is important not to give the {\bf\tt -html} or any other option selecting a
built in generator to {\tt ocamldoc},
are defined in several files \var{\nth{file}{1}}".ml"["i"],
\var{\nth{file}{2}}".ml"["i"], ..., \var{\nth{file}{n}}".ml"["i"]. A ".cma"
library file must be created, including all these files.
The following commands create the "custom.cma" file from files
\var{\nth{file}{1}}".ml"["i"], ..., \var{\nth{file}{n}}".ml"["i"]~:
\begin{alltt}
ocamlc -I +ocamldoc -c \var{\nth{file}{1}}.ml\textrm{[}i\textrm{]}
ocamlc -I +ocamldoc -c \var{\nth{file}{2}}.ml\textrm{[}i\textrm{]}
...
ocamlc -I +ocamldoc -c \var{\nth{file}{n}}.ml\textrm{[}i\textrm{]}
ocamlc -o custom.cma -a \var{\nth{file}{1}}.cmo \var{\nth{file}{2}}.cmo ... \var{\nth{file}{n}}.cmo
\end{alltt}
\noindent{}Then, the following command uses "custom.cma" as custom generator:
\begin{alltt}
ocamldoc -g custom.cma \var{other-options} \var{source-files}
\end{alltt}
\noindent{}Again, it is important not to give the "-html" or any other
option selecting a built-in generator to "ocamldoc",
which would result in using this generator instead of the one you just loaded.

View File

@ -138,9 +138,9 @@ The following environment variables are also consulted:
The multiplier is "k", "M", or "G", for multiplication by $2^{10}$,
$2^{20}$, and $2^{30}$ respectively.
For example, on a 32-bit machine, under "bash" the command
\begin{alltt}
\begin{verbatim}
export OCAMLRUNPARAM='b,s=256k,v=0x015'
\end{alltt}
\end{verbatim}
tells a subsequent "ocamlrun" to print backtraces for uncaught exceptions,
set its initial minor heap size to 1~megabyte and
print a message at the start of each major GC cycle, when the heap

View File

@ -6,7 +6,7 @@ OCaml programs. This interface is generated in an automated way, and
you should refer to Tcl/Tk books and man pages for detailed
information on the behavior of the numerous functions. We also suggest
to use "ocamlbrowser" to see the types of the various functions, that
are the best documentation for the library itself.
are the best documentation for the library itself.
\smallskip\noindent
Programs that use the "labltk" library must be linked as follows:
@ -24,7 +24,7 @@ If the library was not compiled correctly, try to run again the
"configure" script with the option "-tkdefs" \var{switches},
where \var{switches} is a list of C-style inclusion paths leading to
the right "tcl.h" and "tk.h", for instance
'"-I/usr/local/include/tcl8.4 -I/usr/local/include/tk8.4"'.
"\"-I/usr/local/include/tcl8.4 -I/usr/local/include/tk8.4\"".
A script is installed, to make easier the use of the "labltk"
library as toplevel.

View File

@ -1,4 +1,5 @@
\newcommand{\machine}{\tt}
\newenvironment{machineenv}{\begin{alltt}}{\end{alltt}}
\newcommand{\firstline}{\black\#\blue\ }
\newcommand{\nextline}{\ \ }
\newcommand{\@zyva}{\firstline\renewcommand{\?}{\nextline}}

View File

@ -5,8 +5,8 @@
\def\var#1{{\it#1}}
\def\nth#1#2{${\it#1}_{#2}$}
\def\nmth#1#2#3{${\it#1}_{#2}^{#3}$}
\def\optvar#1{[\var{#1}\/]}
\def\event{$bowtie$}
\def\optvar#1{\textrm{[}\var{#1}\/\textrm{]}}
\def\event{$\bowtie$}
\def\fromoneto#1#2{$#1 = 1, \ldots, #2$}
% Pour avoir les exposants sur la ligne au-dessus (???)
@ -38,6 +38,11 @@
% Pour la traduction "xxxx" -> {\machine{xxxx}} faite par texquote2
\def\machine#1{\mbox{\ttstretch{#1}}}
% Pour la traduction "\begin{verbatim}...\end{verbatim}"
% -> "\begin{machineenv}...\end{machineenv}"
% faite aussi par texquote2.
\newenvironment{machineenv}{\alltt}{\endalltt}
% Environnements
\newlength{\versionwidth}
@ -48,8 +53,8 @@
\def\unix{\versionspecific{Unix}}
\def\endunix{\end{description}}
\def\macos{\versionspecific{MacOS 9}}
\def\endmacos{\end{description}}
%\def\macos{\versionspecific{MacOS 9}}
%\def\endmacos{\end{description}}
\def\windows{\versionspecific{Windows}}
\def\endwindows{\end{description}}
@ -180,6 +185,23 @@
\def\rminalltt#1{{\rm #1}}
% redefinition de l'environnement alltt pour que les {} \ et % soient
% dans la bonne fonte
\let\@oldalltt=\alltt
\let\@oldendalltt=\endalltt
\renewenvironment{alltt}{%
\begingroup%
\renewcommand{\{}{\char`\{}%
\renewcommand{\}}{\char`\}}%
\renewcommand{\\}{\char`\\}%
\renewcommand{\%}{\char`\%}%
\@oldalltt%
}{%
\@oldendalltt%
\endgroup%
}
% Index stuff -- cf multind.sty
\def\printindex#1#2{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi

View File

@ -540,9 +540,9 @@ actually be unified with "int".
The other application is to ensure that some definition is sufficiently
polymorphic.
\caml
\?let id : 'a. 'a -> 'a = \<fun x -> x+1\> ;;
\?let id : {\textquotesingle}a. {\textquotesingle}a -> {\textquotesingle}a = \<fun x -> x+1\> ;;
\:Error: This definition has type int -> int which is less general than
\: 'a. 'a -> 'a
\: {\textquotesingle}a. {\textquotesingle}a -> {\textquotesingle}a
\endcaml
\section{Explicit naming of type variables}
@ -901,11 +901,11 @@ same type.
\endcaml
\section{Explicit overriding in class definitions}
\ikwd{method!\@\texttt{method!}}
\ikwd{val!\@\texttt{val!}}
\ikwd{inherit!\@\texttt{inherit!}}
\ikwd{methodx\@\texttt{method\char33}}
\ikwd{valx\@\texttt{val\char33}}
\ikwd{inheritx\@\texttt{inherit\char33}}
(Introduced in OCaml 3.12)
(Introduced in OCaml 3.12) "foo \verb+xxx+ bar"
\begin{syntax}
class-field:

View File

@ -6,7 +6,7 @@
\begin{syntax}
typexpr:
"'" ident
| "_"
| "_"
| '(' typexpr ')'
| [['?']label-name':'] typexpr '->' typexpr
| typexpr {{ '*' typexpr }}
@ -163,7 +163,7 @@ just an abbreviation for a closed variant type where all possible tags
are also potentially present.
In all three cases, tags may be either specified directly in the
{\it `tag-name \rm [\dots]} form, or indirectly through a type
@'`'tag-name ["of" typexpr]@ form, or indirectly through a type
expression. In this last case, the type expression must expand to an
exact variant type, whose tag specifications are inserted in its
place.
@ -214,7 +214,7 @@ type @('#' class-path 'as' "'" ident) '->' "'" ident@.
Use of \#-types to abbreviate polymorphic variant types is deprecated.
If "t" is an exact variant type then "#t" translates to "[< t]",
and @"#t[>" "`tag"_1 \dots"`tag"_k"]"@ translates to
and @"#t[>" "`tag"_1 \dots"`tag"_k"]"@ translates to
@"[<" "t" ">" "`tag"_1 \dots"`tag"_k"]"@
\subsubsection*{Variant and record types}

View File

@ -28,8 +28,11 @@ int main(argc, argv)
int c;
int inquote;
int inverb;
int inverbatim;
int inverbatim_like;
int incaml;
int inverbatim = 0;
char *verbatim_end_in = "";
char *verbatim_end_out = "";
for (c = 0; c < 256; c++) transl[c] = NULL;
#ifdef TIE_BLANKS
@ -51,18 +54,18 @@ int main(argc, argv)
transl['%'] = "\\%";
transl['\''] = "{\\textquotesingle}";
transl['`'] = "{\\textasciigrave}";
inverbatim = 0;
inverbatim_like = 0;
incaml = 0;
inquote = 0;
inverbatim = 0;
puts ("% THIS FILE IS GENERATED.\n");
while(fgets(line, LINE_LENGTH, stdin) != NULL) {
if (inverbatim) {
if (inverbatim_like) {
fputs(line, stdout);
if (isprefix(line, "\\end{verbatim")
|| isprefix(line, "\\end{caml_")
|| isprefix(line, "\\end{rawhtml}")) inverbatim = 0;
if (isprefix(line, "\\end{caml_")
|| isprefix(line, "\\end{rawhtml}")) inverbatim_like = 0;
continue;
}
if (incaml) {
@ -70,11 +73,26 @@ int main(argc, argv)
if (isprefix(line, "\\endcaml")) incaml = 0;
continue;
}
if (isprefix(line, "\\begin{verbatim")
|| isprefix(line, "\\begin{caml_")
if (inverbatim){
if (isprefix (line, verbatim_end_in)){
fputs (verbatim_end_out, stdout);
inverbatim = 0;
}else{
for (p = (unsigned char *) line; *p != 0; p++){
c = *p;
if (c == ' ' || c == '\n' || transl[c] == NULL){
putchar (c);
}else{
fputs (transl[c], stdout);
}
}
}
continue;
}
if (isprefix(line, "\\begin{caml_")
|| isprefix(line, "\\begin{rawhtml}")) {
fputs(line, stdout);
inverbatim = 1;
inverbatim_like = 1;
continue;
}
if (isprefix(line, "\\caml")) {
@ -82,6 +100,20 @@ int main(argc, argv)
incaml = 1;
continue;
}
if (isprefix (line, "\\begin{verbatim}")){
fputs ("\\begin{machineenv}", stdout);
inverbatim = 1;
verbatim_end_in = "\\end{verbatim}";
verbatim_end_out = "\\end{machineenv}";
continue;
}
if (isprefix (line, "\\begin{ocamldoccode}")){
fputs ("\\begin{ocamldoccode}", stdout);
inverbatim = 1;
verbatim_end_in = "\\end{ocamldoccode}";
verbatim_end_out = "\\end{ocamldoccode}";
continue;
}
inverb = 0;
for (p = (unsigned char *) line; *p != 0; p++) {
c = *p;
@ -105,12 +137,7 @@ int main(argc, argv)
}
break;
case '\\':
if (isprefix(p, "\\verb") && p[5] != 0 && !isalpha(p[5])) {
inverb = p[5];
p = p + 5;
fputs("\\verb", stdout);
putchar(inverb);
} else if (inquote) {
if (inquote) {
if (p[1] == '"' || p[1] == '\\') {
c = p[1];
p++;
@ -119,6 +146,11 @@ int main(argc, argv)
fputs(transl[c], stdout);
else
putchar(c);
} else if (isprefix(p, "\\verb") && p[5] != 0 && !isalpha(p[5])) {
inverb = p[5];
p = p + 5;
fputs("\\verb", stdout);
putchar(inverb);
} else {
putchar('\\');
}

View File

@ -14,6 +14,9 @@ rule main = parse
"\\begin{syntax}" {
print_string "\\begin{syntax}";
syntax lexbuf }
| "\\begin{verbatim}" {
print_string "\\begin{verbatim}";
verbatim lexbuf }
| "\\@" {
print_string "@";
main lexbuf }
@ -39,12 +42,12 @@ and syntax = parse
print_string "\\token{";
indoublequote lexbuf }
| "epsilon" { print_string "\\emptystring"; syntax lexbuf }
| ['a'-'z'] ['a'-'z' '0'-'9' '-'] * as lxm {
| ['a'-'z' 'A'-'Z'] ['a'-'z' 'A'-'Z' '0'-'9' '-'] * as lxm {
print_string "\\nonterm{";
print_string lxm ;
print_string"}";
syntax lexbuf }
| '@' (['a'-'z'] ['a'-'z' '0'-'9' '-'] * as lxm) '@' {
| '@' (['a'-'z' 'A'-'Z'] ['a'-'z' 'A'-'Z' '0'-'9' '-'] * as lxm) '@' {
print_string "\\nt{";
print_string lxm ;
print_string"}";
@ -81,8 +84,7 @@ and inquote = parse
print_string "}";
syntax lexbuf }
| _ {
print_string "\\char";
print_int (int_of_char (lexeme_char lexbuf 0));
print_char_repr (lexeme_char lexbuf 0);
inquote lexbuf }
and indoublequote = parse
@ -96,4 +98,10 @@ and indoublequote = parse
print_char_repr (lexeme_char lexbuf 0);
indoublequote lexbuf }
and verbatim = parse
"\n\\end{verbatim}" {
print_string "\n\\end{verbatim}";
main lexbuf }
| _ {
print_char (lexeme_char lexbuf 0);
verbatim lexbuf }