mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
diagnostics: clean up convention for colored diagnostics
* data/diagnostics.css: Rename as... * data/bison-default.css: this. Add the GPL header. This is the convention followed by Bruno Haible in gettext. Adjust dependencies. * src/complain.c (complain_init_color): Use BISON_STYLE instead of BISON_DIAGNOSTICS_STYLE.
This commit is contained in:
13
NEWS
13
NEWS
@@ -15,10 +15,10 @@ GNU Bison NEWS
|
||||
|
||||
*** Colored diagnostics
|
||||
|
||||
As an experimental feature, Bison now generates colored diagnostics,
|
||||
controlled by the new options --color and --style.
|
||||
As an experimental feature, diagnostics are now colored, controlled by the
|
||||
new options --color and --style.
|
||||
|
||||
Install the libtextstyle library before configuring Bison to use them.
|
||||
To use them, install the libtextstyle library before configuring Bison.
|
||||
It is available from
|
||||
|
||||
https://alpha.gnu.org/gnu/gettext/
|
||||
@@ -34,12 +34,13 @@ GNU Bison NEWS
|
||||
|
||||
To customize the styles, create a CSS file similar to
|
||||
|
||||
/* black-and-white.css */
|
||||
/* bison-bw.css */
|
||||
.warning { }
|
||||
.error { font-weight: 800; text-decoration: underline; }
|
||||
.note { }
|
||||
|
||||
then invoke bison with --style=black-and-white.css.
|
||||
then invoke bison with --style=bison-bw.css, or set the BISON_STYLE
|
||||
environment variable to "bison-bw.css".
|
||||
|
||||
*** Disabling output
|
||||
|
||||
@@ -3623,7 +3624,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
LocalWords: redeclaration sval fcaret reentrant XSLT xsl Wmaybe yyvsp Tedi
|
||||
LocalWords: pragmas noreturn untyped Rozenman unexpanded Wojciech Polak
|
||||
LocalWords: Alexandre MERCHANTABILITY yytype emplace ptr automove lvalues
|
||||
LocalWords: nonterminal yy args Pragma dereference yyformat rhs docdir
|
||||
LocalWords: nonterminal yy args Pragma dereference yyformat rhs docdir bw
|
||||
LocalWords: Redeclarations rpcalc Autoconf YFLAGS Makefiles PROG DECL num
|
||||
LocalWords: Heimbigner AST src ast Makefile srcdir MinGW xxlex XXSTYPE
|
||||
LocalWords: XXLTYPE strictfp IDEs ffixit fdiagnostics parseable fixits
|
||||
|
||||
24
data/bison-default.css
Normal file
24
data/bison-default.css
Normal file
@@ -0,0 +1,24 @@
|
||||
/* Default styling rules for Bison when doing terminal output.
|
||||
Copyright (C) 2006-2007 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* This is an experimental feature. The class names may change in the
|
||||
future. */
|
||||
|
||||
.warning { color: purple; }
|
||||
.error { color: red; }
|
||||
.note { color: cyan; }
|
||||
/* Semantic values in Bison's own parser traces. */
|
||||
.value { color: green; }
|
||||
@@ -1,10 +0,0 @@
|
||||
/* CSS style for Bison's diagnostics.
|
||||
|
||||
This is an experimental feature. The class names may change in the
|
||||
future. */
|
||||
|
||||
.warning { color: purple; }
|
||||
.error { color: red; }
|
||||
.note { color: cyan; }
|
||||
/* Semantic values in Bison's parser traces. */
|
||||
.value { color: green; }
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
dist_pkgdata_DATA = \
|
||||
data/README.md \
|
||||
data/diagnostics.css
|
||||
data/bison-default.css
|
||||
|
||||
skeletonsdir = $(pkgdatadir)/skeletons
|
||||
dist_skeletons_DATA = \
|
||||
|
||||
@@ -255,14 +255,13 @@ complain_init_color (void)
|
||||
|| color_mode == color_html
|
||||
|| (color_mode == color_tty && isatty (STDERR_FILENO)))
|
||||
{
|
||||
style_file_prepare ("BISON_DIAGNOSTICS_STYLE", NULL,
|
||||
pkgdatadir (),
|
||||
"diagnostics.css");
|
||||
style_file_prepare ("BISON_STYLE", NULL, pkgdatadir (),
|
||||
"bison-default.css");
|
||||
/* As a fallback, use the default in the current directory. */
|
||||
struct stat statbuf;
|
||||
if ((style_file_name == NULL || stat (style_file_name, &statbuf) < 0)
|
||||
&& stat ("diagnostics.css", &statbuf) == 0)
|
||||
style_file_name = "diagnostics.css";
|
||||
&& stat ("bison-default.css", &statbuf) == 0)
|
||||
style_file_name = "bison-default.css";
|
||||
}
|
||||
else
|
||||
/* No styling. */
|
||||
|
||||
Reference in New Issue
Block a user