- From: Philip Jägenstedt <philipj@opera.com>
- Date: Wed, 06 Jul 2011 10:59:07 +0200
- To: public-media-fragment@w3.org
On Wed, 06 Jul 2011 10:46:57 +0200, Chris Double <cdouble@mozilla.com> wrote: > On Wed, Jul 6, 2011 at 8:39 PM, Philip Jägenstedt <philipj@opera.com> > wrote: >> >> I'm no ABNF master myself, but npttime here means that any of npt-sec, >> npt-mmss or npt-hhmmss can match, so yes, if you think about the parser >> as >> having a pointer into a string that you move forward, then you should >> backtrack if npt-sec does not match. > > Right, my point is that npt-sec does match the string '10:20', in that > it successfully matches the '10', it then goes back to the > 'npttimedef' clause which fails on the presence of ':'. So it is > 'npttimedef' that has failed, not npt-sec. We've gone beyond the > 'npttime' clause here and would need to backtrack back into that. I see. I tend to think of ABNF as a verbose form of a regular expression that also needs to consume the entire input, so as long as there is a possible match, it will be found. Something like /^(npt:)?(npt-sec|npt-mmss|npttime)$/ as a pseudo-regexp ignoring the second part. So, since 10:20 is a valid production of npttimedef, a parser must match it. (I'm no fan of ABNF, since it can't actually express the two-level syntax with percent-encoding we have, anyway.) -- Philip Jägenstedt Core Developer Opera Software
Received on Wednesday, 6 July 2011 08:59:30 UTC