prism-tcl.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. Prism.languages.tcl = {
  2. 'comment': {
  3. pattern: /(^|[^\\])#.*/,
  4. lookbehind: true
  5. },
  6. 'string': {
  7. pattern: /"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"/,
  8. greedy: true
  9. },
  10. 'variable': [
  11. {
  12. pattern: /(\$)(?:::)?(?:[a-zA-Z0-9]+::)*\w+/,
  13. lookbehind: true
  14. },
  15. {
  16. pattern: /(\$)\{[^}]+\}/,
  17. lookbehind: true
  18. },
  19. {
  20. pattern: /(^[\t ]*set[ \t]+)(?:::)?(?:[a-zA-Z0-9]+::)*\w+/m,
  21. lookbehind: true
  22. }
  23. ],
  24. 'function': {
  25. pattern: /(^[\t ]*proc[ \t]+)\S+/m,
  26. lookbehind: true
  27. },
  28. 'builtin': [
  29. {
  30. pattern: /(^[\t ]*)(?:break|class|continue|error|eval|exit|for|foreach|if|proc|return|switch|while)\b/m,
  31. lookbehind: true
  32. },
  33. /\b(?:else|elseif)\b/
  34. ],
  35. 'scope': {
  36. pattern: /(^[\t ]*)(?:global|upvar|variable)\b/m,
  37. lookbehind: true,
  38. alias: 'constant'
  39. },
  40. 'keyword': {
  41. pattern: /(^[\t ]*|\[)(?:Safe_Base|Tcl|after|append|apply|array|auto_(?:execok|import|load|mkindex|qualify|reset)|automkindex_old|bgerror|binary|catch|cd|chan|clock|close|concat|dde|dict|encoding|eof|exec|expr|fblocked|fconfigure|fcopy|file(?:event|name)?|flush|gets|glob|history|http|incr|info|interp|join|lappend|lassign|lindex|linsert|list|llength|load|lrange|lrepeat|lreplace|lreverse|lsearch|lset|lsort|math(?:func|op)|memory|msgcat|namespace|open|package|parray|pid|pkg_mkIndex|platform|puts|pwd|re_syntax|read|refchan|regexp|registry|regsub|rename|scan|seek|set|socket|source|split|string|subst|tcl(?:_endOfWord|_findLibrary|startOf(?:Next|Previous)Word|test|vars|wordBreak(?:After|Before))|tell|time|tm|trace|unknown|unload|unset|update|uplevel|vwait)\b/m,
  42. lookbehind: true
  43. },
  44. 'operator': /!=?|\*\*?|==|&&?|\|\|?|<[=<]?|>[=>]?|[-+~\/%?^]|\b(?:eq|in|ne|ni)\b/,
  45. 'punctuation': /[{}()\[\]]/
  46. };