// This is a TextMate grammar distributed by `starry-night`. // This grammar is developed at // // and licensed `mit`. // See for more info. /** * @import {Grammar} from '@wooorm/starry-night' */ /** @type {Grammar} */ const grammar = { extensions: ['.cob', '.cbl', '.ccp', '.cobol', '.cpy'], names: ['cobol'], patterns: [ { match: '(^[ \\*][ \\*][ \\*][ \\*][ \\*][ \\*])([dD]\\s.*$)', name: 'token.info-token.cobol' }, { captures: { 1: {name: 'constant.numeric.cobol'}, 2: {name: 'comment.line.cobol.newpage'} }, match: '(^[ \\*][ \\*][ \\*][ \\*][ \\*][ \\*])(\\/.*$)' }, { captures: { 1: {name: 'constant.numeric.cobol'}, 2: {name: 'comment.line.cobol.fixed'} }, match: '(^[ \\*][ \\*][ \\*][ \\*][ \\*][ \\*])(\\*.*$)' }, { captures: { 1: {name: 'constant.numeric.cobol'}, 2: {name: 'comment.line.cobol.newpage'} }, match: '(^[0-9\\s][0-9\\s][0-9\\s][0-9\\s][0-9\\s][0-9\\s])(\\/.*$)' }, { match: '^[0-9\\s][0-9\\s][0-9\\s][0-9\\s][0-9\\s][0-9\\s]$', name: 'constant.numeric.cobol' }, { captures: { 1: {name: 'constant.numeric.cobol'}, 2: {name: 'comment.line.cobol.fixed'} }, match: '(^[0-9\\s][0-9\\s][0-9\\s][0-9\\s][0-9\\s][0-9\\s])(\\*.*$)' }, { captures: { 1: {name: 'constant.numeric.cobol'}, 2: {name: 'comment.line.cobol.fixed'} }, match: '(^[0-9a-zA-Z\\s\\$#%\\.@\\- +][0-9a-zA-Z\\s\\$#%\\.@\\- +][0-9a-zA-Z\\s\\$#%\\.@\\- +][0-9a-zA-Z\\s\\$#%\\.@\\- +][0-9a-zA-Z\\s\\$#%\\.@\\- +][0-9a-zA-Z\\s\\$#%\\.@\\- +])(\\*.*$)' }, { captures: { 1: {name: 'constant.numeric.cobol'}, 2: {name: 'variable.other.constant'} }, match: '^\\s+(78)\\s+([0-9a-zA-Z][a-zA-Z\\-0-9_]+)' }, { captures: { 1: {name: 'constant.numeric.cobol'}, 2: {name: 'variable.other.constant'}, 3: {name: 'keyword.identifers.cobol'} }, match: '^\\s+([0-9]+)\\s+([0-9a-zA-Z][a-zA-Z\\-0-9_]+)\\s+((?i:constant))' }, { captures: { 1: {name: 'constant.cobol'}, 2: {name: 'comment.line.cobol.newpage'} }, match: '(^[0-9a-zA-Z\\s\\$#%\\.@][0-9a-zA-Z\\s\\$#%\\.@][0-9a-zA-Z\\s\\$#%\\.@][0-9a-zA-Z\\s\\$#%\\.@][0-9a-zA-Z\\s\\$#%\\.@][0-9a-zA-Z\\s\\$#%\\.@])(\\/.*$)' }, {match: '^\\*.*$', name: 'comment.line.cobol.fixed'}, { captures: { 1: {name: 'keyword.control.directive.conditional.cobol'}, 2: {name: 'entity.name.function.preprocessor.cobol'}, 3: {name: 'entity.name.function.cobol'}, 4: {name: 'keyword.control.directive.conditional.cobol'} }, match: '((?:^|\\s+)(?i:\\$set)\\s+)((?i:constant)\\s+)([0-9a-zA-Z][a-zA-Z\\-0-9]+\\s*)([a-zA-Z\\-0-9]*)' }, { captures: { 1: {name: 'entity.name.function.preprocessor.cobol'}, 2: {name: 'storage.modifier.import.cobol'}, 3: {name: 'punctuation.begin.bracket.round.cobol'}, 4: {name: 'string.quoted.other.cobol'}, 5: {name: 'punctuation.end.bracket.round.cobol'} }, match: '((?i:\\$\\s*set\\s+)(ilusing)(\\()(.*)(\\)))' }, { captures: { 1: {name: 'entity.name.function.preprocessor.cobol'}, 2: {name: 'storage.modifier.import.cobol'}, 3: {name: 'punctuation.definition.string.begin.cobol'}, 4: {name: 'string.quoted.other.cobol'}, 5: {name: 'punctuation.definition.string.begin.cobol'} }, match: '((?i:\\$\\s*set\\s+)(ilusing)(")(.*)("))' }, { captures: { 1: {name: 'keyword.control.directive.conditional.cobol'}, 2: {name: 'entity.name.function.preprocessor.cobol'}, 3: {name: 'punctuation.definition.string.begin.cobol'}, 4: {name: 'string.quoted.other.cobol'}, 5: {name: 'punctuation.definition.string.begin.cobol'} }, match: '((?i:\\$set))\\s+(\\w+)\\s*(")(\\w*)(")' }, { captures: { 1: {name: 'keyword.control.directive.conditional.cobol'}, 2: {name: 'entity.name.function.preprocessor.cobol'}, 3: {name: 'punctuation.begin.bracket.round.cobol'}, 4: {name: 'string.quoted.other.cobol'}, 5: {name: 'punctuation.end.bracket.round.cobol'} }, match: '((?i:\\$set))\\s+(\\w+)\\s*(\\()(.*)(\\))' }, { captures: { 0: {name: 'keyword.control.directive.conditional.cobol'}, 1: {name: 'invalid.illegal.directive'}, 2: {name: 'comment.line.set.cobol'} }, match: '(?:^|\\s+)(?i:\\$\\s*set\\s)((?i:01SHUFFLE|64KPARA|64KSECT|AUXOPT|CHIP|DATALIT|EANIM|EXPANDDATA|FIXING|FLAG-CHIP|MASM|MODEL|OPTSIZE|OPTSPEED|PARAS|PROTMODE|REGPARM|SEGCROSS|SEGSIZE|SIGNCOMPARE|SMALLDD|TABLESEGCROSS|TRICKLECHECK|\\s)+).*$' }, { captures: { 1: {name: 'keyword.control.directive.cobol'}, 2: {name: 'entity.other.attribute-name.preprocessor.cobol'} }, match: '(\\$(?i:region)|\\$(?i:end-region))(.*$)' }, { begin: '\\$(?i:doc)(.*$)', end: '\\$(?i:end-doc)(.*$)', name: 'invalid.illegal.iscobol' }, { match: '>>\\s*(?i:turn|page|listing|leap-seconds|d)\\s+.*$', name: 'invalid.illegal.meta.preprocessor.cobolit' }, { match: '(?i:substitute-case|substitute)\\s+', name: 'invalid.illegal.functions.cobolit' }, { captures: { 1: { name: 'invalid.illegal.keyword.control.directive.conditional.cobol' }, 2: {name: 'invalid.illegal.entity.name.function.preprocessor.cobol'}, 3: {name: 'invalid.illegal.entity.name.function.preprocessor.cobol'} }, match: '((((>>|\\$)[\\s]*)(?i:elif))(.*$))' }, { captures: { 1: {name: 'keyword.control.directive.conditional.cobol'}, 2: {name: 'entity.name.function.preprocessor.cobol'}, 3: {name: 'entity.name.function.preprocessor.cobol'} }, match: '((((>>|\\$)[\\s]*)(?i:if|else|elif|end-if|end-evaluate|end|define|evaluate|when|display|call-convention|set))(.*$))' }, { captures: { 1: {name: 'comment.line.scantoken.cobol'}, 2: {name: 'keyword.cobol'}, 3: {name: 'string.cobol'} }, match: '(\\*>)\\s+(@[0-9a-zA-Z][a-zA-Z\\-0-9]+)\\s+(.*$)' }, {match: '(\\*>.*$)', name: 'comment.line.modern'}, {match: '(>>.*)$', name: 'strong comment.line.set.cobol'}, { match: "([nNuU][xX]|[hHxX])'[[:xdigit:]]*'", name: 'constant.numeric.integer.hexadecimal.cobol' }, { match: "([nNuU][xX]|[hHxX])'.*'", name: 'invalid.illegal.hexadecimal.cobol' }, { match: '([nNuU][xX]|[hHxX])"[[:xdigit:]]*"', name: 'constant.numeric.integer.hexadecimal.cobol' }, { match: '([nNuU][xX]|[hHxX])".*"', name: 'invalid.illegal.hexadecimal.cobol' }, {match: '[bB]"[0-1]"', name: 'constant.numeric.integer.boolean.cobol'}, {match: "[bB]'[0-1]'", name: 'constant.numeric.integer.boolean.cobol'}, {match: '[oO]"[0-7]*"', name: 'constant.numeric.integer.octal.cobol'}, {match: '[oO]".*"', name: 'invalid.illegal.octal.cobol'}, { match: '(#)([0-9a-zA-Z][a-zA-Z\\-0-9]+)', name: 'meta.symbol.forced.cobol' }, { begin: '((?.*$)', name: 'comment.line.modern'}, {match: '(\\:([0-9a-zA-Z\\-_])*)', name: 'variable.cobol'}, {include: 'source.openesql'} ] }, { begin: '(?i:exec\\s+cics)', contentName: 'meta.embedded.block.cics', end: '(?i:end\\-exec)', name: 'keyword.verb.cobol', patterns: [ {match: '(\\()', name: 'meta.symbol.cobol'}, {include: '#cics-keywords'}, {include: '#string-double-quoted-constant'}, {include: '#string-quoted-constant'}, {include: '#number-complex-constant'}, {include: '#number-simple-constant'}, { match: '([a-zA-Z-0-9_]*[a-zA-Z0-9]|([#]?[0-9a-zA-Z]+[a-zA-Z-0-9_]*[a-zA-Z0-9]))', name: 'variable.cobol' } ] }, { begin: '(?i:exec\\s+dli)', contentName: 'meta.embedded.block.dli', end: '(?i:end\\-exec)', name: 'keyword.verb.cobol', patterns: [ {match: '(\\()', name: 'meta.symbol.cobol'}, {include: '#dli-keywords'}, {include: '#dli-options'}, {include: '#string-double-quoted-constant'}, {include: '#string-quoted-constant'}, {include: '#number-complex-constant'}, {include: '#number-simple-constant'}, { match: '([a-zA-Z-0-9_]*[a-zA-Z0-9]|([#]?[0-9a-zA-Z]+[a-zA-Z-0-9_]*[a-zA-Z0-9]))', name: 'variable.cobol' } ] }, { begin: '(?i:exec\\s+sqlims)', contentName: 'meta.embedded.block.openesql', end: '(?i:end\\-exec)', name: 'keyword.verb.cobol', patterns: [ {match: '(\\*>.*$)', name: 'comment.line.modern'}, {match: '(\\:([a-zA-Z\\-])*)', name: 'variable.cobol'}, {include: 'source.openesql'} ] }, { begin: '(?i:exec\\s+ado)', contentName: 'meta.embedded.block.openesql', end: '(?i:end\\-exec)', name: 'keyword.verb.cobol', patterns: [ {match: '(--.*$)', name: 'comment.line.sql'}, {match: '(\\*>.*$)', name: 'comment.line.modern'}, {match: '(\\:([a-zA-Z\\-])*)', name: 'variable.cobol'}, {include: 'source.openesql'} ] }, { begin: '(?i:exec\\s+html)', contentName: 'meta.embedded.block.html', end: '(?i:end\\-exec)', name: 'keyword.verb.cobol', patterns: [{include: 'text.html.basic'}] }, { begin: '(?i:exec\\s+java)', contentName: 'meta.embedded.block.java', end: '(?i:end\\-exec)', name: 'keyword.verb.cobol', patterns: [{include: 'source.java'}] }, { captures: { 1: {name: 'punctuation.definition.string.begin.cobol'}, 2: {name: 'support.function.cobol'}, 3: {name: 'punctuation.definition.string.end.cobol'} }, match: '(")(CBL_.*)(")' }, { captures: { 1: {name: 'punctuation.definition.string.begin.cobol'}, 2: {name: 'support.function.cobol'}, 3: {name: 'punctuation.definition.string.end.cobol'} }, match: '(")(PC_.*)(")' }, { begin: '"', beginCaptures: {0: {name: 'punctuation.definition.string.begin.cobol'}}, end: '("|$)', endCaptures: {0: {name: 'punctuation.definition.string.end.cobol'}}, name: 'string.quoted.double.cobol' }, { captures: { 1: {name: 'punctuation.definition.string.begin.cobol'}, 2: {name: 'support.function.cobol'}, 3: {name: 'punctuation.definition.string.end.cobol'} }, match: "(\\')(CBL_.*)(\\')" }, { captures: { 1: {name: 'punctuation.definition.string.begin.cobol'}, 2: {name: 'support.function.cobol'}, 3: {name: 'punctuation.definition.string.end.cobol'} }, match: "(\\')(PC_.*)(\\')" }, { begin: "'", beginCaptures: {0: {name: 'punctuation.definition.string.begin.cobol'}}, end: "('|$)", endCaptures: {0: {name: 'punctuation.definition.string.end.cobol'}}, name: 'string.quoted.single.cobol' }, { begin: '(?|<=|>=|<>|\\+|\\-|\\*|\\/|(?