From 7e30c7d648ca40ee5e137271cfa7808994b19799 Mon Sep 17 00:00:00 2001 From: ceriel Date: Mon, 10 May 1993 14:02:52 +0000 Subject: [PATCH] Fixed for empty parameter lists --- util/LLgen/src/LLgen.g | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/util/LLgen/src/LLgen.g b/util/LLgen/src/LLgen.g index 3e1d217ca..76f437d0c 100644 --- a/util/LLgen/src/LLgen.g +++ b/util/LLgen/src/LLgen.g @@ -214,11 +214,13 @@ rule { register p_nont p; p->n_lineno = linecount; p->n_off = ftell(fact); } - [ params { p->n_flags |= PARAMS; - if (nparams > 15) { - error(linecount,"Too many parameters"); + [ params { if (nparams > 0) { + p->n_flags |= PARAMS; + if (nparams > 15) { + error(linecount,"Too many parameters"); + } + else setntparams(p,nparams); } - else setntparams(p,nparams); } ]? [ action(0) { p->n_flags |= LOCALS; } @@ -496,8 +498,15 @@ elem (register p_gram pres;) ; params +{ + long off = ftell(fact); +} : '(' { copyact('(',')',0,0); } ')' + { if (nparams == 0) { + fseek(fact, off, 0); + } + } ; expr : '(' { copyact('(',')',1,0); } -- 2.34.1