]> git.saurik.com Git - bison.git/blobdiff - data/c.m4
Rule length is unsigned.
[bison.git] / data / c.m4
index 430a5573290aa1ef7a91b00584f4be6c827d3ef2..f0b5f14d2f7a4e3edc7b8d6dcbb2d8ae141276a9 100644 (file)
--- a/data/c.m4
+++ b/data/c.m4
 ## Identification.  ##
 ## ---------------- ##
 
-# b4_comment(TEXT)
-# ----------------
+# b4_comment_(TEXT, OPEN, CONTINUE, END)
+# -------------------------------------
 # Put TEXT in comment.  Avoid trailing spaces: don't indent empty lines.
 # Avoid adding indentation to the first line, as the indentation comes
-# from "/*".  That's why we don't patsubst([$1], [^\(.\)], [   \1]).
-m4_define([b4_comment], [/* m4_bpatsubst([$1], [
+# from OPEN.  That's why we don't patsubst([$1], [^\(.\)], [   \1]).
+#
+# Prefix all the output lines with PREFIX.
+m4_define([b4_comment_], [$2[]m4_bpatsubst([$1], [
 \(.\)], [
-   \1])  */])
+$3\1])$4])
+
+
+# b4_c_comment(TEXT, [PREFIX])
+# ----------------------------
+# Put TEXT in comment.  Avoid trailing spaces: don't indent empty lines.
+# Avoid adding indentation to the first line, as the indentation comes
+# from "/*".  That's why we don't patsubst([$1], [^\(.\)], [   \1]).
+#
+# Prefix all the output lines with PREFIX.
+m4_define([b4_c_comment],
+[b4_comment_([$1], [$2/* ], [$2   ], [$2  */])])
+
+
+# b4_comment(TEXT, [PREFIX])
+# --------------------------
+# By default, C comments.
+m4_define([b4_comment], [b4_c_comment($@)])
+
 
 # b4_identification
 # -----------------
@@ -159,7 +179,7 @@ m4_define([b4_null], [0])
 # -----------------------------------------
 # Output the definition of this token as #define.
 m4_define([b4_token_define],
-[#define $1 $2
+[#define b4_percent_define_get([token.prefix])$1 $2
 ])
 
 
@@ -177,7 +197,7 @@ m4_map([b4_token_define], [$@])])
 # ---------------------------------------
 # Output the definition of this token as an enum.
 m4_define([b4_token_enum],
-[$1 = $2])
+[b4_percent_define_get([token.prefix])$1 = $2])
 
 
 # b4_token_enums(LIST-OF-PAIRS-TOKEN-NAME-TOKEN-NUMBER)