version 1.30, 2015/01/15 02:29:26 |
version 1.31, 2015/01/15 04:26:40 |
|
|
.\" $Id$ |
.\" $Id$ |
.\" |
.\" |
.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
.\" Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org> |
.\" Copyright (c) 2010, 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org> |
.\" |
.\" |
.\" Permission to use, copy, modify, and distribute this software for any |
.\" Permission to use, copy, modify, and distribute this software for any |
.\" purpose with or without fee is hereby granted, provided that the above |
.\" purpose with or without fee is hereby granted, provided that the above |
|
|
.Nm mparse_strlevel |
.Nm mparse_strlevel |
.Nm mparse_wait , |
.Nm mparse_wait , |
.Nd mandoc macro compiler library |
.Nd mandoc macro compiler library |
.Sh LIBRARY |
|
.Lb libmandoc |
|
.Sh SYNOPSIS |
.Sh SYNOPSIS |
.In sys/types.h |
.In sys/types.h |
.In mandoc.h |
.In mandoc.h |
|
.Pp |
.Fd "#define ASCII_NBRSP" |
.Fd "#define ASCII_NBRSP" |
.Fd "#define ASCII_HYPH" |
.Fd "#define ASCII_HYPH" |
.Fd "#define ASCII_BREAK" |
.Fd "#define ASCII_BREAK" |
Line 176 initiate a parsing sequence with |
|
Line 175 initiate a parsing sequence with |
|
and |
and |
.Fn mparse_alloc ; |
.Fn mparse_alloc ; |
.It |
.It |
parse files with |
open a file with |
.Fn mparse_open |
.Xr open 2 |
and |
or |
|
.Fn mparse_open ; |
|
.It |
|
parse it with |
.Fn mparse_readfd ; |
.Fn mparse_readfd ; |
.It |
.It |
retrieve a parsed syntax tree, if the parse was successful, with |
retrieve the syntax tree with |
.Fn mparse_result ; |
.Fn mparse_result ; |
.It |
.It |
iterate over parse nodes with |
iterate over parse nodes with |
|
|
.Ss Types |
.Ss Types |
.Bl -ohang |
.Bl -ohang |
.It Vt "enum mandocerr" |
.It Vt "enum mandocerr" |
A fatal error, error, or warning message during parsing. |
An error or warning message during parsing. |
.It Vt "enum mandoclevel" |
.It Vt "enum mandoclevel" |
A classification of an |
A classification of an |
.Vt "enum mandocerr" |
.Vt "enum mandocerr" |
Line 229 This may be used across parsed input if |
|
Line 231 This may be used across parsed input if |
|
.Fn mparse_reset |
.Fn mparse_reset |
is called between parses. |
is called between parses. |
.It Vt "mandocmsg" |
.It Vt "mandocmsg" |
A prototype for a function to handle fatal error, error, and warning |
A prototype for a function to handle error and warning |
messages emitted by the parser. |
messages emitted by the parser. |
.El |
.El |
.Ss Functions |
.Ss Functions |
Line 333 This is for example useful in |
|
Line 335 This is for example useful in |
|
to quickly build minimal databases. |
to quickly build minimal databases. |
.It Ar wlevel |
.It Ar wlevel |
Can be set to |
Can be set to |
.Dv MANDOCLEVEL_FATAL , |
.Dv MANDOCLEVEL_BADARG , |
.Dv MANDOCLEVEL_ERROR , |
.Dv MANDOCLEVEL_ERROR , |
or |
or |
.Dv MANDOCLEVEL_WARNING . |
.Dv MANDOCLEVEL_WARNING . |
|
|
.Pa read.c . |
.Pa read.c . |
.It Fn mparse_result |
.It Fn mparse_result |
Obtain the result of a parse. |
Obtain the result of a parse. |
Only successful parses |
One of the three pointers will be filled in. |
.Po |
|
i.e., those where |
|
.Fn mparse_readfd |
|
returned less than MANDOCLEVEL_FATAL |
|
.Pc |
|
should invoke this function, in which case one of the three pointers will |
|
be filled in. |
|
Declared in |
Declared in |
.In mandoc.h , |
.In mandoc.h , |
implemented in |
implemented in |