helper functions for parsing mentat selection function dsl