<?xml version="1.0" encoding="windows-1251"?>
<!--
    Tcl/Tk Base Syntax Highlighting
Created by:
    Andrei Gratchev <angra@intrinsix.com>

    Changes:
        18.04.01 (Andrei Gratchev):
            Namespaces, Variables blocks has rewrited from scratch.
            Added support of Predifined variables.
            Behavior of "slashed" chars has fixed.
            Paired brackets now is working more accurate.
            And many minor changes.
-->
<!DOCTYPE hrc PUBLIC "-//Cail Lomecb//DTD Colorer HRC take5//EN" "../hrc.dtd">
<hrc version="take5" xmlns="http://colorer.sf.net/2003/hrc">
   <type name="tcltk" access="public">

      <import type="def"/>

      <region name="tclString" parent="String"/>
      <region name="tclArrayNm" parent="StringContent"/>
      <region name="tclChar" parent="CharacterContent"/>
      <region name="tclComment" parent="Comment"/>
      <region name="tclSymb" parent="Symbol"/>
      <region name="tclMainSymb" parent="SymbolStrong"/>
      <region name="tclBase" parent="Keyword"/>
      <region name="tclWord" parent="Keyword"/>
      <region name="tclNumb" parent="Number"/>
      <region name="tclVar" parent="Var"/>
      <region name="tclVar2" parent="VarStrong"/>
      <region name="tclFunc" parent="Function"/>
      <region name="tclParam" parent="Parameter"/>
      <region name="tclError" parent="Error"/>


      <scheme name="tcltkBase">
<!-- base syntax -->
         <keywords region="tclBase">
            <word name="break"/>
            <word name="case"/>
            <word name="catch"/>
            <word name="continue"/>
            <word name="for"/>
            <word name="foreach"/>
            <word name="global"/>
            <word name="if"/>
            <word name="else"/>
            <word name="elseif"/>
            <word name="proc"/>
            <word name="return"/>
            <word name="set"/>
            <word name="source"/>
            <word name="switch"/>
            <word name="unset"/>
            <word name="uplevel"/>
            <word name="upvar"/>
            <word name="variable"/>
            <word name="while"/>
            <word name="namespace"/>
         </keywords>
      </scheme>

      <scheme name="tcltkWord">
         <keywords region="tclWord">
<!-- tcl commands -->
            <word name="after"/>
            <word name="append"/>
            <word name="bgerror"/>
            <word name="binary"/>
            <word name="array"/>
            <word name="cd"/>
            <word name="clock"/>
            <word name="close"/>
            <word name="concat"/>
            <word name="eof"/>
            <word name="error"/>
            <word name="eval"/>
            <word name="exec"/>
            <word name="exit"/>
            <word name="expr"/>
            <word name="fblocked"/>
            <word name="fcopy"/>
            <word name="fconfigure"/>
            <word name="file"/>
            <word name="fileevent"/>
            <word name="filename"/>
            <word name="flush"/>
            <word name="format"/>
            <word name="gets"/>
            <word name="glob"/>
            <word name="history"/>
            <word name="incr"/>
            <word name="info"/>
            <word name="interp"/>
            <word name="join"/>
            <word name="lappend"/>
            <word name="library"/>
            <word name="lindex"/>
            <word name="linsert"/>
            <word name="list"/>
            <word name="llength"/>
            <word name="load"/>
            <word name="lrange"/>
            <word name="lreplace"/>
            <word name="lsearch"/>
            <word name="lsort"/>
            <word name="vwait"/>
            <word name="open"/>
            <word name="package"/>
            <word name="pid"/>
            <word name="pkg_mkindex"/>
            <word name="puts"/>
            <word name="pwd"/>
            <word name="read"/>
            <word name="regexp"/>
            <word name="regsub"/>
            <word name="rename"/>
            <word name="resource"/>
            <word name="scan"/>
            <word name="seek"/>
            <word name="socket"/>
            <word name="split"/>
            <word name="string"/>
            <word name="subst"/>
            <word name="tell"/>
            <word name="time"/>
            <word name="trace"/>
            <word name="update"/>
