]> git.saurik.com Git - bison.git/blobdiff - data/yacc.c
Add test glr-regr1.at to check for incorrect collapsing of states during
[bison.git] / data / yacc.c
index 29e13e9feb12d67f619140279a5212da2863e095..0bbd482792d3847c7574b5583526fd7fad9607e3 100644 (file)
@@ -47,6 +47,28 @@ m4_ifdef([b4_parse_param],
           b4_parse_param)])
 
 
+
+## ------------ ##
+## Data Types.  ##
+## ------------ ##
+
+# b4_int_type(MIN, MAX)
+# ---------------------
+# Return the smallest int type able to handle numbers ranging from
+# MIN to MAX (included).  We overwrite the version from c.m4 which relies
+# on `signed char' which is not portable to old K&R compilers.
+m4_define([b4_int_type],
+[m4_if(b4_ints_in($@,      [0],   [255]), [1], [unsigned char],
+       b4_ints_in($@,   [-128],   [127]), [1], [yysigned_char],
+
+       b4_ints_in($@,      [0], [65535]), [1], [unsigned short],
+       b4_ints_in($@, [-32768], [32767]), [1], [short],
+
+       m4_eval([0 <= $1]),                [1], [unsigned int],
+
+                                              [int])])
+
+
 ## ----------------- ##
 ## Semantic Values.  ##
 ## ----------------- ##
@@ -134,7 +156,8 @@ m4_popdef([b4_dollar_dollar])dnl
 ])
 
 
-
+# We do want M4 expansion after # for CPP macros.
+m4_changecom()
 m4_divert(0)dnl
 #output "b4_output_parser_name"
 b4_copyright([Skeleton parser for Yacc-like parsing with Bison],