msgenny_test.js 3.2 KB

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