rewritten calc() parser based on the spec;
some parser cleanup
Authored by: rbri 2020-09-27
Parent: [r721]
Child: [r723]