<?xml version="1.0" encoding="utf-8"?>
<language id="adjlist" _name="Adjlist" version="2.0" _section="Other">
  <metadata>
    <property name="globs">*.adjlist</property>
  </metadata>

  <styles>
    <style id="comment" _name="Comment" map-to="def:comment"/>
    <style id="identifier" _name="Comment" map-to="def:identifier"/>
    <style id="shrink" _name="Shrinkable" map-to="def:complex"/>
    <style id="error" name="Bad" map-to="def:error"/>
    <style id="default" name="Default"/>
    <style id="secondary-active" name="Secondary-Active"/>
    <style id="secondary" name="Secondary"/>
  </styles>

  <definitions>
    <context id="adjlist">
      <include>
        <context id="active-secondary" style-ref="secondary-active">
          <match>^[A-Z0-9]{3}R\s+\d+\.\d+(-\d+|[a-z])?\s+((\+?\-\s*[1-9]\d*(\s*\[\d+\])?)|\+?\s*[1-9]\d*(\s*\[\d+\])?)?\s*(%.*)?$</match>
          <include>
            <context id="shrinkable" style-ref="shrink" sub-pattern="3"/>
          </include>
        </context>
        <context id="active" style-ref="identifier">
          <match>^[A-Z0-9]{3}L?\s+\d+\.\d+(-\d+|[a-z])?\s+((\+?\-\s*[1-9]\d*(\s*\[\d+\])?)|\+?\s*[1-9]\d*(\s*\[\d+\])?)?\s*(%.*)?$</match>
          <include>
            <context id="shrinkable" style-ref="shrink" sub-pattern="3"/>
          </include>
        </context>
        <context id="adj-secondary" style-ref="secondary">
          <match>^[A-Z0-9]{3}R\s+\d+\.\d+(-\d+|[a-z])?\s+((\+?\-\s*0+(\s*\[\d+\])?)|\+?\s*0+(\s*\[\d+\])?)?\s*(%.*)?$</match>
          <include>
            <context id="shrinkable" style-ref="shrink" sub-pattern="3"/>
          </include>
        </context>
        <context id="adj" style-ref="default">
          <match>^[A-Z0-9]{3}L?\s+\d+\.\d+(-\d+|[a-z])?\s+((\+?\-\s*0+(\s*\[\d+\])?)|\+?\s*0+(\s*\[\d+\])?)?\s*(%.*)?$</match>
          <include>
            <context id="shrinkable" style-ref="shrink" sub-pattern="3"/>
          </include>
        </context>
        <context id="comment" style-ref="comment" end-at-line-end="true">
          <start>^\s*%</start>
        </context>
        <context id="glo" style-ref="default">
          <match>^GLO[LR]?\s+k\.\S+\s+((\+?\-\s*\d+(\s*\[\d+\])?)|\+?\s*\d+(\s*\[\d+\])?)?\s*(%.*)?$</match>
          <include>
            <context id="gloshrinkable" style-ref="shrink" sub-pattern="2"/>
          </include>
        </context>
        <context id="bad" style-ref="error">
          <match>^\s*\S+.*</match>
        </context>
      </include>
    </context>
  </definitions>
</language>
