function s(r){for(var t={},n=r.split(" "),e=0;e<n.length;++e)t[n[e]]=!0;return t}var f=s("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"),u=s("if elseif else and not or eq ne in ni for foreach while switch"),c=/[+\-*&%=<>!?^\/\|]/;function i(r,t,n){return t.tokenize=n,n(r,t)}function o(r,t){var n=t.beforeParams;t.beforeParams=!1;var e=r.next();if((e=='"'||e=="'")&&t.inParams)return i(r,t,m(e));if(/[\[\]{}\(\),;\.]/.test(e))return e=="("&&n?t.inParams=!0:e==")"&&(t.inParams=!1),null;if(/\d/.test(e))return r.eatWhile(/[\w\.]/),"number";if(e=="#")return r.eat("*")?i(r,t,p):e=="#"&&r.match(/ *\[ *\[/)?i(r,t,d):(r.skipToEnd(),"comment");if(e=='"')return r.skipTo(/"/),"comment";if(e=="$")return r.eatWhile(/[$_a-z0-9A-Z\.{:]/),r.eatWhile(/}/),t.beforeParams=!0,"builtin";if(c.test(e))return r.eatWhile(c),"comment";r.eatWhile(/[\w\$_{}\xa1-\uffff]/);var a=r.current().toLowerCase();return f&&f.propertyIsEnumerable(a)?"keyword":u&&u.propertyIsEnumerable(a)?(t.beforeParams=!0,"keyword"):null}function m(r){return function(t,n){for(var e=!1,a,l=!1;(a=t.next())!=null;){if(a==r&&!e){l=!0;break}e=!e&&a=="\\"}return l&&(n.tokenize=o),"string"}}function p(r,t){for(var n=!1,e;e=r.next();){if(e=="#"&&n){t.tokenize=o;break}n=e=="*"}return"comment"}function d(r,t){for(var n=0,e;e=r.next();){if(e=="#"&&n==2){t.tokenize=o;break}e=="]"?n++:e!=" "&&(n=0)}return"meta"}const k={name:"tcl",startState:function(){return{tokenize:o,beforeParams:!1,inParams:!1}},token:function(r,t){return r.eatSpace()?null:t.tokenize(r,t)},languageData:{commentTokens:{line:"#"}}};export{k as t};
