Ejemplo n.º 1
0
/*
 * Main parse routine.  Parses a single line -- really just hands off to
 * the macro (mdoc_pmacro()) or text parser (mdoc_ptext()).
 */
int
mdoc_parseln(struct mdoc *m, int ln, char *buf, int offs)
{

	assert( ! (MDOC_HALT & m->flags));

	m->flags |= MDOC_NEWLINE;

	/*
	 * Let the roff nS register switch SYNOPSIS mode early,
	 * such that the parser knows at all times
	 * whether this mode is on or off.
	 * Note that this mode is also switched by the Sh macro.
	 */
	if (roff_regisset(m->roff, REG_nS)) {
		if (roff_regget(m->roff, REG_nS))
			m->flags |= MDOC_SYNOPSIS;
		else
			m->flags &= ~MDOC_SYNOPSIS;
	}

	return(mandoc_getcontrol(buf, &offs) ?
			mdoc_pmacro(m, ln, buf, offs) :
			mdoc_ptext(m, ln, buf, offs));
}
Ejemplo n.º 2
0
/*
 * Main parse routine.  Parses a single line -- really just hands off to
 * the macro (mdoc_pmacro()) or text parser (mdoc_ptext()).
 */
int
mdoc_parseln(struct mdoc *m, int ln, char *buf, int offs)
{

    assert( ! (MDOC_HALT & m->flags));

    m->flags |= MDOC_NEWLINE;

    /*
     * Let the roff nS register switch SYNOPSIS mode early,
     * such that the parser knows at all times
     * whether this mode is on or off.
     * Note that this mode is also switched by the Sh macro.
     */
    if (m->regs->regs[(int)REG_nS].set) {
        if (m->regs->regs[(int)REG_nS].v.u)
            m->flags |= MDOC_SYNOPSIS;
        else
            m->flags &= ~MDOC_SYNOPSIS;
    }

    return(('.' == buf[offs] || '\'' == buf[offs]) ?
           mdoc_pmacro(m, ln, buf, offs) :
           mdoc_ptext(m, ln, buf, offs));
}
Ejemplo n.º 3
0
/*
 * Main parse routine.  Parses a single line -- really just hands off to
 * the macro (mdoc_pmacro()) or text parser (mdoc_ptext()).
 */
int
mdoc_parseln(struct mdoc *mdoc, int ln, char *buf, int offs)
{

	if (mdoc->last->type != MDOC_EQN || ln > mdoc->last->line)
		mdoc->flags |= MDOC_NEWLINE;

	/*
	 * Let the roff nS register switch SYNOPSIS mode early,
	 * such that the parser knows at all times
	 * whether this mode is on or off.
	 * Note that this mode is also switched by the Sh macro.
	 */
	if (roff_getreg(mdoc->roff, "nS"))
		mdoc->flags |= MDOC_SYNOPSIS;
	else
		mdoc->flags &= ~MDOC_SYNOPSIS;

	return(roff_getcontrol(mdoc->roff, buf, &offs) ?
	    mdoc_pmacro(mdoc, ln, buf, offs) :
	    mdoc_ptext(mdoc, ln, buf, offs));
}