w3cttml

What does '+' mean in W3C syntax representation for TTML timeExpression?


I want to understand the valid formats of timeExpressions in TTML. This section of the specification describes the syntax. Here is an extract:

<timeExpression>
  : clock-time
  | offset-time

clock-time
  : hours ":" minutes ":" seconds ( fraction | ":" frames ( "." sub-frames )? )?

offset-time
  : time-count fraction? metric

hours
  : <digit> <digit>
  | <digit> <digit> <digit>+

                                    -- ✂ --

I the nomenclature of the document is familiar to some extent, e.g. I understand:

but what does + mean?


I would assume it means 'one or more' as it does in a regex but, if that were the case, why would the specification read:

hours
  : <digit> <digit>
  | <digit> <digit> <digit>+

Instead of simply:

hours
  : <digit> <digit>+

Solution

  • The doc states that:

    The allowed content of the information item is shown as a grammar fragment, using the Kleene operators ?, * and +.

    And in that grammar + does mean one-or-more.

    As hours needs to be zero padded for values < 10, perhaps the two definitions are intended to illustrate that.