%{/* Bison Grammar Parser -*- C -*-
- Copyright (C) 2002-2011 Free Software Foundation, Inc.
+ Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
#include "symlist.h"
#include "scan-gram.h"
#include "scan-code.h"
+#include "xmemdup0.h"
#define YYLLOC_DEFAULT(Current, Rhs, N) (Current) = lloc_default (Rhs, N)
static YYLTYPE lloc_default (YYLTYPE const *, int);
xmalloc (dir_length + 1 + strlen (skeleton_user) + 1);
if (dir_length > 0)
{
- strncpy (skeleton_build, current_file, dir_length);
+ memcpy (skeleton_build, current_file, dir_length);
skeleton_build[dir_length++] = '/';
}
strcpy (skeleton_build + dir_length, skeleton_user);
}
| "%destructor" "{...}" generic_symlist
{
- symbol_list *list;
- for (list = $3; list; list = list->next)
- symbol_list_destructor_set (list, $2, @2);
- symbol_list_free ($3);
+ code_props code;
+ code_props_symbol_action_init (&code, $2, @2);
+ code_props_translate_code (&code);
+ {
+ symbol_list *list;
+ for (list = $3; list; list = list->next)
+ symbol_list_destructor_set (list, &code);
+ symbol_list_free ($3);
+ }
}
| "%printer" "{...}" generic_symlist
{
- symbol_list *list;
- for (list = $3; list; list = list->next)
- symbol_list_printer_set (list, $2, @2);
- symbol_list_free ($3);
+ code_props code;
+ code_props_symbol_action_init (&code, $2, @2);
+ code_props_translate_code (&code);
+ {
+ symbol_list *list;
+ for (list = $3; list; list = list->next)
+ symbol_list_printer_set (list, &code);
+ symbol_list_free ($3);
+ }
}
| "%default-prec"
{
loc.start = rhs[n].end;
loc.end = rhs[n].end;
- /* Ignore empty nonterminals the start of the the right-hand side.
+ /* Ignore empty nonterminals the start of the right-hand side.
Do not bother to ignore them at the end of the right-hand side,
since empty nonterminals have the same end as their predecessors. */
for (i = 1; i <= n; i++)
complain_at (loc, _("missing identifier in parameter declaration"));
else
{
- char *name;
- size_t name_len;
-
- for (name_len = 1;
- memchr (alphanum, name_start[name_len], sizeof alphanum);
- name_len++)
- continue;
-
- name = xmalloc (name_len + 1);
- memcpy (name, name_start, name_len);
- name[name_len] = '\0';
+ char *name = xmemdup0 (name_start, strspn (name_start, alphanum));
muscle_pair_list_grow (type, decl, name);
free (name);
}
if (strverscmp (version, PACKAGE_VERSION) > 0)
{
complain_at (*loc, "require bison %s, but have %s",
- version, PACKAGE_VERSION);
- exit (63);
+ version, PACKAGE_VERSION);
+ exit (EX_MISMATCH);
}
}