FreeBSD/contrib/mdocml/mdoc_macro.c
/*
 * Parse one word.
 * If it is a macro, call it and return 1.
 * Otherwise, allocate it and return 0.
 */
Parse one word.
If it is a macro, call it and return 1.
Otherwise, allocate it and return 0.
Parse one word . If it is a macro call it and return 1 . Otherwise allocate it and return 0 .
static int
macro_or_word(MACRO_PROT_ARGS, int parsed)
{
	char		*p;
	int		 ntok;
	p = buf + ppos;
	ntok = TOKEN_NONE;
	if (*p == '"')
		p++;
	else if (parsed && ! (mdoc->flags & MDOC_PHRASELIT))
		ntok = lookup(mdoc, tok, line, ppos, p);
	if (ntok == TOKEN_NONE) {
		dword(mdoc, line, ppos, p, DELIM_MAX, tok == TOKEN_NONE ||
		    mdoc_macros[tok].flags & MDOC_JOIN);
		return 0;
	} else {
		if (mdoc_macros[tok].fp == in_line_eoln)
			rew_elem(mdoc, tok);
		mdoc_macro(mdoc, ntok, line, ppos, pos, buf);
		if (tok == TOKEN_NONE)
			append_delims(mdoc, line, pos, buf);
		return 1;
	}
}
static int macro_or_word ( MACRO_PROT_ARGS , int parsed ) { char * p ; int ntok ; p = buf + ppos ; ntok = TOKEN_NONE ; if ( * p == ' ' ) p ++ ; else if ( parsed && ! ( mdoc -> flags & MDOC_PHRASELIT ) ) ntok = lookup ( mdoc , tok , line , ppos , p ) ; if ( ntok == TOKEN_NONE ) { dword ( mdoc , line , ppos , p , DELIM_MAX , tok == TOKEN_NONE || mdoc_macros [ tok ] . flags & MDOC_JOIN ) ; return 0 ; } else { if ( mdoc_macros [ tok ] . fp == in_line_eoln ) rew_elem ( mdoc , tok ) ; mdoc_macro ( mdoc , ntok , line , ppos , pos , buf ) ; if ( tok == TOKEN_NONE ) append_delims ( mdoc , line , pos , buf ) ; return 1 ; } }
Parse one word.
Parse one word .