openrat-cms

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

mscgen_test.min.js (3795B)


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