Hi all,
Bison has recently gained colored diagnostics, like GCC does. I would like
to document that and show examples of this. I would like to do that in PDF,
but I don't think it is possible, and probably not desirable. I would like
to do it in HTML, but then I have a bunch of problems on how to do it.
When I try something like this:
@ifhtml
@macro color{name, text}
@html
<b style="color:\name\">\text\</b>
@end html
@end macro
@end ifhtml
@ifnothtml
@macro color{name, text}
\text\
@end macro
@end ifnothtml
@example
$ @kbd{bison -Wmidrule-value mid.y}
mid.y:2.6-13: @color{purple, warning}: unset value: $$
2 | exp: @color{purple, @{ a(); @}} "b" @{ $$ = c(); @} @{ d(); @} "e" @{ f
= $1; @};
| @color{purple, ^~~~~~~~}
@end group
@end example
it fails with an error:
/Users/akim/src/gnu/bison/doc/bison.texi:4307: warning: @html should only
appear at the beginning of a line (possibly involving @color)
/Users/akim/src/gnu/bison/doc/bison.texi:4307: superfluous argument to @end
html: : unset value: $$ (possibly involving @color)
/Users/akim/src/gnu/bison/doc/bison.texi:4308: warning: @html should only
appear at the beginning of a line (possibly involving @color)
/Users/akim/src/gnu/bison/doc/bison.texi:4308: superfluous argument to @end
html: "b" @{ $$ = c(); @} @{ d(); @} "e" @{ f = $1; @}; (possibly involving
@color)
/Users/akim/src/gnu/bison/doc/bison.texi:4309: warning: @html should only
appear at the beginning of a line (possibly involving @color)
If I add an empty lime
@ifhtml
@macro color{name, text}
@html
<b style="color:\name\">\text\</b>
@end html
@end macro
@end ifhtml
than the output is broken:
I'm afraid that the image will be removed by the mailing list, so let me
describe the result: the bold and the color are there, but the layout is as
follows:
> mid.y:2.6-13: warning
>
> : unset value: $$
> 2 | exp:
> { a(); }
>
> "b" { $$ = c(); } { d(); } "e" { f = $1; };
> |
> ^~~~~~~~
instead of
> mid.y:2.6-13: warning: unset value: $$
> 2 | exp: { a(); } "b" { $$ = c(); } { d(); } "e" { f = $1; };
> | ^~~~~~~~
What can I do?
Thanks!