"m(/s)" passes validation and gives "1/s" as result
dalito opened this issue · comments
Entering m(/s)
in the web-validator gives: m(/s) (1/[second - time]) is a valid unit expression.
The "meter" is lost. I would expect that this fails validation.
Another interesting edge case is m.(/s)
. It passes validation and gives m.(/s) (meter*[1/[second - time]]) is a valid unit expression.
- This should probably also fail at least according to
- Syntax in BNF form in the specification
- ucum-state-automaton figure
- formal grammar page
These formal grammars only allow "/" as unary operator at the beginning of a "main term" but not as unary operator of a "term". Interestingly, the written specification only says: The division operator can be used as a binary and unary operator, i.e. a leading solidus will invert the unit that directly follows it. - This is what your code does for m.(/s)
.
A clarification that unary "/" may only be used at the beginning of the unit code has been added 2013 in ucum-org/ucum@28961d6 (see file ucum-source.xml
)- So unary "/" is really limited to the front.
I created ucum-org/ucum#290 to request an update of the wording.
Thanks for reporting this. I agree that m(/s) should be invalid, and that it's current description is incorrect. I will go ahead and add that one to our internal list of issues.
You make a strong argument for also regarding m.(/s) as invalid, though I would like to wait to see some action on the ucum-org ticket you filed just to make sure, because the text's wording is ambiguous.
This issue is fixed with the latest version.