aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_macro.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-04-02 21:36:49 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-04-02 21:36:49 +0000
commit483afc5a7a52b601da9e854d5645cd4b0a140184 (patch)
tree159f32df48c5d133f76368d6fb95ad45656bccc4 /mdoc_macro.c
parent0fa412f32faf6969057d9e796beabcbf0413f279 (diff)
downloadmandoc-483afc5a7a52b601da9e854d5645cd4b0a140184.tar.gz
mandoc-483afc5a7a52b601da9e854d5645cd4b0a140184.tar.zst
mandoc-483afc5a7a52b601da9e854d5645cd4b0a140184.zip
First step towards parser unification:
Replace enum mdoc_type and enum man_type by a unified enum roff_type. Almost mechanical, no functional change. Written on the ICE train from Frankfurt to Bruxelles on the way to p2k15.
Diffstat (limited to 'mdoc_macro.c')
-rw-r--r--mdoc_macro.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/mdoc_macro.c b/mdoc_macro.c
index efb48d02..55ff5ed1 100644
--- a/mdoc_macro.c
+++ b/mdoc_macro.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_macro.c,v 1.183 2015/02/12 12:24:33 schwarze Exp $ */
+/* $Id: mdoc_macro.c,v 1.184 2015/04/02 21:36:50 schwarze Exp $ */
/*
* Copyright (c) 2008-2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -7,9 +7,9 @@
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
@@ -26,10 +26,11 @@
#include <string.h>
#include <time.h>
-#include "mdoc.h"
#include "mandoc.h"
-#include "libmdoc.h"
+#include "roff.h"
+#include "mdoc.h"
#include "libmandoc.h"
+#include "libmdoc.h"
static void blk_full(MACRO_PROT_ARGS);
static void blk_exp_close(MACRO_PROT_ARGS);
@@ -217,7 +218,7 @@ mdoc_macroend(struct mdoc *mdoc)
mdoc->last->parent : mdoc->last;
for ( ; n; n = n->parent)
- if (n->type == MDOC_BLOCK &&
+ if (n->type == ROFFT_BLOCK &&
mdoc_macros[n->tok].flags & MDOC_EXPLICIT)
mandoc_msg(MANDOCERR_BLK_NOEND, mdoc->parse,
n->line, n->pos, mdoc_macronames[n->tok]);
@@ -287,10 +288,10 @@ rew_pending(struct mdoc *mdoc, const struct mdoc_node *n)
rew_last(mdoc, n);
switch (n->type) {
- case MDOC_HEAD:
+ case ROFFT_HEAD:
mdoc_body_alloc(mdoc, n->line, n->pos, n->tok);
return;
- case MDOC_BLOCK:
+ case ROFFT_BLOCK:
break;
default:
return;
@@ -303,8 +304,8 @@ rew_pending(struct mdoc *mdoc, const struct mdoc_node *n)
if ((n = n->parent) == NULL)
return;
- if (n->type == MDOC_BLOCK ||
- n->type == MDOC_HEAD) {
+ if (n->type == ROFFT_BLOCK ||
+ n->type == ROFFT_HEAD) {
if (n->flags & MDOC_ENDED)
break;
else
@@ -366,9 +367,9 @@ rew_elem(struct mdoc *mdoc, enum mdoct tok)
struct mdoc_node *n;
n = mdoc->last;
- if (MDOC_ELEM != n->type)
+ if (n->type != ROFFT_ELEM)
n = n->parent;
- assert(MDOC_ELEM == n->type);
+ assert(n->type == ROFFT_ELEM);
assert(tok == n->tok);
rew_last(mdoc, n);
}
@@ -387,7 +388,7 @@ dword(struct mdoc *mdoc, int line, int col, const char *p,
if (may_append &&
! (mdoc->flags & (MDOC_SYNOPSIS | MDOC_KEEP | MDOC_SMOFF)) &&
- d == DELIM_NONE && mdoc->last->type == MDOC_TEXT &&
+ d == DELIM_NONE && mdoc->last->type == ROFFT_TEXT &&
mdoc_isdelim(mdoc->last->string) == DELIM_NONE) {
mdoc_word_append(mdoc, p);
return;
@@ -522,13 +523,13 @@ blk_exp_close(MACRO_PROT_ARGS)
/* Remember the start of our own body. */
- if (n->type == MDOC_BODY && atok == n->tok) {
+ if (n->type == ROFFT_BODY && atok == n->tok) {
if (n->end == ENDBODY_NOT)
body = n;
continue;
}
- if (n->type != MDOC_BLOCK || n->tok == MDOC_Nm)
+ if (n->type != ROFFT_BLOCK || n->tok == MDOC_Nm)
continue;
if (n->tok == MDOC_It) {
@@ -873,7 +874,7 @@ blk_full(MACRO_PROT_ARGS)
n->flags |= MDOC_BROKEN;
continue;
}
- if (n->type != MDOC_BLOCK)
+ if (n->type != ROFFT_BLOCK)
continue;
if (tok == MDOC_It && n->tok == MDOC_Bl) {
@@ -1016,7 +1017,7 @@ blk_full(MACRO_PROT_ARGS)
/*
* Emit leading punctuation (i.e., punctuation before
- * the MDOC_HEAD) for non-phrase types.
+ * the ROFFT_HEAD) for non-phrase types.
*/
if (head == NULL &&
@@ -1086,7 +1087,7 @@ blk_full(MACRO_PROT_ARGS)
n->flags |= MDOC_BROKEN;
continue;
}
- if (n->type == MDOC_BLOCK &&
+ if (n->type == ROFFT_BLOCK &&
mdoc_macros[n->tok].flags & MDOC_EXPLICIT) {
n->flags = MDOC_BROKEN;
head->flags = MDOC_ENDED;
@@ -1171,7 +1172,7 @@ blk_part_imp(MACRO_PROT_ARGS)
n->flags |= MDOC_BROKEN;
continue;
}
- if (n->type == MDOC_BLOCK &&
+ if (n->type == ROFFT_BLOCK &&
mdoc_macros[n->tok].flags & MDOC_EXPLICIT) {
n->flags |= MDOC_BROKEN;
if ( ! (body->flags & MDOC_ENDED)) {
@@ -1452,7 +1453,7 @@ phrase_ta(MACRO_PROT_ARGS)
for (n = mdoc->last; n != NULL; n = n->parent) {
if (n->flags & MDOC_ENDED)
continue;
- if (n->tok == MDOC_It && n->type == MDOC_BODY)
+ if (n->tok == MDOC_It && n->type == ROFFT_BODY)
body = n;
if (n->tok == MDOC_Bl)
break;