<!-- tk commands -->
            <word name="bell"/>
            <word name="bind"/>
            <word name="bindtags"/>
            <word name="bitmap"/>
            <word name="button"/>
            <word name="canvas"/>
            <word name="checkbutton"/>
            <word name="clipboard"/>
            <word name="destroy"/>
            <word name="entry"/>
            <word name="event"/>
            <word name="focus"/>
            <word name="font"/>
            <word name="frame"/>
            <word name="grab"/>
            <word name="grid"/>
            <word name="image"/>
            <word name="label"/>
            <word name="listbox"/>
            <word name="lower"/>
            <word name="menu"/>
            <word name="menubutton"/>
            <word name="message"/>
            <word name="option"/>
            <word name="pack"/>
            <word name="pack-old"/>
            <word name="photo"/>
            <word name="place"/>
            <word name="raise"/>
            <word name="radiobutton"/>
            <word name="scale"/>
            <word name="scrollbar"/>
            <word name="selection"/>
            <word name="send"/>
            <word name="text"/>
            <word name="tk_menuBar"/>
            <word name="tk_bindForTraversal"/>
            <word name="tk_bisque"/>
            <word name="tk_setPalette"/>
            <word name="tk_chooseColor"/>
            <word name="tk_dialog"/>
            <word name="tk_focusFollowsMouse"/>
            <word name="tk_focusNext"/>
            <word name="tk_focusPrev"/>
            <word name="tk_getOpenFile"/>
            <word name="tk_getSaveFile"/>
            <word name="tk_messageBox"/>
            <word name="tk_optionMenu"/>
            <word name="tk_popup"/>
            <word name="tkerror"/>
            <word name="tkwait"/>
            <word name="toplevel"/>
            <word name="winfo"/>
            <word name="wm"/>
         </keywords>
      </scheme>

      <scheme name="tcltkPairedBrackets">
<!-- Paired block -->
         <block start="/(\{)/" end="/(\})/" scheme="tcltkPairedBrackets" region00="tclMainSymb" region01="PairStart" region10="tclMainSymb" region11="PairEnd"/>
         <block start="/(\()/" end="/(\))/" scheme="tcltkPairedBrackets" region00="tclSymb" region01="PairStart" region10="tclSymb" region11="PairEnd"/>
         <block start="/(\[)/" end="/(\])/" scheme="tcltkPairedBrackets" region00="tclMainSymb" region01="PairStart" region10="tclMainSymb" region11="PairEnd"/>
      </scheme>

      <scheme name="tcltkPredefinedVar">
         <regexp match="/(\$|\s?#1)(::)?(errorCode|errorInfo|tcl_library|                           tcl_patchLevel|tcl_pkgPath|tcl_precision|                           tcl_rcFileName|tcl_traceExec|tcl_version|                           tcl_rcRsrcName|tcl_traceCompile|                           tk_library|tk_patchLevel|                           tk_strictMotif|tk_version)\b/x" region0="tclVar2" region2="tclMainSymb" region3="tclVar2"/>
<!-- Following variables has array type and needs
        the special handling -->
         <block start="/(\$|\s?#1)(::)?(env|tcl_platform)(?{PairStart}\()/" end="/(?{PairEnd}\))|$/" scheme="tcltkString" priority="low" region="tclArrayNm" region00="tclSymb" region01="tclVar2" region02="tclMainSymb" region03="tclVar2" region10="tclSymb"/>
      </scheme>

      <scheme name="tcltkSymbol">
