tcl.js 2.2 KB

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