Regen grammar from nagaqueen https://github.com/shamanas/nagaqueen/commit/31d5f843d64e4d40c436cf7902fa5fbb6fc1e044 and tune extend_properties test. Closes #711