msgenny_test.js 3.6 KB

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