- Restricted the syntax somewhat, to avoid people typing crap.

(Cf. Golsteijn)
This commit is contained in:
ccremers 2006-05-16 15:00:21 +00:00
parent 6dff931dbc
commit 6a74883adf
3 changed files with 23 additions and 10 deletions

View File

@ -49,7 +49,9 @@ int yylex(void);
%type <tac> typeinfo1
%type <tac> typeinfoN
%type <tac> term
%type <tac> basicterm
%type <tac> termlist
%type <tac> basictermlist
%type <tac> key
%type <tac> roleref
@ -176,21 +178,21 @@ roleref : ID '.' ID
}
;
declaration : secretpref CONST termlist typeinfo1 ';'
declaration : secretpref CONST basictermlist typeinfo1 ';'
{ Tac t = tacCreate(TAC_CONST);
t->t1.tac = $3;
t->t2.tac = $4;
t->t3.tac = $1;
$$ = t;
}
| secretpref VAR termlist typeinfoN ';'
| secretpref VAR basictermlist typeinfoN ';'
{ Tac t = tacCreate(TAC_VAR);
t->t1.tac = $3;
t->t2.tac = $4;
t->t3.tac = $1;
$$ = t;
}
| SECRET termlist typeinfo1 ';'
| SECRET basictermlist typeinfo1 ';'
{ Tac t = tacCreate(TAC_SECRET);
t->t1.tac = $2;
t->t2.tac = $3;
@ -237,7 +239,7 @@ typeinfoN : /* empty */
Tac t = tacCreate(TAC_UNDEF);
$$ = t;
}
| ':' termlist
| ':' basictermlist
{
$$ = $2;
}
@ -254,12 +256,16 @@ optlabel : /* empty */
;
term : ID
basicterm : ID
{
Tac t = tacCreate(TAC_STRING);
t->t1.sym = $1;
$$ = t;
}
;
term : basicterm
{ }
| ID '(' termlist ')'
{
Tac t = tacCreate(TAC_STRING);
@ -282,6 +288,12 @@ termlist : term
{ $$ = tacCat($1,$3); }
;
basictermlist : basicterm
{ }
| basicterm ',' basictermlist
{ $$ = tacCat($1,$3); }
;
key : term
{ }
;

View File

@ -241,6 +241,7 @@ symbolNextFree (Symbol prefixsymbol)
int slen;
slen = sprintf (buffer, "%s%i", prefixstr, n);
buffer[slen] = EOS;
symb = lookup (buffer);
if (symb == NULL)
{

View File

@ -317,11 +317,6 @@ termPrintCustom (Term term, char *leftvar, char *rightvar, char *lefttup,
char *righttup, char *leftenc, char *rightenc,
void (*callback) (int rid))
{
if (term == NULL)
{
eprintf ("*");
return;
}
#ifdef DEBUG
if (!DEBUGL (4))
{
@ -330,6 +325,11 @@ termPrintCustom (Term term, char *leftvar, char *rightvar, char *lefttup,
#else
term = deVar (term);
#endif
if (term == NULL)
{
eprintf ("*");
return;
}
if (realTermLeaf (term))
{
if (term->type == VARIABLE && TermRunid (term) >= 0)