cameligo.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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/cameligo/cameligo',["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. ],
  20. autoClosingPairs: [
  21. { open: '{', close: '}' },
  22. { open: '[', close: ']' },
  23. { open: '(', close: ')' },
  24. { open: '<', close: '>' },
  25. { open: "'", close: "'" },
  26. { open: "\"", close: "\"" },
  27. { open: "(*", close: "*)" },
  28. ],
  29. surroundingPairs: [
  30. { open: '{', close: '}' },
  31. { open: '[', close: ']' },
  32. { open: '(', close: ')' },
  33. { open: '<', close: '>' },
  34. { open: "'", close: "'" },
  35. { open: "\"", close: "\"" },
  36. { open: "(*", close: "*)" },
  37. ]
  38. };
  39. exports.language = {
  40. defaultToken: '',
  41. tokenPostfix: '.cameligo',
  42. ignoreCase: true,
  43. brackets: [
  44. { open: '{', close: '}', token: 'delimiter.curly' },
  45. { open: '[', close: ']', token: 'delimiter.square' },
  46. { open: '(', close: ')', token: 'delimiter.parenthesis' },
  47. { open: '<', close: '>', token: 'delimiter.angle' }
  48. ],
  49. keywords: [
  50. 'abs',
  51. 'assert',
  52. 'block',
  53. 'Bytes',
  54. 'case',
  55. 'Crypto',
  56. 'Current',
  57. 'else',
  58. 'failwith',
  59. 'false',
  60. 'for',
  61. 'fun',
  62. 'if',
  63. 'in',
  64. 'let',
  65. 'let%entry',
  66. 'let%init',
  67. 'List',
  68. 'list',
  69. 'Map',
  70. 'map',
  71. 'match',
  72. 'match%nat',
  73. 'mod',
  74. 'not',
  75. 'operation',
  76. 'Operation',
  77. 'of',
  78. 'record',
  79. 'Set',
  80. 'set',
  81. 'sender',
  82. 'skip',
  83. 'source',
  84. 'String',
  85. 'then',
  86. 'to',
  87. 'true',
  88. 'type',
  89. 'with',
  90. ],
  91. typeKeywords: ['int', 'unit', 'string', 'tz', 'nat', 'bool'],
  92. operators: [
  93. '=',
  94. '>',
  95. '<',
  96. '<=',
  97. '>=',
  98. '<>',
  99. ':',
  100. ':=',
  101. 'and',
  102. 'mod',
  103. 'or',
  104. '+',
  105. '-',
  106. '*',
  107. '/',
  108. '@',
  109. '&',
  110. '^',
  111. '%',
  112. '->',
  113. '<-',
  114. '&&',
  115. '||',
  116. ],
  117. // we include these common regular expressions
  118. symbols: /[=><:@\^&|+\-*\/\^%]+/,
  119. // The main tokenizer for our languages
  120. tokenizer: {
  121. root: [
  122. // identifiers and keywords
  123. [
  124. /[a-zA-Z_][\w]*/,
  125. {
  126. cases: {
  127. '@keywords': { token: 'keyword.$0' },
  128. '@default': 'identifier'
  129. }
  130. }
  131. ],
  132. // whitespace
  133. { include: '@whitespace' },
  134. // delimiters and operators
  135. [/[{}()\[\]]/, '@brackets'],
  136. [/[<>](?!@symbols)/, '@brackets'],
  137. [
  138. /@symbols/,
  139. {
  140. cases: {
  141. '@operators': 'delimiter',
  142. '@default': ''
  143. }
  144. }
  145. ],
  146. // numbers
  147. [/\d*\.\d+([eE][\-+]?\d+)?/, 'number.float'],
  148. [/\$[0-9a-fA-F]{1,16}/, 'number.hex'],
  149. [/\d+/, 'number'],
  150. // delimiter: after number because of .\d floats
  151. [/[;,.]/, 'delimiter'],
  152. // strings
  153. [/'([^'\\]|\\.)*$/, 'string.invalid'],
  154. [/'/, 'string', '@string'],
  155. // characters
  156. [/'[^\\']'/, 'string'],
  157. [/'/, 'string.invalid'],
  158. [/\#\d+/, 'string']
  159. ],
  160. /* */
  161. comment: [
  162. [/[^\(\*]+/, 'comment'],
  163. //[/\(\*/, 'comment', '@push' ], // nested comment not allowed :-(
  164. [/\*\)/, 'comment', '@pop'],
  165. [/\(\*/, 'comment']
  166. ],
  167. string: [
  168. [/[^\\']+/, 'string'],
  169. [/\\./, 'string.escape.invalid'],
  170. [/'/, { token: 'string.quote', bracket: '@close', next: '@pop' }]
  171. ],
  172. whitespace: [
  173. [/[ \t\r\n]+/, 'white'],
  174. [/\(\*/, 'comment', '@comment'],
  175. [/\/\/.*$/, 'comment']
  176. ]
  177. }
  178. };
  179. });