<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language SYSTEM "language.dtd"
[
  <!ENTITY funcname "[A-Za-z_:][A-Za-z0-9_:#&#37;@-]*">
  <!ENTITY varname  "[A-Za-z_][A-Za-z0-9_]*">
  <!ENTITY bos      "^(|.*\s)">			<!-- bol or space following -->
  <!ENTITY eos      "(?=($|\s))">			<!-- eol or space following -->
  <!ENTITY noword   "(?![\w$+-])">		<!-- no word, $, + or - following -->
]>
<language name="Xilinx User Constraints File" version="1.00" kateversion="2.3" section="Hardware" extensions="*.ucf" mimetype="" author="Stefan Endrullis (stefan@endrullis.de)">
  <highlighting>
    <list name="keywords">
      <item> INST </item>
      <item> NET </item>
    </list>
    
    <contexts>
      <!-- start / global environment -->
      <context name="start" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="detectComments" />
        <RegExpr attribute="Keyword" context="netParsed" String="[^\s]+" />
<!--        <keyword attribute="Keyword" context="#stay"  String="keywords"/>
        <Int attribute="Integer" context="#stay" />
        <HlCChar attribute="Bit" context="#stay" />
        <DetectChar attribute="String" context="string" char="&quot;" />
        <AnyChar attribute="Operator" context="#stay" String="[&amp;&gt;&lt;=:+\-*\/|]().,;" />
        <DetectChar attribute="Attribute" context="attribute" char="'" />-->
      </context>
      
      <context name="netParsed" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="detectComments" />
        <RegExpr attribute="Attribute Name" context="attributeNameParsed" String="[^\s]+\s*[=]" />
        <DetectChar attribute="Element Name" context="string Element Name" char="&quot;" />
        <RegExpr attribute="Element Name" context="#stay" char="[^&quot;|\s]+" />
        <DetectChar attribute="Normal Text" context="#pop" char=";" />
      </context>
      <context name="attributeNameParsed" attribute="Alert" lineEndContext="#stay">
        <IncludeRules context="detectComments" />
        <RegExpr attribute="" context="#pop#pop" String="[^\s]+\s*[=]" lookAhead="true" />
        <DetectChar attribute="Attribute Value" context="string Attribute Value" char="&quot;" />
        <DetectChar attribute="Normal Text" context="#pop" char="|" />
        <DetectChar attribute="Normal Text" context="#pop#pop" char=";" />
        <RegExpr attribute="Attribute Value" context="#stay" String="[^\s|;]+" />
      </context>
      
      <!-- detect comments -->
      <context name="detectComments">
        <DetectChar attribute="Comment" context="comment" char="#" />
      </context>
      
      <!-- other environments -->
      <context name="comment" attribute="Comment" lineEndContext="#pop" />
      <context name="string Element Name" attribute="Element Name" lineEndContext="#stay" >
        <DetectChar attribute="Element Name" context="#pop" char="&quot;" />
      </context>
      <context name="string Attribute Value" attribute="Attribute Value" lineEndContext="#stay" >
        <DetectChar attribute="Attribute Value" context="#pop" char="&quot;" />
      </context>
      <context name="string" attribute="Normal Text" lineEndContext="#stay" >
        <DetectChar attribute="Normal Text" context="#pop" char="&quot;" />
      </context>
      <context name="attribute" attribute="Attribute" lineEndContext="#pop">
        <DetectChar attribute="Attribute" context="quot in att" char="&quot;" />
        <DetectChar attribute="Normal Text" context="#pop" char=" " />
        <AnyChar attribute="Attribute" context="#pop" String=")=&lt;&gt;" />
      </context>
      <context name="quot in att" attribute="Attribute" lineEndContext="#stay">
        <DetectChar attribute="Attribute" context="#pop" char="&quot;" />
      </context>
    </contexts>
    <itemDatas>
      <itemData name="Normal Text" defStyleNum="dsNormal" />
      <itemData name="Keyword" defStyleNum="dsKeyword" />
      <itemData name="Comment" defStyleNum="dsComment" />
      <itemData name="Integer" defStyleNum="dsDecVal" />
      <itemData name="Bit" defStyleNum="dsChar" />
      <itemData name="Operator" defStyleNum="dsOthers" />
      <itemData name="Attribute Name" defStyleNum="dsOthers" />
      <itemData name="Attribute Value" defStyleNum="dsString" />
      <itemData name="Element Name" defStyleNum="dsDecVal" />
    </itemDatas>
  </highlighting>
  <general>
    <comments>
      <comment name="singleLine" start="#" />
    </comments>
    <keywords casesensitive="0" />
  </general>
</language>