ini_highlight_rules.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /* ***** BEGIN LICENSE BLOCK *****
  2. * Distributed under the BSD license:
  3. *
  4. * Copyright (c) 2012, Ajax.org B.V.
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions are met:
  9. * * Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. * * Redistributions in binary form must reproduce the above copyright
  12. * notice, this list of conditions and the following disclaimer in the
  13. * documentation and/or other materials provided with the distribution.
  14. * * Neither the name of Ajax.org B.V. nor the
  15. * names of its contributors may be used to endorse or promote products
  16. * derived from this software without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  19. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  20. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  21. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
  22. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  23. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  24. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  25. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  26. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  27. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. *
  29. * ***** END LICENSE BLOCK ***** */
  30. /* This file was autogenerated from tool\tm bundles\ini.tmbundle\Syntaxes\Ini.plist (uuid: ) */
  31. define(function(require, exports, module) {
  32. "use strict";
  33. var oop = require("../lib/oop");
  34. var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
  35. var escapeRe = "\\\\(?:[\\\\0abtrn;#=:]|x[a-fA-F\\d]{4})";
  36. var IniHighlightRules = function() {
  37. this.$rules = {
  38. start: [{
  39. token: 'punctuation.definition.comment.ini',
  40. regex: '#.*',
  41. push_: [{
  42. token: 'comment.line.number-sign.ini',
  43. regex: '$|^',
  44. next: 'pop'
  45. }, {
  46. defaultToken: 'comment.line.number-sign.ini'
  47. }]
  48. }, {
  49. token: 'punctuation.definition.comment.ini',
  50. regex: ';.*',
  51. push_: [{
  52. token: 'comment.line.semicolon.ini',
  53. regex: '$|^',
  54. next: 'pop'
  55. }, {
  56. defaultToken: 'comment.line.semicolon.ini'
  57. }]
  58. }, {
  59. token: ['keyword.other.definition.ini', 'text', 'punctuation.separator.key-value.ini'],
  60. regex: '\\b([a-zA-Z0-9_.-]+)\\b(\\s*)(=)'
  61. }, {
  62. token: ['punctuation.definition.entity.ini', 'constant.section.group-title.ini', 'punctuation.definition.entity.ini'],
  63. regex: '^(\\[)(.*?)(\\])'
  64. }, {
  65. token: 'punctuation.definition.string.begin.ini',
  66. regex: "'",
  67. push: [{
  68. token: 'punctuation.definition.string.end.ini',
  69. regex: "'",
  70. next: 'pop'
  71. }, {
  72. token: "constant.language.escape",
  73. regex: escapeRe
  74. }, {
  75. defaultToken: 'string.quoted.single.ini'
  76. }]
  77. }, {
  78. token: 'punctuation.definition.string.begin.ini',
  79. regex: '"',
  80. push: [{
  81. token: "constant.language.escape",
  82. regex: escapeRe
  83. }, {
  84. token: 'punctuation.definition.string.end.ini',
  85. regex: '"',
  86. next: 'pop'
  87. }, {
  88. defaultToken: 'string.quoted.double.ini'
  89. }]
  90. }]
  91. };
  92. this.normalizeRules();
  93. };
  94. IniHighlightRules.metaData = {
  95. fileTypes: ['ini', 'conf'],
  96. keyEquivalent: '^~I',
  97. name: 'Ini',
  98. scopeName: 'source.ini'
  99. };
  100. oop.inherits(IniHighlightRules, TextHighlightRules);
  101. exports.IniHighlightRules = IniHighlightRules;
  102. });