<lexer>
  <config>
    <name>COBOL</name>
    <alias>cobol</alias>
    <filename>*.cob</filename>
    <filename>*.COB</filename>
    <filename>*.cpy</filename>
    <filename>*.CPY</filename>
    <mime_type>text/x-cobol</mime_type>
    <case_insensitive>true</case_insensitive>
  </config>
  <rules>
    <state name="strings">
      <rule pattern="&#34;[^&#34;\n]*(&#34;|\n)">
        <token type="LiteralStringDouble"/>
      </rule>
      <rule pattern="&#39;[^&#39;\n]*(&#39;|\n)">
        <token type="LiteralStringSingle"/>
      </rule>
    </state>
    <state name="nums">
      <rule pattern="\d+(\s*|\.$|$)">
        <token type="LiteralNumberInteger"/>
      </rule>
      <rule pattern="[+-]?\d*\.\d+(E[-+]?\d+)?">
        <token type="LiteralNumberFloat"/>
      </rule>
      <rule pattern="[+-]?\d+\.\d*(E[-+]?\d+)?">
        <token type="LiteralNumberFloat"/>
      </rule>
    </state>
    <state name="root">
      <rule>
        <include state="comment"/>
      </rule>
      <rule>
        <include state="strings"/>
      </rule>
      <rule>
        <include state="core"/>
      </rule>
      <rule>
        <include state="nums"/>
      </rule>
      <rule pattern="[a-z0-9]([\w\-]*[a-z0-9]+)?">
        <token type="NameVariable"/>
      </rule>
      <rule pattern="[ \t]+">
        <token type="Text"/>
      </rule>
    </state>
    <state name="comment">
      <rule pattern="(^.{6}[*/].*\n|^.{6}|\*&gt;.*\n)">
        <token type="Comment"/>
      </rule>
    </state>
    <state name="core">
      <rule pattern="(^|(?&lt;=[^\w\-]))(ALL\s+)?((ZEROES)|(HIGH-VALUE|LOW-VALUE|QUOTE|SPACE|ZERO)(S)?)\s*($|(?=[^\w\-]))">
        <token type="NameConstant"/>
      </rule>
      <rule pattern="(^|(?&lt;=[^\w\-]))(WORKING-STORAGE|IDENTIFICATION|LOCAL-STORAGE|CONFIGURATION|END-EVALUATE|FILE-CONTROL|END-UNSTRING|END-SUBTRACT|END-MULTIPLY|INPUT-OUTPUT|END-PERFORM|END-DISPLAY|END-OF-PAGE|END-COMPUTE|ENVIRONMENT|I-O-CONTROL|END-REWRITE|END-RETURN|INITIALIZE|END-ACCEPT|END-DIVIDE|PROGRAM-ID|END-STRING|END-DELETE|END-SEARCH|END-WRITE|PROCEDURE|END-START|TERMINATE|END-READ|MULTIPLY|CONTINUE|SUPPRESS|SUBTRACT|INITIATE|UNSTRING|DIVISION|VALIDATE|END-CALL|ALLOCATE|GENERATE|EVALUATE|PERFORM|FOREVER|LINKAGE|END-ADD|REWRITE|INSPECT|SECTION|RELEASE|COMPUTE|DISPLAY|END-IF|GOBACK|INVOKE|CANCEL|UNLOCK|SCREEN|SEARCH|DELETE|STRING|DIVIDE|ACCEPT|RETURN|RESUME|START|RAISE|MERGE|CLOSE|WRITE|FILE|STOP|FREE|READ|ELSE|THEN|SORT|EXIT|OPEN|CALL|MOVE|DATA|END|SET|ADD|USE|GO|FD|SD|IF)\s*($|(?=[^\w\-]))">
        <token type="KeywordReserved"/>
      </rule>
      <rule pattern="(^|(?&lt;=[^\w\-]))(ALPHANUMERIC-EDITED|PROCEDURE-POINTER|ENVIRONMENT-VALUE|ENVIRONMENT-NAME|ALPHABETIC-UPPER|FOREGROUND-COLOR|ALPHABETIC-LOWER|BACKGROUND-COLOR|OBJECT-COMPUTER|SOURCE-COMPUTER|PROGRAM-POINTER|ARGUMENT-NUMBER|NATIONAL-EDITED|NUMERIC-EDITED|LINAGE-COUNTER|UNSIGNED-SHORT|ARGUMENT-VALUE|PACKED-DECIMAL|SPECIAL-NAMES|AUTOTERMINATE|DECIMAL-POINT|CORRESPONDING|UNSIGNED-LONG|SEGMENT-LIMIT|REVERSE-VIDEO|SIGNED-SHORT|SYNCHRONIZED|ALPHANUMERIC|ALTERNATEANY|UNSIGNED-INT|ORGANIZATION|DECLARATIVES|COMMAND-LINE|FUNCTION-ID|SIGNED-LONG|INITIALIZED|FLOAT-SHORT|BYTE-LENGTH|DAY-OF-WEEK|DESCENDING|CHARACTERS|SEQUENTIAL|REPOSITORY|SIGNED-INT|SORT-MERGE|DUPLICATES|STANDARD-1|STANDARD-2|CONVERTING|FLOAT-LONG|ALPHABETIC|PROCEDURES|RECORDING|HIGHLIGHT|ADVANCING|RETURNING|REPLACING|UNDERLINE|TRANSFORM|REMAINDER|INTRINSIC|JUSTIFIED|REFERENCE|REDEFINES|EXCLUSIVE|RECURSIVE|EXCEPTION|COLLATING|ASCENDING|REPORTING|AUTO-SKIP|DEBUGGING|AUTOMATIC|CHARACTER|PARAGRAPH|DELIMITED|DELIMITER|DEPENDING|PREVIOUS|POSITIVE|POSITION|CHAINING|STANDARD|FUNCTION|OVERFLOW|PRINTING|CODE-SET|SEPARATE|OPTIONAL|SYMBOLIC|SEQUENCE|NEGATIVE|TALLYING|NATIONAL|REQUIRED|CURRENCY|MULTIPLE|TRAILING|LOWLIGHT|OVERLINE|SENTENCE|RELATIVE|ROLLBACK|CONTROLS|UNSIGNED|INDICATE|IGNORING|ALPHABET|CONTAINS|CONSTANT|EXTERNAL|YYYYMMDD|FILE-ID|CONTROL|RENAMES|REMOVAL|HEADING|YYYYDDD|RESERVE|VARYING|RECORDS|REPORTS|COLUMNS|PROGRAM|INDEXED|FOOTING|INITIAL|PROCEED|ROUNDED|DEFAULT|PRESENT|INVALID|POINTER|SHARING|PADDING|DYNAMIC|OMITTED|ADDRESS|LEADING|CONTENT|NUMBERS|THROUGH|NUMERIC|PRINTER|SELECT|COMMON|REPORT|LOCALE|ACCESS|LINAGE|MANUAL|MEMORY|LIMITS|FILLER|EXTEND|ESCAPE|GIVING|NATIVE|GLOBAL|COMMIT|ASSIGN|STATUS|OUTPUT|NUMBER|LENGTH|REWIND|CURSOR|BEFORE|OCCURS|SOURCE|IGNORE|VALUES|RECORD|BOTTOM|SIGNED|RANDOM|QUOTES|PROMPT|SCROLL|EBCDIC|FORMAT|SECURE|DETAIL|UPDATE|COLUMN|TIMES|USAGE|CLASS|FINAL|FIRST|USING|CYCLE|UNTIL|MINUS|INPUT|FIXED|INDEX|VALUE|OTHER|QUOTE|ENTRY|ORDER|RIGHT|BLOCK|LABEL|BLINK|BASED|AFTER|NULLS|COUNT|AREAS|WORDS|GROUP|ERASE|LIMIT|LINES|ALTER|COMMA|ERROR|BLANK|THRU|CORR|REEL|FROM|WITH|DATE|WHEN|CODE|SAME|WAIT|COPY|DISK|PLUS|COLS|INTO|UPON|DOWN|PAGE|SIGN|JUST|ONLY|LAST|ALSO|SIZE|UNIT|LINE|BELL|TYPE|BEEP|LOCK|AUTO|NULL|AREA|MODE|SYNC|TIME|NEXT|TAPE|TEST|FULL|LEFT|EOL|CRT|I-O|TOP|DAY|EOS|EOP|FOR|ARE|OFF|ALL|COL|SUM|KEY|RUN|UP|ON|IS|IN|BY|OF|ID|DE|AT|RD|TO|NO|AS)\s*($|(?=[^\w\-]))">
        <token type="KeywordPseudo"/>
      </rule>
      <rule pattern="(^|(?&lt;=[^\w\-]))(REPRESENTS-NOT-A-NUMBER|FUNCTION-POINTER|FLOAT-DECIMAL-34|FLOAT-DECIMAL-16|ENTRY-CONVENTION|EXCEPTION-OBJECT|OBJECT-REFERENCE|FLOAT-BINARY-34|FLOAT-BINARY-16|VALIDATE-STATUS|FLOAT-EXTENDED|CLASSIFICATION|FLOAT-BINARY-7|SYSTEM-DEFAULT|COMMUNICATION|PAGE-COUNTER|USER-DEFAULT|LINE-COUNTER|ACTIVE-CLASS|DATA-POINTER|INTERFACE-ID|DESTINATION|GROUP-USAGE|LC_MESSAGES|SUB-QUEUE-3|SUB-QUEUE-2|SUB-QUEUE-1|END-RECEIVE|LC_MONETARY|VAL-STATUS|LC_NUMERIC|IMPLEMENTS|LC_COLLATE|ARITHMETIC|STATEMENT|METHOD-ID|INTERFACE|ATTRIBUTE|PROTOTYPE|CONDITION|UNIVERSAL|LC_CTYPE|VALIDATE|PROPERTY|TERMINAL|INFINITY|INHERITS|CLASS-ID|RELATION|OVERRIDE|ANYCASE|DISABLE|ALIGNED|REPLACE|RAISING|EXPANDS|FACTORY|TYPEDEF|MESSAGE|RECEIVE|BOOLEAN|SECONDS|SOURCES|SEGMENT|LC_TIME|OPTIONS|METHOD|UTF-16|OBJECT|NORMAL|NESTED|CENTER|LC_ALL|RESUME|INVOKE|ENABLE|STRONG|FORMAT|SYMBOL|B-XOR|QUEUE|RESET|PURGE|RETRY|B-AND|VALID|B-NOT|UTF-8|SUPER|RAISE|UCS-4|TABLE|CHAIN|NONE|B-OR|STEP|SEND|SELF|TEXT|BIT|EMI|ESI|EGI|GET|CD|CF|EC|EO|PF|PH|RH|RF|CH)\s*($|(?=[^\w\-]))">
        <token type="Error"/>
      </rule>
      <rule pattern="(^|(?&lt;=[^\w\-]))(PIC\s+.+?(?=(\s|\.\s))|PICTURE\s+.+?(?=(\s|\.\s))|(COMPUTATIONAL)(-[1-5X])?|(COMP)(-[1-5X])?|BINARY-C-LONG|BINARY-CHAR|BINARY-DOUBLE|BINARY-LONG|BINARY-SHORT|BINARY)\s*($|(?=[^\w\-]))">
        <token type="KeywordType"/>
      </rule>
      <rule pattern="(\*\*|\*|\+|-|/|&lt;=|&gt;=|&lt;|&gt;|==|/=|=)">
        <token type="Operator"/>
      </rule>
      <rule pattern="([(),;:&amp;%.])">
        <token type="Punctuation"/>
      </rule>
      <rule pattern="(^|(?&lt;=[^\w\-]))(ABS|ACOS|ANNUITY|ASIN|ATAN|BYTE-LENGTH|CHAR|COMBINED-DATETIME|CONCATENATE|COS|CURRENT-DATE|DATE-OF-INTEGER|DATE-TO-YYYYMMDD|DAY-OF-INTEGER|DAY-TO-YYYYDDD|EXCEPTION-(?:FILE|LOCATION|STATEMENT|STATUS)|EXP10|EXP|E|FACTORIAL|FRACTION-PART|INTEGER-OF-(?:DATE|DAY|PART)|INTEGER|LENGTH|LOCALE-(?:DATE|TIME(?:-FROM-SECONDS)?)|LOG(?:10)?|LOWER-CASE|MAX|MEAN|MEDIAN|MIDRANGE|MIN|MOD|NUMVAL(?:-C)?|ORD(?:-MAX|-MIN)?|PI|PRESENT-VALUE|RANDOM|RANGE|REM|REVERSE|SECONDS-FROM-FORMATTED-TIME|SECONDS-PAST-MIDNIGHT|SIGN|SIN|SQRT|STANDARD-DEVIATION|STORED-CHAR-LENGTH|SUBSTITUTE(?:-CASE)?|SUM|TAN|TEST-DATE-YYYYMMDD|TEST-DAY-YYYYDDD|TRIM|UPPER-CASE|VARIANCE|WHEN-COMPILED|YEAR-TO-YYYY)\s*($|(?=[^\w\-]))">
        <token type="NameFunction"/>
      </rule>
      <rule pattern="(^|(?&lt;=[^\w\-]))(true|false)\s*($|(?=[^\w\-]))">
        <token type="NameBuiltin"/>
      </rule>
      <rule pattern="(^|(?&lt;=[^\w\-]))(equal|equals|ne|lt|le|gt|ge|greater|less|than|not|and|or)\s*($|(?=[^\w\-]))">
        <token type="OperatorWord"/>
      </rule>
    </state>
  </rules>
</lexer>