[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Reply to: [list | sender only]
Re: [ddlm-group] Triple-quoted strings
- To: Group finalising DDLm and associated dictionaries <ddlm-group@iucr.org>
- Subject: Re: [ddlm-group] Triple-quoted strings
- From: Nick Spadaccini <nick@csse.uwa.edu.au>
- Date: Wed, 28 Oct 2009 15:55:02 +0800
- Authentication-Results: postfix;
- In-Reply-To: <20091027122101.Y40717@epsilon.pair.com>
On 28/10/09 12:30 AM, "Herbert J. Bernstein" <yaya@bernstein-plus-sons.com> wrote: > The current proposal to deal with nested quotes, for all the quoted > strngs in CIF2 is to work python-style: > > 1. The reverse-solidus (\) is used to escape all quote marks and > the reverse solidus itself Just to clarify, the reverse solidus escapes ALL legal characters of the quote string (for instance you can't escape a newline in a single- or double- quote string because a newline is NOT a legal character in those strings). The escape means the immediately following character is not to be considered in the termination of the current string. The parser is required to return the contents of the triple quoted string as read (ie it is a raw string). Your example below is correct. > 2. All quotes strings will terminate on the first uneascaped > closing quote, indpendent of whether it is followed by a blank. > 3. All CIF2 writers are required to follow any closing quote with > a separator appropriate to the context, i.e. on the top level with > whitespace, or in a list by a comma or a close brace, etc. > 4. The reverse-solidus itself would always be passed to the > application to decide what to do with it. > > Thus the following would be used to nest treble quote > > """ here we are inside \""" treble quotes \""" """ > > and the application would receive > > here we are inside \""" treble quotes \""" > > -- HJB > ===================================================== > Herbert J. Bernstein, Professor of Computer Science > Dowling College, Kramer Science Center, KSC 121 > Idle Hour Blvd, Oakdale, NY, 11769 > > +1-631-244-3035 > yaya@dowling.edu > ===================================================== > > On Tue, 27 Oct 2009, Joe Krahn wrote: > >> I just joined the DDL list. Here is my view on triple-quoted strings. I >> hope I'm not missing something already covered on the list. >> >> IMHO, triple-quoting is not a very good solution for multi-line text. >> You still have to define a way to escape a literal triple-quote. Why not >> just stick with the existing newline-semicolon method, and only have to >> define a special escape code for a semicolon at the beginning of a line? >> It is backward-compatible because older CIF's simply do not have >> embedded newline-semicolon. With triple-quotes, you have to deal with >> the possibility of """ being a quoted quote character. >> >> Another possibility is to remove a leading space from all lines within a >> semicolon-quoted block. Most CIF text blocks already formatted that way, >> so that the first line of text with the semicolon is at the same >> indentation level as the remaining lines. For example: >> >> ;11111 >> 22222 >> 33333 >> ; >> >> is a quoted block representing: >> >> 11111 >> 22222 >> 33333 >> >> >> Even though some people might like triple-quoting due to being Python >> users, I think that the alternatives are a better fit into the existing >> syntax. >> >> Joe Krahn >> _______________________________________________ >> ddlm-group mailing list >> ddlm-group@iucr.org >> http://scripts.iucr.org/mailman/listinfo/ddlm-group >> > _______________________________________________ > ddlm-group mailing list > ddlm-group@iucr.org > http://scripts.iucr.org/mailman/listinfo/ddlm-group cheers Nick -------------------------------- Associate Professor N. Spadaccini, PhD School of Computer Science & Software Engineering The University of Western Australia t: +61 (0)8 6488 3452 35 Stirling Highway f: +61 (0)8 6488 1089 CRAWLEY, Perth, WA 6009 AUSTRALIA w3: www.csse.uwa.edu.au/~nick MBDP M002 CRICOS Provider Code: 00126G e: Nick.Spadaccini@uwa.edu.au _______________________________________________ ddlm-group mailing list ddlm-group@iucr.org http://scripts.iucr.org/mailman/listinfo/ddlm-group
Reply to: [list | sender only]
- References:
- Re: [ddlm-group] Triple-quoted strings (Herbert J. Bernstein)
- Prev by Date: Re: [ddlm-group] [THREAD 4] UTF8
- Next by Date: Re: [ddlm-group] CIF-2 changes
- Prev by thread: Re: [ddlm-group] testers for cifget version 1.1
- Next by thread: Re: [ddlm-group] Triple-quoted strings
- Index(es):