packages feed

skylighting-core-0.13.1: xml/vhdl.xml

<?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 identifier "\b(?:[A-Za-z_][A-Za-z0-9_]*)\b|/(?:[^/]++(?://)?+)*+/">
  <!ENTITY bos      "\b">                        <!-- bol or space following -->
]>
<language name="VHDL" version="15" kateversion="5.62" section="Hardware" extensions="*.vhdl;*.vhd" mimetype="text/x-vhdl" author="Rocky Scaletta (rocky@purdue.edu), Stefan Endrullis (stefan@endrullis.de), Florent Ouchet (outchy@users.sourceforge.net), Chris Higgs (chiggs.99@gmail.com), Jan Michel (jan@mueschelsoft.de), Luigi Calligaris (luigi.calligaris@stfc.ac.uk)">
  <!-- BNF: https://github.com/antlr/grammars-v4/blob/master/vhdl/vhdl.g4 -->
  <highlighting>
    <list name="keywordsToplevel">
      <item>file</item>
      <item>library</item>
      <item>use</item>
      <item>with</item>
    </list>

    <list name="keywords">
      <item>access</item>
      <item>after</item>
      <item>alias</item>
      <item>all</item>
      <item>array</item>
      <item>assert</item>
      <item>assume</item>
      <item>assume_guarantee</item>
      <item>attribute</item>
      <item>begin</item>
      <item>block</item>
      <item>body</item>
      <item>bus</item>
      <item>case</item>
      <item>component</item>
      <item>constant</item>
      <item>context</item>
      <item>cover</item>
      <item>default</item>
      <item>disconnect</item>
      <item>downto</item>
      <item>else</item>
      <item>elsif</item>
      <item>end</item>
      <item>fairness</item>
      <item>falling_edge</item>
      <item>file</item>
      <item>for</item>
      <item>force</item>
      <item>function</item>
      <item>generate</item>
      <item>generic</item>
      <item>group</item>
      <item>guarded</item>
      <item>if</item>
      <item>impure</item>
      <item>inertial</item>
      <item>is</item>
      <item>label</item>
      <item>linkage</item>
      <item>literal</item>
      <item>map</item>
      <item>new</item>
      <item>null</item>
      <item>of</item>
      <item>on</item>
      <item>open</item>
      <item>others</item>
      <item>parameter</item>
      <item>port</item>
      <item>postponed</item>
      <item>procedure</item>
      <item>process</item>
      <item>property</item>
      <item>protected</item>
      <item>pure</item>
      <item>range</item>
      <item>record</item>
      <item>register</item>
      <item>reject</item>
      <item>release</item>
      <item>report</item>
      <item>rising_edge</item>
      <item>select</item>
      <item>sequence</item>
      <item>severity</item>
      <item>signal</item>
      <item>shared</item>
      <item>strong</item>
      <item>subtype</item>
      <item>then</item>
      <item>to</item>
      <item>transport</item>
      <item>type</item>
      <item>unaffected</item>
      <item>units</item>
      <item>until</item>
      <item>variable</item>
      <item>vmode</item>
      <item>vprop</item>
      <item>vunit</item>
      <item>wait</item>
      <item>when</item>
      <item>with</item>
      <item>note</item>
      <item>warning</item>
      <item>error</item>
      <item>failure</item>
      <item>in</item>
      <item>inout</item>
      <item>out</item>
      <item>buffer</item>
      <item>and</item>
      <item>abs</item>
      <item>or</item>
      <item>xor</item>
      <item>xnor</item>
      <item>not</item>
      <item>mod</item>
      <item>nand</item>
      <item>nor</item>
      <item>rem</item>
      <item>rol</item>
      <item>ror</item>
      <item>sla</item>
      <item>sra</item>
      <item>sll</item>
      <item>srl</item>
    </list>

    <list name="controls">
      <item>exit</item>
      <item>next</item>
      <item>return</item>
    </list>

    <list name="signals">
      <item>signal</item>
      <item>variable</item>
      <item>constant</item>
      <item>type</item>
      <item>attribute</item>
    </list>

    <list name="range">
      <item>to</item>
      <item>downto</item>
      <item>others</item>
    </list>

    <list name="timeunits">
      <item>fs</item>
      <item>ps</item>
      <item>ns</item>
      <item>us</item>
      <item>ms</item>
      <item>sec</item>
      <item>min</item>
      <item>hr</item>
    </list>


    <list name="types">
      <item>bit</item>
      <item>bit_vector</item>
      <item>character</item>
      <item>boolean</item>
      <item>boolean_vector</item>
      <item>integer</item>
      <item>integer_vector</item>
      <item>real</item>
      <item>real_vector</item>
      <item>time</item>
      <item>time_vector</item>
      <item>delay_length</item>
      <item>string</item>
      <item>severity_level</item>
      <item>positive</item>
      <item>natural</item>
      <item>file_open_kind</item>
      <item>file_open_status</item>
      <item>signed</item>
      <item>unsigned</item>
      <item>unresolved_unsigned</item>
      <item>unresolved_signed</item>
      <item>line</item>
      <item>text</item>
      <item>side</item>
      <item>width</item>
      <item>std_logic</item>
      <item>std_logic_vector</item>
      <item>std_ulogic</item>
      <item>std_ulogic_vector</item>
      <item>x01</item>
      <item>x01z</item>
      <item>ux01</item>
      <item>ux01z</item>
      <item>qsim_state</item>
      <item>qsim_state_vector</item>
      <item>qsim_12state</item>
      <item>qsim_12state_vector</item>
      <item>qsim_strength</item>
      <item>mux_bit</item>
      <item>mux_vector</item>
      <item>reg_bit</item>
      <item>reg_vector</item>
      <item>wor_bit</item>
      <item>wor_vector</item>
    </list>


    <contexts>

