Example #1
0
        public bool TryGet(SymbolTable table, SymbolAtom component, out FullSymbol result)
        {
            Contract.RequiresNotNull(table, "table != null");
            Contract.Requires(component.IsValid);

            HierarchicalNameId child;
            var found = table.TryGetName(Value, component.StringId, out child);

            result = new FullSymbol(child);
            return(found);
        }
Example #2
0
        public bool TryGet(SymbolTable table, SymbolAtom component, out FullSymbol result)
        {
            Contract.Requires(table != null, "table != null");
            Contract.Requires(component.IsValid);
            Contract.Ensures(Contract.Result <bool>() == (Contract.ValueAtReturn(out result) != FullSymbol.Invalid));

            HierarchicalNameId child;
            var found = table.TryGetName(Value, component.StringId, out child);

            result = new FullSymbol(child);
            return(found);
        }
Example #3
0
        public bool TryGet(SymbolTable table, PartialSymbol relativeId, out FullSymbol result)
        {
            Contract.RequiresNotNull(table, "table != null");

            if (relativeId.IsEmpty)
            {
                result = this;
                return(true);
            }

            HierarchicalNameId child;
            var found = table.TryGetName(Value, relativeId.Components, out child);

            result = new FullSymbol(child);
            return(found);
        }
Example #4
0
        public bool TryGet(SymbolTable table, PartialSymbol relativeId, out FullSymbol result)
        {
            Contract.Requires(table != null, "table != null");
            Contract.Ensures(Contract.Result <bool>() == (Contract.ValueAtReturn(out result) != FullSymbol.Invalid));

            if (relativeId.IsEmpty)
            {
                result = this;
                return(true);
            }

            HierarchicalNameId child;
            var found = table.TryGetName(Value, relativeId.Components, out child);

            result = new FullSymbol(child);
            return(found);
        }
Example #5
0
        public static bool TryGet(SymbolTable table, StringSegment fullSymbol, out FullSymbol result)
        {
            Contract.RequiresNotNull(table, "table != null");

            StringId[]  components;
            int         characterWithError;
            ParseResult parseRes = TryGetComponents(table, fullSymbol, out components, out characterWithError);

            if (parseRes == ParseResult.Success)
            {
                HierarchicalNameId nameId;
                bool b = table.TryGetName(components, out nameId);
                result = b ? new FullSymbol(nameId) : Invalid;

                return(b);
            }

            result = Invalid;
            return(false);
        }