<!-- operators -->
         <keywords region="tclSymb">
            <symb name="="/>
            <symb name="/"/>
            <symb name="&amp;"/>
            <symb name="|"/>
            <symb name="&gt;"/>
            <symb name="%"/>
            <symb name="~"/>
            <symb name="^"/>
            <symb name="&lt;"/>
            <symb name="+"/>
            <symb name="-"/>
            <symb name="*"/>
            <symb name=","/>
            <symb name="\"/>
            <symb name="!"/>
            <symb name=";"/>
            <word name="::" region="tclMainSymb"/>
         </keywords>
      </scheme>

      <scheme name="tcltkError">
         <keywords region="tclError">
            <symb name="("/>
            <symb name=")"/>
            <symb name="{"/>
            <symb name="}"/>
            <symb name="["/>
            <symb name="]"/>
         </keywords>
      </scheme>

      <scheme name="tcltkNamespace">
         <inherit scheme="tcltkPredefinedVar"/>
         <block start="/\$(\{)/" end="/(\})|$/" scheme="empty" region="tclVar2" region00="tclVar2" region01="tclSymb" region11="tclSymb"/>
         <block start="/(::)?[\w]*((\())\m/" end="/(\))|$/" scheme="tcltkString" region="tclArrayNm" region01="tclMainSymb" region02="PairStart" region03="tclSymb" region10="tclSymb" region11="PairEnd"/>
         <regexp match="/(::)[\w]*/" region1="tclMainSymb"/>
      </scheme>

      <scheme name="tcltkVar">
         <inherit scheme="tcltkPredefinedVar"/>
         <block start="/\$(\{)/" end="/(\})|$/" scheme="empty" region="tclVar2" region00="tclVar2" region01="tclSymb" region11="tclSymb"/>
         <block start="/(\$)(::)?([\w]*)(\()/" end="/(\))|$/" scheme="tcltkString" priority="low" region="tclArrayNm" region00="tclSymb" region01="tclVar" region02="tclMainSymb" region03="tclVar" region04="PairStart" region10="tclSymb" region11="PairEnd"/>
         <block start="/\$(::)?[\w]*/" end="/\M([^\w]|$)/" scheme="tcltkNamespace" region="tclVar" region00="tclVar" region01="tclMainSymb"/>
      </scheme>

      <scheme name="tcltkNumb">
         <inherit scheme="CHexNumber"/>
         <regexp match="/\b(0[xX])/" region0="tclError"/>
         <inherit scheme="FloatNumber"/>
         <inherit scheme="DecNumber"/>
      </scheme>

      <scheme name="tcltkSpec">
<!-- Special characters -->
         <regexp match="/(\\x[\da-fA-F]{1,2})\M([^\da-fA-F]|$) | \\x([\da-fA-F]*)?[\da-fA-F]{2}/x" region2="tclChar" region4="tclChar" region5="tclError"/>
         <regexp match="/\\[\d]{1,3}/" region0="tclChar"/>
         <regexp match="/\\\s+$/" region0="tclError"/>
         <regexp match="/\\./" region0="tclChar"/>
      </scheme>

      <scheme name="tcltk">
<!-- Variables -->
         <inherit scheme="tcltkVar"/>
<!-- Numbers -->
         <inherit scheme="tcltkNumb"/>
<!-- Strings -->
         <block start="/&#34;/" end="/&#34;/" scheme="tcltkString" priority="low" region="tclString" region00="PairStart" region10="PairEnd"/>
<!-- Linear comments -->
         <block start="/\#/" end="/([^\\]?#1$)|([\\]\s+$)/" scheme="Comment" region="tclComment" region12="tclError"/>
<!-- paired block for matching -->
         <inherit scheme="tcltkPairedBrackets">
            <virtual scheme="tcltkPairedBrackets" subst-scheme="tcltk"/>
         </inherit>
<!-- Functions -->
         <block start="/^\s*\M(proc)\s+/" end="/(proc\s+[\w:\$]+\m\s+(([\w]+)|([&#34;\{]?=)))|(\m[&#34;\{].*?$)?=|$/" scheme="tcltkNamespace" region="tclFunc" region01="tclBase" region13="tclVar" region14="tclMainSymb"/>
