Exemplo n.º 1
0
        public static List <Identifier> GetIdentifiers(string name, List <IdentifierPartTemplate> templates,
                                                       DebuggerOperations debuggerOperations)
        {
            Identifier start = new Identifier(name: name, parts: new List <IdentifierPart>());

            return(GetIdentifiers(start, templates, debuggerOperations));
        }
Exemplo n.º 2
0
        private static List <Identifier> GetIdentifiers(Identifier cur, List <IdentifierPartTemplate> templates,
                                                        DebuggerOperations debuggerOperations)
        {
            if (templates.Count == 0)
            {
                return(new List <Identifier> {
                    cur
                });
            }

            var head = templates.FirstOrDefault();

            Debug.Assert(head != null, nameof(head) + " != null");

            int begin = GetNumber(head.BeginTemplate ?? "", cur, debuggerOperations, $"Begin range of index {head.Name} in {cur.Name}");
            int end   = GetNumber(head.EndTemplate ?? "", cur, debuggerOperations, $"End range of {head.Name} index in {cur.Name}");
            var res   = new List <Identifier>();

            for (int i = begin; i < end; i++)
            {
                var part    = new IdentifierPart(head.Name, i);
                var partRes = GetIdentifiers(cur.AddIdentifierPart(part), templates.Skip(1).ToList(), debuggerOperations);
                res.AddRange(partRes);
            }

            return(res);
        }
Exemplo n.º 3
0
 public GraphRenderer(DebuggerOperations debuggerOperations)
 {
     _graph = new Graph();
     _edges = new Dictionary <Identifier, Edge>();
     _nodes = new Dictionary <Identifier, Node>();
     _debuggerOperations = debuggerOperations;
 }
Exemplo n.º 4
0
        public static int GetNumber(string template, Identifier id, DebuggerOperations debuggerOperations, string message)
        {
            var expressionResult = debuggerOperations.GetExpressionForIdentifier(template, id);

            if (!expressionResult.IsValid || !Int32.TryParse(expressionResult.Value, out var res))
            {
                throw new GraphRenderException($"{message} \'{template}\' is not valid:\n{expressionResult.Value}");
            }

            return(res);
        }