Example #1
0
            private void ParseTacticAttributes(Attributes attr)
            {
                // incase TacticInformation is not created
                TacticInfo = TacticInfo ?? new TacticInformation();
                if (attr == null)
                {
                    return;
                }
                switch (attr.Name)
                {
                case "search":
                    var    expr      = attr.Args.FirstOrDefault();
                    string stratName = (expr as NameSegment)?.Name;
                    Contract.Assert(stratName != null);
                    try {
                        TacticInfo.SearchStrategy = (Strategy)Enum.Parse(typeof(Strategy), stratName, true); // TODO: change to ENUM
                    } catch {
                        _reporter.Warning(MessageSource.Tacny, ((MemberDecl)ActiveTactic).tok, $"Unsupported search strategy {stratName}; Defaulting to DFS");
                        TacticInfo.SearchStrategy = Strategy.Bfs;
                    }
                    break;

                default:
                    _reporter.Warning(MessageSource.Tacny, ((MemberDecl)ActiveTactic).tok, $"Unrecognized attribute {attr.Name}");
                    break;
                }

                if (attr.Prev != null)
                {
                    ParseTacticAttributes(attr.Prev);
                }
            }
Example #2
0
 public Frame(Frame parent, List <Statement> body)
 {
     Contract.Requires <ArgumentNullException>(parent != null);
     Contract.Requires <ArgumentNullException>(tcce.NonNullElements(body), "body");
     // carry over the tactic info
     TacticInfo         = parent.TacticInfo;
     Body               = body;
     _declaredVariables = new Dictionary <string, object>();
     Parent             = parent;
     ActiveTactic       = parent.ActiveTactic;
     _reporter          = parent._reporter;
 }
Example #3
0
      private void ParseTacticAttributes(Attributes attr) {
        // incase TacticInformation is not created
        TacticInfo = TacticInfo ?? new TacticInformation();
        if (attr == null)
          return;
        switch (attr.Name) {
          case "search":
            var expr = attr.Args.FirstOrDefault();
            string stratName = (expr as NameSegment)?.Name;
            Contract.Assert(stratName != null);
            try {
              TacticInfo.SearchStrategy = (Strategy)Enum.Parse(typeof(Strategy), stratName, true); // TODO: change to ENUM
            } catch {
              _reporter.Warning(MessageSource.Tacny, ((MemberDecl)ActiveTactic).tok, $"Unsupported search strategy {stratName}; Defaulting to DFS");
              TacticInfo.SearchStrategy = Strategy.Bfs;
            }
            break;
          default:
            _reporter.Warning(MessageSource.Tacny, ((MemberDecl)ActiveTactic).tok, $"Unrecognized attribute {attr.Name}");
            break;
        }

        if (attr.Prev != null)
          ParseTacticAttributes(attr.Prev);
      }
Example #4
0
 public Frame(Frame parent, List<Statement> body) {
   Contract.Requires<ArgumentNullException>(parent != null);
   Contract.Requires<ArgumentNullException>(tcce.NonNullElements(body), "body");
   // carry over the tactic info
   TacticInfo = parent.TacticInfo;
   Body = body;
   _declaredVariables = new Dictionary<string, object>();
   Parent = parent;
   ActiveTactic = parent.ActiveTactic;
   _reporter = parent._reporter;
 }