Sebastian Yepes wrote a scanner for AppleScript. From http://odd-eyed-code.org/issues/28 His code is on a branch: https://github.com/rubychan/coderay/commits/applescript-scanner