<!-- start / global environment -->
      <context name="start" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preDeclaration"/>

        <WordDetect attribute="Control" context="entity" insensitive="1" String="entity"/>
        <WordDetect attribute="Control" context="configuration" insensitive="1" String="configuration"/>
        <WordDetect attribute="Control" context="architecture" insensitive="1" String="architecture"/>
        <WordDetect attribute="Control" context="package" insensitive="1" String="package"/>

        <keyword attribute="Keyword" context="#stay" String="keywordsToplevel"/>

        <IncludeRules context="postDeclaration"/>
      </context>


      <context name="package" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="#pop">
        <IncludeRules context="blank"/>
        <WordDetect attribute="Control" context="#pop!packagebody" insensitive="true" String="body"/>
        <RegExpr attribute="Name" context="package_main" beginRegion="PackageRegion1"
                 String="(&identifier;)"/>
      </context>

      <context name="package_main" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="package_decl">
        <RegExpr attribute="Control" context="#pop#pop" dynamic="1" insensitive="1"
                 String="&bos;end(\s+package\b)?(\s+%1)?\s*;" endRegion="PackageRegion1"/>
        <WordDetect attribute="Error" context="#pop#pop!expressionError" insensitive="true"
                    String="end" endRegion="PackageRegion1"/>
      </context>

      <context name="package_decl" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preDeclaration"/>
        <WordDetect attribute="Control" context="#pop" insensitive="true" String="end" lookAhead="1"/>
        <IncludeRules context="postDeclaration"/>
      </context>

      <!-- package body environment -->

      <context name="packagebody" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="#pop">
        <IncludeRules context="blank"/>
        <RegExpr attribute="Name" context="packagebody_main" beginRegion="PackageBodyRegion1"
                 String="(&identifier;)"/>
      </context>

      <context name="packagebody_main" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="package_decl">
        <RegExpr attribute="Control" context="#pop#pop" dynamic="1" insensitive="1"
                 String="&bos;end(\s+package\s+body\b)?(\s+%1)?\s*;" endRegion="PackageBodyRegion1"/>
        <WordDetect attribute="Error" context="#pop#pop!expressionError" insensitive="true"
                    String="end" endRegion="PackageBodyRegion1"/>
      </context>

<!--====ARCHITECTURE ===============-->
      <context name="architecture" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="blank"/>
        <RegExpr attribute="Name" context="arch_of" beginRegion="ArchitectureRegion1"
                 String="(&identifier;)"/>
      </context>

      <context name="arch_of" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="arch_decl">
        <IncludeRules context="blank"/>
        <WordDetect attribute="Keyword" context="arch_ref" insensitive="1" String="of"/>
        <RegExpr attribute="Control" context="#pop#pop" insensitive="1" dynamic="1"
                 String="&bos;end(\s+architecture\b)?(\s+%1)?\s*;" endRegion="ArchitectureRegion1"/>
        <WordDetect attribute="Error" context="#pop#pop!expressionError" insensitive="1"
                    String="end" endRegion="ArchitectureRegion1"/>
      </context>

      <context name="arch_ref" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="#pop!arch_decl">
        <IncludeRules context="blank"/>
        <WordDetect attribute="Keyword" context="#pop!arch_decl" insensitive="1" String="is" />
        <RegExpr attribute="Reference" context="#pop!arch_decl" String="&identifier;"/>
      </context>

      <context name="arch_decl" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preDeclaration"/>
        <WordDetect attribute="Control" context="#pop!parallel_stmt" insensitive="true" String="begin"/>
        <WordDetect attribute="Control" context="#pop" insensitive="true" String="end" lookAhead="1"/>
        <IncludeRules context="postDeclaration"/>
      </context>

