- From: Norm Tovey-Walsh <norm@saxonica.com>
- Date: Mon, 28 Feb 2022 14:11:43 +0000
- To: public-ixml@w3.org
- Message-ID: <87k0dfcbmk.fsf@saxonica.com>
Hello, We have to talk about pragmas again eventually. One of my goals after getting my implementation running was to be able to experiment with some concrete proposals. Here’s one, expressed as a diff off the ixml grammar: $ diff invisible.ixml pragma.ixml 3c3 < -s: (whitespace; comment)*. --- > -s: (whitespace; comment; pragma)*. 8c8,10 < comment: -"{", (cchar; comment)*, -"}". --- > > comment: -"{", ((~["["]; comment; pragma), (cchar; comment; pragma)*)?, -"}". > pragma: -"{[", name, (whitespace, (cchar; comment; pragma)*)?, -"]}". This adopts “{[” and “]}” as the pragma delimiters, satisfying the desire to have them appear as a “kind of comment.” Pragmas have a required name, but it’s not any kind of special, qualified name. I can’t say I intended it, but I kind of liked the fact that the pragma name came out as an attribute because of the mark on “name”. As written, if a pragma consists of anything more than a name, it must have whitespace after the name. So you can’t do this: {[name{comment}]}. I think I can live with that, though a more complicated grammar could fix it. (If you don’t require whitespace, then the parser can turn {[name data]} into <pragma name="nam">e data</pragma>.) I sort of like how small the footprint of this change is, so I didn’t try to file off every possible edge case. There’s a part of me that would have expected all of the characters in the pragma, even nested comments and pragmas to appear as pragma data: <pragma name="name">testing {a comment} and {[nested pragma]}</pragma> But that isn’t how comments work today, so I went with the simple thing and let pragmas work the same way. This proposal fits my sort of bare minimum needed for pragmas. It’s the closest thing to a compromise solution that I’ve been able to imagine, which at least means it’ll probably have the distinction of being hated by *everyone*! :-) Be seeing you, norm -- Norm Tovey-Walsh Saxonica
Received on Monday, 28 February 2022 14:24:51 UTC