#include "symfile.h"
#include "objfiles.h"
-/* Ensure that if the generated parser contains any calls to malloc/realloc,
- that they get mapped to xmalloc/xrealloc. */
-
-#define malloc xmalloc
-#define realloc xrealloc
-
-/* These MUST be included in any grammar file!!!!
- Please choose unique names! */
+/* These MUST be included in any grammar file!!!! Please choose unique names!
+ Note that this are a combined list of variables that can be produced
+ by any one of bison, byacc, or yacc. */
#define yymaxdepth m2_maxdepth
#define yyparse m2_parse
#define yylex m2_lex
#define yy_yyv m2_yyv
#define yyval m2_val
#define yylloc m2_lloc
+#define yyss m2_yyss /* byacc */
+#define yyssp m2_yysp /* byacc */
+#define yyvs m2_yyvs /* byacc */
+#define yyvsp m2_yyvsp /* byacc */
#if 0
static char *
struct block *modblock=0;
/* #define YYDEBUG 1 */
-
%}
/* Although the yacc "value" of an expression is not used,
%type <sym> fblock
%token <lval> INT HEX ERROR
-%token <ulval> UINT TRUE FALSE CHAR
+%token <ulval> UINT M2_TRUE M2_FALSE CHAR
%token <dval> FLOAT
/* Both NAME and TYPENAME tokens represent symbols in the input,
/* This is not an actual token ; it is used for precedence.
%right QID
*/
+
+%{
+/* Ensure that if the generated parser contains any calls to malloc/realloc,
+ that they get mapped to xmalloc/xrealloc. We have to do this here
+ rather than earlier in the file because this is the first point after
+ the place where the SVR4 yacc includes <malloc.h>, and if we do it
+ before that, then the remapped declarations in <malloc.h> will collide
+ with the ones in "defs.h". */
+
+#define malloc xmalloc
+#define realloc xrealloc
+%}
+
%%
start : exp
/* Constants */
-exp : TRUE
+exp : M2_TRUE
{ write_exp_elt_opcode (OP_BOOL);
write_exp_elt_longcst ((LONGEST) $1);
write_exp_elt_opcode (OP_BOOL); }
;
-exp : FALSE
+exp : M2_FALSE
{ write_exp_elt_opcode (OP_BOOL);
write_exp_elt_longcst ((LONGEST) $1);
write_exp_elt_opcode (OP_BOOL); }
{
char *err_copy = (char *) alloca (p - tokstart + 1);
- bcopy (tokstart, err_copy, p - tokstart);
+ memcpy (err_copy, tokstart, p - tokstart);
err_copy[p - tokstart] = 0;
error ("Invalid number \"%s\".", err_copy);
}
if(!strncmp(tokstart,"TRUE",4))
{
yylval.ulval = 1;
- return TRUE;
+ return M2_TRUE;
}
else if(!strncmp(tokstart,"FALSE",5))
{
yylval.ulval = 0;
- return FALSE;
+ return M2_FALSE;
}
}