token references in EM replacements do not work. Give error message

This commit is contained in:
ceriel 1989-05-30 12:20:54 +00:00
parent 6266743c4c
commit 8f2fe1c003

View file

@ -32,6 +32,7 @@ int optstack=0; /* Inside with <blah> STACK rule */
int saferulefound=0; int saferulefound=0;
int maxempatlen=0; int maxempatlen=0;
int maxrule=0; int maxrule=0;
int in_em_repl=0; /* set when in EM replacement part */
struct varinfo *defcost; struct varinfo *defcost;
int Xstackflag=0; /* set in coercions, moves, and tests. %1 means something int Xstackflag=0; /* set in coercions, moves, and tests. %1 means something
different then. different then.
@ -882,8 +883,8 @@ yieldlist
leaving leaving
: /* empty */ : /* empty */
{ $$ = 0; } { $$ = 0; }
| LEAVING {emhere=1; } leavelist | LEAVING {emhere=1; in_em_repl=1; } leavelist
{ emhere=0; $$ = $3; } { emhere=0; in_em_repl=0; $$ = $3; }
; ;
leavelist leavelist
: leavelist_el : leavelist_el
@ -947,6 +948,8 @@ emarg
tokarg tokarg
: PERCENT : PERCENT
{ $$ = $1; { $$ = $1;
if (in_em_repl)
error("No token references allowed in EM replacement part");
if ($1<1 || $1>tokpatlen) { if ($1<1 || $1>tokpatlen) {
error("Only %d tokens in stackpattern",tokpatlen); error("Only %d tokens in stackpattern",tokpatlen);
$$ =1; $$ =1;