mode-csp.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. define("ace/mode/csp_highlight_rules",["ace_require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(ace_require, exports, module) {
  2. "use strict";
  3. var oop = ace_require("../lib/oop");
  4. var TextHighlightRules = ace_require("./text_highlight_rules").TextHighlightRules;
  5. var CspHighlightRules = function() {
  6. var keywordMapper = this.createKeywordMapper({
  7. "constant.language": "child-src|connect-src|default-src|font-src|frame-src|img-src|manifest-src|media-src|object-src"
  8. + "|script-src|style-src|worker-src|base-uri|plugin-types|sandbox|disown-opener|form-action|frame-ancestors|report-uri"
  9. + "|report-to|upgrade-insecure-requests|block-all-mixed-content|ace_require-sri-for|reflected-xss|referrer|policy-uri",
  10. "variable": "'none'|'self'|'unsafe-inline'|'unsafe-eval'|'strict-dynamic'|'unsafe-hashed-attributes'"
  11. }, "identifier", true);
  12. this.$rules = {
  13. start: [{
  14. token: "string.link",
  15. regex: /https?:[^;\s]*/
  16. }, {
  17. token: "operator.punctuation",
  18. regex: /;/
  19. }, {
  20. token: keywordMapper,
  21. regex: /[^\s;]+/
  22. }]
  23. };
  24. };
  25. oop.inherits(CspHighlightRules, TextHighlightRules);
  26. exports.CspHighlightRules = CspHighlightRules;
  27. });
  28. define("ace/mode/csp",["ace_require","exports","module","ace/mode/text","ace/mode/csp_highlight_rules","ace/lib/oop"], function(ace_require, exports, module) {
  29. "use strict";
  30. var TextMode = ace_require("./text").Mode;
  31. var CspHighlightRules = ace_require("./csp_highlight_rules").CspHighlightRules;
  32. var oop = ace_require("../lib/oop");
  33. var Mode = function() {
  34. this.HighlightRules = CspHighlightRules;
  35. };
  36. oop.inherits(Mode, TextMode);
  37. (function() {
  38. this.$id = "ace/mode/csp";
  39. }).call(Mode.prototype);
  40. exports.Mode = Mode;
  41. }); (function() {
  42. window.ace_require(["ace/mode/csp"], function(m) {
  43. if (typeof module == "object" && typeof exports == "object" && module) {
  44. module.exports = m;
  45. }
  46. });
  47. })();