public entry(lexicalScanner.SYMBOL token, string lexeme, int depth) { this.token = token; this.lexeme = lexeme; this.depth = depth; //this.typeOfEntry = typeOfEntry; }
/// <summary> /// Inserts an entry into the symbol table. Uses a hash function to find its position /// </summary> /// <param name="lexeme"></param> /// <param name="token"></param> /// <param name="depth"></param> unsafe public void insert(string lexeme, lexicalScanner.SYMBOL token, int depth) { //int h = hash(convertStringToCharP(lexeme)); // Get hash uint h = hash(lexeme.ToLower()); entry temp = new entry(token, lexeme, depth); //Create new record //Console.WriteLine(hashTable[h].Count); //S Console.WriteLine(token); //If there are elements in the list if (hashTable[h].ElementAt(0).Next != null) { temp.Next = hashTable[h].ElementAt(0).Next; hashTable[h].ElementAt(0).Next = temp; temp.Next.Prev = temp; temp.Prev = hashTable[h].ElementAt(0); } //If there are no elements in the list else { hashTable[h].ElementAt(0).Next = temp; temp.Prev = hashTable[h].ElementAt(0); } }