<!--====if ===============-->
      <context name="if_start" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="if_expr">
        <RegExpr attribute="Control" context="#pop" insensitive="true" endRegion="IfRegion1"
                 String="&bos;end\s+if(\s+&varname;)?\s*;"/>
        <WordDetect attribute="Error" context="#pop!expressionError" insensitive="true"
                    String="end" endRegion="IfRegion1"/>
      </context>

      <context name="if_expr" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preExpression"/>
        <WordDetect attribute="Control" context="#pop" insensitive="true" String="end" lookAhead="1"/>
        <WordDetect attribute="Control" context="if_body" insensitive="true" String="then"/>
        <IncludeRules context="postExpression"/>
      </context>

      <context name="if_body" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="sequential_stmt_decl">
        <IncludeRules context="blank"/>
        <WordDetect attribute="Control" context="#pop#pop" insensitive="true" String="end" lookAhead="1"/>
        <WordDetect attribute="Control" context="#pop" insensitive="true" String="elsif"/>
        <WordDetect attribute="Control" context="#pop#pop!sequential_stmt" insensitive="true" String="else"/>
        <IncludeRules context="sequentialStatementKw"/>
        <IncludeRules context="label"/>
      </context>

<!--====case ===============-->
      <context name="case" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preExpression"/>
        <WordDetect attribute="Keyword" context="#pop!case_stmt" insensitive="true" String="is"/>
        <IncludeRules context="postExpression"/>
      </context>

      <context name="case_stmt" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="case_when">
        <RegExpr attribute="Control" context="#pop" insensitive="true" endRegion="CaseRegion1"
                 String="&bos;end\s+case(\s+&varname;)?\s*;"/>
        <WordDetect attribute="Error" context="#pop!expressionError" insensitive="true"
                    String="end" endRegion="CaseRegion1"/>
      </context>

      <context name="case_when" attribute="Normal Text" lineEndContext="#stay">
        <Detect2Chars char="=" char1="&gt;" attribute="Operator" context="case_when2" beginRegion="CaseWhenRegion1"/>
        <IncludeRules context="preExpression"/>
        <WordDetect attribute="Control" insensitive="true" String="when" context="case_when_name"/>
        <IncludeRules context="postExpression"/>
      </context>

      <context name="case_when2" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="sequential_stmt_decl">
        <IncludeRules context="blank"/>
        <WordDetect attribute="Control" context="#pop!case_when_name" insensitive="true" String="when" endRegion="CaseWhenRegion1"/>
        <WordDetect attribute="Control" context="#pop#pop" insensitive="true" String="end" lookAhead="1" endRegion="CaseWhenRegion1"/>
        <IncludeRules context="sequentialStatementKw"/>
        <IncludeRules context="label"/>
      </context>

      <context name="case_when_name" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="#pop">
        <IncludeRules context="blank"/>
        <DetectIdentifier attribute="Name" context="#pop"/>
      </context>
      <!-- 'when' and 'end case' are checked at the beginning of the line for better code folding -->

<!--====while ===============-->
      <context name="while" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preExpression"/>
        <WordDetect attribute="Control" context="#pop!loop" insensitive="true" String="loop" beginRegion="LoopRegion1"/>
        <IncludeRules context="postExpression"/>
      </context>

<!--====loop ===============-->
      <context name="loop" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="sequential_stmt">
        <RegExpr attribute="Control" context="#pop" insensitive="true" endRegion="LoopRegion1"
                 String="&bos;end\s+loop(\s+&varname;)?\s*;"/>
        <WordDetect attribute="Error" context="#pop!expressionError" insensitive="true"
                    String="end" endRegion="LoopRegion1"/>
      </context>

<!--====declare ===============-->
      <context name="declare" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preExpression"/>
        <WordDetect attribute="Keyword" context="#pop!declare_begin" insensitive="true"
                    String="begin"/>
        <keyword attribute="Signal" context="signal" String="signals"/>
        <IncludeRules context="postExpression"/>
      </context>

      <context name="declare_begin" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="sequential_stmt">
        <RegExpr attribute="Keyword" context="#pop" insensitive="true" endRegion="DeclareRegion1"
                 String="&bos;end(\s+declare)?\s*;"/>
        <WordDetect attribute="Error" context="#pop!expressionError" insensitive="true"
                    String="end" endRegion="DeclareRegion1"/>
      </context>


<!--====ENTITY ===============-->
<!-- entity environment -->
      <context name="entity" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="#pop">
        <IncludeRules context="blank"/>
        <RegExpr attribute="Name" context="entity_main" beginRegion="EntityRegion1"
                 String="(&identifier;)"/>
      </context>

      <context name="entity_main" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="entity_decl">
        <RegExpr attribute="Control" context="#pop#pop" dynamic="1" insensitive="1"
                 String="&bos;end(\s+entity\b)?(\s+%1)?\s*;" endRegion="EntityRegion1"/>
        <WordDetect attribute="Error" context="#pop#pop!expressionError" insensitive="true"
                    String="end" endRegion="EntityRegion1"/>
      </context>

      <context name="entity_decl" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preDeclaration"/>
        <WordDetect attribute="Control" context="#stay" insensitive="true" String="generic"/>
        <WordDetect attribute="Control" context="#stay" insensitive="true" String="port"/>
        <WordDetect attribute="Keyword" context="#pop!parallel_stmt" insensitive="true" String="begin"/>
        <WordDetect attribute="Control" context="#pop" insensitive="true" String="end" lookAhead="1"/>
        <IncludeRules context="postDeclaration"/>
      </context>

