]>
git.cameronkatri.com Git - mandoc.git/blob - roff.h
3 * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
4 * Copyright (c) 2013, 2014, 2015 Ingo Schwarze <schwarze@openbsd.org>
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
29 SEC_IMPLEMENTATION
, /* IMPLEMENTATION NOTES */
62 ROFF_NEXT_SIBLING
= 0,
67 * Indicates that a BODY's formatting has ended, but
68 * the scope is still open. Used for badly nested blocks.
72 ENDBODY_SPACE
, /* Is broken: append a space. */
73 ENDBODY_NOSPACE
/* Is broken: don't append a space. */
77 struct roff_node
*parent
; /* Parent AST node. */
78 struct roff_node
*child
; /* First child AST node. */
79 struct roff_node
*last
; /* Last child AST node. */
80 struct roff_node
*next
; /* Sibling AST node. */
81 struct roff_node
*prev
; /* Prior sibling AST node. */
82 struct roff_node
*head
; /* BLOCK */
83 struct roff_node
*body
; /* BLOCK/ENDBODY */
84 struct roff_node
*tail
; /* BLOCK */
85 struct mdoc_arg
*args
; /* BLOCK/ELEM */
86 union mdoc_data
*norm
; /* Normalized arguments. */
87 char *string
; /* TEXT */
88 const struct tbl_span
*span
; /* TBL */
89 const struct eqn
*eqn
; /* EQN */
90 int nchild
; /* Number of child nodes. */
91 int line
; /* Input file line number. */
92 int pos
; /* Input file column number. */
93 int tok
; /* Request or macro ID. */
95 #define MDOC_VALID (1 << 0) /* Has been validated. */
96 #define MDOC_ENDED (1 << 1) /* Gone past body end mark. */
97 #define MDOC_EOS (1 << 2) /* At sentence boundary. */
98 #define MDOC_LINE (1 << 3) /* First macro/text on line. */
99 #define MDOC_SYNPRETTY (1 << 4) /* SYNOPSIS-style formatting. */
100 #define MDOC_BROKEN (1 << 5) /* Must validate parent when ending. */
101 #define MDOC_DELIMO (1 << 6)
102 #define MDOC_DELIMC (1 << 7)
103 #define MAN_VALID MDOC_VALID
104 #define MAN_EOS MDOC_EOS
105 #define MAN_LINE MDOC_LINE
106 int prev_font
; /* Before entering this node. */
107 int aux
; /* Decoded node data, type-dependent. */
108 enum roff_type type
; /* AST node type. */
109 enum roff_sec sec
; /* Current named section. */
110 enum mdoc_endbody end
; /* BODY */
114 char *msec
; /* Manual section, usually a digit. */
115 char *vol
; /* Manual volume title. */
116 char *os
; /* Operating system. */
117 char *arch
; /* Machine architecture. */
118 char *title
; /* Manual title, usually CAPS. */
119 char *name
; /* Leading manual name. */
120 char *date
; /* Normalized date. */
121 int hasbody
; /* Document is not empty. */
125 struct roff_meta meta
; /* Document meta-data. */
126 struct mparse
*parse
; /* Parse pointer. */
127 struct roff
*roff
; /* Roff parser state data. */
128 const char *defos
; /* Default operating system. */
129 struct roff_node
*first
; /* The first node parsed. */
130 struct roff_node
*last
; /* The last node parsed. */
131 struct roff_node
*last_es
; /* The most recent Es node. */
132 int quick
; /* Abort parse early. */
133 int flags
; /* Parse flags. */
134 #define MDOC_LITERAL (1 << 1) /* In a literal scope. */
135 #define MDOC_PBODY (1 << 2) /* In the document body. */
136 #define MDOC_NEWLINE (1 << 3) /* First macro/text in a line. */
137 #define MDOC_PHRASELIT (1 << 4) /* Literal within a partial phrase. */
138 #define MDOC_PPHRASE (1 << 5) /* Within a partial phrase. */
139 #define MDOC_FREECOL (1 << 6) /* `It' invocation should close. */
140 #define MDOC_SYNOPSIS (1 << 7) /* SYNOPSIS-style formatting. */
141 #define MDOC_KEEP (1 << 8) /* In a word keep. */
142 #define MDOC_SMOFF (1 << 9) /* Spacing is off. */
143 #define MDOC_NODELIMC (1 << 10) /* Disable closing delimiter handling. */
144 #define MAN_ELINE (1 << 11) /* Next-line element scope. */
145 #define MAN_BLINE (1 << 12) /* Next-line block scope. */
146 #define MAN_LITERAL MDOC_LITERAL
147 #define MAN_NEWLINE MDOC_NEWLINE
148 enum roff_sec lastsec
; /* Last section seen. */
149 enum roff_sec lastnamed
; /* Last standard section seen. */
150 enum roff_next next
; /* Where to put the next node. */