123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- /*
- Language: Tcl
- Description: Tcl is a very simple programming language.
- Author: Radek Liska <radekliska@gmail.com>
- Website: https://www.tcl.tk/about/language.html
- Category: scripting
- */
- function tcl(hljs) {
- const regex = hljs.regex;
- const TCL_IDENT = /[a-zA-Z_][a-zA-Z0-9_]*/;
- const NUMBER = {
- className: 'number',
- variants: [
- hljs.BINARY_NUMBER_MODE,
- hljs.C_NUMBER_MODE
- ]
- };
- const KEYWORDS = [
- "after",
- "append",
- "apply",
- "array",
- "auto_execok",
- "auto_import",
- "auto_load",
- "auto_mkindex",
- "auto_mkindex_old",
- "auto_qualify",
- "auto_reset",
- "bgerror",
- "binary",
- "break",
- "catch",
- "cd",
- "chan",
- "clock",
- "close",
- "concat",
- "continue",
- "dde",
- "dict",
- "encoding",
- "eof",
- "error",
- "eval",
- "exec",
- "exit",
- "expr",
- "fblocked",
- "fconfigure",
- "fcopy",
- "file",
- "fileevent",
- "filename",
- "flush",
- "for",
- "foreach",
- "format",
- "gets",
- "glob",
- "global",
- "history",
- "http",
- "if",
- "incr",
- "info",
- "interp",
- "join",
- "lappend|10",
- "lassign|10",
- "lindex|10",
- "linsert|10",
- "list",
- "llength|10",
- "load",
- "lrange|10",
- "lrepeat|10",
- "lreplace|10",
- "lreverse|10",
- "lsearch|10",
- "lset|10",
- "lsort|10",
- "mathfunc",
- "mathop",
- "memory",
- "msgcat",
- "namespace",
- "open",
- "package",
- "parray",
- "pid",
- "pkg::create",
- "pkg_mkIndex",
- "platform",
- "platform::shell",
- "proc",
- "puts",
- "pwd",
- "read",
- "refchan",
- "regexp",
- "registry",
- "regsub|10",
- "rename",
- "return",
- "safe",
- "scan",
- "seek",
- "set",
- "socket",
- "source",
- "split",
- "string",
- "subst",
- "switch",
- "tcl_endOfWord",
- "tcl_findLibrary",
- "tcl_startOfNextWord",
- "tcl_startOfPreviousWord",
- "tcl_wordBreakAfter",
- "tcl_wordBreakBefore",
- "tcltest",
- "tclvars",
- "tell",
- "time",
- "tm",
- "trace",
- "unknown",
- "unload",
- "unset",
- "update",
- "uplevel",
- "upvar",
- "variable",
- "vwait",
- "while"
- ];
- return {
- name: 'Tcl',
- aliases: [ 'tk' ],
- keywords: KEYWORDS,
- contains: [
- hljs.COMMENT(';[ \\t]*#', '$'),
- hljs.COMMENT('^[ \\t]*#', '$'),
- {
- beginKeywords: 'proc',
- end: '[\\{]',
- excludeEnd: true,
- contains: [
- {
- className: 'title',
- begin: '[ \\t\\n\\r]+(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*',
- end: '[ \\t\\n\\r]',
- endsWithParent: true,
- excludeEnd: true
- }
- ]
- },
- {
- className: "variable",
- variants: [
- { begin: regex.concat(
- /\$/,
- regex.optional(/::/),
- TCL_IDENT,
- '(::',
- TCL_IDENT,
- ')*'
- ) },
- {
- begin: '\\$\\{(::)?[a-zA-Z_]((::)?[a-zA-Z0-9_])*',
- end: '\\}',
- contains: [ NUMBER ]
- }
- ]
- },
- {
- className: 'string',
- contains: [ hljs.BACKSLASH_ESCAPE ],
- variants: [ hljs.inherit(hljs.QUOTE_STRING_MODE, { illegal: null }) ]
- },
- NUMBER
- ]
- };
- }
- export { tcl as default };
|