<!-- !!! Selects some user defined functions as type function in text !!! -->
<!-- You could enable this and disable next two blocks if you like -->
<!--
   <block start="/\M(::)?[\w]+?(::)[\w]+?/" end="/([\]};]?=)|(([^\w]?=)|$)/"
          scheme="tcltkNamespace" region="tclFunc"/>
   <block start="/\M(::)[\w]+?/" end="/([\]};]?=)|(([^\w]?=)|$)/"
          scheme="tcltkNamespace" region="tclFunc"/>
   -->
         <block start="/\M(::)?[\w]+?(::)[\w]*?/" end="/([\]\};]?=)|(([^\w]?=)|$)/" scheme="tcltkNamespace"/>
         <block start="/\M(::)[\w]+?/" end="/([\]\};]?=)|(([^\w]?=)|$)/" scheme="tcltkNamespace"/>
<!-- Namespace definition -->
         <block start="/\M(namespace)\s+(eval)\s+/" end="/((namespace)\s+(eval)\s+[\w:\$]+\m\s+[&#34;\{]?=)|(\m[&#34;\{].*?$)?=|$/" scheme="tcltkNamespace" region="tclFunc" region01="tclBase" region02="tclWord"/>
<!-- Specials -->
         <block start="/(^|;?#1|\{?#1|\[?#1)\s*(set|variable)\s+\M(::)?[\w]/" end="/([\]};]?=)|(([^\w\(\$]?=)|$)/" scheme="tcltkNamespace" region="tclVar" region02="tclBase"/>
         <block start="/(^|;?#1|\{?#1|\[?#1)\s*(append|lappend|incr)\s+\M(::)?[\w]/" end="/([\]};]?=)|(([^\w\(\$]?=)|$)/" scheme="tcltkNamespace" region="tclVar" region02="tclWord"/>
         <block start="/(^|;?#1|\{?#1|\[?#1)\s*(unset|global)\s+\M(::)?[\w]/" end="/([\]};]?=)|$/" scheme="tcltkNamespace" region="tclVar" region02="tclBase"/>
         <block start="/(^|;?#1|\{?#1|\[?#1)\s*(upvar)(\s+((\\?\#)?([\d]+|\$[\w]+)))?\s+/" end="/\M([;\]}])|$/" scheme="tcltkNamespace" region="tclVar" region02="tclBase" region03="tclNumb" region06="tclVar"/>
         <block start="/(^|;?#1|\{?#1|\[?#1)\s*(uplevel)(\s+((\\?\#)?([\d]+|\$[\w]+)))?/" end="/([;\]}])?=|$/" scheme="tcltk" priority="low" region02="tclBase" region03="tclNumb" region06="tclVar"/>
         <regexp match="/(^|;?#1|\{?#1|\[?#1)\s*(foreach)\s+(([\w]+)|([&#34;\{]?=))/" region0="tclVar" region2="tclBase"/>
         <regexp match="/\b((\s-)?#2[\w]+)/" region1="tclParam"/>
         <inherit scheme="tcltkSpec"/>
         <inherit scheme="tcltkBase"/>
         <inherit scheme="tcltkWord"/>
         <inherit scheme="tcltkSymbol"/>
         <inherit scheme="tcltkError"/>
      </scheme>

      <scheme name="tcltkString">
<!-- override comments -->
         <keywords region="tclString">
            <symb name="#"/>
         </keywords>
         <inherit scheme="tcltkVar"/>
<!-- !!! Additional parsing in srings !!! -->
         <block start="/(\[)/" end="/(\])/" scheme="tcltk" priority="low" region00="PairStart" region10="PairEnd" region01="tclMainSymb" region11="tclMainSymb"/>
         <inherit scheme="tcltkNumb"/>
         <inherit scheme="tcltkSpec"/>
<!-- inherit scheme="tcltkBase"/-->
<!-- inherit scheme="tcltkWord"/-->
<!-- inherit scheme="tcltkSymbol"/-->
<!-- inherit scheme="tcltkError"/-->
      </scheme>

   </type>
</hrc>
