I went back and looked at RFC 2616 for details on ABNF, and in fact this reformulation is no better than the original. The issue is that 2616 doesn't say whether a "greedy" algorithm should be used.

So when matching against "abba", the pattern ("a" ["b"]) could match either "a" or "ab".

In practice this is resolved in a larger context, because it is usually the greedy match that consumes enough so that the parent to a given pattern can match.

In your example, <host> can match "h" out of "host.domain.com". But if you are trying to match
host ";" port
out of "host.domain.com;5060", then only the match of host to "host.domain.com" works.


Of course, this means that a naive (e.g. pure recursive descent) implementation of the ABNF will be intolerably slow. But that is why naive implementations aren't used.

        Paul

[EMAIL PROTECTED] wrote:
Comment inline.
<snip>


Hmm - seems like maybe you do have a point here.


Shouldn't they rather be defined as:
domainlabel = 1*alphanum / alphanum *( alphanum / "-" ) alphanum
toplabel = 1*ALPHA / ALPHA *( alphanum / "-" ) alphanum

That may work but it still seems a bit obscure. How about the following?


 domainlabel = alphanum [ *( alphanum / "-" ) alphanum ]
 toplabel = ALPHA [ *( alphanum / "-" ) alphanum ]


I agree, this looks like a much cleaner and more intuitive way.


Thanks, Andy.


_______________________________________________ Sip-implementors mailing list [EMAIL PROTECTED] http://lists.cs.columbia.edu/mailman/listinfo/sip-implementors

Reply via email to