Add unittests for kParserErrorTermination; Fix bugs in last merge.