- From: John Lumley <john@saxonica.com>
- Date: Tue, 1 Feb 2022 16:49:38 +0000
- To: ixml <public-ixml@w3.org>
- Message-ID: <f8eea5f6-9f0d-87cd-1b7a-638d21ff9128@saxonica.com>
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"> <rule name='XPath'> <alt> <option> <nonterminal name='s'/> </option> <nonterminal name='Expr'/> <option> <nonterminal name='s'/> </option> </alt> </rule> /*<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>/* <nonterminal name='Param'/> </alt> </alts> </repeat0> </alt> </rule> <rule name='Param'> ..... 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. -- *John Lumley* MA PhD CEng FIEE john@saxonica.com
Received on Tuesday, 1 February 2022 16:50:00 UTC