-
- if (MAN_MAX == (c = man_hash_find(m->htab, mac))) {
- if ( ! (MAN_IGN_MACRO & m->pflags)) {
- (void)man_verr(m, ln, 1,
- "unknown macro: %s", mac);
- goto err;
- }
- if ( ! man_vwarn(m, ln, 1, "unknown macro: %s", mac))
- goto err;
+
+ if ( ! man_word_alloc(m, line, offs, buf + offs))
+ return(0);
+
+ /*
+ * End-of-sentence check. If the last character is an unescaped
+ * EOS character, then flag the node as being the end of a
+ * sentence. The front-end will know how to interpret this.
+ */
+
+ assert(i);
+ if (mandoc_eos(buf, (size_t)i, 0))
+ m->last->flags |= MAN_EOS;
+
+ return(man_descope(m, line, offs));
+}
+
+static int
+man_pmacro(struct man *m, int ln, char *buf, int offs)
+{
+ int i, ppos;
+ enum mant tok;
+ char mac[5];
+ struct man_node *n;
+
+ if ('"' == buf[offs]) {
+ man_pmsg(m, ln, offs, MANDOCERR_BADCOMMENT);
+ return(1);
+ } else if ('\0' == buf[offs])
+ return(1);
+
+ ppos = offs;
+
+ /*
+ * Copy the first word into a nil-terminated buffer.
+ * Stop copying when a tab, space, or eoln is encountered.
+ */
+
+ i = 0;
+ while (i < 4 && '\0' != buf[offs] &&
+ ' ' != buf[offs] && '\t' != buf[offs])
+ mac[i++] = buf[offs++];
+
+ mac[i] = '\0';
+
+ tok = (i > 0 && i < 4) ? man_hash_find(mac) : MAN_MAX;
+
+ if (MAN_MAX == tok) {
+ mandoc_vmsg(MANDOCERR_MACRO, m->parse, ln,
+ ppos, "%s", buf + ppos - 1);