Tweaked grammar to allow multiple ON clauses in SORT statements.