HPCC-12198 Abort parsing earlier for invalid queries

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Merge pull request #6456 from ghalliday/issue12198

HPCC-12198 Abort parsing earlier for invalid queries

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>