ENH: rationalize dictionary access methods

- use keyType::option enum to consolidate searching options.
  These enumeration names should be more intuitive to use
  and improve code readability.

    Eg,   lookupEntry(key, keyType::REGEX);
    vs    lookupEntry(key, false, true);

  or

    Eg,   lookupEntry(key, keyType::LITERAL_RECURSIVE);
    vs    lookupEntry(key, true, false);

- new findEntry(), findDict(), findScoped() methods with consolidated
  search options for shorter naming and access names more closely
  aligned with other components. Behave simliarly to the
  methods lookupEntryPtr(), subDictPtr(), lookupScopedEntryPtr(),
  respectively. Default search parameters consistent with lookupEntry().

    Eg, const entry* e = dict.findEntry(key);
    vs  const entry* e = dict.lookupEntryPtr(key, false, true);

- added '*' and '->' dereference operators to dictionary searchers.
This commit is contained in:
Mark Olesen
2018-10-15 16:16:12 +02:00
parent 4f9e45fbab
commit c6520033c9
56 changed files with 769 additions and 753 deletions

View File

@ -55,14 +55,14 @@ static inline void writeEntryIfPresent
)
{
// non-recursive like dictionary::found, but no pattern-match either
const entry* ptr = dict.lookupEntryPtr(key, false, false);
const entry* eptr = dict.findEntry(key, keyType::LITERAL);
if (ptr)
if (eptr)
{
os.writeKeyword(key)
<< token::HASH << token::BEGIN_BLOCK;
os.writeQuoted(string(ptr->stream()), false)
os.writeQuoted(string(eptr->stream()), false)
<< token::HASH << token::END_BLOCK
<< token::END_STATEMENT << nl;
}