mode-vhdl.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. ace.define("ace/mode/vhdl_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 VHDLHighlightRules = function() {
  6. var keywords = "access|after|ailas|all|architecture|assert|attribute|"+
  7. "begin|block|buffer|bus|case|component|configuration|"+
  8. "disconnect|downto|else|elsif|end|entity|file|for|function|"+
  9. "generate|generic|guarded|if|impure|in|inertial|inout|is|"+
  10. "label|linkage|literal|loop|mapnew|next|of|on|open|"+
  11. "others|out|port|process|pure|range|record|reject|"+
  12. "report|return|select|shared|subtype|then|to|transport|"+
  13. "type|unaffected|united|until|wait|when|while|with";
  14. var storageType = "bit|bit_vector|boolean|character|integer|line|natural|"+
  15. "positive|real|register|severity|signal|signed|"+
  16. "std_logic|std_logic_vector|string||text|time|unsigned|"+
  17. "variable";
  18. var storageModifiers = "array|constant";
  19. var keywordOperators = "abs|and|mod|nand|nor|not|rem|rol|ror|sla|sll|sra"+
  20. "srl|xnor|xor";
  21. var builtinConstants = (
  22. "true|false|null"
  23. );
  24. var keywordMapper = this.createKeywordMapper({
  25. "keyword.operator": keywordOperators,
  26. "keyword": keywords,
  27. "constant.language": builtinConstants,
  28. "storage.modifier": storageModifiers,
  29. "storage.type": storageType
  30. }, "identifier", true);
  31. this.$rules = {
  32. "start" : [ {
  33. token : "comment",
  34. regex : "--.*$"
  35. }, {
  36. token : "string", // " string
  37. regex : '".*?"'
  38. }, {
  39. token : "string", // ' string
  40. regex : "'.*?'"
  41. }, {
  42. token : "constant.numeric", // float
  43. regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
  44. }, {
  45. token : "keyword", // pre-compiler directives
  46. regex : "\\s*(?:library|package|use)\\b"
  47. }, {
  48. token : keywordMapper,
  49. regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
  50. }, {
  51. token : "keyword.operator",
  52. regex : "&|\\*|\\+|\\-|\\/|<|=|>|\\||=>|\\*\\*|:=|\\/=|>=|<=|<>"
  53. }, {
  54. token : "punctuation.operator",
  55. regex : "\\'|\\:|\\,|\\;|\\."
  56. },{
  57. token : "paren.lparen",
  58. regex : "[[(]"
  59. }, {
  60. token : "paren.rparen",
  61. regex : "[\\])]"
  62. }, {
  63. token : "text",
  64. regex : "\\s+"
  65. } ]
  66. };
  67. };
  68. oop.inherits(VHDLHighlightRules, TextHighlightRules);
  69. exports.VHDLHighlightRules = VHDLHighlightRules;
  70. });
  71. ace.define("ace/mode/vhdl",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/vhdl_highlight_rules"], function(require, exports, module) {
  72. "use strict";
  73. var oop = require("../lib/oop");
  74. var TextMode = require("./text").Mode;
  75. var VHDLHighlightRules = require("./vhdl_highlight_rules").VHDLHighlightRules;
  76. var Mode = function() {
  77. this.HighlightRules = VHDLHighlightRules;
  78. this.$behaviour = this.$defaultBehaviour;
  79. };
  80. oop.inherits(Mode, TextMode);
  81. (function() {
  82. this.lineCommentStart = "--";
  83. this.$id = "ace/mode/vhdl";
  84. }).call(Mode.prototype);
  85. exports.Mode = Mode;
  86. });