|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Language grammar generator for XMLHi list,
I've recently been working on a Relax NG to TM Language Grammar XSLT stylesheet. I did it mainly to exercise, so I didn’t look far for anything similar. Because Relax NG is XML and can be easily generated from DTD or XML Schema using trang, it seemed like a good choice. I’d like to read your comments, especially about the generated grammars style which need much improvement. How does it work: 1) put a file.rng (in XML syntax) in the Schema directory 2) from the root directory, execute the shell script ./rng2txmt.sh Schema/file.rng 3) the grammar is generated as "Generated Language Grammars/ file.plist" (along with file.plist.xml) If this doesn’t work, please read the known issues, it might be a namespace problem. What does it try and do: * look for and mark invalid tags or attributes under or in a given tag * avoid to create empty repository entries * give a tag-aware scope for attributes (aim is to generate auto- completion lists aside) What I would like it to do: * have basic namespace support * have current-tag-aware (not any-ancestor-aware) scope for auto- completion of tags e.g, a scope which only match the dots in <a>....<b> <c/> <b>....<c/>....</a> Not so long ago, I would have say it's impossible, but now that I’ve slightly improved my TM grammar-fu, I’m pretty sure it is achievable and may even be not that hard. Matching > and /> to open, looking-ahead for <b and <c to close, perhaps. * actually generate completion list. This shouldn’t be too hard. Known issues: * If I’m right, TM grammars works in a « first matching rule is chosen » which is incompatible with Relax NG main advantage : non- determinism. Thus I think some Relax NG schema may never be parsed correctly. DTD and XML Schema need to be deterministic, however, so the issue is not that important. I think this is the problem with the generated relaxng grammar. * / ! \ Because XML namespace is a mess and I didn’t bother dealing with it in my stylesheet, one need to remove any mention of the default namespace in the rng file. Otherwise the stylesheet won’t generate anything * It currently doesn’t deal with anyName, exceptions, exclusive choice or any other RNG construction. * No auto-indentation of the generated plist. Who cares, anyway, TM cleans it up for you. * A whole lot of useless scopes, mainly there for debugging. * Whitespace in tag management in inconsistent. * The code is ugly. By the way, I’ve used some excerpts from default XML grammar. I hope it does not bother its author. Is he Brian Lalor or Allan Odgaard? Thanks, Édouard _______________________________________________ textmate mailing list textmate@... http://lists.macromates.com/listinfo/textmate |
|
|
Re: Language grammar generator for XMLLe 7 mars 09 à 16:01, Édouard Gilbert a écrit :
> I've recently been working on a Relax NG to TM Language Grammar XSLT > stylesheet. I did it mainly to exercise, so I didn’t look far for > anything similar. Because Relax NG is XML and can be easily > generated from DTD or XML Schema using trang, it seemed like a good > choice. As I recently wrote, I haven’t had much time to progress. Still, as there seemed to be at least one other person interested, I put the project on GitHub. It’s called rng2txmt, and is found here: http://github.com/egilbert/rng2txmt Édouard GILBERT edouard.gilbert@... [=?WINDOWS-1252?Q?=C9douard_Gilbert.vcf?=] BEGIN:VCARD VERSION:3.0 N:Gilbert;Ãdouard;;; FN:Ãdouard Gilbert ORG:Université Charles de Gaulle â Lille 3; EMAIL;type=INTERNET;type=WORK;type=pref:edouard.gilbert@... TEL;type=WORK:+33 3 59 57 78 63 item1.ADR;type=WORK:;;INRIA Lille â Nord Europe\nParc Scientifique de la Haute Borne\nPark Plaza - Bât A - 40 avenue Halley;Villeneuve d'Ascq;;59650;France item1.X-ABADR:fr X-JABBER;type=WORK:edouard.gilbert@... X-ABUID:C65CA7A2-8CEF-45B5-82FF-EA0F5934F3DE\:ABPerson END:VCARD _______________________________________________ textmate mailing list textmate@... http://lists.macromates.com/listinfo/textmate |
| Free embeddable forum powered by Nabble | Forum Help |