Menu

User Defined Language based on Existing

komrade
2009-09-11
2012-11-14
  • komrade

    komrade - 2009-09-11

    Hi,
    I'm trying to set up a new language, <a href=http://xbiblio.svn.sourceforge.net/viewvc/xbiblio/csl/schema/tags/0.8/csl.rnc?revision=768&view=markup>CSL</a>, which is closely based on XML.

    Is there a way to define a new language by starting with the existing XML,  and just adding a few new keywords?

    Thanks!

     
    • cchris

      cchris - 2009-09-11

      Not in a straifhtforward way, as XML is quite far from what you'd consider a programmming lanuage. UDL's for all their flexibility, tend to be very much Clike. Hopefullly this changes a bit some day.

      The quick and dirty road is to create your own internal lexer dlicating LexXML.cxx in the Scintilla source. Duplicate all style names, and entries in langs.xml and stylers.xml, and make your adjustments. Then recompile ScoLexer.dll. You'll have t redo on some Scintilla version changes.

      The more straightforward way would be to create an external lexer plugin for your language. You will want to reuse code from LexXML.cxx, but it won't be as sraightforward. Once your plugin is compiled, you don't need to worry about Scintilla changes. And you have no obligation to us C++ to code your plugin - it becomes just a bit more low-level, as you cannot reuse as-is ant header file.

      HTH
      CChris

       
MongoDB Logo MongoDB