1*67217f5cSschwarze /* $OpenBSD: mandoc_parse.h,v 1.4 2019/11/09 14:39:42 schwarze Exp $ */ 299acaf1eSschwarze /* 399acaf1eSschwarze * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> 499acaf1eSschwarze * Copyright (c) 2014,2015,2016,2017,2018 Ingo Schwarze <schwarze@openbsd.org> 599acaf1eSschwarze * 699acaf1eSschwarze * Permission to use, copy, modify, and distribute this software for any 799acaf1eSschwarze * purpose with or without fee is hereby granted, provided that the above 899acaf1eSschwarze * copyright notice and this permission notice appear in all copies. 999acaf1eSschwarze * 1099acaf1eSschwarze * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES 1199acaf1eSschwarze * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 1299acaf1eSschwarze * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR 1399acaf1eSschwarze * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 1499acaf1eSschwarze * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 1599acaf1eSschwarze * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 1699acaf1eSschwarze * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 1799acaf1eSschwarze * 1899acaf1eSschwarze * Top level parser interface. For use in the main program 1999acaf1eSschwarze * and in the main parser, but not in formatters. 2099acaf1eSschwarze */ 2199acaf1eSschwarze 2299acaf1eSschwarze /* 2399acaf1eSschwarze * Parse options. 2499acaf1eSschwarze */ 2599acaf1eSschwarze #define MPARSE_MDOC (1 << 0) /* assume -mdoc */ 2699acaf1eSschwarze #define MPARSE_MAN (1 << 1) /* assume -man */ 2799acaf1eSschwarze #define MPARSE_SO (1 << 2) /* honour .so requests */ 2899acaf1eSschwarze #define MPARSE_QUICK (1 << 3) /* abort the parse early */ 2999acaf1eSschwarze #define MPARSE_UTF8 (1 << 4) /* accept UTF-8 input */ 3099acaf1eSschwarze #define MPARSE_LATIN1 (1 << 5) /* accept ISO-LATIN-1 input */ 316b86842eSschwarze #define MPARSE_VALIDATE (1 << 6) /* call validation functions */ 32*67217f5cSschwarze #define MPARSE_COMMENT (1 << 7) /* save comments in the tree */ 3399acaf1eSschwarze 3499acaf1eSschwarze 356b86842eSschwarze struct roff_meta; 3699acaf1eSschwarze struct mparse; 3799acaf1eSschwarze 38e501e731Sschwarze struct mparse *mparse_alloc(int, enum mandoc_os, const char *); 3999acaf1eSschwarze void mparse_copy(const struct mparse *); 4099acaf1eSschwarze void mparse_free(struct mparse *); 4199acaf1eSschwarze int mparse_open(struct mparse *, const char *); 42e501e731Sschwarze void mparse_readfd(struct mparse *, int, const char *); 4399acaf1eSschwarze void mparse_reset(struct mparse *); 446b86842eSschwarze struct roff_meta *mparse_result(struct mparse *); 45