test.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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}, "dylan");
  5. function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
  6. MT('comments',
  7. '[comment // This is a line comment]',
  8. '[comment /* This is a block comment */]',
  9. '[comment /* This is a multi]',
  10. '[comment line comment]',
  11. '[comment */]',
  12. '[comment /* And this is a /*]',
  13. '[comment /* nested */ comment */]');
  14. MT('unary_operators',
  15. '[operator -][variable a]',
  16. '[operator -] [variable a]',
  17. '[operator ~][variable a]',
  18. '[operator ~] [variable a]');
  19. MT('binary_operators',
  20. '[variable a] [operator +] [variable b]',
  21. '[variable a] [operator -] [variable b]',
  22. '[variable a] [operator *] [variable b]',
  23. '[variable a] [operator /] [variable b]',
  24. '[variable a] [operator ^] [variable b]',
  25. '[variable a] [operator =] [variable b]',
  26. '[variable a] [operator ==] [variable b]',
  27. '[variable a] [operator ~=] [variable b]',
  28. '[variable a] [operator ~==] [variable b]',
  29. '[variable a] [operator <] [variable b]',
  30. '[variable a] [operator <=] [variable b]',
  31. '[variable a] [operator >] [variable b]',
  32. '[variable a] [operator >=] [variable b]',
  33. '[variable a] [operator &] [variable b]',
  34. '[variable a] [operator |] [variable b]',
  35. '[variable a] [operator :=] [variable b]');
  36. MT('integers',
  37. '[number 1]',
  38. '[number 123]',
  39. '[number -123]',
  40. '[number +456]',
  41. '[number #b010]',
  42. '[number #o073]',
  43. '[number #xabcDEF123]');
  44. MT('floats',
  45. '[number .3]',
  46. '[number -1.]',
  47. '[number -2.335]',
  48. '[number +3.78d1]',
  49. '[number 3.78s-1]',
  50. '[number -3.32e+5]');
  51. MT('characters_and_strings',
  52. "[string 'a']",
  53. "[string '\\\\'']",
  54. '[string ""]',
  55. '[string "a"]',
  56. '[string "abc def"]',
  57. '[string "More escaped characters: \\\\\\\\ \\\\a \\\\b \\\\e \\\\f \\\\n \\\\r \\\\t \\\\0 ..."]');
  58. MT('brackets',
  59. '[bracket #[[]]]',
  60. '[bracket #()]',
  61. '[bracket #(][number 1][bracket )]',
  62. '[bracket [[][number 1][punctuation ,] [number 3][bracket ]]]',
  63. '[bracket ()]',
  64. '[bracket {}]',
  65. '[keyword if] [bracket (][variable foo][bracket )]',
  66. '[bracket (][number 1][bracket )]',
  67. '[bracket [[][number 1][bracket ]]]');
  68. MT('hash_words',
  69. '[punctuation ##]',
  70. '[atom #f]', '[atom #F]',
  71. '[atom #t]', '[atom #T]',
  72. '[atom #all-keys]',
  73. '[atom #include]',
  74. '[atom #key]',
  75. '[atom #next]',
  76. '[atom #rest]',
  77. '[string #"foo"]',
  78. '[error #invalid]');
  79. })();