Adding AppleScript support to my app - need help

See this SO article that explains what I’m struggling with:

It’s a Xojo app, using Xojo’s AppleEvent and related classes.

My code is based on Thomas Reed’s code from 2003 (published in RBD 1.5 and 1.6).

I’m struggling with supporting advanced AppleScript syntax such as “whose” and “repeat with”.

Has anyone done this in Carbon or Xojo or REALbasic?