<!--====Configuration ===============-->
<!-- configuration environment -->
      <context name="configuration" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="#pop">
        <IncludeRules context="blank"/>
        <RegExpr attribute="Name" context="conf_of" beginRegion="ConfigurationRegion1"
                 String="(&identifier;)"/>
      </context>

      <context name="conf_of" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="conf_is">
        <IncludeRules context="blank"/>
        <WordDetect attribute="Keyword" context="conf_ref" insensitive="1" String="of"/>
        <RegExpr attribute="Control" context="#pop#pop" insensitive="1" dynamic="1"
                 String="&bos;end(\s+configuration\b)?(\s+%1)?\s*;" endRegion="ConfigurationRegion1"/>
        <WordDetect attribute="Error" context="#pop#pop!expressionError" insensitive="1"
                    String="end" endRegion="ConfigurationRegion1"/>
      </context>

      <context name="conf_ref" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="#pop!conf_decl">
        <IncludeRules context="blank"/>
        <WordDetect attribute="Keyword" context="#pop!conf_decl" insensitive="1" String="is" />
        <RegExpr attribute="Reference" context="#pop!conf_is" String="&identifier;"/>
      </context>

      <context name="conf_is" attribute="Control" lineEndContext="#stay" fallthroughContext="#pop#pop#pop">
        <IncludeRules context="blank"/>
        <WordDetect attribute="Keyword" context="#pop!conf_decl" insensitive="1" String="is" />
      </context>

      <context name="conf_decl" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preDeclaration"/>
        <WordDetect attribute="Control" context="conf_for" insensitive="1" String="for"/>
        <WordDetect attribute="Control" context="#pop" insensitive="1" lookAhead="1" String="end"/>
        <IncludeRules context="postDeclaration"/>
      </context>

      <context name="conf_for" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preDeclaration"/>
        <WordDetect attribute="Control" context="conf_for" insensitive="1" String="for"/>
        <WordDetect attribute="Control" context="conf_for_end" insensitive="1" lookAhead="1" String="end"/>
        <IncludeRules context="postDeclaration"/>
      </context>

      <context name="conf_for_end" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="#pop#pop!expressionError">
        <RegExpr attribute="Control" context="#pop#pop" insensitive="true"  String="&bos;end(\s+for\b)?\s*;"/>
      </context>


<!--====Basic Stuff ===============-->
<!-- comment and spaces -->
      <context name="blank" attribute="Normal Text" lineEndContext="#stay">
        <DetectSpaces attribute="Normal Text" context="#stay"/>
        <Detect2Chars attribute="Comment" context="comment" char="-" char1="-"/>
      </context>

<!-- declaration -->
      <context name="preDeclaration" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="blank"/>
        <AnyChar attribute="Operator" context="#stay" String="[&amp;&gt;&lt;=:+-*/|`].,"/>
        <DetectChar attribute="Vector" context="string" char="&quot;"/>
        <DetectChar attribute="Attribute" context="attribute" char="'"/>
        <Int attribute="Integer" context="#stay"/>
      </context>

      <!-- must be synchronized with postDeclaration_pop_semi -->
      <context name="postDeclaration" attribute="Normal Text" lineEndContext="#stay">
        <WordDetect attribute="Signal" context="type" insensitive="1" String="type"/>
        <WordDetect attribute="Redirection" context="function" insensitive="1" String="function"/>
        <WordDetect attribute="Keyword" context="procedure" insensitive="1" String="procedure" beginRegion="ProcedureRegion1"/>
        <WordDetect attribute="Control" context="component" insensitive="1" String="component"/>
        <keyword attribute="Data Type" context="#stay" String="types"/>
        <keyword attribute="Data Type" context="#stay" String="timeunits"/>
        <keyword attribute="Signal" context="signal" String="signals"/>
        <keyword attribute="Range" context="#stay" String="range"/>
        <keyword attribute="Keyword" context="#stay" String="keywords"/>
        <keyword attribute="Control" context="#stay" String="controls"/>
        <DetectIdentifier attribute="Normal Text"/>
      </context>

      <!-- same as postDeclaration, but pops a context when ; is found -->
      <context name="postDeclaration_pop_semi" attribute="Normal Text" lineEndContext="#stay">
        <WordDetect attribute="Signal" context="#pop!type" insensitive="1" String="type"/>
        <WordDetect attribute="Redirection" context="#pop!function" insensitive="1" String="function"/>
        <WordDetect attribute="Keyword" context="#pop!procedure" insensitive="1" String="procedure" beginRegion="ProcedureRegion1"/>
        <WordDetect attribute="Control" context="#pop!component" insensitive="1" String="component"/>
        <keyword attribute="Data Type" context="#stay" String="types"/>
        <keyword attribute="Data Type" context="#stay" String="timeunits"/>
        <keyword attribute="Signal" context="#pop!signal" String="signals"/>
        <keyword attribute="Range" context="#stay" String="range"/>
        <keyword attribute="Keyword" context="#stay" String="keywords"/>
        <keyword attribute="Control" context="#stay" String="controls"/>
        <DetectIdentifier attribute="Normal Text"/>
      </context>

