Implement :sort and ranges.

:sort mainly serving as a way to test the ranges.

Fixes #694.
Fixes #695, at least partially by implementing the parser.