Ingen beskrivning
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.

mode-scheme.js 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. ace.define("ace/mode/scheme_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
  2. "use strict";
  3. var oop = require("../lib/oop");
  4. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  5. var SchemeHighlightRules = function() {
  6. var keywordControl = "case|do|let|loop|if|else|when";
  7. var keywordOperator = "eq?|eqv?|equal?|and|or|not|null?";
  8. var constantLanguage = "#t|#f";
  9. var supportFunctions = "cons|car|cdr|cond|lambda|lambda*|syntax-rules|format|set!|quote|eval|append|list|list?|member?|load";
  10. var keywordMapper = this.createKeywordMapper({
  11. "keyword.control": keywordControl,
  12. "keyword.operator": keywordOperator,
  13. "constant.language": constantLanguage,
  14. "support.function": supportFunctions
  15. }, "identifier", true);
  16. this.$rules =
  17. {
  18. "start": [
  19. {
  20. token : "comment",
  21. regex : ";.*$"
  22. },
  23. {
  24. "token": ["storage.type.function-type.scheme", "text", "entity.name.function.scheme"],
  25. "regex": "(?:\\b(?:(define|define-syntax|define-macro))\\b)(\\s+)((?:\\w|\\-|\\!|\\?)*)"
  26. },
  27. {
  28. "token": "punctuation.definition.constant.character.scheme",
  29. "regex": "#:\\S+"
  30. },
  31. {
  32. "token": ["punctuation.definition.variable.scheme", "variable.other.global.scheme", "punctuation.definition.variable.scheme"],
  33. "regex": "(\\*)(\\S*)(\\*)"
  34. },
  35. {
  36. "token" : "constant.numeric", // hex
  37. "regex" : "#[xXoObB][0-9a-fA-F]+"
  38. },
  39. {
  40. "token" : "constant.numeric", // float
  41. "regex" : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?"
  42. },
  43. {
  44. "token" : keywordMapper,
  45. "regex" : "[a-zA-Z_#][a-zA-Z0-9_\\-\\?\\!\\*]*"
  46. },
  47. {
  48. "token" : "string",
  49. "regex" : '"(?=.)',
  50. "next" : "qqstring"
  51. }
  52. ],
  53. "qqstring": [
  54. {
  55. "token": "constant.character.escape.scheme",
  56. "regex": "\\\\."
  57. },
  58. {
  59. "token" : "string",
  60. "regex" : '[^"\\\\]+',
  61. "merge" : true
  62. }, {
  63. "token" : "string",
  64. "regex" : "\\\\$",
  65. "next" : "qqstring",
  66. "merge" : true
  67. }, {
  68. "token" : "string",
  69. "regex" : '"|$',
  70. "next" : "start",
  71. "merge" : true
  72. }
  73. ]
  74. }
  75. };
  76. oop.inherits(SchemeHighlightRules, TextHighlightRules);
  77. exports.SchemeHighlightRules = SchemeHighlightRules;
  78. });
  79. ace.define("ace/mode/scheme",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/scheme_highlight_rules"], function(require, exports, module) {
  80. "use strict";
  81. var oop = require("../lib/oop");
  82. var TextMode = require("./text").Mode;
  83. var SchemeHighlightRules = require("./scheme_highlight_rules").SchemeHighlightRules;
  84. var Mode = function() {
  85. this.HighlightRules = SchemeHighlightRules;
  86. };
  87. oop.inherits(Mode, TextMode);
  88. (function() {
  89. this.lineCommentStart = ";";
  90. this.$id = "ace/mode/scheme";
  91. }).call(Mode.prototype);
  92. exports.Mode = Mode;
  93. });