openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

msgenny_test.js (3255B)


      1 // CodeMirror, copyright (c) by Marijn Haverbeke and others
      2 // Distributed under an MIT license: http://codemirror.net/LICENSE
      3 
      4 (function() {
      5   var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-msgenny");
      6   function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "msgenny"); }
      7 
      8   MT("comments",
      9     "[comment // a single line comment]",
     10     "[comment # another  single line comment /* and */ ignored here]",
     11     "[comment /* A multi-line comment even though it contains]",
     12     "[comment msc keywords and \"quoted text\"*/]");
     13 
     14   MT("strings",
     15     "[string \"// a string\"]",
     16     "[string \"a string running over]",
     17     "[string two lines\"]",
     18     "[string \"with \\\"escaped quote\"]"
     19   );
     20 
     21   MT("xù/ msgenny keywords classify as 'keyword'",
     22     "[keyword watermark]",
     23     "[keyword alt]","[keyword loop]","[keyword opt]","[keyword ref]","[keyword else]","[keyword break]","[keyword par]","[keyword seq]","[keyword assert]"
     24   );
     25 
     26   MT("xù/ msgenny constants classify as 'variable'",
     27     "[variable auto]",
     28     "[variable true]", "[variable false]", "[variable on]", "[variable off]"
     29   );
     30 
     31   MT("mscgen options classify as keyword",
     32     "[keyword hscale]", "[keyword width]", "[keyword arcgradient]", "[keyword wordwraparcs]"
     33   );
     34 
     35   MT("mscgen arcs classify as keyword",
     36     "[keyword note]","[keyword abox]","[keyword rbox]","[keyword box]",
     37     "[keyword |||...---]", "[keyword ..--==::]",
     38     "[keyword ->]", "[keyword <-]", "[keyword <->]",
     39     "[keyword =>]", "[keyword <=]", "[keyword <=>]",
     40     "[keyword =>>]", "[keyword <<=]", "[keyword <<=>>]",
     41     "[keyword >>]", "[keyword <<]", "[keyword <<>>]",
     42     "[keyword -x]", "[keyword x-]", "[keyword -X]", "[keyword X-]",
     43     "[keyword :>]", "[keyword <:]", "[keyword <:>]"
     44   );
     45 
     46   MT("within an attribute list, mscgen/ xù attributes classify as base",
     47     "[base [[label]",
     48     "[base idurl id url]",
     49     "[base linecolor linecolour textcolor textcolour textbgcolor textbgcolour]",
     50     "[base arclinecolor arclinecolour arctextcolor arctextcolour arctextbgcolor arctextbgcolour]",
     51     "[base arcskip]]]"
     52   );
     53 
     54   MT("outside an attribute list, mscgen/ xù attributes classify as base",
     55     "[base label]",
     56     "[base idurl id url]",
     57     "[base linecolor linecolour textcolor textcolour textbgcolor textbgcolour]",
     58     "[base arclinecolor arclinecolour arctextcolor arctextcolour arctextbgcolor arctextbgcolour]",
     59     "[base arcskip]"
     60   );
     61 
     62   MT("a typical program",
     63     "[comment # typical msgenny program]",
     64     "[keyword wordwraparcs][operator =][variable true][base , ][keyword hscale][operator =][string \"0.8\"][base , ][keyword arcgradient][operator =][base 30;]",
     65     "[base   a : ][string \"Entity A\"][base ,]",
     66     "[base   b : Entity B,]",
     67     "[base   c : Entity C;]",
     68     "[base   a ][keyword =>>][base  b: ][string \"Hello entity B\"][base ;]",
     69     "[base   a ][keyword alt][base  c][bracket {]",
     70     "[base     a ][keyword <<][base  b: ][string \"Here's an answer dude!\"][base ;]",
     71     "[keyword ---][base : ][string \"sorry, won't march - comm glitch\"]",
     72     "[base     a ][keyword x-][base  b: ][string \"Here's an answer dude! (won't arrive...)\"][base ;]",
     73     "[bracket }]",
     74     "[base   c ][keyword :>][base  *: What about me?;]"
     75   );
     76 })();