tcl.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. Language: Tcl
  3. Description: Tcl is a very simple programming language.
  4. Author: Radek Liska <radekliska@gmail.com>
  5. Website: https://www.tcl.tk/about/language.html
  6. */
  7. function tcl(hljs) {
  8. return {
  9. name: 'Tcl',
  10. aliases: ['tk'],
  11. keywords: 'after append apply array auto_execok auto_import auto_load auto_mkindex ' +
  12. 'auto_mkindex_old auto_qualify auto_reset bgerror binary break catch cd chan clock ' +
  13. 'close concat continue dde dict encoding eof error eval exec exit expr fblocked ' +
  14. 'fconfigure fcopy file fileevent filename flush for foreach format gets glob global ' +
  15. 'history http if incr info interp join lappend|10 lassign|10 lindex|10 linsert|10 list ' +
  16. 'llength|10 load lrange|10 lrepeat|10 lreplace|10 lreverse|10 lsearch|10 lset|10 lsort|10 '+
  17. 'mathfunc mathop memory msgcat namespace open package parray pid pkg::create pkg_mkIndex '+
  18. 'platform platform::shell proc puts pwd read refchan regexp registry regsub|10 rename '+
  19. 'return safe scan seek set socket source split string subst switch tcl_endOfWord '+
  20. 'tcl_findLibrary tcl_startOfNextWord tcl_startOfPreviousWord tcl_wordBreakAfter '+
  21. 'tcl_wordBreakBefore tcltest tclvars tell time tm trace unknown unload unset update '+
  22. 'uplevel upvar variable vwait while',
  23. contains: [
  24. hljs.COMMENT(';[ \\t]*#', '$'),
  25. hljs.COMMENT('^[ \\t]*#', '$'),
  26. {
  27. beginKeywords: 'proc',
  28. end: '[\\{]',
  29. excludeEnd: true,
  30. contains: [
  31. {
  32. className: 'title',
  33. begin: '[ \\t\\n\\r]+(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*',
  34. end: '[ \\t\\n\\r]',
  35. endsWithParent: true,
  36. excludeEnd: true
  37. }
  38. ]
  39. },
  40. {
  41. excludeEnd: true,
  42. variants: [
  43. {
  44. begin: '\\$(\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*\\(([a-zA-Z0-9_])*\\)',
  45. end: '[^a-zA-Z0-9_\\}\\$]'
  46. },
  47. {
  48. begin: '\\$(\\{)?(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*',
  49. end: '(\\))?[^a-zA-Z0-9_\\}\\$]'
  50. }
  51. ]
  52. },
  53. {
  54. className: 'string',
  55. contains: [hljs.BACKSLASH_ESCAPE],
  56. variants: [
  57. hljs.inherit(hljs.QUOTE_STRING_MODE, {illegal: null})
  58. ]
  59. },
  60. {
  61. className: 'number',
  62. variants: [hljs.BINARY_NUMBER_MODE, hljs.C_NUMBER_MODE]
  63. }
  64. ]
  65. }
  66. }
  67. module.exports = tcl;