Extract and cleanup Linemap functions from Stream
Encapsulate grammar in a table