tcl.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. /*!-----------------------------------------------------------------------------
  2. * Copyright (c) Microsoft Corporation. All rights reserved.
  3. * Version: 0.31.1(337587859b1c171314b40503171188b6cea6a32a)
  4. * Released under the MIT license
  5. * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
  6. *-----------------------------------------------------------------------------*/
  7. // src/basic-languages/tcl/tcl.ts
  8. var conf = {
  9. brackets: [
  10. ["{", "}"],
  11. ["[", "]"],
  12. ["(", ")"]
  13. ],
  14. autoClosingPairs: [
  15. { open: "{", close: "}" },
  16. { open: "[", close: "]" },
  17. { open: "(", close: ")" },
  18. { open: '"', close: '"' },
  19. { open: "'", close: "'" }
  20. ],
  21. surroundingPairs: [
  22. { open: "{", close: "}" },
  23. { open: "[", close: "]" },
  24. { open: "(", close: ")" },
  25. { open: '"', close: '"' },
  26. { open: "'", close: "'" }
  27. ]
  28. };
  29. var language = {
  30. tokenPostfix: ".tcl",
  31. specialFunctions: [
  32. "set",
  33. "unset",
  34. "rename",
  35. "variable",
  36. "proc",
  37. "coroutine",
  38. "foreach",
  39. "incr",
  40. "append",
  41. "lappend",
  42. "linsert",
  43. "lreplace"
  44. ],
  45. mainFunctions: [
  46. "if",
  47. "then",
  48. "elseif",
  49. "else",
  50. "case",
  51. "switch",
  52. "while",
  53. "for",
  54. "break",
  55. "continue",
  56. "return",
  57. "package",
  58. "namespace",
  59. "catch",
  60. "exit",
  61. "eval",
  62. "expr",
  63. "uplevel",
  64. "upvar"
  65. ],
  66. builtinFunctions: [
  67. "file",
  68. "info",
  69. "concat",
  70. "join",
  71. "lindex",
  72. "list",
  73. "llength",
  74. "lrange",
  75. "lsearch",
  76. "lsort",
  77. "split",
  78. "array",
  79. "parray",
  80. "binary",
  81. "format",
  82. "regexp",
  83. "regsub",
  84. "scan",
  85. "string",
  86. "subst",
  87. "dict",
  88. "cd",
  89. "clock",
  90. "exec",
  91. "glob",
  92. "pid",
  93. "pwd",
  94. "close",
  95. "eof",
  96. "fblocked",
  97. "fconfigure",
  98. "fcopy",
  99. "fileevent",
  100. "flush",
  101. "gets",
  102. "open",
  103. "puts",
  104. "read",
  105. "seek",
  106. "socket",
  107. "tell",
  108. "interp",
  109. "after",
  110. "auto_execok",
  111. "auto_load",
  112. "auto_mkindex",
  113. "auto_reset",
  114. "bgerror",
  115. "error",
  116. "global",
  117. "history",
  118. "load",
  119. "source",
  120. "time",
  121. "trace",
  122. "unknown",
  123. "unset",
  124. "update",
  125. "vwait",
  126. "winfo",
  127. "wm",
  128. "bind",
  129. "event",
  130. "pack",
  131. "place",
  132. "grid",
  133. "font",
  134. "bell",
  135. "clipboard",
  136. "destroy",
  137. "focus",
  138. "grab",
  139. "lower",
  140. "option",
  141. "raise",
  142. "selection",
  143. "send",
  144. "tk",
  145. "tkwait",
  146. "tk_bisque",
  147. "tk_focusNext",
  148. "tk_focusPrev",
  149. "tk_focusFollowsMouse",
  150. "tk_popup",
  151. "tk_setPalette"
  152. ],
  153. symbols: /[=><!~?:&|+\-*\/\^%]+/,
  154. brackets: [
  155. { open: "(", close: ")", token: "delimiter.parenthesis" },
  156. { open: "{", close: "}", token: "delimiter.curly" },
  157. { open: "[", close: "]", token: "delimiter.square" }
  158. ],
  159. escapes: /\\(?:[abfnrtv\\"'\[\]\{\};\$]|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
  160. variables: /(?:\$+(?:(?:\:\:?)?[a-zA-Z_]\w*)+)/,
  161. tokenizer: {
  162. root: [
  163. [
  164. /[a-zA-Z_]\w*/,
  165. {
  166. cases: {
  167. "@specialFunctions": {
  168. token: "keyword.flow",
  169. next: "@specialFunc"
  170. },
  171. "@mainFunctions": "keyword",
  172. "@builtinFunctions": "variable",
  173. "@default": "operator.scss"
  174. }
  175. }
  176. ],
  177. [/\s+\-+(?!\d|\.)\w*|{\*}/, "metatag"],
  178. { include: "@whitespace" },
  179. [/[{}()\[\]]/, "@brackets"],
  180. [/@symbols/, "operator"],
  181. [/\$+(?:\:\:)?\{/, { token: "identifier", next: "@nestedVariable" }],
  182. [/@variables/, "type.identifier"],
  183. [/\.(?!\d|\.)[\w\-]*/, "operator.sql"],
  184. [/\d+(\.\d+)?/, "number"],
  185. [/\d+/, "number"],
  186. [/;/, "delimiter"],
  187. [/"/, { token: "string.quote", bracket: "@open", next: "@dstring" }],
  188. [/'/, { token: "string.quote", bracket: "@open", next: "@sstring" }]
  189. ],
  190. dstring: [
  191. [/\[/, { token: "@brackets", next: "@nestedCall" }],
  192. [/\$+(?:\:\:)?\{/, { token: "identifier", next: "@nestedVariable" }],
  193. [/@variables/, "type.identifier"],
  194. [/[^\\$\[\]"]+/, "string"],
  195. [/@escapes/, "string.escape"],
  196. [/"/, { token: "string.quote", bracket: "@close", next: "@pop" }]
  197. ],
  198. sstring: [
  199. [/\[/, { token: "@brackets", next: "@nestedCall" }],
  200. [/\$+(?:\:\:)?\{/, { token: "identifier", next: "@nestedVariable" }],
  201. [/@variables/, "type.identifier"],
  202. [/[^\\$\[\]']+/, "string"],
  203. [/@escapes/, "string.escape"],
  204. [/'/, { token: "string.quote", bracket: "@close", next: "@pop" }]
  205. ],
  206. whitespace: [
  207. [/[ \t\r\n]+/, "white"],
  208. [/#.*\\$/, { token: "comment", next: "@newlineComment" }],
  209. [/#.*(?!\\)$/, "comment"]
  210. ],
  211. newlineComment: [
  212. [/.*\\$/, "comment"],
  213. [/.*(?!\\)$/, { token: "comment", next: "@pop" }]
  214. ],
  215. nestedVariable: [
  216. [/[^\{\}\$]+/, "type.identifier"],
  217. [/\}/, { token: "identifier", next: "@pop" }]
  218. ],
  219. nestedCall: [
  220. [/\[/, { token: "@brackets", next: "@nestedCall" }],
  221. [/\]/, { token: "@brackets", next: "@pop" }],
  222. { include: "root" }
  223. ],
  224. specialFunc: [
  225. [/"/, { token: "string", next: "@dstring" }],
  226. [/'/, { token: "string", next: "@sstring" }],
  227. [/\S+/, { token: "type", next: "@pop" }]
  228. ]
  229. }
  230. };
  231. export {
  232. conf,
  233. language
  234. };