-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adjust Formal Grammar to simplify no leading zeros #23
Comments
This indeed looks nice and clear. I am not sure if there is chemical sense in allowing isotope 0, though.
This could be done as:
However, by using such rule there is no way to limit the number of digits. Thus I prefer your grammar notation instead. |
Great, thanks for the feedback. I'm glad the new notation makes sense. Yes, I agree with you that isotope 0 does not make chemical sense, but we do need to define it in the sense of parsing SMILES. This is actually one of the changes we made compared to OpenSMILES. In OpenSMILES an isotope value of 0 is a zero isotope, while in the IUPAC SMILES+ draft, it states:
|
Thanks for pointing out the description of isotope 0 in IUPAC SMILES+ draft to me. Nevertheless I think isotope 0 should not be allowed, as I cannot see benefit of writing |
In the current IUPAC SMILES+ draft document, leading zeros are not allowed for atom properties including isotope, H count, charge, atom class, and ring bonds.
In an effort to clarify this in the formal grammar, digit notation was added:
digit ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
digit_nonzero ::= '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
We then added notation like this below to specify no leading zeros (The isotope specification supports up to 3 digits,
nnn
):isotope ::= digit | digit_nonzero digit | digit_nonzero digit digit
In hindsight, there is probably a cleaner way to do this by defining a
number
, which can not have leading zeros. If you ideas on how best to do this with the formal grammar, please comment!The text was updated successfully, but these errors were encountered: