findNearestOpenStatementBlock returns function that creates Entities with positions

add tests