<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE language
[
  <!ENTITY unum "\d+">                                 <!-- Unsigned integer number, e.g. 123 -->
  <!ENTITY inum "_?&unum;">                            <!-- Integer number, e.g. _123 -->
  <!ENTITY anum "[a-z\d]+">                            <!-- Non-decimal unsigned integer number, e.g. 1a -->
  <!ENTITY bnum "\b_?&unum;b_?&anum;(\.&anum;)?\b">    <!-- Non-decimal number, e.g. _36b_1a.z2 -->
  <!ENTITY xnum "\b&inum;x\b">                         <!-- Extended precision integer number, e.g. _123x -->
  <!ENTITY rnum "\b&inum;r&inum;\b">                   <!-- Rational number, e.g. _1r23 -->
  <!ENTITY fnum "&inum;(\.&unum;)?">                   <!-- Floating point number, e.g. _1.23 -->
  <!ENTITY enum "(&fnum;(e&inum;)?|_?_|_\.)">          <!-- Exponential (scientific) notation, e.g. _1.2e_3 -->
  <!ENTITY cnum "&enum;((j|a[dr])&enum;)?">            <!-- Complex number, e.g. _1.2e3j_4.5e_6 -->
  <!ENTITY pnum "\b&cnum;([px]&cnum;)?(?![a-z\d_.])">  <!-- Number based on pi or on e, e.g. _1j2p3j4 -->
  <!ENTITY name "[a-zA-Z]\w*">                         <!-- Name -->
  <!ENTITY lname "\b&name;_(&name;)?_\b">              <!-- Locative, a__ means a_base_ -->
  <!ENTITY ilname "\b&name;__&name;\b">                <!-- Indirect locative -->
]>
<!--
  J language Syntax Highlighting Definition
  See updates and changelog at https://github.com/jip/syntax-highlighting

  J is a high-level, general-purpose programming language
  https://www.jsoftware.com

  This file is part of the KDE's KSyntaxHighlighting framework
  https://invent.kde.org/frameworks/syntax-highlighting

  SPDX-FileCopyrightText: 2012,2013,2015,2016,2020,2023,2026 Igor Zhuravlov <zhuravlov.ip@ya.ru>
  SPDX-FileCopyrightText: 2014 greg heil <gheil.j@gmail.com>
  SPDX-License-Identifier: GPL-3.0-or-later
