unitsofmeasurement / uom-systems

Units of Measurement Systems
http://www.uom.systems
Other
36 stars 17 forks source link

Digits not parsed correctly #166

Closed frothga closed 4 years ago

frothga commented 4 years ago

Code: UnitFormat UCUM = ServiceProvider.current ().getFormatService ().getUnitFormat ("UCUM"); System.out.println ("d = " + UCUM.format (UCUM.parse ("d"))); System.out.println ("1.d = " + UCUM.format (UCUM.parse ("1.d"))); System.out.println ("2.d = " + UCUM.format (UCUM.parse ("2.d"))); System.out.println ("7.d = " + UCUM.format (UCUM.parse ("7.d")));

Output: d = d 1.d = d 2.d = 12.d 7.d = 17.d

Version: systems-ucum-2.0.jar downloaded from Maven on 4/3/20

keilw commented 4 years ago

Thanks for pointing that out. I am not sure if it would make a difference but did you try 2.0.1 of the UCUM system as well?

frothga commented 4 years ago

Not yet. I was just about to pull the project from git and build. Since the parser is in JavaCC, I'm wondering if this is an error in the grammar definition.

frothga commented 4 years ago

Tested with systems-ucum-2.0.1. It was also necessary to upgrade to indriya-2.0.2 to get past a missing class exception. The code still behaves the same way as reported above.

frothga commented 4 years ago

Could not find a parser definition file (.jj or .jjt) in the current codebase in git. This makes it difficult to understand or debug the parser.

keilw commented 4 years ago

They have been discontinued a long time ago. It would exceed a small update do forward port from JSR 275: https://github.com/unitsofmeasurement/jsr-275/tree/master/src/main/javacc/javax/measure/unit/format, for UCUM such a jj file never existed.