HPCC-12341 Improve syntax checking for FORWARD modules (and fix core)

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

HPCC-12341 Improve syntax checking for FORWARD modules (and fix core)

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>