{"name":"vscode-textmate","version":"7.0.0","description":"VSCode TextMate grammar helpers","author":{"name":"Microsoft Corporation"},"main":"./release/main.js","typings":"./release/main.d.ts","repository":{"type":"git","url":"git+https://github.com/microsoft/vscode-textmate.git"},"license":"MIT","bugs":{"url":"https://github.com/microsoft/vscode-textmate/issues"},"scripts":{"watch":"tsc --watch","compile":"tsc","test":"mocha --ui=tdd ./out/tests/all.test.js","benchmark":"node benchmark/benchmark.js","inspect":"node out/tests/inspect.js","tmconvert":"node scripts/tmconvert.js","version":"npm run compile && npm run test && node scripts/release.js","postversion":"git push && git push --tags","prepublishOnly":"tsc && webpack --progress && node scripts/release.js"},"devDependencies":{"@types/node":"^16.6.1","@types/mocha":"^9.1.0","mocha":"^9.2.2","typescript":"^4.3.5","vscode-oniguruma":"^1.5.1","webpack":"^5.50.0","webpack-cli":"^4.8.0"},"gitHead":"57f23511608c513e146b86b789255b33009a7650","homepage":"https://github.com/microsoft/vscode-textmate#readme","_id":"vscode-textmate@7.0.0","_nodeVersion":"16.14.2","_npmVersion":"8.5.0","dist":{"integrity":"sha512-27bFXGG5JtLrq/reWnkCxkfNq7gnFko7xORba2Gznokx2LmPpHfu880a44B1jPyoFiGNjprZ883qiYTvR/P+pA==","shasum":"6c90a591c1291e80c6783bddf43e841ad6f8ccc3","tarball":"http://registry-npm.ywwl.com/vscode-textmate/download/vscode-textmate-7.0.0.tgz","fileCount":12,"unpackedSize":337634,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCck7Dw7BtJZmqka3ITG+poU/fPdpK3bKKGPLulSLjk7gIhAMCO7VdKUWJnSNKMs4AfBSPr21EWY0O/dj1F48XwwWPJ"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiTteNACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqktQ//bdR8OViBkH6nFTuS/+jhtS6nyB9+uyykl6Ex2kxwXPRSdbvy\r\nYpnFeChl8QIte0XkXn8YaI7KRl3p8RAXwRHABtpQo8swUmiyKcELsNqQLp/T\r\nDlROJQxS3IJLtv5kgP523+r/8OoawgojZ3XprLJ0cd8eaZNSd+H6p1Pttj90\r\nyKOeN05m7JpQ1JAJTBKWFG0y7BTzBGm4N62OJ5Grq4NGNpMy5cupxMIGlMSr\r\nOzQvVyCBvWGpxNlL8RZir3fGigWH/xEk6aciL9FFl/yTuX2EmSfZ0K85Wj8G\r\n7FUFzKIPASgHvlfwMn2Vq/lzxq00UQUMwVAJmiJ+WXWAFrfVTU+GFsuAPZrh\r\neVXDMXM7Wk2K15wAi5ylWEuhCMORhtDnZCP2bEd7vgbMlX+pE/YqhlY1DKqh\r\n8Z5ksCxdi+wNsC+Qv5RTQHwbIhL+GqILS7R5fCJGxNi+QfglQSHQTxcrjNFe\r\n7Dn/7y9t6sZT7ySqR5rEpdEHFRxEGCq8iMHsu2HT6Cwf7xjCcqd+hbPZUsRm\r\nLbsRV8+mXoC+NtCd91KkoS2eWpfTXxhc8aN2mKU5h2ZJFFq+PZ0i1uh1ONdY\r\nIu1n8dfMf+3GpqOzj4olBM45l43hrl+ABPUTW0pbCVVQEodZot8V25ttLnrL\r\nSaivB8gV4JdlPizlBWtEhvmnDx54dMGduUI=\r\n=+ChJ\r\n-----END PGP SIGNATURE-----\r\n","size":81109,"noattachment":false,"key":"/vscode-textmate/-/vscode-textmate-7.0.0.tgz"},"_npmUser":{"name":"alexandrudima","email":"alexdima@microsoft.com"},"directories":{},"maintainers":[{"name":"mattbierner","email":"mattbierner@gmail.com"},{"name":"egamma","email":"egamma@microsoft.com"},{"name":"alexandrudima","email":"alexdima@microsoft.com"},{"name":"aeschli","email":"martinae@microsoft.com"},{"name":"bpasero","email":"benjpas@microsoft.com"},{"name":"hediet-msft","email":"hdieterichs@microsoft.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vscode-textmate_7.0.0_1649334157223_0.4436602949056041"},"_hasShrinkwrap":false,"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":1649334157494,"_cnpm_publish_time":1649334157494,"dist-tags":{"latest":"9.3.2","next":"4.0.0-next.3"}}