+ for (i = 0; ' ' == buf[i]; i++)
+ /* Skip to first non-space. */ ;
+
+ if ('\0' == buf[i]) {
+ if ( ! mdoc_pwarn(m, line, 0, ENOBLANK))
+ return(0);
+
+ /*
+ * Insert a `Pp' in the case of a blank line. Technically,
+ * blank lines aren't allowed, but enough manuals assume this
+ * behaviour that we want to work around it.
+ */
+ if ( ! mdoc_elem_alloc(m, line, 0, MDOC_Pp, NULL))
+ return(0);
+
+ m->next = MDOC_NEXT_SIBLING;
+ return(1);
+ }
+
+ /*
+ * Warn if the last un-escaped character is whitespace. Then
+ * strip away the remaining spaces (tabs stay!).
+ */
+
+ i = (int)strlen(buf);
+ assert(i);
+
+ if (' ' == buf[i - 1] || '\t' == buf[i - 1]) {
+ if (i > 1 && '\\' != buf[i - 2])
+ if ( ! mdoc_pwarn(m, line, i - 1, ETAILWS))
+ return(0);
+
+ for (--i; i && ' ' == buf[i]; i--)
+ /* Spin back to non-space. */ ;
+
+ /* Jump ahead of escaped whitespace. */
+ i += '\\' == buf[i] ? 2 : 1;
+
+ buf[i] = '\0';
+ }
+
+ /* Allocate the whole word. */
+
+ return(mdoc_word_alloc(m, line, 0, buf));