// // Map a new or existing string to an atom, inventing a new atom if necessary. // int TPpContext::LookUpAddString(const char *s) { TAtomMap::const_iterator it = atomMap.find(s); if (it == atomMap.end()) return AddAtomFixed(s, nextAtom++); else return it->second; }
// // Map a new or existing string to an atom, inventing a new atom if necessary. // int TPpContext::LookUpAddString(const char* s) { auto it = atomMap.find(s); if (it == atomMap.end()) { AddAtomFixed(s, nextAtom); return nextAtom++; } else return it->second; }
// // Initialize the atom table. // void TPpContext::InitAtomTable() { // Add single character tokens to the atom table: const char* s = "~!%^&*()-+=|,.<>/?;:[]{}#\\"; char t[2]; t[1] = '\0'; while (*s) { t[0] = *s; AddAtomFixed(t, s[0]); s++; } // Add multiple character scanner tokens : for (size_t ii = 0; ii < sizeof(tokens)/sizeof(tokens[0]); ii++) AddAtomFixed(tokens[ii].str, tokens[ii].val); nextAtom = PpAtomLast; }