<!-- label -->
      <context name="label" attribute="Normal Text" lineEndContext="#stay">
        <RegExpr attribute="Name" context="after_label" String="\b(?!(process|constant|signal|variable)\b)&varname;(?=\s*:(?!=))"/>
      </context>

      <context name="after_label" attribute="Normal Text" lineEndContext="#stay">
        <DetectChar attribute="Operator" context="#pop!instantiation_statement" char=":"/>
        <DetectSpaces attribute="Normal Text"/>
      </context>

      <context name="instantiation_statement" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="#pop">
        <IncludeRules context="blank"/>
        <WordDetect attribute="Keyword" context="#pop!instance" insensitive="1" String="component"/>
        <WordDetect attribute="Keyword" context="#pop!instance" insensitive="1" String="entity"/>
        <WordDetect attribute="Keyword" context="#pop!instance" insensitive="1" String="configuration"/>
        <WordDetect attribute="Control" context="#pop!generate" insensitive="1" String="if"/>
        <WordDetect attribute="Control" context="#pop!generate" insensitive="1" String="for"/>
        <WordDetect attribute="Control" context="#pop!block" insensitive="1" String="block" beginRegion="BlockRegion1"/>
        <WordDetect attribute="Process" context="#pop!process" insensitive="1" String="process" beginRegion="ProcessRegion1"/>
        <WordDetect attribute="Keyword" context="#stay" insensitive="1" String="postponed"/>
        <IncludeRules context="reference"/>
      </context>

<!-- parallel statement -->
      <context name="parallel_stmt" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="parallel_stmt_decl">
        <IncludeRules context="blank"/>
        <WordDetect attribute="Control" context="#pop" insensitive="true" String="end" lookAhead="1"/>
        <IncludeRules context="parallelStatementKw"/>
        <IncludeRules context="label"/>
      </context>

      <context name="parallelStatementKw" attribute="Normal Text" lineEndContext="#stay">
        <WordDetect attribute="Control" context="if_start" insensitive="1" String="if" beginRegion="IfRegion1"/>
        <WordDetect attribute="Control" context="while" insensitive="1" String="for"/>
        <WordDetect attribute="Control" context="while" insensitive="1" String="while"/>
        <WordDetect attribute="Control" context="block" insensitive="1" String="block" beginRegion="BlockRegion1"/>
        <WordDetect attribute="Process" context="process" insensitive="1" String="process" beginRegion="ProcessRegion1"/>
        <WordDetect attribute="Keyword" context="#stay" insensitive="1" String="postponed"/>
      </context>

      <context name="parallel_stmt_decl" attribute="Normal Text" lineEndContext="#stay">
        <DetectChar attribute="Normal Text" context="#pop" char=";"/>
        <IncludeRules context="preDeclaration"/>
        <WordDetect attribute="Keyword" context="#stay" insensitive="true" String="generic"/>
        <WordDetect attribute="Keyword" context="#stay" insensitive="true" String="port"/>
        <WordDetect attribute="Keyword" context="#stay" insensitive="true" String="map"/>
        <IncludeRules context="postDeclaration_pop_semi"/>
      </context>

<!-- sequential statement -->
      <context name="sequential_stmt" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="sequential_stmt_decl">
        <IncludeRules context="blank"/>
        <WordDetect attribute="Control" context="#pop" insensitive="true" String="end" lookAhead="1"/>
        <IncludeRules context="sequentialStatementKw"/>
        <IncludeRules context="label"/>
      </context>

      <context name="sequentialStatementKw" attribute="Normal Text" lineEndContext="#stay">
        <WordDetect attribute="Control" context="if_start" insensitive="1" String="if" beginRegion="IfRegion1"/>
        <WordDetect attribute="Control" context="case" insensitive="1" String="case" beginRegion="CaseRegion1"/>
        <WordDetect attribute="Control" context="while" insensitive="1" String="for"/>
        <WordDetect attribute="Control" context="while" insensitive="1" String="while"/>
        <WordDetect attribute="Control" context="loop" insensitive="1" String="loop" beginRegion="LoopRegion1"/>
        <WordDetect attribute="Keyword" context="declare" insensitive="1" String="declare" beginRegion="DeclareRegion1"/>
      </context>

      <context name="sequential_stmt_decl" attribute="Normal Text" lineEndContext="#stay">
        <DetectChar attribute="Normal Text" context="#pop" char=";"/>
        <IncludeRules context="preDeclaration"/>
        <IncludeRules context="postDeclaration_pop_semi"/>
      </context>

