// This is a TextMate grammar distributed by `starry-night`. // This grammar is developed at // // and licensed `apache-2.0`. // See for more info. /** * @import {Grammar} from '@wooorm/starry-night' */ /** @type {Grammar} */ const grammar = { extensions: ['.wit'], names: ['webassembly-interface-type', 'wit'], patterns: [ {include: '#comment'}, {include: '#feature-gate'}, {include: '#package'}, {include: '#toplevel-use'}, {include: '#world'}, {include: '#interface'}, {include: '#whitespace'} ], repository: { 'block-comments': { patterns: [ {match: '/\\*\\*/', name: 'comment.block.empty.wit'}, { applyEndPatternLast: true, begin: '/\\*\\*', end: '\\*/', name: 'comment.block.documentation.wit', patterns: [ {include: '#block-comments'}, {include: '#markdown'}, {include: '#whitespace'} ] }, { applyEndPatternLast: true, begin: '/\\*(?!\\*)', end: '\\*/', name: 'comment.block.wit', patterns: [{include: '#block-comments'}, {include: '#whitespace'}] } ] }, boolean: {match: '\\b(bool)\\b', name: 'entity.name.type.boolean.wit'}, comment: { patterns: [ {include: '#block-comments'}, {include: '#doc-comment'}, {include: '#line-comment'} ] }, container: { name: 'meta.container.ty.wit', patterns: [ {include: '#tuple'}, {include: '#list'}, {include: '#option'}, {include: '#result'}, {include: '#handle'} ] }, 'doc-comment': { begin: '^\\s*///', end: '$', name: 'comment.line.documentation.wit', patterns: [{include: '#markdown'}] }, enum: { applyEndPatternLast: true, begin: '\\b(enum)\\b\\s+%?((?)', name: 'meta.handle.ty.wit' }, identifier: { match: '\\b%?((?)', endCaptures: {1: {name: 'punctuation.brackets.angle.end.wit'}}, name: 'meta.list.ty.wit', patterns: [ {include: '#comment'}, {include: '#types', name: 'meta.types.list.wit'}, { captures: {1: {name: 'punctuation.comma.wit'}}, match: '\\s*(,)\\s*', name: 'meta.list-size-separator.wit' }, { captures: {1: {name: 'constant.numeric.integer.list-size.wit'}}, match: '\\b([0-9]+)\\b', name: 'meta.list-size.wit' }, {include: '#whitespace'} ] }, markdown: { patterns: [ { captures: {1: {name: 'markup.heading.markdown'}}, match: '\\G\\s*(#+.*)$' }, { captures: {2: {name: 'punctuation.definition.quote.begin.markdown'}}, match: '\\G\\s*((\\>)\\s+)+' }, { captures: {1: {name: 'punctuation.definition.list.begin.markdown'}}, match: '\\G\\s*(\\-)\\s+' }, { captures: { 1: {name: 'markup.list.numbered.markdown'}, 2: {name: 'punctuation.definition.list.begin.markdown'} }, match: '\\G\\s*(([0-9]+\\.)\\s+)' }, {captures: {1: {name: 'markup.italic.markdown'}}, match: '(`.*?`)'}, {captures: {1: {name: 'markup.bold.markdown'}}, match: '\\b(__.*?__)'}, {captures: {1: {name: 'markup.italic.markdown'}}, match: '\\b(_.*?_)'}, { captures: {1: {name: 'markup.bold.markdown'}}, match: '(\\*\\*.*?\\*\\*)' }, {captures: {1: {name: 'markup.italic.markdown'}}, match: '(\\*.*?\\*)'} ] }, 'named-type-list': { applyEndPatternLast: true, begin: '\\b%?((?', name: 'punctuation.brackets.angle.end.wit'}, {match: '\\*', name: 'keyword.operator.star.wit'}, {match: '\\-\\>', name: 'keyword.operator.arrow.skinny.wit'} ] }, option: { applyEndPatternLast: true, begin: '\\b(option)\\b(\\<)', beginCaptures: { 1: {name: 'entity.name.type.option.wit'}, 2: {name: 'punctuation.brackets.angle.begin.wit'} }, end: '(\\>)', endCaptures: {1: {name: 'punctuation.brackets.angle.end.wit'}}, name: 'meta.option.ty.wit', patterns: [ {include: '#comment'}, {include: '#types', name: 'meta.types.option.wit'}, {include: '#whitespace'} ] }, package: { captures: { 1: {name: 'storage.modifier.package-decl.wit'}, 2: { name: 'meta.id.package-decl.wit', patterns: [ { captures: { 1: { name: 'entity.name.namespace.package-identifier.wit', patterns: [{include: '#identifier'}] }, 2: {name: 'keyword.operator.namespace.package-identifier.wit'}, 3: { name: 'entity.name.type.package-identifier.wit', patterns: [{include: '#identifier'}] }, 5: {name: 'keyword.operator.versioning.package-identifier.wit'}, 6: {name: 'constant.numeric.versioning.package-identifier.wit'} }, match: '([^\\:]+)(\\:)([^\\@]+)((\\@)([^\\s]+))?', name: 'meta.package-identifier.wit' } ] } }, match: '^(package)\\s+([^\\s]+)\\s*', name: 'meta.package-decl.wit' }, 'parameter-list': { applyEndPatternLast: true, begin: '(\\()', beginCaptures: {1: {name: 'punctuation.brackets.round.begin.wit'}}, end: '(\\))', endCaptures: {1: {name: 'punctuation.brackets.round.end.wit'}}, name: 'meta.param-list.wit', patterns: [ {include: '#comment'}, {include: '#named-type-list'}, {include: '#whitespace'} ] }, primitive: { name: 'meta.primitive.ty.wit', patterns: [ {include: '#numeric'}, {include: '#boolean'}, {include: '#string'} ] }, record: { applyEndPatternLast: true, begin: '\\b(record)\\b\\s+%?((?)', endCaptures: {1: {name: 'punctuation.brackets.angle.end.wit'}}, name: 'meta.result.ty.wit', patterns: [ {include: '#comment'}, { match: '(?)', beginCaptures: {1: {name: 'keyword.operator.arrow.skinny.wit'}}, end: '((?<=\\n)|(?=\\}))', name: 'meta.result-list.wit', patterns: [ {include: '#comment'}, {include: '#types'}, {include: '#parameter-list'}, {include: '#whitespace'} ] }, string: {match: '\\b(string|char)\\b', name: 'entity.name.type.string.wit'}, 'toplevel-use': { captures: { 1: {name: 'keyword.other.use.toplevel-use-item.wit'}, 2: { name: 'meta.interface.toplevel-use-item.wit', patterns: [ { match: '\\b%?((?)', endCaptures: {1: {name: 'punctuation.brackets.angle.end.wit'}}, name: 'meta.tuple.ty.wit', patterns: [ {include: '#comment'}, {include: '#types', name: 'meta.types.tuple.wit'}, {match: '(\\,)', name: 'punctuation.comma.wit'}, {include: '#whitespace'} ] }, 'type-definition': { applyEndPatternLast: true, begin: '\\b(type)\\b\\s+%?((?