Skip to content

(A subset of) RELAX NG XML Schema to TextMate language grammar generator

Notifications You must be signed in to change notification settings

egilbert/rng2txmt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 

Repository files navigation

RELAX NG to TextMate language grammar generator

The aim of this is to automatically generate TextMate language grammars from RELAX NG XML Schemas. As both TextMate grammars and RELAX NG Schemas can be written as XML, our program mainly consists of a XSLT transformation.

Note that RELAX NG schemas can be generated from DTDs or W3C XML Schemas using tools such as Trang.

Usage

Currently, XML namespace are not dealt with. You’ll have to modify your RNG schemas so that the RNG namespace is the default namespace — both empty and not defined. See known issues.

./rng2txmt.sh schema.rng

Generates the language grammars schema.plist.xml and schema.plist in the "Generated Language Grammars" repository.

Prerequisites

Everything should run directly on Mac OS X 10.5 Leopard. Developer Tools might need to be installed.

  • xsltproc (compiled with exslt support)
  • plutil
  • a sh compatible shell

Current features

What it currently does. Not much.

  • 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)

Expected features

What I would like it to do at some point in a not-so-far future.

  • improve scope definitions

  • (in progress) have parent-tag-aware scopes for auto-completion of tags, i.e.

    <a> <b/> </a> <!-- b is in a scope related to a -->

    <b attr="value" /> <!-- attribute is in a scope related to b -->

  • actually generate completion list.

  • have basic namespace support

Known issues

Issues which are not on considered a priority or currently seem unavoidable.

  • TextMate language grammars are deterministic. I thus don’t think it’s possible to generate (exact) grammars from non-deterministic RNG schemas. However, these are rare in real-life. In particular, both DTDs and W3C XML Schemas always are deterministic.
  • Dealing with XML namespace (especially default namespace) in XSLT stylesheets is quite a mess. Currently, only the default namespace is dealt with. Currently, one thus have to make edits
  • No management of many RNG construction.
  • No management of file reference.
  • No indentation of the generated plist. TextMate can however indent results by itself.
  • Probably too many scopes.

Links

About

(A subset of) RELAX NG XML Schema to TextMate language grammar generator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages