p->n_lineno = linecount;
p->n_off = ftell(fact);
}
- [ params { if (nparams > 0) {
+ [ params(1) { if (nparams > 0) {
p->n_flags |= PARAMS;
if (nparams > 15) {
error(linecount,"Too many parameters");
C_IDENT { pe = search(UNKNOWN,lextoken.t_string,BOTH);
*pres = *pe;
}
- [ params { if (nparams > 15) {
+ [ params(0) { if (nparams > 15) {
error(linecount,"Too many parameters");
} else g_setnpar(pres,nparams);
if (g_gettype(pres) == TERMINAL) {
action(1)
;
-params
+params(int formal)
{
long off = ftell(fact);
}
- : '(' { copyact('(',')',0,0); }
+ : '(' { copyact('(', ')', formal ? 2 : 0, 0); }
')'
{ if (nparams == 0) {
fseek(fact, off, 0);
/*
* Copy an action to file f. Opening bracket is ch1, closing bracket
* is ch2.
- * If flag != 0, copy opening and closing parameters too.
+ * If flag & 1, copy opening and closing parameters too.
+ * If flag & 2, don't allow ','.
*/
static int text_seen = 0;
register FILE *f;
putc('\0',f);
fprintf(f,"# line %d \"%s\"\n", linecount,f_input);
}
- if (level || flag) putc(ch1,f);
+ if (level || (flag & 1)) putc(ch1,f);
for (;;) {
ch = input();
if (ch == ch2) {
unput(ch);
if (text_seen) nparams++;
}
- if (level || flag) putc(ch,f);
+ if (level || (flag & 1)) putc(ch,f);
return;
}
switch(ch) {
if (! level && text_seen) {
text_seen = 0;
nparams++;
+ if (ch == ',' && (flag & 2)) {
+ error(linecount, "Parameters may not be separated with a ','");
+ }
}
break;
case '\'':