* NEWS: Announce it.
* doc/bison.texi (Bison Options):  Here.
---
 NEWS           | 13 +++++++++++++
 doc/bison.texi | 44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+)

diff --git a/NEWS b/NEWS
index 2cd57c2..10dc93a 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,19 @@ GNU Bison NEWS
 
 * Noteworthy changes in release ?.? (????-??-??) [?]
 
+** New option for invoking Bison: -fcaret
+
+  Caret errors have been added to Bison, for example (taken from the
+  documentation):
+
+    err.y:4.5-8: error: invalid reference: '$foo'
+     C: {$foo{bar} };
+         ^^^^
+
+  The default behaviour for now is still not to display these unless explictly
+  asked with -fall of -fcaret. However, in a later release, it will be made the
+  default behavior (but may still be deactivated with -fno-caret).
+
 ** New value for %define variable: api.pure full
 
   The %define variable api.pure requests a pure (reentrant) parser. However,
diff --git a/doc/bison.texi b/doc/bison.texi
index 5952225..ffc8ac8 100644
--- a/doc/bison.texi
+++ b/doc/bison.texi
@@ -9239,6 +9239,50 @@ Treat warnings as errors.
 A category can be turned off by prefixing its name with @samp{no-}.  For
 instance, @option{-Wno-yacc} will hide the warnings about
 POSIX Yacc incompatibilities.
+
+@item -f [@var{feature}]
+@itemx --flags[=@var{feature}]
+Activate miscellaneous @var{feature}, which can be one of:
+@table @code
+@item caret
+@itemx diagnostics-show-caret
+Show caret errors, in a manner similar to GCC's
+@option{-fdiagnostics-show-caret}, or Clang's @option{-fcaret-diagnotics}. The
+location provided with the message is used to quote the corresponding line of
+the source file, underlining the important part of it with carets (^). Here is
+an example, using the following file @file{input.y}:
+
+@example
+%%
+exp : A BBBBB CC;
+B: 'char';
+C: @{$foo@{bar@} @};
+@end example
+
+When invoked with @option{-fcaret}, Bison will output:
+
+@example
+err.y:3.4-9: warning: extra characters in character literal
+ B: 'char';
+    ^^^^^^
+err.y:2.7: error: symbol A is used, but is not defined as a token and has no 
rules
+ exp : A BBBBB CC;
+       ^
+err.y:2.9-13: error: symbol BBBBB is used, but is not defined as a token and 
has no rules
+ exp : A BBBBB CC;
+         ^^^^^
+err.y:2.15-16: error: symbol CC is used, but is not defined as a token and has 
no rules
+ exp : A BBBBB CC;
+               ^^
+err.y:4.5-8: error: invalid reference: '$foo'
+ C: @{$foo@{bar@} @};
+     ^^^^
+err.y:4.4-15:    symbol not found in production: foo
+ C: @{$foo@{bar@} @};
+    ^^^^^^^^^^^^
+@end example
+
+@end table
 @end table
 
 @noindent
-- 
1.8.0


Reply via email to