Introduced 'fresh' for fresh value generation and added deprecation warning for 'const' usage.
This commit is contained in:
parent
519a9d0a81
commit
6d9d89eca2
@ -850,6 +850,30 @@ normalDeclaration (Tac tc)
|
|||||||
levelDeclareConst (tc);
|
levelDeclareConst (tc);
|
||||||
if (level < 2 && tc->t3.tac == NULL)
|
if (level < 2 && tc->t3.tac == NULL)
|
||||||
knowledgeAddTermlist (sys->know, tacTermlist (tc->t1.tac));
|
knowledgeAddTermlist (sys->know, tacTermlist (tc->t1.tac));
|
||||||
|
if (level > 0)
|
||||||
|
{
|
||||||
|
globalError++;
|
||||||
|
warning_pre ();
|
||||||
|
eprintf ("const ");
|
||||||
|
termlistPrint (tacTermlist (tc->t1.tac));
|
||||||
|
eprintf
|
||||||
|
(" usage inside roles is deprecated. Please use 'fresh' instead on line %i.\n",
|
||||||
|
tc->lineno);
|
||||||
|
globalError--;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case TAC_FRESH:
|
||||||
|
levelDeclareConst (tc);
|
||||||
|
if (level < 2)
|
||||||
|
{
|
||||||
|
globalError++;
|
||||||
|
error_pre ();
|
||||||
|
eprintf ("fresh terms ");
|
||||||
|
termlistPrint (tacTermlist (tc->t1.tac));
|
||||||
|
eprintf (" should be declared inside roles,");
|
||||||
|
errorTac (tc->lineno); // exits Scyther here
|
||||||
|
globalError--;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case TAC_SECRET:
|
case TAC_SECRET:
|
||||||
levelDeclareConst (tc);
|
levelDeclareConst (tc);
|
||||||
|
15
src/parser.y
15
src/parser.y
@ -45,6 +45,7 @@ int yylex(void);
|
|||||||
%token CLAIMT
|
%token CLAIMT
|
||||||
%token VAR
|
%token VAR
|
||||||
%token CONST
|
%token CONST
|
||||||
|
%token FRESH
|
||||||
%token RUN
|
%token RUN
|
||||||
%token SECRET
|
%token SECRET
|
||||||
%token COMPROMISED
|
%token COMPROMISED
|
||||||
@ -221,16 +222,22 @@ knowsdecl : KNOWS termlist ';'
|
|||||||
|
|
||||||
declaration : secretpref CONST basictermlist typeinfo1 ';'
|
declaration : secretpref CONST basictermlist typeinfo1 ';'
|
||||||
{ Tac t = tacCreate(TAC_CONST);
|
{ Tac t = tacCreate(TAC_CONST);
|
||||||
t->t1.tac = $3;
|
t->t1.tac = $3; // names
|
||||||
t->t2.tac = $4;
|
t->t2.tac = $4; // type
|
||||||
t->t3.tac = $1;
|
t->t3.tac = $1; // secret?
|
||||||
|
$$ = t;
|
||||||
|
}
|
||||||
|
| FRESH basictermlist typeinfo1 ';'
|
||||||
|
{ Tac t = tacCreate(TAC_FRESH);
|
||||||
|
t->t1.tac = $2; // names
|
||||||
|
t->t2.tac = $3; // type
|
||||||
$$ = t;
|
$$ = t;
|
||||||
}
|
}
|
||||||
| secretpref VAR basictermlist typeinfoN ';'
|
| secretpref VAR basictermlist typeinfoN ';'
|
||||||
{ Tac t = tacCreate(TAC_VAR);
|
{ Tac t = tacCreate(TAC_VAR);
|
||||||
t->t1.tac = $3;
|
t->t1.tac = $3;
|
||||||
t->t2.tac = $4;
|
t->t2.tac = $4;
|
||||||
t->t3.tac = $1;
|
t->t3.tac = $1; // obsolete: should not even occur at the global level
|
||||||
$$ = t;
|
$$ = t;
|
||||||
}
|
}
|
||||||
| SECRET basictermlist typeinfo1 ';'
|
| SECRET basictermlist typeinfo1 ';'
|
||||||
|
@ -162,6 +162,7 @@ recv { return RECVT; }
|
|||||||
send { return SENDT; }
|
send { return SENDT; }
|
||||||
var { return VAR; }
|
var { return VAR; }
|
||||||
const { return CONST; }
|
const { return CONST; }
|
||||||
|
fresh { return FRESH; }
|
||||||
claim { return CLAIMT; }
|
claim { return CLAIMT; }
|
||||||
run { return RUN; }
|
run { return RUN; }
|
||||||
secret { return SECRET; }
|
secret { return SECRET; }
|
||||||
|
Loading…
Reference in New Issue
Block a user