diff --git a/text/neqn/lex.c b/text/neqn/lex.c index 1d9afe9..1e1d241 100644 --- a/text/neqn/lex.c +++ b/text/neqn/lex.c @@ -4,9 +4,11 @@ #include "e.h" #include "y.tab.h" +extern YYSTYPE yyval; + #define SSIZE 400 char token[SSIZE]; -int sp, yyval; +int sp; #define putbak(c) *ip++ = c; #define PUSHBACK 300 /* maximum pushback characters */ char ibuf[PUSHBACK+SSIZE]; /* pushback buffer for definitions, etc. */ @@ -212,7 +214,7 @@ include() { } delim() { - yyval = eqnreg = 0; + yyval.token = eqnreg = 0; if (cstr(token, 0, SSIZE)) error(FATAL, "Bizarre delimiters at %.20s", token); lefteq = token[0]; diff --git a/text/neqn/neqn.mk b/text/neqn/neqn.mk index 0bb5b8a..e510e16 100644 --- a/text/neqn/neqn.mk +++ b/text/neqn/neqn.mk @@ -51,7 +51,7 @@ install : all @chown $(OWNER) $(MAN1DIR)/neqn.1 clean : - rm -f *.o y.tab.c y.tab.h + rm -f *.o y.tab.c y.tab.h e.c clobber : clean rm -f neqn @@ -61,6 +61,10 @@ neqn : $(OFILES) $(OFILES) : e.h e.o +e.c: e.y + $(YACC) -d e.y + sed -f yyval.sed $@ + changes : @trap "" 1 2 3 15; \ sed \ diff --git a/text/neqn/yyval.sed b/text/neqn/yyval.sed new file mode 100644 index 0000000..fbbc5e8 --- /dev/null +++ b/text/neqn/yyval.sed @@ -0,0 +1,22 @@ +# +# Sccsid @(#)yyval.sed 1.2 (gritter) 10/2/07 +# +# bison has a yacc-compatible yyval, but it is a local variable inside +# yyparse(). Making the variable global is necessary to make bc work +# with a bison-generated parser. +1,2 { + /Bison/ { + :look + /second part of user declarations/ { + i\ + YYSTYPE yyval; + :repl + s/^[ ]*YYSTYPE[ ]*yyval;// + n + t + b repl + } + n + b look + } +}