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.

77 lines
3.2 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}, "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 wordwrapentities]",
  20. "[keyword alt]","[keyword loop]","[keyword opt]","[keyword ref]","[keyword else]","[keyword break]","[keyword par]","[keyword seq]","[keyword assert]"
  21. );
  22. MT("xù/ msgenny constants classify as 'variable'",
  23. "[variable auto]",
  24. "[variable true]", "[variable false]", "[variable on]", "[variable off]"
  25. );
  26. MT("mscgen options classify as keyword",
  27. "[keyword hscale]", "[keyword width]", "[keyword arcgradient]", "[keyword wordwraparcs]"
  28. );
  29. MT("mscgen arcs classify as keyword",
  30. "[keyword note]","[keyword abox]","[keyword rbox]","[keyword box]",
  31. "[keyword |||...---]", "[keyword ..--==::]",
  32. "[keyword ->]", "[keyword <-]", "[keyword <->]",
  33. "[keyword =>]", "[keyword <=]", "[keyword <=>]",
  34. "[keyword =>>]", "[keyword <<=]", "[keyword <<=>>]",
  35. "[keyword >>]", "[keyword <<]", "[keyword <<>>]",
  36. "[keyword -x]", "[keyword x-]", "[keyword -X]", "[keyword X-]",
  37. "[keyword :>]", "[keyword <:]", "[keyword <:>]"
  38. );
  39. MT("within an attribute list, mscgen/ xù attributes classify as base",
  40. "[base [[label]",
  41. "[base idurl id url]",
  42. "[base linecolor linecolour textcolor textcolour textbgcolor textbgcolour]",
  43. "[base arclinecolor arclinecolour arctextcolor arctextcolour arctextbgcolor arctextbgcolour]",
  44. "[base arcskip]]]"
  45. );
  46. MT("outside an attribute list, mscgen/ xù attributes classify as base",
  47. "[base label]",
  48. "[base idurl id url]",
  49. "[base linecolor linecolour textcolor textcolour textbgcolor textbgcolour]",
  50. "[base arclinecolor arclinecolour arctextcolor arctextcolour arctextbgcolor arctextbgcolour]",
  51. "[base arcskip]"
  52. );
  53. MT("a typical program",
  54. "[comment # typical msgenny program]",
  55. "[keyword wordwraparcs][operator =][variable true][base , ][keyword hscale][operator =][string \"0.8\"][base , ][keyword arcgradient][operator =][base 30;]",
  56. "[base a : ][string \"Entity A\"][base ,]",
  57. "[base b : Entity B,]",
  58. "[base c : Entity C;]",
  59. "[base a ][keyword =>>][base b: ][string \"Hello entity B\"][base ;]",
  60. "[base a ][keyword alt][base c][bracket {]",
  61. "[base a ][keyword <<][base b: ][string \"Here's an answer dude!\"][base ;]",
  62. "[keyword ---][base : ][string \"sorry, won't march - comm glitch\"]",
  63. "[base a ][keyword x-][base b: ][string \"Here's an answer dude! (won't arrive...)\"][base ;]",
  64. "[bracket }]",
  65. "[base c ][keyword :>][base *: What about me?;]"
  66. );
  67. })();