W3C home > Mailing lists > Public > public-cwm-bugs@w3.org > June 2005

Re: string escapes reverted on purpose?

From: EspeonEefi <eefi@MIT.EDU>
Date: Mon, 20 Jun 2005 19:21:37 -0400
To: public-cwm-bugs@w3.org, connolly@w3.org
Message-Id: <1119309697.6503.186.camel@localhost.localdomain>

On Thu, 2005-02-17 at 11:37 -0600, Dan Connolly wrote:
> Norm noticed...
> 
> This used to be valid: :N1001D :label "T4: 'It\'s Been...'" .
> seems to me \' would produce that traceback since 1.99         (connolly
> 14-Feb-02)
> 
> 
> But now he gets...
> 
> [exec] notation3.BadSyntax: Line 184 of
> <file:/share/projects/w3c/WWW/XML/Group/xsl-query-specs/data-model/build/dm-example.n3>: Bad syntax (bad escape) at ^ in:
>      [exec] "... a :Text .
>      [exec] :N1001D :parent :N1001C .
>      [exec] :N1001D :label "T4: 'It^\'s Been...'" .

I've found exactly where this is being triggered. In notation3.py v1.180
SinkParser.strconst at lines 1054-1056,
                k = string.find('abfrtvn\\"', ch)
                if k >= 0:
                    uch = '\a\b\f\r\t\v\n\\"'[k]
should be
                k = string.find('abfrtvn\\"\'', ch)
                if k >= 0:
                    uch = '\a\b\f\r\t\v\n\\"\''[k]

Interestingly, there is a dictionary Escapes defined in notation3.py as
well (at line 1836). Escapes includes the single quotation mark.
However, Escapes doesn't seem to be used anywhere else.

> It should be written up somewhere... I don't think it's reasonable
> to expect people to understand this as a specification:
> 
> string		cfg:matches		"(\"\"\"[^\"\\\\]*(?:(?:\\\\.|\"(?!\"\"))[^\"\\\
> \]*)*\"\"\")|(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\")";
> 
>  -- http://www.w3.org/2000/10/swap/grammar/n3.n3

Hmm... So the reason I haven't committed the above change is that I'm
not sure what you meant by the bug. As far as I can tell, the above
specification actually doesn't specify what are legal escapes; it seems
that all escapes are legal (note that my regexp-foo is not very high,
though).

Do you want cwm to accept the escaped quotation mark as an escaped
quotation mark like Python (note an escaped double quotation mark acts
this way), or do you want to keep the current behavior (complaining that
we have an illegal escape), or do you want to dump that into the string
as a true \'?

-- eefi
Received on Monday, 20 June 2005 23:21:50 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:10:59 GMT