! ====================================================================== ! Syntax Highlighting Patterns for NEdit files in LTM syntax. ! ====================================================================== ! ! Author: Michael Chapman ! Release: June 16th, 2004 (original) ! Location: http://mchapman.com/scripts/ltm.pats ! Contact: http://interarb.com/contact.html ! !----------------------------------------------------------------------- ! NOTE: These patterns WILL ONLY work with NEdit versions 5.1 and latter !----------------------------------------------------------------------- ! ! To load: ! 1. Save this to a file ! 2. Start NEdit using the -import command line option ! ex: nedit -import ! that is: nedit -import ltm.pats ! 3. To retain the patterns in your NEdit startup file... ! Preferences -> Save Default... and click "OK". ! ! Abstract: ! These patterns attempt to highlight text written in ! Linear Topic Map Notation (LTM). ! LTM notation records topic maps. ! The formal syntax is defined in Lars Marius Garshol's ! 'Definition and introduction' at ! http://www.ontopia.com/download/ltm.html. ! (Topic Maps have an extensive literature: formal ! documents include ISO 13250 and the specification for ! XTM 1.0 at http://www.topicmaps.org/xtm/1.0/ ) ! ! Features: ! o This is a very simple creation by a novice: Comments ! are italicised. Topics definitions are in black, association ! definitions in red, and occurrence definitions in blue. ! There is some minimal further highlighting within definitions. ! Directives are in bold red. ! ! Limitations: ! o Probably many: see 'Features'. ! o Extensive checking has not yet been done, especially against ! texts created by several authors (LTM is very liberal about ! the use of whitespace, and not all possibilities may have been ! covered). ! o These patterns could be made slightly more complicated to ! allow for some basic syntax checking (for example at present ! there is a check that Occurrence definitions consist of ! three sections separated by two commas and that the third section ! looks roughly like a Specification or a Description). Doing this ! for Topic and Association definitions would need to countenance ! many possible 'or's' in the syntax ... ! o Scoping is not highlighted (but because of that does show up ! nicely ;-)> ! nedit.highlightPatterns: LTM:1:0{\n\ Comment:"/\\*":"\\*/"::ltm-comment::\n\ topic:"\\[[\\r\\b\\t ]*([A-Za-z_][-A-Za-z_0-9]*)":"\\]"::Plain::\n\ encoding:"^@""[^""]*""":::ltm-encoding::\n\ directives:"(#TOPICMAP[\\r\\n\\t ]+[A-Za-z_][-A-Za-z_0-9.]*)|(#BASEURI[\\r\\n\\t ]+""[^""]*"")|(#MERGEMAP[\\r\\n\\t ]+""[^""]*""([\\r\\n\\t ]+""((xtm)|(ltm)|(hytm)|(astma))"")?)":::ltm-directive::\n\ tid:"\\1":""::ltm-tid:topic:C\n\ string:"""":""""::ltm-top-string:topic:\n\ assoc:"[A-Za-z_][-A-Za-z_0-9]*\\(":"\\)"::ltm-assoc::\n\ occur:"\\{.*?,.*?,[\\n\\r\\t ]*((\\[\\[(([^\\]]|[\\n\\r])*)\\]\\])|(""([^""]|[\\n\\r])*""))":"\\}"::ltm-occur::\n\ description:"\\3":""::ltm-description:occur:C\n\ specif:"\\5":""::ltm-specif:occur:C\n\ } nedit.languageModes: LTM:ltm:"#TOPICMAP":None::::"\\r\\n\\t " nedit.styles: ltm-comment:#808080:Italic\n\ ltm-encoding:red:Bold\n\ ltm-directive:red:Bold\n\ ltm-tid:black:Bold\n\ ltm-top-string:black:Bold Italic\n\ ltm-assoc:red:Plain\n\ ltm-occur:blue:Plain\n\ ltm-specif:blue:Bold Italic\n\ ltm-description:blue:Italic