CLI: new optimize() method in CommandToken

optimize() will transform a parse tree into a more efficient equivalient
variant. This will be useful to prevent redundant expensive API calls
in autocomplete.

Signed-off-by: Guillermo Ontanon <guillermo@midokura.jp>
CLI: optimize autocomplete

Use the new optimize() tree transformations in autocomplete by merging
all command patterns into one grammar and invoking optimize() on it. Also
during complete() calls, trim the parse tree in Or nodes, and use the
resulting trimmed tree until clear() is called on the CompletionCache.

Signed-off-by: Guillermo Ontanon <guillermo@midokura.jp>
CLI: parser optimization

Use the new optimize() mechanism created for autocomplete also for
actual command parsing. OR all command patterns into a single parse
tree that is then optimized. That tree is what the CLI uses to parse
commands now.

Signed-off-by: Guillermo Ontanon <guillermo@midokura.jp>
Merge pull request #50 from gontanon/autocompleteBug

Autocomplete optimizations
Merge pull request #52 from gontanon/optimize

CLI: parser optimization
CLI: Implement unlinking, DNS servers for dhcp, and other fixes.

Fixes MN-191, MN-192.

Also addresses the following issues:
-The -A flag now actually skips authentication.
-The set operation now supports object references.
-Support sending empty lists in API calls.

Signed-off-by: Brandon Berg <bberg@midokura.jp>