// 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: [ '.lua', '.fcgi', '.nse', '.p8', '.pd_lua', '.rbxs', '.rockspec', '.wlua' ], names: ['lua'], patterns: [ { begin: '\\b(?:(local)\\s+)?(function)\\b(?![,:])', beginCaptures: { 1: {name: 'keyword.local.lua'}, 2: {name: 'keyword.control.lua'} }, end: '(?<=[\\)\\-{}\\[\\]"\'])', name: 'meta.function.lua', patterns: [ {include: '#comment'}, { begin: '(\\()', beginCaptures: { 1: {name: 'punctuation.definition.parameters.begin.lua'} }, end: '(\\))|(?=[\\-{}\\[\\]"\'])|(?' }, { match: '\\<[a-zA-Z_\\*][a-zA-Z0-9_\\.\\*\\-]*\\>', name: 'storage.type.generic.lua' }, { match: '\\b(break|do|else|for|if|elseif|goto|return|then|repeat|while|until|end|in)\\b', name: 'keyword.control.lua' }, {match: '\\b(local)\\b', name: 'keyword.local.lua'}, { captures: {1: {name: 'keyword.global.lua'}}, match: '^\\s*(global)\\b(?!\\s*=)' }, {match: '\\b(function)\\b(?![,:])', name: 'keyword.control.lua'}, { match: '(?=?|(?|\\<', name: 'keyword.operator.lua'} ] }, { begin: '(?<=---)[ \\t]*@see', beginCaptures: {0: {name: 'storage.type.annotation.lua'}}, end: '(?=[\\n@#])', patterns: [ { match: '\\b([a-zA-Z_\\*][a-zA-Z0-9_\\.\\*\\-]*)', name: 'support.class.lua' }, {match: '#', name: 'keyword.operator.lua'} ] }, { begin: '(?<=---)[ \\t]*@diagnostic', beginCaptures: {0: {name: 'storage.type.annotation.lua'}}, end: '(?=[\\n@#])', patterns: [ { begin: '([a-zA-Z_\\-0-9]+)[ \\t]*(:)?', beginCaptures: { 1: {name: 'keyword.other.unit'}, 2: {name: 'keyword.operator.unit'} }, end: '(?=\\n)', patterns: [ { match: '\\b([a-zA-Z_\\*][a-zA-Z0-9_\\-]*)', name: 'support.class.lua' }, {match: ',', name: 'keyword.operator.lua'} ] } ] }, { begin: '(?<=---)[ \\t]*@module', beginCaptures: {0: {name: 'storage.type.annotation.lua'}}, end: '(?=[\\n@#])', patterns: [{include: '#string'}] }, { match: '(?<=---)[ \\t]*@(async|nodiscard)', name: 'storage.type.annotation.lua' }, { begin: '(?<=---)\\|\\s*[\\>\\+]?', beginCaptures: {0: {name: 'storage.type.annotation.lua'}}, end: '(?=[\\n@#])', patterns: [{include: '#string'}] } ] }, 'emmydoc.type': { patterns: [ { begin: '\\bfun\\b', beginCaptures: {0: {name: 'keyword.control.lua'}}, end: '(?=[\\s#])', patterns: [ { match: '[\\(\\),\\:\\?\\[\\]\\<\\>][ \\t]*', name: 'keyword.operator.lua' }, { match: '([a-zA-Z_][a-zA-Z0-9_\\.\\*\\-]*)(?', name: 'storage.type.generic.lua' }, {match: '\\basync\\b', name: 'entity.name.tag.lua'}, {match: '[\\{\\}\\:\\,\\?\\|\\`][ \\t]*', name: 'keyword.operator.lua'}, { begin: '(?=[a-zA-Z_\\.\\*"\'\\[])', end: '(?=[\\s\\)\\,\\?\\:\\}\\|#])', patterns: [ { match: '([a-zA-Z0-9_\\.\\*\\[\\]\\<\\>\\,\\-]+)(?