- From: Bethan Tovey-Walsh <accounts@bethan.wales>
- Date: Tue, 1 Feb 2022 17:03:16 +0000
- To: John Lumley <john@saxonica.com>
- Cc: public-ixml@w3.org
- Message-Id: <A0424DD1-8931-4B88-9CE0-9616381B2A73@bethan.wales>
Thanks for the speedy test, John! Sent from my iPhone > On 1 Feb 2022, at 17:01, John Lumley <john@saxonica.com> wrote: > > >> On 01/02/2022 16:49, John Lumley wrote: >> 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: >> >> XPath: s?, Expr, s?. >> >> {# jl:opt rule} ParamList: {#jl:opt ruleStart} Param, ( -',', {#jl:opt inBracket} Param )*. >> Param: -'$', EQName, TypeDeclaration?. >> >> .... >> >> If we pass this through Steven's processor against the grammar for IXML we get: >> >> <ixml ixml:state="ambiguous" xmlns:ixml="http://invisiblexml.org/NS"> >> ....... >> so it seems that within a rule the comments scope within the tree, in appropriate sibling position. 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. >> > And the comments do also nest in the XML tree: > > {# jl:opt rule} ParamList: {#jl:opt ruleStart} Param, ( -',', {#jl:opt inBracket {#jl:nest Nested}} Param )*. > > becomes: > > <comment># jl:opt rule</comment> > <rule name='ParamList'> > <comment>#jl:opt ruleStart</comment> > <alt> > <nonterminal name='Param'/> > <repeat0> > <alts> > <alt> > <literal tmark='-' sstring=','/> > <comment>#jl:opt inBracket > <comment>#jl:nest Nested</comment> > </comment> > <nonterminal name='Param'/> > </alt> > </alts> > </repeat0> > </alt> > </rule> > -- > John Lumley MA PhD CEng FIEE > john@saxonica.com
Received on Tuesday, 1 February 2022 17:03:31 UTC