github.com/elliott5/community@v0.14.1-0.20160709191136-823126fb026a/app/public/codemirror/mode/mscgen/xu_test.js (about)

     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-xu");
     6    function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "xu"); }
     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 'keyword'",
    28      "[keyword watermark]",
    29      "[keyword alt]","[keyword loop]","[keyword opt]","[keyword ref]","[keyword else]","[keyword break]","[keyword par]","[keyword seq]","[keyword assert]"
    30    );
    31  
    32    MT("mscgen options classify as keyword",
    33      "[keyword hscale]", "[keyword width]", "[keyword arcgradient]", "[keyword wordwraparcs]"
    34    );
    35  
    36    MT("mscgen arcs classify as keyword",
    37      "[keyword note]","[keyword abox]","[keyword rbox]","[keyword box]",
    38      "[keyword |||...---]", "[keyword ..--==::]",
    39      "[keyword ->]", "[keyword <-]", "[keyword <->]",
    40      "[keyword =>]", "[keyword <=]", "[keyword <=>]",
    41      "[keyword =>>]", "[keyword <<=]", "[keyword <<=>>]",
    42      "[keyword >>]", "[keyword <<]", "[keyword <<>>]",
    43      "[keyword -x]", "[keyword x-]", "[keyword -X]", "[keyword X-]",
    44      "[keyword :>]", "[keyword <:]", "[keyword <:>]"
    45    );
    46  
    47    MT("within an attribute list, attributes classify as attribute",
    48      "[bracket [[][attribute label]",
    49      "[attribute id]","[attribute url]","[attribute idurl]",
    50      "[attribute linecolor]","[attribute linecolour]","[attribute textcolor]","[attribute textcolour]","[attribute textbgcolor]","[attribute textbgcolour]",
    51      "[attribute arclinecolor]","[attribute arclinecolour]","[attribute arctextcolor]","[attribute arctextcolour]","[attribute arctextbgcolor]","[attribute arctextbgcolour]",
    52      "[attribute arcskip][bracket ]]]"
    53    );
    54  
    55    MT("outside an attribute list, attributes classify as base",
    56      "[base label]",
    57      "[base id]","[base url]","[base idurl]",
    58      "[base linecolor]","[base linecolour]","[base textcolor]","[base textcolour]","[base textbgcolor]","[base textbgcolour]",
    59      "[base arclinecolor]","[base arclinecolour]","[base arctextcolor]","[base arctextcolour]","[base arctextbgcolor]","[base arctextbgcolour]",
    60      "[base arcskip]"
    61    );
    62  
    63    MT("a typical program",
    64      "[comment # typical mscgen program]",
    65      "[keyword msc][base  ][bracket {]",
    66      "[keyword wordwraparcs][operator =][string \"true\"][keyword hscale][operator =][string \"0.8\"][keyword arcgradient][operator =][base 30;]",
    67      "[base   a][bracket [[][attribute label][operator =][string \"Entity A\"][bracket ]]][base ,]",
    68      "[base   b][bracket [[][attribute label][operator =][string \"Entity B\"][bracket ]]][base ,]",
    69      "[base   c][bracket [[][attribute label][operator =][string \"Entity C\"][bracket ]]][base ;]",
    70      "[base   a ][keyword =>>][base  b][bracket [[][attribute label][operator =][string \"Hello entity B\"][bracket ]]][base ;]",
    71      "[base   a ][keyword <<][base  b][bracket [[][attribute label][operator =][string \"Here's an answer dude!\"][bracket ]]][base ;]",
    72      "[base   c ][keyword :>][base  *][bracket [[][attribute label][operator =][string \"What about me?\"][base , ][attribute textcolor][operator =][base red][bracket ]]][base ;]",
    73      "[bracket }]"
    74    );
    75  })();