+2010-11-26 Thomas Dickey <tom@crayon>
+
+ * skeleton.c: typo
+
+ * output.c:
+ correct line-numbering when "-r" option is used; the 'outline' variable
+ should only be incremented when writing to the code-file.
+
+ * test/code_calc.code.c, test/code_error.code.c: regen
+
+ * yacc.1: bump date
+
+ * yacc.1: comment on -b option vs -r
+
+ * test/calc2.tab.c, test/calc2.y, test/calc3.tab.c, test/calc3.y, test/ftp.tab.c, test/grammar.tab.c, test/pure_calc.tab.c, test/pure_error.tab.c, test/calc.tab.c, test/calc1.tab.c, test/code_calc.code.c, test/code_error.code.c, test/error.tab.c:
+ regen
+
+ * output.c:
+ improve on YYERROR_DECL(), adding dummy params which can be used for the
+ actual function declaration. Also add YYERROR_CALL(). The two macros
+ simplify maintaining sets of grammars which may/may not be pure.
+
+ * test/calc1.y, test/ftp.tab.c, test/grammar.tab.c, test/pure_calc.tab.c, test/pure_error.tab.c, test/calc.tab.c, test/calc1.tab.c, test/calc2.tab.c, test/calc3.tab.c, test/code_calc.code.c, test/code_error.code.c, test/error.tab.c:
+ regen
+
+ * output.c: generate yyerror() calls in output.c
+ This is for compatibility with bison, which passes the yylval to yyerror
+ when the %parse-param feature is used.
+
+ * skeleton.c, defs.h: generate yyerror() calls in output.c
+
+ * output.c: simplified a little, using putc_code() and putl_code()
+
+ * test/calc1.tab.h: regen
+
+ * reader.c:
+ improve ifdef for YYSTYPE union declaration (report by Clifford Yapp)
+
+ * reader.c:
+ accept underscore as a replacement for dash in command names, e.g.,
+ "%pure_parser" vs "%pure-parser".
+
+ * test/calc1.tab.c: regen
+
+ * output.c, reader.c:
+ also ifdef YYSTYPE declaration in the generated code (report by Clifford Yapp)
+
+ * package/debian/changelog, package/byacc.spec, VERSION: bump
+
2010-11-24 Thomas Dickey <tom@crayon>
* main.c, defs.h, symtab.c, error.c: reduce global variables
-/* $Id: defs.h,v 1.29 2010/11/24 15:13:25 tom Exp $ */
+/* $Id: defs.h,v 1.30 2010/11/26 15:19:36 tom Exp $ */
#ifdef HAVE_CONFIG_H
#include <config.h>
extern const char *body_1[];
extern const char *body_vars[];
extern const char *body_2[];
+extern const char *body_3[];
extern const char *trailer[];
+extern const char *trailer_2[];
extern char *code_file_name;
extern char *input_file_name;
-/* $Id: output.c,v 1.31 2010/11/23 01:45:45 tom Exp $ */
+/* $Id: output.c,v 1.36 2010/11/26 16:47:40 tom Exp $ */
#include "defs.h"
#define StaticOrR (rflag ? "" : "static ")
+#define CountLine(fp) (!rflag || ((fp) == code_file))
static int nvectors;
static int nentries;
static int high;
static void
-write_char(FILE * out, int c)
+putc_code(int c)
{
if (c == '\n')
++outline;
- putc(c, out);
+ putc(c, code_file);
}
static void
-write_code_lineno(FILE * out)
+putl_code(const char *s)
+{
+ ++outline;
+ fputs(s, code_file);
+}
+
+static void
+puts_code(const char *s)
+{
+ fputs(s, code_file);
+}
+
+static void
+write_code_lineno(void)
{
if (!lflag)
- fprintf(out, line_format, (outline++) + 1, code_file_name);
+ {
+ ++outline;
+ fprintf(code_file, line_format, outline, code_file_name);
+ }
}
static void
-write_input_lineno(FILE * out)
+write_input_lineno(void)
{
if (!lflag)
{
++outline;
- fprintf(out, line_format, lineno, input_file_name);
+ fprintf(code_file, line_format, lineno, input_file_name);
}
}
static void
define_prefixed(FILE * fp, const char *name)
{
- ++outline;
+ int bump_line = CountLine(fp);
+ if (bump_line)
+ ++outline;
fprintf(fp, "\n");
- ++outline;
+ if (bump_line)
+ ++outline;
fprintf(fp, "#ifndef %s\n", name);
- ++outline;
+ if (bump_line)
+ ++outline;
fprintf(fp, "#define %-10s %s%s\n", name, symbol_prefix, name + 2);
- ++outline;
+ if (bump_line)
+ ++outline;
fprintf(fp, "#endif /* %s */\n", name);
}
define_prefixed(fp, "yyname");
define_prefixed(fp, "yyrule");
}
- ++outline;
+ if (CountLine(fp))
+ ++outline;
fprintf(fp, "#define YYPREFIX \"%s\"\n", symbol_prefix);
}
s = symbol_name[i];
if (is_C_identifier(s))
{
- fprintf(code_file, "#define ");
+ puts_code("#define ");
if (dflag)
fprintf(defines_file, "#define ");
c = *s;
if (dflag && unionized)
{
rewind(union_file);
- fprintf(defines_file,
- "#if !(defined(YYSTYPE) || defined(YYSTYPE_IS_DECLARED))\n");
while ((c = getc(union_file)) != EOF)
putc(c, defines_file);
- fprintf(defines_file,
- "#endif /* !(YYSTYPE || YYSTYPE_IS_DECLARED) */\n");
fprintf(defines_file, "extern YYSTYPE %slval;\n",
symbol_prefix);
}
output_stored_text(void)
{
int c;
- FILE *in, *out;
+ FILE *in;
rewind(text_file);
if (text_file == NULL)
in = text_file;
if ((c = getc(in)) == EOF)
return;
- out = code_file;
- write_char(out, c);
+ putc_code(c);
while ((c = getc(in)) != EOF)
{
- write_char(out, c);
+ putc_code(c);
}
- write_code_lineno(out);
+ write_code_lineno();
}
static void
++outline;
fprintf(code_file, "#define YYFINAL %d\n", final_state);
- outline += 3;
- fprintf(code_file, "#ifndef YYDEBUG\n#define YYDEBUG %d\n#endif\n", tflag);
+ putl_code("#ifndef YYDEBUG\n");
+ ++outline;
+ fprintf(code_file, "#define YYDEBUG %d\n", tflag);
+ putl_code("#endif\n");
if (rflag)
{
static void
output_pure_parser(void)
{
- outline += 3;
- fprintf(code_file, "\n#define YYPURE %d\n\n", pure_parser);
+ putc_code('\n');
+
+ outline += 1;
+ fprintf(code_file, "#define YYPURE %d\n", pure_parser);
+
+ putc_code('\n');
}
static void
{
if (!unionized && ntags == 0)
{
- outline += 5;
- fprintf(code_file,
- "\n#ifndef YYSTYPE\ntypedef int YYSTYPE;\n#endif\n\n");
+ putc_code('\n');
+ putl_code("#ifndef YYSTYPE\n");
+ putl_code("typedef int YYSTYPE;\n");
+ putl_code("#endif\n");
+ putc_code('\n');
}
}
output_trailing_text(void)
{
int c, last;
- FILE *in, *out;
+ FILE *in;
if (line == 0)
return;
in = input_file;
- out = code_file;
c = *cptr;
if (c == '\n')
{
++lineno;
if ((c = getc(in)) == EOF)
return;
- write_input_lineno(out);
- write_char(out, c);
+ write_input_lineno();
+ putc_code(c);
last = c;
}
else
{
- write_input_lineno(out);
+ write_input_lineno();
do
{
- putc(c, out);
+ putc_code(c);
}
while ((c = *++cptr) != '\n');
- write_char(out, c);
+ putc_code(c);
last = '\n';
}
while ((c = getc(in)) != EOF)
{
- write_char(out, c);
+ putc_code(c);
last = c;
}
if (last != '\n')
{
- write_char(out, '\n');
+ putc_code('\n');
}
- write_code_lineno(out);
+ write_code_lineno();
}
static void
output_semantic_actions(void)
{
int c, last;
- FILE *out;
rewind(action_file);
if ((c = getc(action_file)) == EOF)
return;
- out = code_file;
last = c;
- write_char(out, c);
+ putc_code(c);
while ((c = getc(action_file)) != EOF)
{
- write_char(out, c);
+ putc_code(c);
last = c;
}
if (last != '\n')
{
- write_char(out, '\n');
+ putc_code('\n');
}
- write_code_lineno(out);
+ write_code_lineno();
}
static void
output_parse_decl(void)
{
- ++outline;
- fprintf(code_file, "/* compatibility with bison */\n");
- ++outline;
- fprintf(code_file, "#ifdef YYPARSE_PARAM\n");
- ++outline;
- fprintf(code_file, "/* compatibility with FreeBSD */\n");
- ++outline;
- fprintf(code_file, "# ifdef YYPARSE_PARAM_TYPE\n");
- ++outline;
- fprintf(code_file, "# define YYPARSE_DECL() "
- "yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)\n");
- ++outline;
- fprintf(code_file, "# else\n");
- ++outline;
- fprintf(code_file, "# define YYPARSE_DECL() "
- "yyparse(void *YYPARSE_PARAM)\n");
- ++outline;
- fprintf(code_file, "# endif\n");
- ++outline;
- fprintf(code_file, "#else\n");
- ++outline;
- fprintf(code_file, "# define YYPARSE_DECL() yyparse(");
+ putl_code("/* compatibility with bison */\n");
+ putl_code("#ifdef YYPARSE_PARAM\n");
+ putl_code("/* compatibility with FreeBSD */\n");
+ putl_code("# ifdef YYPARSE_PARAM_TYPE\n");
+ putl_code("# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)\n");
+ putl_code("# else\n");
+ putl_code("# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)\n");
+ putl_code("# endif\n");
+ putl_code("#else\n");
+
+ puts_code("# define YYPARSE_DECL() yyparse(");
if (!parse_param)
- fprintf(code_file, "void");
+ puts_code("void");
else
{
param *p;
fprintf(code_file, "%s %s%s%s", p->type, p->name, p->type2,
p->next ? ", " : "");
}
- fprintf(code_file, ")\n");
- outline += 2;
- fprintf(code_file, "#endif\n\n");
+ putl_code(")\n");
+
+ putl_code("#endif\n");
+ putl_code("\n");
}
static void
output_lex_decl(void)
{
- ++outline;
- fprintf(code_file, "/* Parameters sent to lex. */\n");
- ++outline;
- fprintf(code_file, "#ifdef YYLEX_PARAM\n");
+ putl_code("/* Parameters sent to lex. */\n");
+ putl_code("#ifdef YYLEX_PARAM\n");
if (pure_parser)
{
- ++outline;
- fprintf(code_file, "# define YYLEX_DECL() yylex(YYSTYPE *yylval, "
- "void *YYLEX_PARAM)\n");
- ++outline;
- fprintf(code_file, "# define YYLEX yylex(&yylval, YYLEX_PARAM)\n");
+ putl_code("# define YYLEX_DECL() yylex(YYSTYPE *yylval, "
+ "void *YYLEX_PARAM)\n");
+ putl_code("# define YYLEX yylex(&yylval, YYLEX_PARAM)\n");
}
else
{
- ++outline;
- fprintf(code_file,
- "# define YYLEX_DECL() yylex(void *YYLEX_PARAM)\n");
- ++outline;
- fprintf(code_file, "# define YYLEX yylex(YYLEX_PARAM)\n");
+ putl_code("# define YYLEX_DECL() yylex(void *YYLEX_PARAM)\n");
+ putl_code("# define YYLEX yylex(YYLEX_PARAM)\n");
}
- ++outline;
- fprintf(code_file, "#else\n");
+ putl_code("#else\n");
if (pure_parser && lex_param)
{
param *p;
- fprintf(code_file, "# define YYLEX_DECL() yylex(YYSTYPE *yylval, ");
+ puts_code("# define YYLEX_DECL() yylex(YYSTYPE *yylval, ");
for (p = lex_param; p; p = p->next)
fprintf(code_file, "%s %s%s%s", p->type, p->name, p->type2,
p->next ? ", " : "");
- ++outline;
- fprintf(code_file, ")\n");
+ putl_code(")\n");
- fprintf(code_file, "# define YYLEX yylex(&yylval, ");
+ puts_code("# define YYLEX yylex(&yylval, ");
for (p = lex_param; p; p = p->next)
fprintf(code_file, "%s%s", p->name, p->next ? ", " : "");
- ++outline;
- fprintf(code_file, ")\n");
+ putl_code(")\n");
}
else if (pure_parser)
{
- ++outline;
- fprintf(code_file, "# define YYLEX_DECL() yylex(YYSTYPE *yylval)\n");
-
- ++outline;
- fprintf(code_file, "# define YYLEX yylex(&yylval)\n");
+ putl_code("# define YYLEX_DECL() yylex(YYSTYPE *yylval)\n");
+ putl_code("# define YYLEX yylex(&yylval)\n");
}
else if (lex_param)
{
param *p;
- fprintf(code_file, "# define YYLEX_DECL() yylex(");
+ puts_code("# define YYLEX_DECL() yylex(");
for (p = lex_param; p; p = p->next)
fprintf(code_file, "%s %s%s%s", p->type, p->name, p->type2,
p->next ? ", " : "");
- ++outline;
- fprintf(code_file, ")\n");
+ putl_code(")\n");
- fprintf(code_file, "# define YYLEX yylex(");
+ puts_code("# define YYLEX yylex(");
for (p = lex_param; p; p = p->next)
fprintf(code_file, "%s%s", p->name, p->next ? ", " : "");
- ++outline;
- fprintf(code_file, ")\n");
+ putl_code(")\n");
}
else
{
- ++outline;
- fprintf(code_file, "# define YYLEX_DECL() yylex(void)\n");
+ putl_code("# define YYLEX_DECL() yylex(void)\n");
+ putl_code("# define YYLEX yylex()\n");
+ }
+ putl_code("#endif\n");
+ putl_code("\n");
+}
- ++outline;
- fprintf(code_file, "# define YYLEX yylex()\n");
+static void
+output_error_decl(void)
+{
+ putl_code("/* Parameters sent to yyerror. */\n");
+ if (parse_param)
+ {
+ putl_code("#define YYERROR_DECL() yyerror(YYSTYPE *v, const char *s)\n");
+ putl_code("#define YYERROR_CALL(msg) yyerror(&yylval, msg)\n");
+ }
+ else
+ {
+ putl_code("#define YYERROR_DECL() yyerror(const char *s)\n");
+ putl_code("#define YYERROR_CALL(msg) yyerror(msg)\n");
}
- outline += 2;
- fprintf(code_file, "#endif\n\n");
+ putl_code("\n");
}
static void
}
}
+static void
+output_yyerror_call(const char *msg)
+{
+ puts_code(" yyerror(");
+ if (parse_param)
+ {
+ puts_code("&yylval, ");
+ }
+ puts_code("\"");
+ puts_code(msg);
+ putl_code("\");\n");
+}
+
void
output(void)
{
output_stype();
output_parse_decl();
output_lex_decl();
+ output_error_decl();
write_section(xdecls);
output_defines();
output_rule_data();
write_section(body_vars);
}
write_section(body_2);
+ output_yyerror_call("syntax error");
+ write_section(body_3);
output_semantic_actions();
write_section(trailer);
+ output_yyerror_call("yacc stack overflow");
+ write_section(trailer_2);
}
#ifdef NO_LEAKS
Summary: byacc - public domain Berkeley LALR Yacc parser generator
%define AppProgram byacc
-%define AppVersion 20101124
+%define AppVersion 20101126
%define UseProgram yacc
-# $XTermId: byacc.spec,v 1.4 2010/11/24 14:55:39 tom Exp $
+# $XTermId: byacc.spec,v 1.5 2010/11/26 09:22:40 tom Exp $
Name: %{AppProgram}
Version: %{AppVersion}
Release: 1
+byacc (20101126) unstable; urgency=low
+
+ * additional fix to generated code to avoid symbol conflict
+
+ -- Thomas E. Dickey <dickey@invisible-island.net> Fri, 26 Nov 2010 04:23:08 -0500
+
byacc (20101124) unstable; urgency=low
* amend fix for Red Hat #112617 to restore warning message.
-/* $Id: reader.c,v 1.28 2010/11/24 14:49:38 tom Exp $ */
+/* $Id: reader.c,v 1.31 2010/11/26 12:30:40 tom Exp $ */
#include "defs.h"
}
}
+/*
+ * Compare keyword to cached token, treating '_' and '-' the same. Some
+ * grammars rely upon this misfeature.
+ */
+static int
+matchec(const char *name)
+{
+ const char *p = cache;
+ const char *q = name;
+ int code = 0; /* assume mismatch */
+
+ while (*p != '\0' && *q != '\0')
+ {
+ char a = *p++;
+ char b = *q++;
+ if (a == '_')
+ a = '-';
+ if (b == '_')
+ b = '-';
+ if (a != b)
+ break;
+ if (*p == '\0' && *q == '\0')
+ {
+ code = 1;
+ break;
+ }
+ }
+ return code;
+}
+
static int
keyword(void)
{
c = tolower(c);
cachec(c);
}
- else if (isdigit(c) || c == '-' || c == '_' || c == '.' || c == '$')
+ else if (isdigit(c)
+ || c == '-'
+ || c == '_'
+ || c == '.'
+ || c == '$')
+ {
cachec(c);
+ }
else
+ {
break;
+ }
c = *++cptr;
}
cachec(NUL);
- if (strcmp(cache, "token") == 0 || strcmp(cache, "term") == 0)
+ if (matchec("token") || matchec("term"))
return (TOKEN);
- if (strcmp(cache, "type") == 0)
+ if (matchec("type"))
return (TYPE);
- if (strcmp(cache, "left") == 0)
+ if (matchec("left"))
return (LEFT);
- if (strcmp(cache, "right") == 0)
+ if (matchec("right"))
return (RIGHT);
- if (strcmp(cache, "nonassoc") == 0 || strcmp(cache, "binary") == 0)
+ if (matchec("nonassoc") || matchec("binary"))
return (NONASSOC);
- if (strcmp(cache, "start") == 0)
+ if (matchec("start"))
return (START);
- if (strcmp(cache, "union") == 0)
+ if (matchec("union"))
return (UNION);
- if (strcmp(cache, "ident") == 0)
+ if (matchec("ident"))
return (IDENT);
- if (strcmp(cache, "expect") == 0)
+ if (matchec("expect"))
return (EXPECT);
- if (strcmp(cache, "expect-rr") == 0)
+ if (matchec("expect-rr"))
return (EXPECT_RR);
- if (strcmp(cache, "pure-parser") == 0)
+ if (matchec("pure-parser"))
return (PURE_PARSER);
- if (strcmp(cache, "parse-param") == 0)
+ if (matchec("parse-param"))
return (PARSE_PARAM);
- if (strcmp(cache, "lex-param") == 0)
+ if (matchec("lex-param"))
return (LEX_PARAM);
- if (strcmp(cache, "yacc") == 0)
+ if (matchec("yacc"))
return (POSIX_YACC);
}
else
if (!lflag)
fprintf(text_file, line_format, lineno, input_file_name);
+ puts_both("#ifdef YYSTYPE\n");
+ puts_both("#undef YYSTYPE_IS_DECLARED\n");
+ puts_both("#define YYSTYPE_IS_DECLARED 1\n");
+ puts_both("#endif\n");
+ puts_both("#ifndef YYSTYPE_IS_DECLARED\n");
+ puts_both("#define YYSTYPE_IS_DECLARED 1\n");
puts_both("typedef union");
depth = 0;
if (--depth == 0)
{
puts_both(" YYSTYPE;\n");
+ puts_both("#endif /* !YYSTYPE_IS_DECLARED */\n");
FREE(u_line);
return;
}
-/* $Id: skeleton.c,v 1.25 2010/06/07 21:24:58 Andres.Mejia Exp $ */
+/* $Id: skeleton.c,v 1.27 2010/11/26 17:24:00 tom Exp $ */
#include "defs.h"
" }",
" if (yyerrflag) goto yyinrecovery;",
"",
- " yyerror(\"syntax error\");",
+ 0
+};
+
+const char *body_3[] =
+{
"",
" goto yyerrlab;",
"",
" goto yyloop;",
"",
"yyoverflow:",
- " yyerror(\"yacc stack overflow\");",
+ 0
+};
+
+const char *trailer_2[] =
+{
"",
"yyabort:",
" yyfreestack(&yystack);",
# define YYLEX yylex()
#endif
+/* Parameters sent to yyerror. */
+#define YYERROR_DECL() yyerror(const char *s)
+#define YYERROR_CALL(msg) yyerror(msg)
+
extern int YYPARSE_DECL();
extern int YYLEX_DECL();
}
return( c );
}
-#line 336 "calc.tab.c"
+#line 340 "calc.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
#line 60 "calc.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
-#line 606 "calc.tab.c"
+#line 610 "calc.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
INTERVAL vreg[26];
#line 27 "calc1.y"
+#ifdef YYSTYPE
+#undef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+#endif
+#ifndef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
typedef union
{
int ival;
double dval;
INTERVAL vval;
} YYSTYPE;
-#line 128 "calc1.tab.c"
+#endif /* !YYSTYPE_IS_DECLARED */
+#line 135 "calc1.tab.c"
/* compatibility with bison */
#ifdef YYPARSE_PARAM
/* compatibility with FreeBSD */
# define YYLEX yylex()
#endif
+/* Parameters sent to yyerror. */
+#define YYERROR_DECL() yyerror(const char *s)
+#define YYERROR_CALL(msg) yyerror(msg)
+
extern int YYPARSE_DECL();
extern int YYLEX_DECL();
{
/* gobble up digits, points, exponents */
char buf[BSZ + 1], *cp = buf;
- int dot = 0, exp = 0;
+ int dot = 0, expr = 0;
for (; (cp - buf) < BSZ; ++cp, c = getchar())
{
continue;
if (c == '.')
{
- if (dot++ || exp)
+ if (dot++ || expr)
return ('.'); /* will cause syntax error */
continue;
}
if (c == 'e')
{
- if (exp++)
+ if (expr++)
return ('e'); /* will cause syntax error */
continue;
}
{
return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
}
-#line 466 "calc1.tab.c"
+#line 477 "calc1.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
yyval.vval = yystack.l_mark[-1].vval;
}
break;
-#line 839 "calc1.tab.c"
+#line 850 "calc1.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
#define VREG 258
#define CONST 259
#define UMINUS 260
-#if !(defined(YYSTYPE) || defined(YYSTYPE_IS_DECLARED))
+#ifdef YYSTYPE
+#undef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+#endif
+#ifndef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
typedef union
{
int ival;
double dval;
INTERVAL vval;
} YYSTYPE;
-#endif /* !(YYSTYPE || YYSTYPE_IS_DECLARED) */
+#endif /* !YYSTYPE_IS_DECLARED */
extern YYSTYPE calc1_lval;
{
/* gobble up digits, points, exponents */
char buf[BSZ + 1], *cp = buf;
- int dot = 0, exp = 0;
+ int dot = 0, expr = 0;
for (; (cp - buf) < BSZ; ++cp, c = getchar())
{
continue;
if (c == '.')
{
- if (dot++ || exp)
+ if (dot++ || expr)
return ('.'); /* will cause syntax error */
continue;
}
if (c == 'e')
{
- if (exp++)
+ if (expr++)
return ('e'); /* will cause syntax error */
continue;
}
# define YYLEX yylex(base)
#endif
+/* Parameters sent to yyerror. */
+#define YYERROR_DECL() yyerror(YYSTYPE *v, const char *s)
+#define YYERROR_CALL(msg) yyerror(&yylval, msg)
+
extern int YYPARSE_DECL();
extern int YYLEX_DECL();
}
static void
-yyerror(const char *s)
+YYERROR_DECL()
{
fprintf(stderr, "%s\n", s);
}
}
return( c );
}
-#line 336 "calc2.tab.c"
+#line 340 "calc2.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
}
if (yyerrflag) goto yyinrecovery;
- yyerror("syntax error");
+ yyerror(&yylval, "syntax error");
goto yyerrlab;
#line 62 "calc2.y"
{ yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
-#line 606 "calc2.tab.c"
+#line 610 "calc2.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
goto yyloop;
yyoverflow:
- yyerror("yacc stack overflow");
+ yyerror(&yylval, "yacc stack overflow");
yyabort:
yyfreestack(&yystack);
}
static void
-yyerror(const char *s)
+YYERROR_DECL()
{
fprintf(stderr, "%s\n", s);
}
# define YYLEX yylex(&yylval, base)
#endif
+/* Parameters sent to yyerror. */
+#define YYERROR_DECL() yyerror(YYSTYPE *v, const char *s)
+#define YYERROR_CALL(msg) yyerror(&yylval, msg)
+
extern int YYPARSE_DECL();
extern int YYLEX_DECL();
}
static void
-yyerror(const char *s)
+YYERROR_DECL()
{
fprintf(stderr, "%s\n", s);
}
}
return( c );
}
-#line 329 "calc3.tab.c"
+#line 333 "calc3.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
}
if (yyerrflag) goto yyinrecovery;
- yyerror("syntax error");
+ yyerror(&yylval, "syntax error");
goto yyerrlab;
#line 64 "calc3.y"
{ yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
-#line 606 "calc3.tab.c"
+#line 610 "calc3.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
goto yyloop;
yyoverflow:
- yyerror("yacc stack overflow");
+ yyerror(&yylval, "yacc stack overflow");
yyabort:
yyfreestack(&yystack);
}
static void
-yyerror(const char *s)
+YYERROR_DECL()
{
fprintf(stderr, "%s\n", s);
}
int regs[26];
int base;
-#line 106 "code_calc.code.c"
+#line 25 "code_calc.code.c"
#ifndef YYSTYPE
typedef int YYSTYPE;
# define YYLEX yylex()
#endif
+/* Parameters sent to yyerror. */
+#define YYERROR_DECL() yyerror(const char *s)
+#define YYERROR_CALL(msg) yyerror(msg)
+
extern int YYPARSE_DECL();
extern int YYLEX_DECL();
}
return( c );
}
-#line 318 "code_calc.code.c"
+#line 241 "code_calc.code.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
#line 60 "code_calc.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
-#line 588 "code_calc.code.c"
+#line 511 "code_calc.code.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
# define YYLEX yylex()
#endif
+/* Parameters sent to yyerror. */
+#define YYERROR_DECL() yyerror(const char *s)
+#define YYERROR_CALL(msg) yyerror(msg)
+
extern int YYPARSE_DECL();
extern int YYLEX_DECL();
{
printf("%s\n", s);
}
-#line 288 "code_error.code.c"
+#line 211 "code_error.code.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
# define YYLEX yylex()
#endif
+/* Parameters sent to yyerror. */
+#define YYERROR_DECL() yyerror(const char *s)
+#define YYERROR_CALL(msg) yyerror(msg)
+
extern int YYPARSE_DECL();
extern int YYLEX_DECL();
{
printf("%s\n", s);
}
-#line 224 "error.tab.c"
+#line 228 "error.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
# define YYLEX yylex()
#endif
+/* Parameters sent to yyerror. */
+#define YYERROR_DECL() yyerror(const char *s)
+#define YYERROR_CALL(msg) yyerror(msg)
+
extern int YYPARSE_DECL();
extern int YYLEX_DECL();
reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]);
}
}
-#line 1066 "ftp.tab.c"
+#line 1070 "ftp.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
}
}
break;
-#line 1912 "ftp.tab.c"
+#line 1916 "ftp.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
# define YYLEX yylex()
#endif
+/* Parameters sent to yyerror. */
+#define YYERROR_DECL() yyerror(const char *s)
+#define YYERROR_CALL(msg) yyerror(msg)
+
extern int YYPARSE_DECL();
extern int YYLEX_DECL();
#endif
}
#endif
-#line 1068 "grammar.tab.c"
+#line 1072 "grammar.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
yyval.declarator->func_def = FUNC_ANSI;
}
break;
-#line 1952 "grammar.tab.c"
+#line 1956 "grammar.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
# define YYLEX yylex(&yylval)
#endif
+/* Parameters sent to yyerror. */
+#define YYERROR_DECL() yyerror(const char *s)
+#define YYERROR_CALL(msg) yyerror(msg)
+
extern int YYPARSE_DECL();
extern int YYLEX_DECL();
}
return( c );
}
-#line 329 "pure_calc.tab.c"
+#line 333 "pure_calc.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
#line 60 "pure_calc.y"
{ yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
break;
-#line 606 "pure_calc.tab.c"
+#line 610 "pure_calc.tab.c"
}
yystack.s_mark -= yym;
yystate = *yystack.s_mark;
# define YYLEX yylex(&yylval)
#endif
+/* Parameters sent to yyerror. */
+#define YYERROR_DECL() yyerror(const char *s)
+#define YYERROR_CALL(msg) yyerror(msg)
+
extern int YYPARSE_DECL();
extern int YYLEX_DECL();
{
printf("%s\n", s);
}
-#line 217 "pure_error.tab.c"
+#line 221 "pure_error.tab.c"
#if YYDEBUG
#include <stdio.h> /* needed for printf */
-.\" $Id: yacc.1,v 1.9 2010/06/10 20:50:08 tom Exp $
+.\" $Id: yacc.1,v 1.11 2010/11/26 16:27:11 tom Exp $
.\"
.\" .TH YACC 1 "July\ 15,\ 1990"
.\" .UC 6
-.TH YACC 1 "June 10, 2010" "Berkeley Yacc" "User Commands"
+.TH YACC 1 "November 26, 2010" "Berkeley Yacc" "User Commands"
.SH NAME
Yacc \- an LALR(1) parser generator
.SH SYNOPSIS
.IR y.code.c,
and the tables file is named
.IR y.tab.c.
+The prefix "\fIy.\fP" can be overridden using the \fB\-b\fP option.
.TP
.B \-t
The