Skip to content

ending-number documentation doesn't fit shown regular expression #580

@lemzwerg

Description

@lemzwerg

In https://www.w3.org/2021/06/musicxml40/musicxml-reference/data-types/ending-number/ you can read the following (emphasis added by me).

The ending-number type is used to specify either a comma-separated list of positive integers without leading zeros, or a string of zero or more spaces. [...]

However, this description only approximates the shown regular expression. Since what is given in the documentation is hard to read (please show this with a typewriter font!), here is the same using Perl's/Python's 'extended' notation that allows arbitrary whitespace for better legibility.

  (
    [ ]*
  )
|  
  (
    [1-9] [0-9]*
    (
      , [ ]?
      [1-9] [0-9]*
    )*
  )

As can be seen. stuff like 1, 2, 3 is also allowed (note the [ ]? after the comma), which should be documented IMHO. This brings me to a strange feature: The regular expression allows exactly one single space after the comma. Why only one? Wouldn't it be better to use [ ]* instead to allow an arbitrary number of spaces?

I could even imagine to repace[ ] with \s, indicating any type of whitespace (tabs, for example).

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