-->
<language name="J"
          section="Scripts"
          version="7"
          kateversion="5.0"
          extensions="*.ijs;*.ijt;*.ijx"
          mimetype="text/x-j;text/x-jsrc"
          author="Igor Zhuravlov (zhuravlov.ip@ya.ru), greg heil (gheil.j@gmail.com)"
          indenter="normal"
          license="GPL">
  <highlighting>
    <list name="controls">
      <item>{{</item>
      <item>}}</item>
      <item>assert.</item>
      <item>break.</item>
      <item>case.</item>
      <item>catch.</item>
      <item>catchd.</item>
      <item>catcht.</item>
      <item>continue.</item>
      <item>do.</item>
      <item>else.</item>
      <item>elseif.</item>
      <item>end.</item>
      <item>for.</item>
      <item>fcase.</item>
      <item>if.</item>
      <item>return.</item>
      <item>select.</item>
      <item>throw.</item>
      <item>try.</item>
      <item>while.</item>
      <item>whilst.</item>
    </list>
    <contexts>
      <context attribute="Sentence" lineEndContext="#pop" name="sentence">
        <DetectSpaces/>
        <StringDetect attribute="Comment"        context="#stay"        String="NB.(" beginRegion="CommentBlock"/>
        <StringDetect attribute="Comment"        context="#stay"        String="NB.)" endRegion="CommentBlock"/>
        <StringDetect attribute="Annotation"     context="annotation"   String="NB. * "/>
        <StringDetect attribute="Comment"        context="comment line" String="NB."/>
        <RegExpr      attribute="Foldable"       context="noun block"   String="(?&lt;![.\w])0\s+:\s*0|\bNote\s*&apos;" beginRegion="DefBlock"/>
        <RegExpr      attribute="Foldable"       context="#stay"        String=":\s*0|\bdefine\b" beginRegion="DefBlock"/>
        <LineContinue attribute="Foldable"       context="#stay"        char=")" endRegion="DefBlock" column="0"/>
        <StringDetect attribute="Foldable"       context="#stay"        String="{{" beginRegion="DDBlock"/>
        <StringDetect attribute="Foldable"       context="#stay"        String="}}" endRegion="DDBlock"/>
        <RegExpr      attribute="String"         context="#stay"        String="&apos;([^&apos;]|&apos;&apos;)*&apos;"/>
        <RegExpr      attribute="Adverb"         context="#stay"        String="([/\\]\.|/\.\.|\]:|\b[bfM]\.|[~/\\}])(?![.:])"/>
        <RegExpr      attribute="Verb"           context="#stay"        String="(_?\d:|p\.\.|[AcCeEIjLor]\.|__?:|[/\\iqsuxZ]:|\{::|[=!\]]|[-&lt;&gt;+*%$|,#\{][.:]?|[;\[]:?|[~}&quot;ip][.:]|[?^]\.?|\b[uv](\b|\.))(?![.:])"/>
        <RegExpr      attribute="Number"         context="#stay"        String="&bnum;|&xnum;|&rnum;|&pnum;"/>
        <AnyChar      attribute="Parenthese"     context="#stay"        String="()"/>
        <RegExpr      attribute="Conjunction"    context="#stay"        String="(&quot;|[:@&amp;][.:]?|;?\.|![.:]|&amp;\.:|[;[\]Hmt]\.|`:?|[LS^]:)(?![.:])"/>
        <keyword      attribute="Control"        context="#stay"        String="controls"/>
        <RegExpr      attribute="Control"        context="#stay"        String="\b(for|goto|label)_&name;\.(?![.:])"/>
        <StringDetect attribute="Copulae Global" context="#stay"        String="=:"/>
        <StringDetect attribute="Copulae Local"  context="#stay"        String="=."/>
        <RegExpr      attribute="Noun"           context="#stay"        String="\b(a[.:](?![.:])|[mnxy](?![\w.:]))"/>
      </context>
      <context attribute="NounBlock" lineEndContext="#stay" name="noun block">
        <DetectChar   attribute="Foldable"       context="#pop"         char=")" endRegion="DefBlock" column="0"/>
      </context>
      <context attribute="Annotation" lineEndContext="#pop" name="annotation">
        <DetectSpaces/>
        <IncludeRules context="##Comments"/>
        <DetectIdentifier/>
      </context>
      <context attribute="Comment" lineEndContext="#pop" name="comment line">
        <DetectSpaces/>
        <IncludeRules context="##Comments"/>
        <DetectIdentifier/>
      </context>
    </contexts>
    <itemDatas>
      <itemData name="Sentence"       defStyleNum="dsNormal"        spellChecking="false"/>
      <itemData name="Adverb"         defStyleNum="dsOperator"      spellChecking="false" bold="true"/>
      <itemData name="Annotation"     defStyleNum="dsAnnotation"    spellChecking="false"/>
      <itemData name="Comment"        defStyleNum="dsComment"       spellChecking="true"/>
      <itemData name="Conjunction"    defStyleNum="dsOperator"      spellChecking="false" bold="true"/>
      <itemData name="Control"        defStyleNum="dsControlFlow"   spellChecking="false"/>
      <itemData name="Copulae Global" defStyleNum="dsBuiltIn"       spellChecking="false"/>
      <itemData name="Copulae Local"  defStyleNum="dsBuiltIn"       spellChecking="false" bold="false"/>
      <itemData name="Foldable"       defStyleNum="dsRegionMarker"  spellChecking="false"/>
      <itemData name="Noun"           defStyleNum="dsKeyword"       spellChecking="false"/>
      <itemData name="NounBlock"      defStyleNum="dsNormal"        spellChecking="false"/>
      <itemData name="Number"         defStyleNum="dsDecVal"        spellChecking="false"/>
      <itemData name="Parenthese"     defStyleNum="dsRegionMarker"  spellChecking="false"/>
      <itemData name="String"         defStyleNum="dsString"        spellChecking="false"/>
      <itemData name="Verb"           defStyleNum="dsOperator"      spellChecking="false" bold="true"/>
    </itemDatas>
  </highlighting>
  <general>
    <keywords casesensitive="true" weakDeliminator=".{}"/>
    <comments>
      <comment name="singleLine" start="NB." position="afterwhitespace"/>
      <comment name="multiLine" start="NB.(" end="NB.)" region="CommentBlock"/>
    </comments>
    <folding indentationsensitive="true"/>
  </general>
</language>
<!-- kate: replace-tabs on; indent-width 2; -->
