Esempio n. 1
0
        public static SYMBOL add(string id, uint hash)
        {
            if (table[hash] == null)
            {
                table[hash] = new SYMBOL(id);
                return(table[hash]);
            }

            SYMBOL element = table[hash];

            do
            {
                if (element.identifier == id)
                {
                    return(element);
                }

                if (element.next == null)
                {
                    element.next = new SYMBOL(id);
                    return(element.next);
                }
                else
                {
                    element = element.next;
                }
            }while(true);
        }
Esempio n. 2
0
        public static void print( )
        {
            for (int i = 0; i < Scanner.hash_module; i++)
            {
                if (table[i] == null)
                {
                    continue;
                }
                SYMBOL element = table[i];

                System.Console.Write("Hash = {0}: ", i);
                while (element != null)
                {
                    System.Console.Write(" {0}", element.identifier);
                    element = element.next;
                }
                System.Console.WriteLine(" ");
            }
        }