scheme.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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/scheme/scheme',["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. blockComment: ['#|', '|#']
  13. },
  14. brackets: [
  15. ['(', ')'],
  16. ['{', '}'],
  17. ['[', ']']
  18. ],
  19. autoClosingPairs: [
  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. ]
  31. };
  32. exports.language = {
  33. defaultToken: '',
  34. ignoreCase: true,
  35. tokenPostfix: '.scheme',
  36. brackets: [
  37. { open: '(', close: ')', token: 'delimiter.parenthesis' },
  38. { open: '{', close: '}', token: 'delimiter.curly' },
  39. { open: '[', close: ']', token: 'delimiter.square' }
  40. ],
  41. keywords: [
  42. 'case',
  43. 'do',
  44. 'let',
  45. 'loop',
  46. 'if',
  47. 'else',
  48. 'when',
  49. 'cons',
  50. 'car',
  51. 'cdr',
  52. 'cond',
  53. 'lambda',
  54. 'lambda*',
  55. 'syntax-rules',
  56. 'format',
  57. 'set!',
  58. 'quote',
  59. 'eval',
  60. 'append',
  61. 'list',
  62. 'list?',
  63. 'member?',
  64. 'load'
  65. ],
  66. constants: ['#t', '#f'],
  67. operators: ['eq?', 'eqv?', 'equal?', 'and', 'or', 'not', 'null?'],
  68. tokenizer: {
  69. root: [
  70. [/#[xXoObB][0-9a-fA-F]+/, 'number.hex'],
  71. [/[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?/, 'number.float'],
  72. [
  73. /(?:\b(?:(define|define-syntax|define-macro))\b)(\s+)((?:\w|\-|\!|\?)*)/,
  74. ['keyword', 'white', 'variable']
  75. ],
  76. { include: '@whitespace' },
  77. { include: '@strings' },
  78. [
  79. /[a-zA-Z_#][a-zA-Z0-9_\-\?\!\*]*/,
  80. {
  81. cases: {
  82. '@keywords': 'keyword',
  83. '@constants': 'constant',
  84. '@operators': 'operators',
  85. '@default': 'identifier'
  86. }
  87. }
  88. ]
  89. ],
  90. comment: [
  91. [/[^\|#]+/, 'comment'],
  92. [/#\|/, 'comment', '@push'],
  93. [/\|#/, 'comment', '@pop'],
  94. [/[\|#]/, 'comment']
  95. ],
  96. whitespace: [
  97. [/[ \t\r\n]+/, 'white'],
  98. [/#\|/, 'comment', '@comment'],
  99. [/;.*$/, 'comment']
  100. ],
  101. strings: [
  102. [/"$/, 'string', '@popall'],
  103. [/"(?=.)/, 'string', '@multiLineString']
  104. ],
  105. multiLineString: [
  106. [/[^\\"]+$/, 'string', '@popall'],
  107. [/[^\\"]+/, 'string'],
  108. [/\\./, 'string.escape'],
  109. [/"/, 'string', '@popall'],
  110. [/\\$/, 'string']
  111. ]
  112. }
  113. };
  114. });