How do I get BBEdit to display the error browser programmatically? One of the nice features of BBEdit is that it can show a list of errors (e.g. syntax errors in a Ruby program), and clicking on the error will display the line in the source code file.

How can I bring this window up programmatically, e.g. via the command line, AppleScript, or a language module?

In my specific situation, I'm compiling SML/NJ programs.  The compiler lists errors in the following format:

codegen.sml:121.31 Error: syntax error: inserting  LPAREN
codegen.sml:130.49 Error: syntax error: inserting  EQUALOP


When I get compiler errors like that, I'd like BBEdit to display those error messages and let me click on them to display the buggy line in my code.
You can do it using AppleScript and BBEdit's results browser command. It isn't well documented, but there are some good examples around to help you out. For example: John Gruber's CSS Syntax Checker.

Here is a sample AppleScript.

tell application "BBEdit"
  set error_list to ¬
    {{result_kind: "Error", result_file: "/path/to/codegen.sml",¬
      result_line: 121, message: "syntax error: inserting  LPAREN"},¬
     {result_kind: "Error", result_file: "/path/to/codegen.sml",¬
      result_line: 130, message: "syntax error: inserting  EQUALOP"}}
  make new results browser with data error_list with properties ¬
    {name:"Errors"}
end tell


Of course, you will want to create the error_list variable programmatically, but this should get you started. If you change /path/to/codegen.sml to a file that exists on your system, you can see it in action.