<!-- if/for generate -->
      <context name="generate" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preExpression"/>
        <WordDetect attribute="Control" context="generate_decl" insensitive="1" String="generate" beginRegion="GenerateRegion1"/>
        <!-- label: for ... loop -->
        <WordDetect attribute="Control" context="#pop!loop" insensitive="1" String="loop" beginRegion="LoopRegion1"/>
        <IncludeRules context="postExpression"/>
      </context>

      <context name="generate_decl" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="generate_stmt">
        <RegExpr attribute="Control" context="generate_els" insensitive="1"
                 String="&bos;end\s*;"/>
        <RegExpr attribute="Control" context="#pop#pop" insensitive="1"
                 String="&bos;end(\s+generate\b)?(\s+&varname;)?\s*;" endRegion="GenerateRegion1"/>
        <WordDetect attribute="Error" context="#pop#pop!expressionError" insensitive="true"
                    String="end" endRegion="GenerateRegion1"/>
      </context>

      <context name="generate_els" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="#pop">
        <IncludeRules context="blank"/>
        <WordDetect attribute="Control" context="#pop!generate_stmt_els" insensitive="1" String="elsif"/>
        <WordDetect attribute="Control" context="#pop!generate_stmt_els" insensitive="1" String="else"/>
      </context>

      <context name="generate_stmt" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="sequential_stmt_decl">
        <IncludeRules context="preDeclaration"/>
        <WordDetect attribute="Control" context="#pop" insensitive="1" String="end" lookAhead="1"/>
        <WordDetect attribute="Control" context="#pop!generate_body" insensitive="1" String="begin"/>
        <WordDetect attribute="Control" context="#pop!generate_stmt_els" insensitive="1" String="elsif"/>
        <WordDetect attribute="Control" context="#pop!generate_stmt_els" insensitive="1" String="else"/>
        <IncludeRules context="sequentialStatementKw"/>
        <IncludeRules context="label"/>
        <IncludeRules context="postDeclaration"/>
      </context>

      <context name="generate_body" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="sequential_stmt_decl">
        <IncludeRules context="parallel_stmt"/>
      </context>

      <context name="generate_stmt_els" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preExpression"/>
        <WordDetect attribute="Control" context="#pop!generate_stmt" insensitive="1" String="generate"/>
        <IncludeRules context="postExpression"/>
      </context>

<!-- block -->
      <context name="block" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="entity_decl">
        <RegExpr attribute="Control" context="#pop#pop" insensitive="1"
                 String="&bos;end(\s+block\b)?(\s+&varname;)?\s*;" endRegion="BlockRegion1"/>
        <WordDetect attribute="Error" context="#pop#pop!expressionError" insensitive="true"
                    String="end" endRegion="BlockRegion1"/>
      </context>

<!-- process -->
      <context name="process" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="process_decl">
        <RegExpr attribute="Process" context="#pop" insensitive="1"
                 String="&bos;end(\s+postponed)?(\s+process\b)?(\s+&varname;)?\s*;" endRegion="ProcessRegion1"/>
        <WordDetect attribute="Error" context="#pop!expressionError" insensitive="true"
                    String="end" endRegion="ProcessRegion1"/>
      </context>

      <context name="process_decl" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preDeclaration"/>
        <WordDetect attribute="Process" context="#pop!sequential_stmt" insensitive="true" String="begin"/>
        <WordDetect attribute="Control" context="#pop" insensitive="true" String="end" lookAhead="1"/>
        <IncludeRules context="postDeclaration"/>
      </context>

<!-- expression -->
      <context name="preExpression" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preDeclaration"/>
      </context>

      <context name="postExpression" attribute="Normal Text" lineEndContext="#stay">
        <keyword attribute="Data Type" context="#stay" String="types"/>
        <keyword attribute="Data Type" context="#stay" String="timeunits"/>
        <keyword attribute="Range" context="#stay" String="range"/>
        <keyword attribute="Keyword" context="#stay" String="keywords"/>
        <DetectIdentifier attribute="Normal Text"/>
      </context>

<!-- expression error -->
      <context name="expressionError" attribute="Error" lineEndContext="#pop">
        <Detect2Chars attribute="Comment" context="comment" char="-" char1="-"/>
        <DetectChar attribute="Error" context="#pop" char=";"/>
      </context>

<!-- other environments -->
      <context name="comment" attribute="Comment" lineEndContext="#pop">
        <DetectSpaces />
        <IncludeRules context="##Comments"/>
      </context>

      <context name="string" attribute="Vector" lineEndContext="#stay">
        <DetectChar attribute="Vector" context="#pop" char="&quot;"/>
      </context>

      <context name="attribute" attribute="Attribute" lineEndContext="#pop">
        <DetectChar attribute="Attribute" context="quot in att" char="&quot;"/>
        <DetectChar attribute="Attribute" context="par in att" char="("/>
        <DetectChar attribute="Normal Text" context="#pop" char=" "/>
        <DetectChar attribute="Attribute" context="#pop" char="'"/>
        <AnyChar attribute="Attribute" context="#pop" String=")=&lt;&gt;;" lookAhead="true" />
       </context>

      <context name="quot in att" attribute="Attribute" lineEndContext="#stay">
        <DetectChar attribute="Attribute" context="#pop" char="&quot;"/>
      </context>
      <context name="par in att" attribute="Attribute" lineEndContext="#stay">
        <DetectChar attribute="Attribute" context="#pop" char=")"/>
      </context>

      <context name="signal" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preExpression"/>
        <DetectChar attribute="Normal Text" context="#pop" char=";"/>
        <IncludeRules context="postExpression"/>
      </context>

