Discussion List Archives

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ddlm-group] CIF2 Syntax all wrapped up?

This is example is made more convoluted by including , in lists, which have
no meaning. If I recall correctly we agreed on space delimited list values.
If we stick to that then the confusions below disappear. It also removes the
dangling comma and double comma problem.

The parsing with a compound data type is exactly the same as outside a
compound data type (hence you can build a simpler recursive descent parser).

The correct definition of the list below is

[1 #one
 2 #two
 3 #three
 4 #four

Which is the list [1 2 3 4] with embedded comments #one #two #three and

The list below is (I add the quotes for clarity)
["1,#one" "2," 3 ",4"] with the embedded quotes #two #three and #four

On 24/12/09 2:58 AM, "Joe Krahn" <krahn@niehs.nih.gov> wrote:

> James Hester wrote:
>> I would answer as follows:
> ...
>>     2) What are the rules for comments within lists and tables?
>> I would treat them as whitespace
> One detail is whether the "#" starting a comment requires preceding
> whitespace. Herbert's example is:
>     [1,#one
>      2, #two
>      3 #three
>      ,4 #four
>      ]
> He suggests that preceding whitespace is there only if needed to
> terminate the preceding token, and not a requirement in the actual
> comment syntax. This looks OK in the above example, but may not be clear
> after a quoted string:
>     "string"#comment
> Or, perhaps this is no less clear than the lack of whitespace in a list:
>    ["string"]
>>     4) Why require single or double quotes for table index strings, rather
>>     than just follow the normal quoting rules?
>> No good reason - so let's just follow the normal rules.
> Should quotes be requires at all for the index string? Correct parsing
> only requires quotes if the index string contains a colon. In the
> current draft, that is imposed for all strings, not just table-index
> strings. So, there is no need to mandate quotes here, unless the global
> requirement to quote strings with : is dropped.
> Maybe the intention was to disallow multi-line index strings?
>>     Some of these are more technical details compared to the other issues.
>>     These came up while I was working on a big CIF2 regular-expression,
>>     where parsing details have to be considered more carefully.
>> Actually, it would be rather good if you could post these regular
>> expressions once we have a final specification, as they are likely to be
>> useful to a broad audience.
> I plan to do that. To be fully functional, it has to be done in Perl
> syntax, which has a feature that allows recursion for table and list
> values. Despite that caveat, it will be useful even where the full
> recursive expression will not work.
> Joe
> _______________________________________________
> ddlm-group mailing list
> ddlm-group@iucr.org
> http://scripts.iucr.org/mailman/listinfo/ddlm-group



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

Reply to: [list | sender only]
International Union of Crystallography

Scientific Union Member of the International Science Council (admitted 1947). Member of CODATA, the ISC Committee on Data. Partner with UNESCO, the United Nations Educational, Scientific and Cultural Organization in the International Year of Crystallography 2014.

International Science Council Scientific Freedom Policy

The IUCr observes the basic policy of non-discrimination and affirms the right and freedom of scientists to associate in international scientific activity without regard to such factors as ethnic origin, religion, citizenship, language, political stance, gender, sex or age, in accordance with the Statutes of the International Council for Science.