{"name":"vscode-textmate","version":"9.2.1","author":{"name":"Microsoft Corporation"},"license":"MIT","_id":"vscode-textmate@9.2.1","maintainers":[{"name":"alexandrudima","email":"alexdima@microsoft.com"},{"name":"microsoft1es","email":"npmjs@microsoft.com"},{"name":"lszomoru","email":"lszomoru@microsoft.com"},{"name":"vscode-bot","email":"vscode-bot-npm@microsoft.com"}],"homepage":"https://github.com/microsoft/vscode-textmate#readme","bugs":{"url":"https://github.com/microsoft/vscode-textmate/issues"},"tag":"latest","dist":{"shasum":"d0e8138270d8189e7c9d1244a2879ba1da7cf46e","tarball":"http://registry-npm.ywwl.com/vscode-textmate/download/vscode-textmate-9.2.1.tgz","fileCount":5,"integrity":"sha512-eXiUi2yYFv9bdvgrYtJynA7UemCEkpVNE50S9iBBA08LYG5t9+/TB+8IRS/YoYOubCez2OkSyZ1Q12eQMwzbrw==","signatures":[{"sig":"MEQCIDVKLMoFlouvRuob4UWo0BJExv98/f0/BHTb+MWhg6NQAiBY3D4d6IDfgcD9T6k5nmdyNcNKWIIH5x72dJpPFQrNaA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":90344,"size":24617,"noattachment":false,"key":"/vscode-textmate/-/vscode-textmate-9.2.1.tgz"},"main":"./release/main.js","_from":"file:M:\\SvcFab\\_App\\MS.Ess.PackageManager.Publisher_App2\\temp\\a8f22da4-e750-4dbe-8351-0a337d7eecfc\\vscode-textmate-9.2.1.tgz","scripts":{"test":"mocha --ui=tdd ./out/tests/all.test.js","watch":"tsc --watch","bundle":"webpack && npm run api-extractor","compile":"tsc","inspect":"node out/tests/inspect.js","version":"npm run compile && npm run test","benchmark":"node benchmark/benchmark.js","tmconvert":"node scripts/tmconvert.js","postversion":"git push && git push --tags","api-extractor":"mkdirp etc && npx api-extractor run --local","prepublishOnly":"tsc && webpack --progress && npm run api-extractor"},"typings":"./types/vscode-textmate.d.ts","_npmUser":{"name":"microsoft1es","email":"npmjs@microsoft.com"},"_resolved":"M:\\SvcFab\\_App\\MS.Ess.PackageManager.Publisher_App2\\temp\\a8f22da4-e750-4dbe-8351-0a337d7eecfc\\vscode-textmate-9.2.1.tgz","_integrity":"sha512-eXiUi2yYFv9bdvgrYtJynA7UemCEkpVNE50S9iBBA08LYG5t9+/TB+8IRS/YoYOubCez2OkSyZ1Q12eQMwzbrw==","repository":{"url":"git+https://github.com/microsoft/vscode-textmate.git","type":"git"},"description":"VSCode TextMate grammar helpers","directories":{},"_nodeVersion":"18.5.0","_hasShrinkwrap":false,"devDependencies":{"mocha":"^11.1.0","mkdirp":"^3.0.1","webpack":"^5.50.0","typescript":"^4.3.5","@types/node":"^16.6.1","webpack-cli":"^4.8.0","@types/mocha":"^9.1.0","vscode-oniguruma":"^1.5.1","copy-webpack-plugin":"^9.1.0","@microsoft/api-extractor":"^7.48.0"},"_npmOperationalInternal":{"tmp":"tmp/vscode-textmate_9.2.1_1759613458659_0.06703293474709415","host":"s3://npm-registry-packages-npm-production"},"readme":"# VSCode TextMate [![Build Status](https://dev.azure.com/ms/vscode-textmate/_apis/build/status/microsoft.vscode-textmate?branchName=master)](https://dev.azure.com/ms/vscode-textmate/_build/latest?definitionId=172&branchName=master)\n\nAn interpreter for grammar files as defined by TextMate. TextMate grammars use the oniguruma dialect (https://github.com/kkos/oniguruma). Supports loading grammar files from JSON or PLIST format. This library is used in VS Code. Cross - grammar injections are currently not supported.\n\n## Installing\n\n```sh\nnpm install vscode-textmate\n```\n\n## Using\n\n```javascript\nconst fs = require('fs');\nconst path = require('path');\nconst vsctm = require('vscode-textmate');\nconst oniguruma = require('vscode-oniguruma');\n\n/**\n * Utility to read a file as a promise\n */\nfunction readFile(path) {\n    return new Promise((resolve, reject) => {\n        fs.readFile(path, (error, data) => error ? reject(error) : resolve(data));\n    })\n}\n\nconst wasmBin = fs.readFileSync(path.join(__dirname, './node_modules/vscode-oniguruma/release/onig.wasm')).buffer;\nconst vscodeOnigurumaLib = oniguruma.loadWASM(wasmBin).then(() => {\n    return {\n        createOnigScanner(patterns) { return new oniguruma.OnigScanner(patterns); },\n        createOnigString(s) { return new oniguruma.OnigString(s); }\n    };\n});\n\n// Create a registry that can create a grammar from a scope name.\nconst registry = new vsctm.Registry({\n    onigLib: vscodeOnigurumaLib,\n    loadGrammar: (scopeName) => {\n        if (scopeName === 'source.js') {\n            // https://github.com/textmate/javascript.tmbundle/blob/master/Syntaxes/JavaScript.plist\n            return readFile('./JavaScript.plist').then(data => vsctm.parseRawGrammar(data.toString()))\n        }\n        console.log(`Unknown scope name: ${scopeName}`);\n        return null;\n    }\n});\n\n// Load the JavaScript grammar and any other grammars included by it async.\nregistry.loadGrammar('source.js').then(grammar => {\n    const text = [\n        `function sayHello(name) {`,\n        `\\treturn \"Hello, \" + name;`,\n        `}`\n    ];\n    let ruleStack = vsctm.INITIAL;\n    for (let i = 0; i < text.length; i++) {\n        const line = text[i];\n        const lineTokens = grammar.tokenizeLine(line, ruleStack);\n        console.log(`\\nTokenizing line: ${line}`);\n        for (let j = 0; j < lineTokens.tokens.length; j++) {\n            const token = lineTokens.tokens[j];\n            console.log(` - token from ${token.startIndex} to ${token.endIndex} ` +\n              `(${line.substring(token.startIndex, token.endIndex)}) ` +\n              `with scopes ${token.scopes.join(', ')}`\n            );\n        }\n        ruleStack = lineTokens.ruleStack;\n    }\n});\n\n/* OUTPUT:\n\nUnknown scope name: source.js.regexp\n\nTokenizing line: function sayHello(name) {\n - token from 0 to 8 (function) with scopes source.js, meta.function.js, storage.type.function.js\n - token from 8 to 9 ( ) with scopes source.js, meta.function.js\n - token from 9 to 17 (sayHello) with scopes source.js, meta.function.js, entity.name.function.js\n - token from 17 to 18 (() with scopes source.js, meta.function.js, punctuation.definition.parameters.begin.js\n - token from 18 to 22 (name) with scopes source.js, meta.function.js, variable.parameter.function.js\n - token from 22 to 23 ()) with scopes source.js, meta.function.js, punctuation.definition.parameters.end.js\n - token from 23 to 24 ( ) with scopes source.js\n - token from 24 to 25 ({) with scopes source.js, punctuation.section.scope.begin.js\n\nTokenizing line:        return \"Hello, \" + name;\n - token from 0 to 1 (  ) with scopes source.js\n - token from 1 to 7 (return) with scopes source.js, keyword.control.js\n - token from 7 to 8 ( ) with scopes source.js\n - token from 8 to 9 (\") with scopes source.js, string.quoted.double.js, punctuation.definition.string.begin.js\n - token from 9 to 16 (Hello, ) with scopes source.js, string.quoted.double.js\n - token from 16 to 17 (\") with scopes source.js, string.quoted.double.js, punctuation.definition.string.end.js\n - token from 17 to 18 ( ) with scopes source.js\n - token from 18 to 19 (+) with scopes source.js, keyword.operator.arithmetic.js\n - token from 19 to 20 ( ) with scopes source.js\n - token from 20 to 24 (name) with scopes source.js, support.constant.dom.js\n - token from 24 to 25 (;) with scopes source.js, punctuation.terminator.statement.js\n\nTokenizing line: }\n - token from 0 to 1 (}) with scopes source.js, punctuation.section.scope.end.js\n\n*/\n\n```\n\n## For grammar authors\n\nSee [vscode-tmgrammar-test](https://github.com/PanAeon/vscode-tmgrammar-test) that can help you write unit tests against your grammar.\n\n## API doc\n\nSee [the main.ts file](./src/main.ts)\n\n## Developing\n\n* Clone the repository\n* Run `npm install`\n* Compile in the background with `npm run watch`\n* Run tests with `npm test`\n* Run benchmark with `npm run benchmark`\n* Troubleshoot a grammar with `npm run inspect -- PATH_TO_GRAMMAR PATH_TO_FILE`\n\n## Code of Conduct\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n\n\n## License\n[MIT](https://github.com/Microsoft/vscode-textmate/blob/master/LICENSE.md)\n\n","publish_time":1759613458855,"_cnpm_publish_time":1759613458855,"dist-tags":{"latest":"9.3.2","next":"4.0.0-next.3"}}