Re: FW: XML grammar error?

On Mon, Dec 12, 2011 at 09:53:46AM -0500, Grosso, Paul wrote:
> Forwarding:
> http://lists.w3.org/Archives/Public/xml-editor/2011OctDec/0010
> 
> -----Original Message-----
> From: bacchi raffaele [mailto:bacchi_raffaele@lycos.com] 
> Sent: Monday, 2011 December 12 3:45
> To: xml-editor@w3.org
> Subject: XML grammar error?
> 
> I think that rule [20] (and other similar) are wrong:
> 
> CData ::= (Char* - (Char* ']]>' Char*))
> 
> The purpose of the rule is to match (reduce) any Char sequence 
> not containing ']]>'.  But this result is not achieved since 
> the Char definition includes ']' and '>' so the exception part 
> of the rule:
> 
> -(Char* ']]>' Char*)
> 
> is ambiguous. Most parsers solve the ambiguity by applying the 
> rule "reduce as soon, as much as possible" thus the rule will 
> always mismatch because the first Char* reduces also the sequence 
> ']]>' and the next terminal ']]>' will never match.

  Interest here is making sure the rule is clear rather than
generating a perfect grammar.

> I think the rule (and other similar) should be written:
> 
> Cdata ::= ( Char - ']]>' )*

  I disagree, since ']]>' is not a Char but an array of 3 Char(s)
thus Char - ']]>' make little sense to me, as no char can match such
an array. I call this a type error :-)

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

Received on Monday, 12 December 2011 15:17:43 UTC