!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("tcl",function(){function e(e){for(var r={},t=e.split(" "),n=0;n<t.length;++n)r[t[n]]=!0;return r}var a=e("Tcl safe after append array auto_execok auto_import auto_load auto_mkindex auto_mkindex_old auto_qualify auto_reset bgerror binary break catch cd close concat continue dde eof encoding error eval exec exit expr fblocked fconfigure fcopy file fileevent filename filename flush for foreach format gets glob global history http if incr info interp join lappend lindex linsert list llength load lrange lreplace lsearch lset lsort memory msgcat namespace open package parray pid pkg::create pkg_mkIndex proc puts pwd re_syntax read regex regexp registry regsub rename resource return scan seek set socket source split string subst switch tcl_endOfWord tcl_findLibrary tcl_startOfNextWord tcl_wordBreakAfter tcl_startOfPreviousWord tcl_wordBreakBefore tcltest tclvars tell time trace unknown unset update uplevel upvar variable vwait"),i=e("if elseif else and not or eq ne in ni for foreach while switch"),f=/[+\-*&%=<>!?^\/\|]/;function l(e,r,t){return(r.tokenize=t)(e,r)}function c(e,r){var t=r.beforeParams;r.beforeParams=!1;var n=e.next();if('"'!=n&&"'"!=n||!r.inParams){if(/[\[\]{}\(\),;\.]/.test(n))return"("==n&&t?r.inParams=!0:")"==n&&(r.inParams=!1),null;if(/\d/.test(n))return e.eatWhile(/[\w\.]/),"number";if("#"==n)return e.eat("*")?l(e,r,u):"#"==n&&e.match(/ *\[ *\[/)?l(e,r,s):(e.skipToEnd(),"comment");if('"'==n)return e.skipTo(/"/),"comment";if("$"==n)return e.eatWhile(/[$_a-z0-9A-Z\.{:]/),e.eatWhile(/}/),r.beforeParams=!0,"builtin";if(f.test(n))return e.eatWhile(f),"comment";e.eatWhile(/[\w\$_{}\xa1-\uffff]/);var o=e.current().toLowerCase();return a&&a.propertyIsEnumerable(o)?"keyword":i&&i.propertyIsEnumerable(o)?(r.beforeParams=!0,"keyword"):null}return l(e,r,function(a){return function(e,r){for(var t,n=!1,o=!1;null!=(t=e.next());){if(t==a&&!n){o=!0;break}n=!n&&"\\"==t}return o&&(r.tokenize=c),"string"}}(n))}function u(e,r){for(var t,n=!1;t=e.next();){if("#"==t&&n){r.tokenize=c;break}n="*"==t}return"comment"}function s(e,r){for(var t,n=0;t=e.next();){if("#"==t&&2==n){r.tokenize=c;break}"]"==t?n++:" "!=t&&(n=0)}return"meta"}return{startState:function(){return{tokenize:c,beforeParams:!1,inParams:!1}},token:function(e,r){return e.eatSpace()?null:r.tokenize(e,r)}}}),e.defineMIME("text/x-tcl","tcl")});