Parser for patterns.