Allow for use of RECV instead of READ.

Read will become deprecated later on.
This commit is contained in:
Cas Cremers 2008-08-20 16:15:27 +02:00
parent 739f59174f
commit aaf27779a3
3 changed files with 14 additions and 1 deletions

View File

@ -163,7 +163,7 @@ class XMLReader(object):
followlist.append(follow) followlist.append(follow)
(etype,index) = (xml.get('type'),int(xml.get('index'))) (etype,index) = (xml.get('type'),int(xml.get('index')))
if etype in ('send','read'): if etype in ('send','read','recv'):
fr = self.readTerm(xml.find('from')) fr = self.readTerm(xml.find('from'))
to = self.readTerm(xml.find('to')) to = self.readTerm(xml.find('to'))
message = self.readTerm(xml.find('message')) message = self.readTerm(xml.find('message'))

View File

@ -40,6 +40,7 @@ int yylex(void);
%token PROTOCOL %token PROTOCOL
%token ROLE %token ROLE
%token READT %token READT
%token RECVT
%token SENDT %token SENDT
%token CLAIMT %token CLAIMT
%token VAR %token VAR
@ -169,6 +170,10 @@ roledef : /* empty */
{ $$ = tacCat($1,$2); } { $$ = tacCat($1,$2); }
; ;
/*
* For now, recv and read are synonyms, but have their own branch below. That's ugly duplication. Ultimately we want to deprecate read,
* but that will take a while I guess.
*/
event : READT label '(' termlist ')' ';' event : READT label '(' termlist ')' ';'
{ Tac t = tacCreate(TAC_READ); { Tac t = tacCreate(TAC_READ);
t->t1.sym = $2; t->t1.sym = $2;
@ -176,6 +181,13 @@ event : READT label '(' termlist ')' ';'
t->t2.tac = $4; t->t2.tac = $4;
$$ = t; $$ = t;
} }
| RECVT label '(' termlist ')' ';'
{ Tac t = tacCreate(TAC_READ);
t->t1.sym = $2;
/* TODO test here: tac2 should have at least 3 elements */
t->t2.tac = $4;
$$ = t;
}
| SENDT label '(' termlist ')' ';' | SENDT label '(' termlist ')' ';'
{ Tac t = tacCreate(TAC_SEND); { Tac t = tacCreate(TAC_SEND);
t->t1.sym = $2; t->t1.sym = $2;

View File

@ -158,6 +158,7 @@ include BEGIN(incl);
protocol { return PROTOCOL; } protocol { return PROTOCOL; }
role { return ROLE; } role { return ROLE; }
read { return READT; } read { return READT; }
recv { return RECVT; }
send { return SENDT; } send { return SENDT; }
var { return VAR; } var { return VAR; }
const { return CONST; } const { return CONST; }