Implement term rules in the pattern grammar

Implement term rules (texts, numbers and identifiers) to make patterns for
specified value in the pattern grammar.