<!-- type -->
      <context name="type" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="blank"/>
        <WordDetect attribute="Signal" context="type_is" insensitive="1" String="is"/>
        <DetectIdentifier attribute="Normal Text"/>
      </context>

      <context name="type_is" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="#pop#pop!signal">
        <IncludeRules context="blank"/>
        <WordDetect attribute="Keyword" context="#pop#pop!type_record" insensitive="1" String="record" beginRegion="sig"/>
        <WordDetect attribute="Keyword" context="#pop#pop!type_range" insensitive="1" String="range"/>
      </context>

<!-- type range -->
      <context name="type_range" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preExpression"/>
        <DetectChar attribute="Normal Text" context="#pop" char=";"/>
        <WordDetect attribute="Control" context="type_range_units" insensitive="1" String="units" beginRegion="UnitRegion1"/>
        <IncludeRules context="postExpression"/>
      </context>

      <context name="type_range_units" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="type_body">
        <RegExpr attribute="Control" context="#pop#pop" insensitive="1"
                 String="&bos;end\s+units(\s+&varname;)?\s*;" endRegion="UnitRegion1"/>
        <WordDetect attribute="Error" context="#pop#pop!expressionError" insensitive="true"
                    String="end" endRegion="UnitRegion1"/>
      </context>

      <context name="type_body" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preExpression"/>
        <WordDetect context="#pop" insensitive="true" String="end" lookAhead="1"/>
        <IncludeRules context="postExpression"/>
      </context>

<!-- type record -->
      <context name="type_record" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="type_body">
        <IncludeRules context="blank"/>
        <RegExpr attribute="Keyword" context="#pop" insensitive="1"
                 String="&bos;end\s+record;" endRegion="sig"/>
        <WordDetect attribute="Error" context="#pop!expressionError" insensitive="true"
                    String="end" endRegion="sig"/>
      </context>

<!-- function -->
      <context name="function" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="function_name">
        <IncludeRules context="blank"/>
        <DetectIdentifier attribute="Name" context="function_name"/>
      </context>

      <context name="function_name" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preExpression"/>
        <WordDetect attribute="Control" context="function_return" insensitive="true" String="return"/>
        <IncludeRules context="postExpression"/>
      </context>

      <context name="function_return" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="blank"/>
        <DetectChar attribute="Normal Text" context="#pop#pop#pop" char=";"/>
        <WordDetect attribute="Keyword" context="#pop#pop#pop!function_is" insensitive="1" String="is" beginRegion="FunctionRegion1"/>
        <keyword attribute="Data Type" context="#stay" String="types"/>
      </context>

      <context name="function_is" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preExpression"/>
        <WordDetect attribute="Redirection" context="#pop!function_begin" insensitive="true"
                    String="begin"/>
        <keyword attribute="Signal" context="signal" String="signals"/>
        <IncludeRules context="postExpression"/>
      </context>

      <context name="function_begin" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="sequential_stmt">
        <RegExpr attribute="Redirection" context="#pop" insensitive="1"
                 String="&bos;end(\s+function\b)?(\s+(&varname;|&quot;[^&quot;]+&quot;))?\s*;" endRegion="FunctionRegion1"/>
        <WordDetect attribute="Error" context="#pop!expressionError" insensitive="true"
                    String="end" endRegion="FunctionRegion1"/>
      </context>

<!-- procedure -->
      <context name="procedure" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="blank"/>
        <DetectIdentifier attribute="Name" context="procedure_name"/>
      </context>

      <context name="procedure_name" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preExpression"/>
        <WordDetect attribute="Control" context="#pop#pop!procedure_is" insensitive="true" String="is"/>
        <keyword attribute="Signal" context="signal" String="signals"/>
        <IncludeRules context="postExpression"/>
      </context>

      <context name="procedure_is" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preExpression"/>
        <WordDetect attribute="Keyword" context="#pop!procedure_begin" insensitive="true"
                    String="begin" endRegion="ProcedureRegion1" beginRegion="ProcedureRegion1"/>
        <keyword attribute="Signal" context="signal" String="signals"/>
        <IncludeRules context="postExpression"/>
      </context>

      <context name="procedure_begin" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="sequential_stmt">
        <RegExpr attribute="Keyword" context="#pop" insensitive="1"
                 String="&bos;end(\s+procedure)?(\s+&varname;)?\s*;" endRegion="ProcedureRegion1"/>
        <WordDetect attribute="Error" context="#pop!expressionError" insensitive="true"
                    String="end" endRegion="ProcedureRegion1"/>
      </context>

