[parser] improve message interface
[parser] add tests for new interface