def tok(s)
    case s[0]
    when ?{ then ['{', s[0,1], s[0,1]]
    when ?} then ['}', s[0,1], s[0,1]]
    when ?: then [':', s[0,1], s[0,1]]
    when ?, then [',', s[0,1], s[0,1]]
    when ?[ then ['[', s[0,1], s[0,1]]
    when ?] then [']', s[0,1], s[0,1]]
    when ?n then nulltok(s)
    when ?t then truetok(s)
    when ?f then falsetok(s)
    when ?" then strtok(s)
    when Spc, ?\t, ?\n, ?\r then [:space, s[0,1], s[0,1]]
    else
      numtok(s)
    end
  end
def tok(s)
    case s[0]
    when ?{ then ['{', s[0,1], s[0,1]]
    when ?} then ['}', s[0,1], s[0,1]]
    when ?: then [':', s[0,1], s[0,1]]
    when ?, then [',', s[0,1], s[0,1]]
    when ?[ then ['[', s[0,1], s[0,1]]
    when ?] then [']', s[0,1], s[0,1]]
    when ?n then nulltok(s)
    when ?t then truetok(s)
    when ?f then falsetok(s)
    when ?" then strtok(s)
    when Spc, ?\t, ?\n, ?\r then [:space, s[0,1], s[0,1]]
    else
      numtok(s)
    end
  end
Scans the first token in s and
 returns a 3-element list, or nil
 if s does not begin with a valid token.

 The first list element is one of
 '{', '}', ':', ',', '[', ']',
 :val, :str, and :space.

 The second element is the lexeme.

 The third element is the value of the
 token for :val and :str, otherwise
 it is the lexeme.