Ex-Mente / auxi.0

GNU Lesser General Public License v3.0
8 stars 8 forks source link

Revisit parsing code #191

Closed alchemyst closed 7 years ago

alchemyst commented 7 years ago

The parsing code in auxi/tools/chemistry/stoichiometry.py has much logical duplication. It also uses the ord values of characters, which should not be relied upon. We should parse once into an abstract representation and then derive the other properties from there instead of parsing the same string many times with different goals as is currently done.

I have a working parser which handles this a little more normally, with separate tokenisation and parsing to an abstract form, but it may be even better just to use a proper parsing framework like PyParsing or the newer Parsimonious.