rule text parser refactor + test