mirror of
https://github.com/ThomasDickey/byacc-snapshots.git
synced 2026-01-26 13:14:29 +00:00
snapshot of project "byacc", label t20230515
This commit is contained in:
parent
679c51505a
commit
b8ded32537
23
CHANGES
23
CHANGES
@ -1,3 +1,26 @@
|
||||
2023-05-15 Thomas E. Dickey <dickey@invisible-island.net>
|
||||
|
||||
* VERSION, package/byacc.spec, package/debian/changelog,
|
||||
package/mingw-byacc.spec, package/pkgsrc/Makefile:
|
||||
bump
|
||||
|
||||
* reader.c:
|
||||
when copying parameters, check for a case where the last token is not a
|
||||
name, e.g., "foo [1]" would have "[1]". In this case, scan back to find
|
||||
the actual parameter name.
|
||||
|
||||
* reader.c:
|
||||
correct a use-after-free in more_curly, which could occur if a %lex-param
|
||||
or %parse-param was multi-line (Redhat #2183006).
|
||||
|
||||
2023-05-11 Thomas E. Dickey <dickey@invisible-island.net>
|
||||
|
||||
* main.c: rename no_space() to on_error()
|
||||
|
||||
* error.c: rename no_space() to no_error(), handling any errno
|
||||
|
||||
* defs.h: rename no_space() to on_error()
|
||||
|
||||
2023-02-26 Thomas E. Dickey <dickey@invisible-island.net>
|
||||
|
||||
* mstring.c, reader.c: yak-indent
|
||||
|
||||
2
MANIFEST
2
MANIFEST
@ -1,4 +1,4 @@
|
||||
MANIFEST for byacc, version t20230226
|
||||
MANIFEST for byacc, version t20230515
|
||||
--------------------------------------------------------------------------------
|
||||
MANIFEST this file
|
||||
ACKNOWLEDGEMENTS original version of byacc - 1993
|
||||
|
||||
6
defs.h
6
defs.h
@ -1,4 +1,4 @@
|
||||
/* $Id: defs.h,v 1.71 2022/11/06 21:44:54 tom Exp $ */
|
||||
/* $Id: defs.h,v 1.72 2023/05/11 07:43:15 tom Exp $ */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
@ -187,7 +187,7 @@ SYM_CASES;
|
||||
|
||||
#define DO_FREE(x) if (x) { FREE(x); x = 0; }
|
||||
|
||||
#define NO_SPACE(p) if (p == 0) no_space(); assert(p != 0)
|
||||
#define NO_SPACE(p) do { if (p == 0) on_error(); assert(p != 0); } while (0)
|
||||
|
||||
/* messages */
|
||||
#define PLURAL(n) ((n) > 1 ? "s" : "")
|
||||
@ -484,7 +484,7 @@ extern GCC_NORETURN void illegal_character(char *c_cptr);
|
||||
extern GCC_NORETURN void illegal_tag(int t_lineno, char *t_line, char *t_cptr);
|
||||
extern GCC_NORETURN void missing_brace(void);
|
||||
extern GCC_NORETURN void no_grammar(void);
|
||||
extern GCC_NORETURN void no_space(void);
|
||||
extern GCC_NORETURN void on_error(void);
|
||||
extern GCC_NORETURN void open_error(const char *filename);
|
||||
extern GCC_NORETURN void over_unionized(char *u_cptr);
|
||||
extern void prec_redeclared(void);
|
||||
|
||||
11
error.c
11
error.c
@ -1,4 +1,4 @@
|
||||
/* $Id: error.c,v 1.14 2016/12/02 18:35:55 tom Exp $ */
|
||||
/* $Id: error.c,v 1.15 2023/05/11 07:45:34 tom Exp $ */
|
||||
|
||||
/* routines for printing error messages */
|
||||
|
||||
@ -12,10 +12,13 @@ fatal(const char *msg)
|
||||
}
|
||||
|
||||
void
|
||||
no_space(void)
|
||||
on_error(void)
|
||||
{
|
||||
fprintf(stderr, "%s: f - out of space\n", myname);
|
||||
done(2);
|
||||
const char *msg;
|
||||
if (errno && (msg = strerror(errno)) != NULL)
|
||||
fatal(msg);
|
||||
else
|
||||
fatal("unknown error");
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
6
main.c
6
main.c
@ -1,4 +1,4 @@
|
||||
/* $Id: main.c,v 1.73 2021/08/08 20:39:34 tom Exp $ */
|
||||
/* $Id: main.c,v 1.74 2023/05/11 07:51:36 tom Exp $ */
|
||||
|
||||
#include <signal.h>
|
||||
#if !defined(_WIN32) || defined(__MINGW32__)
|
||||
@ -563,8 +563,8 @@ static char *
|
||||
alloc_file_name(size_t len, const char *suffix)
|
||||
{
|
||||
char *result = TMALLOC(char, len + strlen(suffix) + 1);
|
||||
if (result == 0)
|
||||
no_space();
|
||||
if (result == NULL)
|
||||
on_error();
|
||||
strcpy(result, file_prefix);
|
||||
strcpy(result + len, suffix);
|
||||
return result;
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
Summary: public domain Berkeley LALR Yacc parser generator
|
||||
|
||||
%global AppVersion 2.0
|
||||
%global AppPatched 20230226
|
||||
%global AppPatched 20230515
|
||||
|
||||
%global AltProgram byacc2
|
||||
%global UseProgram yacc
|
||||
|
||||
# $Id: byacc.spec,v 1.72 2023/02/26 09:49:18 tom Exp $
|
||||
# $Id: byacc.spec,v 1.73 2023/05/15 23:34:59 tom Exp $
|
||||
Name: byacc
|
||||
Version: %{AppVersion}.%{AppPatched}
|
||||
Release: 1
|
||||
|
||||
@ -1,3 +1,9 @@
|
||||
byacc (1:2.0.20230515) unstable; urgency=low
|
||||
|
||||
* maintenance updates
|
||||
|
||||
-- Thomas E. Dickey <dickey@invisible-island.net> Wed, 10 May 2023 18:06:06 -0400
|
||||
|
||||
byacc (1:2.0.20230226) unstable; urgency=low
|
||||
|
||||
* maintenance updates
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
Summary: public domain Berkeley LALR Yacc parser generator
|
||||
|
||||
%global AppVersion 2.0
|
||||
%global AppPatched 20230226
|
||||
%global AppPatched 20230515
|
||||
|
||||
%global UseProgram yacc
|
||||
|
||||
# $Id: mingw-byacc.spec,v 1.49 2023/02/26 09:49:18 tom Exp $
|
||||
# $Id: mingw-byacc.spec,v 1.50 2023/05/15 23:34:59 tom Exp $
|
||||
Name: byacc
|
||||
Version: %{AppVersion}.%{AppPatched}
|
||||
Release: 1
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# $NetBSD: Makefile,v 1.24 2021/08/14 01:04:32 mef Exp $
|
||||
#
|
||||
|
||||
DISTNAME= byacc-20230226
|
||||
DISTNAME= byacc-20230515
|
||||
CATEGORIES= devel
|
||||
MASTER_SITES= https://invisible-mirror.net/archives/byacc/
|
||||
DIST_SUBDIR= byacc-20220101
|
||||
|
||||
91
reader.c
91
reader.c
@ -1,4 +1,4 @@
|
||||
/* $Id: reader.c,v 1.94 2023/02/26 10:14:44 tom Exp $ */
|
||||
/* $Id: reader.c,v 1.96 2023/05/15 23:34:53 tom Exp $ */
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
@ -23,6 +23,8 @@
|
||||
/* limit the size of optional names for %union */
|
||||
#define NAME_LEN 32
|
||||
|
||||
#define IS_ALNUM(c) (isalnum(c) || (c) == '_')
|
||||
|
||||
#define begin_case(f,n) fprintf(f, "case %d:\n", (int)(n))
|
||||
|
||||
#define end_case(f) \
|
||||
@ -47,8 +49,22 @@ static char **tag_table;
|
||||
|
||||
static char saw_eof;
|
||||
char unionized;
|
||||
char *cptr, *line;
|
||||
static int linesize;
|
||||
|
||||
char *line; /* current input-line */
|
||||
char *cptr; /* position within current input-line */
|
||||
static int linesize; /* length of current input-line */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *line_data; /* saved input-line */
|
||||
size_t line_used; /* position within saved input-line */
|
||||
size_t line_size; /* length of saved input-line */
|
||||
fpos_t line_fpos; /* pointer before reading past saved input-line */
|
||||
}
|
||||
SAVE_LINE;
|
||||
|
||||
static SAVE_LINE save_area;
|
||||
static int must_save; /* request > 0, triggered < 0, inactive 0 */
|
||||
|
||||
static bucket *goal;
|
||||
static Value_t prec;
|
||||
@ -267,11 +283,55 @@ line_directive(void)
|
||||
#undef UNLESS
|
||||
}
|
||||
|
||||
static void
|
||||
save_line(void)
|
||||
{
|
||||
/* remember to save the input-line if we call get_line() */
|
||||
if (!must_save)
|
||||
{
|
||||
must_save = 1;
|
||||
save_area.line_used = (cptr - line);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
restore_line(void)
|
||||
{
|
||||
/* if we saved the line, restore it */
|
||||
if (must_save < 0)
|
||||
{
|
||||
free(line);
|
||||
line = save_area.line_data;
|
||||
cptr = save_area.line_used + line;
|
||||
linesize = save_area.line_size;
|
||||
if (fsetpos(input_file, &save_area.line_fpos) != 0)
|
||||
on_error();
|
||||
memset(&save_area, 0, sizeof(save_area));
|
||||
}
|
||||
else if (must_save > 0)
|
||||
{
|
||||
cptr = line + save_area.line_used;
|
||||
}
|
||||
must_save = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
get_line(void)
|
||||
{
|
||||
FILE *f = input_file;
|
||||
|
||||
if (must_save > 0)
|
||||
{
|
||||
save_area.line_data = TMALLOC(char, linesize);
|
||||
save_area.line_used = (cptr - line);
|
||||
save_area.line_size = linesize;
|
||||
NO_SPACE(save_area.line_data);
|
||||
memcpy(save_area.line_data, line, linesize);
|
||||
if (fgetpos(f, &save_area.line_fpos) != 0)
|
||||
on_error();
|
||||
must_save = -must_save;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
int c;
|
||||
@ -428,6 +488,7 @@ nextc(void)
|
||||
{
|
||||
switch (ch = next_inline())
|
||||
{
|
||||
case '\0':
|
||||
case '\n':
|
||||
get_line();
|
||||
break;
|
||||
@ -1084,9 +1145,9 @@ trim_blanks(char *buffer)
|
||||
static int
|
||||
more_curly(void)
|
||||
{
|
||||
char *save = cptr;
|
||||
int result = 0;
|
||||
int finish = 0;
|
||||
save_line();
|
||||
do
|
||||
{
|
||||
switch (next_inline())
|
||||
@ -1103,7 +1164,7 @@ more_curly(void)
|
||||
++cptr;
|
||||
}
|
||||
while (!finish);
|
||||
cptr = save;
|
||||
restore_line();
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1120,6 +1181,24 @@ save_param(int k, char *buffer, int name, int type2)
|
||||
buffer[type2] = '\0';
|
||||
(void)trim_blanks(p->type2);
|
||||
|
||||
if (!IS_ALNUM(buffer[name]))
|
||||
{
|
||||
int n;
|
||||
for (n = name - 1; n >= 0; --n)
|
||||
{
|
||||
if (!isspace(UCH(buffer[n])))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (n > 0)
|
||||
{
|
||||
if (!IS_ALNUM(UCH(buffer[n - 1])))
|
||||
break;
|
||||
--n;
|
||||
}
|
||||
name = n;
|
||||
}
|
||||
p->name = strdup(buffer + name);
|
||||
NO_SPACE(p->name);
|
||||
buffer[name] = '\0';
|
||||
@ -1307,7 +1386,7 @@ copy_param(int k)
|
||||
type2 = i + 1;
|
||||
}
|
||||
|
||||
while (i > 0 && (isalnum(UCH(parms[i])) || UCH(parms[i]) == '_'))
|
||||
while (i > 0 && IS_ALNUM(UCH(parms[i])))
|
||||
i--;
|
||||
|
||||
if (!isspace(UCH(parms[i])) && parms[i] != '*')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user