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