Something that SQLite does that may be useful: the parser stops parsing once it reaches the end of a statement (in sqlite3_prepare_v3) and returns the unused part of the statement. Maybe the existing parser can be used for this somehow?
Oops, looks like it got mangled. Attached as a patch instead.
DatabaseManagerSwing doesn't show returned result from PROCEDURE call
Parser error when system_time refers to a variable