| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
it, make_pending(), which was the most difficult function of the
whole mdoc(7) parser. After almost five years of maintaining this
hellhole, i just noticed the pointer isn't needed after all.
Blocks are always rewound in the reverse order they were opened;
that even holds for broken blocks. Consequently, it is sufficient
to just mark broken blogs with the flag MDOC_BROKEN and breaking
blocks with the flag MDOC_ENDED. When rewinding, instead of iterating
the pending pointers, just iterate from each broken block to its
parents, rewinding all that are MDOC_ENDED and stopping after
processing the first ancestor that it not MDOC_BROKEN. For ENDBODY
markers, use the mdoc_node.body pointer in place of the former
mdoc_node.pending.
This also fixes an assertion failure found by jsg@ with afl,
test case #467 (Bo Bl It Bd Bc It), where (surprise surprise)
the pending pointer got corrupted.
Improved functionality, minus one function, minus one struct field,
minus 50 lines of code.
|
|
|
|
|
| |
eventually leading to NULL pointer access;
found by jsg@ with afl, text case #455.
|
|
|
|
|
|
|
|
| |
That could happen when their first argument was another called macro,
causing a NULL pointer access in .St validation found by jsg@ with afl.
Make in_line_argn() easier to understand by using one state
variable rather than two.
|
|
|
|
|
| |
so if we are in a loop over blocks, cleanly restart the loop
rather than risking use after free; found by jsg@ with afl.
|
|
|
|
|
| |
replacing the last instances by more specific warnings.
Improved functionality, minus 50 lines of code.
|
|
|
|
| |
better handle .Fo with more than one argument
|
| |
|
| |
|
|
|
|
| |
Minus one struct member, minus 17 lines of code, no functional change.
|
|
|
|
|
| |
Discard empty .Bk blocks.
Improve related diagnostics.
|
| |
|
|
|
|
| |
(assertion failure); regression found in jsg@'s afl test case 847.
|
|
|
|
|
|
|
| |
They were a maintenance and auditing nightmare because if you changed
one bit in there, stuff tended to break at seemingly unrelated places.
No functional change except getting rid of one bogus error message,
but minus 80 lines of code.
|
|
|
|
| |
as a bonus, get rid of another call to rew_sub().
|
|
|
|
|
|
| |
except that some error messages become less confusing.
Now the function is almost readable (but still requires
nineteen lines of comments for fourteen lines of code).
|
|
|
|
|
| |
the calling macro handler already found the breaking block.
No functional change except tiny variations in error messages.
|
|
|
|
|
| |
is known. This only leaves three that do actual searching.
No functional change, minus 30 lines of code.
|
|
|
|
|
|
| |
remain in other functions. As a bonus, this fixes an assertion failure
jsg@ found some time ago with afl (test case 982) and improves minor
details in error reporting.
|
|
|
|
|
|
|
|
|
| |
block closure macro it calls, do not attempt to open its body.
This can for example happen for (nonsensical) constructions like
.Fo
.Nm Fc
in the SYNOPSIS. Fixing an assertion failure jsg@ found with afl
some time ago (test case number 731).
|
| |
|
|
|
|
|
|
| |
* Replace calls to rew_sub() with rew_last() - two less out of 18.
* No need to keep track of the body, it's always opened right after
the head and never used for anything in this function.
|
|
|
|
|
|
|
|
|
|
| |
and elements under any and all circumstances, even handling some
bad block nesting now and then. Little surprisingly, this ends up
in excessive complexity and has caused many bugs in the past.
Start to slowly disentangle this mess by replacing calls to rew_sub()
immediately following mdoc_head_alloc() by the much simpler rew_last().
Gets rid of the first two rew_sub() calls out of twenty.
No functional change.
|
|
|
|
|
|
|
| |
Similarly, avoid having the same block break two other blocks.
In some situations, this could lead to an endless loop in rew_sub()
found by jsg@ with afl.
Minimal example: .Po Ao Pc Bo Pc Ac Bc
|
|
|
|
|
|
|
|
| |
1) rew_sub(): Make sure REWIND_MORE is acted upon even when followed by
REWIND_NONE. This prevents .It from ending up inside other children of .Bl.
2) blk_exp_close(): Only allow extension of .Bl when it has at least
one .It. Otherwise, a broken child block could be moved in front of
the .Bl, effectively resulting in a .Bl that ended before it began.
|
|
|
|
| |
Fixes an assertion found by jsg@ with afl.
|
|
|
|
|
|
|
| |
already closed. In this respect, also consider lists closed
that have broken another block, their closure pending until the
end of the broken block. This avoids syntax tree corruption
leading to a NULL pointer access found by jsg@ with afl.
|
|
|
|
| |
Do not show bogus quotes when .Bl -column phrases are quoted.
|
|
|
|
|
|
|
| |
* The first argument of .Pf is not parsed.
* Normal delimiter handling does not apply to the first argument of .Pf.
* Warn if nothing follows a prefix (inspired by groff_mdoc(7)).
* In that case, do not suppress spacing.
|
|
|
|
| |
inspired by a similar warning in the groff_mdoc(7) macros
|
|
|
|
|
| |
for in_line_eoln() macros and .Bl -column phrases.
No functional change.
|
|
|
|
|
|
|
|
|
|
| |
same chunk of argument parsing code out of five of the eight callback
functions. The other three have too much special handling to
participate.
As a bonus, let lookup() and mdoc_args() deal with line macros and
retire the lookup_raw() helper and the mdoc_zargs() internal interface
function.
No functional change, minus 40 lines of code.
|
|
|
|
|
|
| |
it was the same in all four cases. As a bonus, get rid
of one enum type that was used for internal communication.
No functional change, minus 40 lines of code.
|
|
|
|
| |
no functional change, minus 50 lines of code.
|
|
|
|
| |
No functional change, minus 130 lines of code.
|
|
|
|
| |
No functional change, minus 90 lines of code.
|
|
|
|
|
|
|
|
| |
1. Correctly parse stray .Ec without preceding .Eo,
avoiding an assertion violation found by jsg@ with afl.
2. Correctly parse .Ec arguments when breaking another block.
3. Correct spacing around closing delimiter when breaking another block.
4. Sync some related formatting control from -Tascii to -Thtml.
|
|
|
|
| |
fixing an assertion failure found by jsg@ with afl.
|
|
|
|
|
| |
which can for example happen for .Sh Xo .Sh without .Xc.
Crash found by jsg@ with afl.
|
|
|
|
|
| |
1. The first argument of .Fn is not supposed to be parsed.
2. The .Fn macro is not supposed to reopen its scope after punctuation.
|
|
|
|
|
|
|
|
|
|
| |
* .No selects the default font; relevant e.g. in .Bf blocks
* no need to force empty .Li elements
* closing delimiters as leading macro arguments do not suppress space
* opening delimiters at the end of a macro line do not suppress space
* correctly handle delimiter spacing in -Tman
As a side effect, these fixes let mandoc warn about empty .No macros
as requested by bentley@.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
just like a closing delimiter. This didn't work in groff-1.15,
but it now works in groff-1.22.
After being closed by delimiters, .Nm scopes do not reopen.
Do not suppress white space after .Fl if the next node is a text node
on the same input line; that can happen for middle delimiters.
Fixing an issue reported by jmc@.
|
|
|
|
|
|
|
| |
even though the list is still the last processed macro.
This fixes a regression introduced in mdoc_macro.c rev. 1.138:
Ulrich Spoerlein <uqs at FreeBSD> reports that various of their
kernel manuals trigger assertions.
|
|
|
|
|
|
| |
Include <sys/types.h> where needed, it does not belong in config.h.
Remove <stdio.h> from config.h; if it is missing somewhere, it should
be added, but i cannot find a *.c file where it is missing.
|
| |
|
|
|
|
|
| |
When finding items outside lists, simply skip them and throw an ERROR.
Handle subsections before the first section instead of bailing out.
|
|
|
|
| |
Hierarchical naming and mention macro names in messages.
|
|
|
|
|
|
| |
* Downgrade ".Bf -emphasis Em" from FATAL to WARNING.
* Mention the macros, the arguments, and the fallbacks.
* Hierarchical naming.
|
|
|
|
| |
in particular reporting the macro names involved.
|