]> git.saurik.com Git - bison.git/blobdiff - data/c.m4
Fix --help.
[bison.git] / data / c.m4
index 1fe4bc56c74d22f86a93dac51412a78034767cba..46ced82655c748f8b567cda4eac3ab98ad8dd8d8 100644 (file)
--- a/data/c.m4
+++ b/data/c.m4
@@ -205,6 +205,21 @@ m4_define([b4_token_enums_defines],
 ])
 
 
+## ----------------- ##
+## Semantic Values.  ##
+## ----------------- ##
+
+
+# b4_symbol_value(VAL, [TYPE])
+# ----------------------------
+# Given a semantic value VAL ($$, $1 etc.), extract its value of type
+# TYPE if TYPE is given, otherwise just return VAL.  The result can be
+# used safetly, it is put in parens to avoid nasty precedence issues.
+# TYPE is *not* put in braces, provide some if needed.
+m4_define([b4_symbol_value],
+[($1[]m4_ifval([$2], [.$2]))])
+
+
 
 ## --------------------------------------------- ##
 ## Defining C functions in both K&R and ANSI-C.  ##
@@ -352,6 +367,7 @@ m4_define([b4_sync_start], [[#]line $1 $2])
 m4_define([b4_case],
 [  case $1:
 $2
+b4_syncline([@oline@], [@ofile@])
     break;])
 
 # b4_symbol_actions(FILENAME, LINENO,
@@ -360,7 +376,7 @@ $2
 # -------------------------------------------------
 m4_define([b4_symbol_actions],
 [m4_pushdef([b4_dollar_dollar],
-   [m4_ifval([$6], [(yyvaluep->$6)], [(*yyvaluep)])])dnl
+   [b4_symbol_value([(*yyvaluep)], [$6])])dnl
 m4_pushdef([b4_at_dollar], [(*yylocationp)])dnl
       case $4: /* $3 */
 b4_syncline([$2], [$1])