Esempio n. 1
0
        public ExprOp Lookup(SymbolKindEnum kind, string name, object parent)
        {
            IDictionary <string, ExprOp> items;

            if (LookupKindItems.TryGetValue(kind, out items))
            {
                name = name.Replace('-', '_'); // search optimization
                ExprOp op;
                if (items.TryGetValue(name, out op))
                {
                    return(op);
                }
            }

            Tuple <OptionCollection, IDictionary <Option, ExprOp> > optionItems;

            if (LookupKindOptionItems.TryGetValue(kind, out optionItems))
            {
                Option option = optionItems.Item1.LookupOption(name, parent);
                if (option != null)
                {
                    return(optionItems.Item2[option]);
                }
            }

            return(null);
        }
Esempio n. 2
0
        private IDictionary <string, ExprOp> GetOrCreate(SymbolKindEnum kind)
        {
            IDictionary <string, ExprOp> items;

            if (!LookupKindItems.TryGetValue(kind, out items))
            {
                items = new Dictionary <string, ExprOp>();
                LookupKindItems.Add(kind, items);
            }
            return(items);
        }