Added error for attributes used out of context.

This also introduces a simpler way to prepare parser errors that cannot
be easily, immediately recognized.