Another crack at a simple robust query analyzer.