ini.js 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*---------------------------------------------------------------------------------------------
  2. * Copyright (c) Microsoft Corporation. All rights reserved.
  3. * Licensed under the MIT License. See License.txt in the project root for license information.
  4. *--------------------------------------------------------------------------------------------*/
  5. define('vs/basic-languages/ini/ini',["require", "exports"], function (require, exports) {
  6. "use strict";
  7. Object.defineProperty(exports, "__esModule", { value: true });
  8. exports.language = exports.conf = void 0;
  9. exports.conf = {
  10. comments: {
  11. lineComment: '#'
  12. },
  13. brackets: [
  14. ['{', '}'],
  15. ['[', ']'],
  16. ['(', ')']
  17. ],
  18. autoClosingPairs: [
  19. { open: '{', close: '}' },
  20. { open: '[', close: ']' },
  21. { open: '(', close: ')' },
  22. { open: '"', close: '"' },
  23. { open: "'", close: "'" }
  24. ],
  25. surroundingPairs: [
  26. { open: '{', close: '}' },
  27. { open: '[', close: ']' },
  28. { open: '(', close: ')' },
  29. { open: '"', close: '"' },
  30. { open: "'", close: "'" }
  31. ]
  32. };
  33. exports.language = {
  34. defaultToken: '',
  35. tokenPostfix: '.ini',
  36. // we include these common regular expressions
  37. escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
  38. // The main tokenizer for our languages
  39. tokenizer: {
  40. root: [
  41. // sections
  42. [/^\[[^\]]*\]/, 'metatag'],
  43. // keys
  44. [/(^\w+)(\s*)(\=)/, ['key', '', 'delimiter']],
  45. // whitespace
  46. { include: '@whitespace' },
  47. // numbers
  48. [/\d+/, 'number'],
  49. // strings: recover on non-terminated strings
  50. [/"([^"\\]|\\.)*$/, 'string.invalid'],
  51. [/'([^'\\]|\\.)*$/, 'string.invalid'],
  52. [/"/, 'string', '@string."'],
  53. [/'/, 'string', "@string.'"]
  54. ],
  55. whitespace: [
  56. [/[ \t\r\n]+/, ''],
  57. [/^\s*[#;].*$/, 'comment']
  58. ],
  59. string: [
  60. [/[^\\"']+/, 'string'],
  61. [/@escapes/, 'string.escape'],
  62. [/\\./, 'string.escape.invalid'],
  63. [
  64. /["']/,
  65. {
  66. cases: {
  67. '$#==$S2': { token: 'string', next: '@pop' },
  68. '@default': 'string'
  69. }
  70. }
  71. ]
  72. ]
  73. }
  74. };
  75. });