lib/parser_base: intro `StringProcessor::eof` and fix index error