Пример #1
0
        /// <summary>
        /// Convert to DottedIdentifier
        /// </summary>
        public DottedIdentifier ToDottedIdentifier(SymbolTable table, DottedIdentifier tail = null)
        {
            FullSymbol       current          = this;
            DottedIdentifier dottedIdentifier = tail;

            while (current.IsValid)
            {
                dottedIdentifier = new DottedIdentifier(current.GetName(table), dottedIdentifier);
                current          = current.GetParent(table);
            }

            return(dottedIdentifier);
        }
Пример #2
0
        /// <summary>
        /// Convert from DottedIdentifier
        /// </summary>
        public static PartialSymbol FromDottedIdentifier(SymbolTable symbolTable, DottedIdentifier identifier)
        {
            using (var pooledStringIds = Pools.GetStringIdList())
            {
                var stringIds = pooledStringIds.Instance;
                while (identifier != null)
                {
                    stringIds.Add(identifier.Head.StringId);
                    identifier = identifier.GetTail(symbolTable);
                }

                var components = stringIds.AsArray();
                return(new PartialSymbol(components));
            }
        }
Пример #3
0
        /// <summary>
        /// Convert to DottedIdentifier
        /// </summary>
        public DottedIdentifier ToDottedIdentifier()
        {
            if (!IsValid || IsEmpty)
            {
                return(null);
            }

            int index = Components.Length - 1;
            DottedIdentifier dottedIdentifier = null;

            while (index != 0)
            {
                dottedIdentifier = new DottedIdentifier(new SymbolAtom(Components[index]), dottedIdentifier);
                index--;
            }

            return(dottedIdentifier);
        }