msgenny_test.js 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  2. // Distributed under an MIT license: http://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("mscgen options classify as keyword",
  22. "[keyword hscale]", "[keyword width]", "[keyword arcgradient]", "[keyword wordwraparcs]"
  23. );
  24. MT("mscgen arcs classify as keyword",
  25. "[keyword note]","[keyword abox]","[keyword rbox]","[keyword box]",
  26. "[keyword |||...---]", "[keyword ..--==::]",
  27. "[keyword ->]", "[keyword <-]", "[keyword <->]",
  28. "[keyword =>]", "[keyword <=]", "[keyword <=>]",
  29. "[keyword =>>]", "[keyword <<=]", "[keyword <<=>>]",
  30. "[keyword >>]", "[keyword <<]", "[keyword <<>>]",
  31. "[keyword -x]", "[keyword x-]", "[keyword -X]", "[keyword X-]",
  32. "[keyword :>]", "[keyword <:]", "[keyword <:>]"
  33. );
  34. MT("within an attribute list, mscgen/ xù attributes classify as base",
  35. "[base [[label]",
  36. "[base idurl id url]",
  37. "[base linecolor linecolour textcolor textcolour textbgcolor textbgcolour]",
  38. "[base arclinecolor arclinecolour arctextcolor arctextcolour arctextbgcolor arctextbgcolour]",
  39. "[base arcskip]]]"
  40. );
  41. MT("outside an attribute list, mscgen/ xù attributes classify as base",
  42. "[base label]",
  43. "[base idurl id url]",
  44. "[base linecolor linecolour textcolor textcolour textbgcolor textbgcolour]",
  45. "[base arclinecolor arclinecolour arctextcolor arctextcolour arctextbgcolor arctextbgcolour]",
  46. "[base arcskip]"
  47. );
  48. MT("a typical program",
  49. "[comment # typical msgenny program]",
  50. "[keyword wordwraparcs][operator =][string \"true\"][base , ][keyword hscale][operator =][string \"0.8\"][base , ][keyword arcgradient][operator =][base 30;]",
  51. "[base a : ][string \"Entity A\"][base ,]",
  52. "[base b : Entity B,]",
  53. "[base c : Entity C;]",
  54. "[base a ][keyword =>>][base b: ][string \"Hello entity B\"][base ;]",
  55. "[base a ][keyword alt][base c][bracket {]",
  56. "[base a ][keyword <<][base b: ][string \"Here's an answer dude!\"][base ;]",
  57. "[keyword ---][base : ][string \"sorry, won't march - comm glitch\"]",
  58. "[base a ][keyword x-][base b: ][string \"Here's an answer dude! (won't arrive...)\"][base ;]",
  59. "[bracket }]",
  60. "[base c ][keyword :>][base *: What about me?;]"
  61. );
  62. })();