pik-piam / magclass

R package | Data Class and Tools for Handling Spatial-Temporal Data
GNU Lesser General Public License v3.0
4 stars 24 forks source link

Parentheses in units #119

Closed mikapfl closed 2 years ago

mikapfl commented 2 years ago

After we added support for parentheses in variable names in write.report(), it quickly became apparent that people also want to put parentheses into units. Since the most general case with parentheses in the variable name and the unit is actually not properly defined, we can only support balanced parentheses in the unit, i.e. as many opening as closing parentheses.

To support this, I had to resort to perl-compatible regular expressions with subroutines. I added a lot of comments in the hope that whoever has to touch this next has a chance to understand the regex.

mikapfl commented 2 years ago

I have run magclass reporting with this version and compared with magclass 6.2.0, and found no differences in the output, so I think we're fine.