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.

87 lines
4.1 KiB

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