Method code for $trie.match_begin()

[Turn off line numbering]
  1: arg trie, key;
  2: var n, t;
  3: 
  4: if (trie[1] && (key == trie[1][1] || trie.length() == 2 && match_begin(trie[1][1], key)))
  5:     return trie[1];
  6: if (!key)
  7:     throw(~ambig, "Trie: ambiguous match.");
  8: if (!(n = key[1] in trie[2]))
  9:     throw(~keynf, "Trie: key not found.");
 10: (> (t = .match_begin(trie[n + 2], key.subrange(2))) <);
 11: t = t.replace(1, key[1] + t[1]);
 12: return t;

// Miroslav Silovic
// Created 10-May-1995 as a part of ColdCore, see: @help Credit

Tlon