pascaligo.js 5.0 KB

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