You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
3.7 KiB

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