1*6d38604fSBaptiste Daroussin /* $Id: mandoc_parse.h,v 1.5 2019/11/09 14:39:49 schwarze Exp $ */ 27295610fSBaptiste Daroussin /* 37295610fSBaptiste Daroussin * Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> 47295610fSBaptiste Daroussin * Copyright (c) 2014,2015,2016,2017,2018 Ingo Schwarze <schwarze@openbsd.org> 57295610fSBaptiste Daroussin * 67295610fSBaptiste Daroussin * Permission to use, copy, modify, and distribute this software for any 77295610fSBaptiste Daroussin * purpose with or without fee is hereby granted, provided that the above 87295610fSBaptiste Daroussin * copyright notice and this permission notice appear in all copies. 97295610fSBaptiste Daroussin * 107295610fSBaptiste Daroussin * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES 117295610fSBaptiste Daroussin * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 127295610fSBaptiste Daroussin * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR 137295610fSBaptiste Daroussin * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 147295610fSBaptiste Daroussin * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 157295610fSBaptiste Daroussin * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 167295610fSBaptiste Daroussin * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 177295610fSBaptiste Daroussin * 187295610fSBaptiste Daroussin * Top level parser interface. For use in the main program 197295610fSBaptiste Daroussin * and in the main parser, but not in formatters. 207295610fSBaptiste Daroussin */ 217295610fSBaptiste Daroussin 227295610fSBaptiste Daroussin /* 237295610fSBaptiste Daroussin * Parse options. 247295610fSBaptiste Daroussin */ 257295610fSBaptiste Daroussin #define MPARSE_MDOC (1 << 0) /* assume -mdoc */ 267295610fSBaptiste Daroussin #define MPARSE_MAN (1 << 1) /* assume -man */ 277295610fSBaptiste Daroussin #define MPARSE_SO (1 << 2) /* honour .so requests */ 287295610fSBaptiste Daroussin #define MPARSE_QUICK (1 << 3) /* abort the parse early */ 297295610fSBaptiste Daroussin #define MPARSE_UTF8 (1 << 4) /* accept UTF-8 input */ 307295610fSBaptiste Daroussin #define MPARSE_LATIN1 (1 << 5) /* accept ISO-LATIN-1 input */ 317295610fSBaptiste Daroussin #define MPARSE_VALIDATE (1 << 6) /* call validation functions */ 32*6d38604fSBaptiste Daroussin #define MPARSE_COMMENT (1 << 7) /* save comments in the tree */ 337295610fSBaptiste Daroussin 347295610fSBaptiste Daroussin 357295610fSBaptiste Daroussin struct roff_meta; 367295610fSBaptiste Daroussin struct mparse; 377295610fSBaptiste Daroussin 387295610fSBaptiste Daroussin struct mparse *mparse_alloc(int, enum mandoc_os, const char *); 397295610fSBaptiste Daroussin void mparse_copy(const struct mparse *); 407295610fSBaptiste Daroussin void mparse_free(struct mparse *); 417295610fSBaptiste Daroussin int mparse_open(struct mparse *, const char *); 427295610fSBaptiste Daroussin void mparse_readfd(struct mparse *, int, const char *); 437295610fSBaptiste Daroussin void mparse_reset(struct mparse *); 447295610fSBaptiste Daroussin struct roff_meta *mparse_result(struct mparse *); 45