flatten parser and scanner