blob: f13c28cf946b985f77cc5f2c3d3a8f53fcd06fa8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Boogie;
using System.Diagnostics;
using System.Text.RegularExpressions;
namespace Microsoft.Boogie
{
class GetRHSOfEqualityVisitor : StandardVisitor
{
string LHSPattern;
Expr result;
internal GetRHSOfEqualityVisitor(string LHSPattern)
{
this.LHSPattern = LHSPattern;
result = null;
}
public override Expr VisitNAryExpr(NAryExpr node)
{
if (node.Fun is BinaryOperator && ((BinaryOperator)node.Fun).Op == BinaryOperator.Opcode.Eq)
{
if (node.Args[0] is IdentifierExpr && Regex.IsMatch(((IdentifierExpr)node.Args[0]).Decl.Name, LHSPattern))
{
Debug.Assert(result == null);
result = node.Args[1];
}
}
return base.VisitNAryExpr(node);
}
internal Expr getResult()
{
Debug.Assert(result != null);
return result;
}
}
}
|