Rewrite OrderBy's parser

Rewrite OrderBy's parser to simplify logic and simplify future function
depending.