64537e0da9421afadc14d7c91e2f6ae1.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. ace.define("ace/mode/mixal_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module){"use strict";
  2. var oop = require("../lib/oop");
  3. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  4. var MixalHighlightRules = function () {
  5. var isValidSymbol = function (string) {
  6. return string && string.search(/^[A-Z\u0394\u03a0\u03a30-9]{1,10}$/) > -1 && string.search(/[A-Z\u0394\u03a0\u03a3]/) > -1;
  7. };
  8. var isValidOp = function (op) {
  9. return op && [
  10. 'NOP', 'ADD', 'FADD', 'SUB', 'FSUB', 'MUL', 'FMUL', 'DIV', 'FDIV', 'NUM', 'CHAR', 'HLT',
  11. 'SLA', 'SRA', 'SLAX', 'SRAX', 'SLC', 'SRC', 'MOVE', 'LDA', 'LD1', 'LD2', 'LD3', 'LD4',
  12. 'LD5', 'LD6', 'LDX', 'LDAN', 'LD1N', 'LD2N', 'LD3N', 'LD4N', 'LD5N', 'LD6N', 'LDXN',
  13. 'STA', 'ST1', 'ST2', 'ST3', 'ST4', 'ST5', 'ST6', 'STX', 'STJ', 'STZ', 'JBUS', 'IOC',
  14. 'IN', 'OUT', 'JRED', 'JMP', 'JSJ', 'JOV', 'JNOV', 'JL', 'JE', 'JG', 'JGE', 'JNE', 'JLE',
  15. 'JAN', 'JAZ', 'JAP', 'JANN', 'JANZ', 'JANP', 'J1N', 'J1Z', 'J1P', 'J1NN', 'J1NZ',
  16. 'J1NP', 'J2N', 'J2Z', 'J2P', 'J2NN', 'J2NZ', 'J2NP', 'J3N', 'J3Z', 'J3P', 'J3NN', 'J3NZ',
  17. 'J3NP', 'J4N', 'J4Z', 'J4P', 'J4NN', 'J4NZ', 'J4NP', 'J5N', 'J5Z', 'J5P', 'J5NN',
  18. 'J5NZ', 'J5NP', 'J6N', 'J6Z', 'J6P', 'J6NN', 'J6NZ', 'J6NP', 'JXAN', 'JXZ', 'JXP',
  19. 'JXNN', 'JXNZ', 'JXNP', 'INCA', 'DECA', 'ENTA', 'ENNA', 'INC1', 'DEC1', 'ENT1', 'ENN1',
  20. 'INC2', 'DEC2', 'ENT2', 'ENN2', 'INC3', 'DEC3', 'ENT3', 'ENN3', 'INC4', 'DEC4', 'ENT4',
  21. 'ENN4', 'INC5', 'DEC5', 'ENT5', 'ENN5', 'INC6', 'DEC6', 'ENT6', 'ENN6', 'INCX', 'DECX',
  22. 'ENTX', 'ENNX', 'CMPA', 'FCMP', 'CMP1', 'CMP2', 'CMP3', 'CMP4', 'CMP5', 'CMP6', 'CMPX',
  23. 'EQU', 'ORIG', 'CON', 'ALF', 'END'
  24. ].indexOf(op) > -1;
  25. };
  26. var containsOnlySupportedCharacters = function (string) {
  27. return string && string.search(/[^ A-Z\u0394\u03a0\u03a30-9.,()+*/=$<>@;:'-]/) == -1;
  28. };
  29. this.$rules = {
  30. "start": [{
  31. token: "comment.line.character",
  32. regex: /^ *\*.*$/
  33. }, {
  34. token: function (label, space0, keyword, space1, literal, comment) {
  35. return [
  36. isValidSymbol(label) ? "variable.other" : "invalid.illegal",
  37. "text",
  38. "keyword.control",
  39. "text",
  40. containsOnlySupportedCharacters(literal) ? "text" : "invalid.illegal",
  41. "comment.line.character"
  42. ];
  43. },
  44. regex: /^(\S+)?( +)(ALF)( )(.{5})(\s+.*)?$/
  45. }, {
  46. token: function (label, space0, keyword, space1, literal, comment) {
  47. return [
  48. isValidSymbol(label) ? "variable.other" : "invalid.illegal",
  49. "text",
  50. "keyword.control",
  51. "text",
  52. containsOnlySupportedCharacters(literal) ? "text" : "invalid.illegal",
  53. "comment.line.character"
  54. ];
  55. },
  56. regex: /^(\S+)?( +)(ALF)( )(\S.{4})(\s+.*)?$/
  57. }, {
  58. token: function (label, space0, op, comment) {
  59. return [
  60. isValidSymbol(label) ? "variable.other" : "invalid.illegal",
  61. "text",
  62. isValidOp(op) ? "keyword.control" : "invalid.illegal",
  63. "comment.line.character"
  64. ];
  65. },
  66. regex: /^(\S+)?( +)(\S+)(?:\s*)$/
  67. }, {
  68. token: function (label, space0, op, space1, address, comment) {
  69. return [
  70. isValidSymbol(label) ? "variable.other" : "invalid.illegal",
  71. "text",
  72. isValidOp(op) ? "keyword.control" : "invalid.illegal",
  73. "text",
  74. containsOnlySupportedCharacters(address) ? "text" : "invalid.illegal",
  75. "comment.line.character"
  76. ];
  77. },
  78. regex: /^(\S+)?( +)(\S+)( +)(\S+)(\s+.*)?$/
  79. }, {
  80. defaultToken: "text"
  81. }]
  82. };
  83. };
  84. oop.inherits(MixalHighlightRules, TextHighlightRules);
  85. exports.MixalHighlightRules = MixalHighlightRules;
  86. });
  87. ace.define("ace/mode/mixal",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/mixal_highlight_rules"], function(require, exports, module){"use strict";
  88. var oop = require("../lib/oop");
  89. var TextMode = require("./text").Mode;
  90. var MixalHighlightRules = require("./mixal_highlight_rules").MixalHighlightRules;
  91. var Mode = function () {
  92. this.HighlightRules = MixalHighlightRules;
  93. };
  94. oop.inherits(Mode, TextMode);
  95. (function () {
  96. this.$id = "ace/mode/mixal";
  97. this.lineCommentStart = "*";
  98. }).call(Mode.prototype);
  99. exports.Mode = Mode;
  100. }); (function() {
  101. ace.require(["ace/mode/mixal"], function(m) {
  102. if (typeof module == "object" && typeof exports == "object" && module) {
  103. module.exports = m;
  104. }
  105. });
  106. })();