Skip to content

Adjust Formal Grammar to simplify no leading zeros #23

@vfscalfani

Description

@vfscalfani

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions