Terminate SMARTS parsing on whitespace or EOF.

Fixes http://sourceforge.net/p/cdk/bugs/1353/