fixes to grammar rule parsing