]> git.saurik.com Git - bison.git/blobdiff - NEWS
c++: use YYRHSLOC.
[bison.git] / NEWS
diff --git a/NEWS b/NEWS
index 7097f3bd80aaba305a64ca052b62b92193c0b573..cacdb7702cc0d9803504a5f33b82b317e2fb0a31 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -3,10 +3,46 @@ Bison News
 
 * Changes in version ?.? (????-??-??):
 
 
 * Changes in version ?.? (????-??-??):
 
+** C++ parsers use YYRHSLOC
+
+  Similarly to the C parsers, the C++ parsers now define the YYRHSLOC
+  macro and use it in the default YYLLOC_DEFAULT.  You are encouraged
+  to use it.  If, for instance, your location structure has "first"
+  and "last" members, instead of
+
+      # define YYLLOC_DEFAULT(Current, Rhs, N)                             \
+        do                                                                 \
+          if (N)                                                           \
+            {                                                              \
+              (Current).first = (Rhs)[1].location.first;                   \
+              (Current).last  = (Rhs)[N].location.last;                    \
+            }                                                              \
+          else                                                             \
+            {                                                              \
+              (Current).first = (Current).last = (Rhs)[0].location.last;   \
+            }                                                              \
+        while (false)
+
+  use:
+
+      # define YYLLOC_DEFAULT(Current, Rhs, N)                             \
+        do                                                                 \
+          if (N)                                                           \
+            {                                                              \
+              (Current).first = YYRHSLOC (Rhs, 1).first;                   \
+              (Current).last  = YYRHSLOC (Rhs, N).last;                    \
+            }                                                              \
+          else                                                             \
+            {                                                              \
+              (Current).first = (Current).last = YYRHSLOC (Rhs, 0).last;   \
+            }                                                              \
+        while (false)
+
+
 ** Additional yylex/yyparse arguments
 
   The new directive %param declare additional argument to both yylex
 ** Additional yylex/yyparse arguments
 
   The new directive %param declare additional argument to both yylex
-  and yyparse.  The %lex-param, %parse-param, and %param directive
+  and yyparse.  The %lex-param, %parse-param, and %param directives
   support one or more arguments.  Instead of
 
       %lex-param   {arg1_type *arg1}
   support one or more arguments.  Instead of
 
       %lex-param   {arg1_type *arg1}