<!-- component -->
      <context name="component" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="#pop">
        <IncludeRules context="blank"/>
        <RegExpr attribute="Name" context="component_main" beginRegion="ComponentRegion1"
                 String="(&identifier;)"/>
      </context>

      <context name="component_main" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="component_body">
        <RegExpr attribute="Control" context="#pop#pop" dynamic="1" insensitive="1"
                 String="&bos;end\s+component\b(\s+%1)?\s*;" endRegion="ComponentRegion1"/>
        <WordDetect attribute="Error" context="#pop#pop!expressionError" insensitive="true"
                    String="end" endRegion="ComponentRegion1"/>
      </context>

      <context name="component_body" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preExpression"/>
        <WordDetect attribute="Control" context="#stay" insensitive="true" String="generic"/>
        <WordDetect attribute="Control" context="#stay" insensitive="true" String="port"/>
        <WordDetect attribute="Control" context="#pop" insensitive="true" String="end" lookAhead="1"/>
        <IncludeRules context="postExpression"/>
      </context>

<!-- label: configuration ref -->
<!-- label: component ref -->
<!-- label: entity ref -->
<!-- label: ref -->
      <context name="instance" attribute="Normal Text" lineEndContext="#stay" fallthroughContext="#pop">
        <IncludeRules context="blank"/>
        <IncludeRules context="reference"/>
      </context>

      <context name="reference" attribute="Normal Text" lineEndContext="#stay">
        <RegExpr attribute="Reference" context="instance_body" beginRegion="InstanceRegion1"
                 String="&varname;(\s*\.\s*&varname;)?"/>
      </context>

      <context name="instance_body" attribute="Normal Text" lineEndContext="#stay">
        <DetectChar attribute="Normal Text" context="#pop#pop" char=";" endRegion="InstanceRegion1"/>
        <IncludeRules context="preExpression"/>
        <WordDetect attribute="Control" context="#pop#pop" insensitive="true" String="end" lookAhead="1"/>
        <RegExpr attribute="Keyword" context="instance_map_start" insensitive="true" beginRegion="InstanceMapRegion" String="&bos;(port|generic)\s+map\s*(?=\()"/>
        <IncludeRules context="postExpression"/>
      </context>
      <context name="instance_map_start" attribute="Normal Text" lineEndContext="#stay">
        <DetectChar attribute="Normal Text" context="#pop!instance_map" char="("/>
      </context>

      <!-- Inside a port or generic map -->
      <context name="instance_map" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preDeclaration"/>
        <AnyChar attribute="Error" context="#stay" String="&lt;;:"/>
        <DetectChar attribute="Normal Text" context="#pop" char=")" endRegion="InstanceMapRegion"/>
        <DetectChar attribute="Normal Text" context="instance_inner_par" char="("/>
        <IncludeRules context="postDeclaration"/>
      </context>

      <!-- Inside parantheses inside a map -->
      <context name="instance_inner_par" attribute="Normal Text" lineEndContext="#stay">
        <IncludeRules context="preDeclaration"/>
        <DetectChar attribute="Error" context="#stay" char=";"/>
        <DetectChar attribute="Normal Text" context="#pop" char=")"/>
        <DetectChar attribute="Normal Text" context="instance_inner_par" char="("/>
        <IncludeRules context="postDeclaration"/>
      </context>

    </contexts>
    <itemDatas>
      <itemData name="Normal Text" defStyleNum="dsNormal"/>
      <itemData name="Keyword" defStyleNum="dsKeyword"/>
      <itemData name="Data Type" defStyleNum="dsDataType"/>
      <itemData name="Comment" defStyleNum="dsComment"/>
      <itemData name="Integer" defStyleNum="dsDecVal"/>
      <itemData name="Reference" defStyleNum="dsFunction"/>
      <itemData name="Error" defStyleNum="dsError" bold="1"/>
      <itemData name="Vector" defStyleNum="dsString"/>
      <itemData name="Operator" defStyleNum="dsOthers"/>
      <itemData name="Attribute" defStyleNum="dsBaseN"/>
      <itemData name="Signal" defStyleNum="dsOthers"/>
      <itemData name="Range" defStyleNum="dsOthers"/>
      <itemData name="Redirection" defStyleNum="dsAttribute" bold="1"/> <!-- #223388 -->
      <itemData name="Process" defStyleNum="dsSpecialChar" bold="1"/> <!-- #0099AA -->
      <itemData name="Control" defStyleNum="dsControlFlow"/> <!-- #223388 -->
      <itemData name="Name" defStyleNum="dsDecVal" bold="1"/> <!-- #bb6600 -->
    </itemDatas>
  </highlighting>
  <general>
    <comments>
      <comment name="singleLine" start="--" position="afterwhitespace"/>
    </comments>
    <keywords casesensitive="0"/>
  </general>
</language>
<!-- kate: replace-tabs on; tab-width 2; indent-width 2; -->