added pattern matching on literals that come after a repeat
merged