- From: John Lumley <john@saxonica.com>
- Date: Tue, 1 Feb 2022 18:33:12 +0000
- To: "C. M. Sperberg-McQueen" <cmsmcq@blackmesatech.com>
- Cc: public-ixml@w3.org
I fully understand Michael…. Personally I would prefer the pragma to be a child of the rule…. But I was looking at whether using ‘marked comments’ would permit someone to have sufficient precision in placement of these comments in the XML tree to recover the intent…. My test shows it should be possible, but semantically suboptimal… Sent from my iPad > On 1 Feb 2022, at 18:08, C. M. Sperberg-McQueen <cmsmcq@blackmesatech.com> wrote: > > > John Lumley writes: > >> One of the issues I raised was how would 'specially marked' comments >> scope in the parsed XML for a grammar? I've just run a very small >> test, using my 'annotated' XPath.ixml which starts: ...> .... >> >> If we pass this through Steven's processor against the grammar for >> IXML we get: ... >> so it seems that within a rule the comments scope within the tree, in >> appropriate sibling position. > > When you raised the question in the call, I was prepared to answer "no, > placing pragmas where comments are currently allow quite often does not > make it convenient to have them annotating the correct construct in the > XML." > > I think your example demonstrates my point: a pragma annotating an > element E should ideally be a child of E, not a sibling. The current > placement of s in the grammar is not designed with this kind of > consideration in mind, and accordingly makes necessary some awkward > placement of comments if you care about where they go in the XML. > > Of course, your comments also demonstrate that tastes differ. > >> For those before a rule start, the >> comment is, unsurprisingly, in the preceding-sibling::*[1] position. I >> think anyone who's using this for preprocessing via a rule-rewriting >> operation through the XML representation could live with this small >> additional complexity. > > People can *live with* all kinds of things. > > If pragmas are simply added to s, or defined as a subclass of comments, > then I think the XML locations of pragmas will simply advertise very > clearly to anyone who looks that the designers of ixml paid no attention > to making it possible to get pragmas into appropriate locations in the > XML. > > Consider the ixml rule for rules, and its XML representation: > > rule: (mark, s)?, name, s, -["=:"], s, -alts, -".". > > <rule name='rule'> > <alt> > <option> > <alts> > <alt> > <nonterminal name='mark'/> > <nonterminal name='s'/> > </alt> > </alts> > </option> > <nonterminal name='name'/> > <nonterminal name='s'/> > <inclusion tmark='-'> > <literal dstring='=:'/> > </inclusion> > <nonterminal name='s'/> > <nonterminal mark='-' name='alts'/> > <literal tmark='-' dstring='.'/> > </alt> > </rule> > > Now consider all the locations where comments are allowed in the ixml: > > {1}rule {2} : {3} ( {4} mark {5} , {6} s {7} ) {8} ? {9} , {10} name > {11}, {12} s {13}, {14} - {15} [ {16} "=:" {18} ] {19} , {20} s {21} > , {22} - {23} alts {24} , {25} - {26} "." {27} . {28} > > If you can predict accurately the locations in the XML of even half of > the comments in the ixml production just given, without consulting the > grammar, then I will be surprised. I found it challenging to get them > all even when consulting the grammar. > > Tom and I devoted a good deal of time to this question, because we had > the goal of making pragmas usable and did not have the goal of making > them unpleasant to use. But of course paying attention to details like > this would go against the view that pragmas are only worth two lines in > the spec, so it appears to be doomed. > > -- > C. M. Sperberg-McQueen > Black Mesa Technologies LLC > http://blackmesatech.com
Received on Tuesday, 1 February 2022 18:33:29 UTC