Source: site.view [edit]
Function name: lookupInTrie
Arguments: trie,term,dataType
Description: Returns Data if term is in trie, nil otherwise
Page type: webl
Render function:  
Module: siteutil

Page source:

var subTrie = trie;

var i = 0;
var res = nil;

var s = "";

while (i < Size(term)) do

   var ch = Select(term, i, i+1);

   var t = subTrie[ch] ? nil;

   if (t == nil) then
      i = Size(term) + 2
   elsif (i + 1 == Size(term)) then
      res = t[dataType] ? nil;
      i = Size(term) + 2
   else
      subTrie = t;
   end;

   i = i + 1;
end;

res;