{"name":"vscode-textmate","version":"4.0.0-next.3","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":"npm run compile && mocha out/tests/*.test.js","test-travis":"istanbul cover ./node_modules/mocha/bin/_mocha -- -R spec out/tests/","benchmark":"node benchmark/benchmark.js","inspect":"node scripts/inspect.js","prepublishOnly":"node scripts/release.js"},"dependencies":{"oniguruma":"^7.0.0"},"devDependencies":{"@types/mocha":"2.2.39","@types/node":"^7.0.43","coveralls":"^2.11.12","durations":"^3.4.1","istanbul":"^0.4.4","mocha":"^3.0.2","onigasm":"^2.1.0","remap-istanbul":"^0.6.4","tslint":"^3.15.1","typescript":"^2.0.8","typings":"^1.3.2"},"readme":"# VSCode TextMate [![Build Status](https://travis-ci.org/Microsoft/vscode-textmate.svg?branch=master)](https://travis-ci.org/Microsoft/vscode-textmate) [![Coverage Status](https://coveralls.io/repos/github/Microsoft/vscode-textmate/badge.svg?branch=master)](https://coveralls.io/github/Microsoft/vscode-textmate?branch=master)\r\n\r\nAn interpreter for grammar files as defined by TextMate. Supports loading grammar files from JSON or PLIST format. Cross - grammar injections are currently not supported.\r\n\r\n## Installing\r\n\r\n```sh\r\nnpm install vscode-textmate\r\n```\r\n\r\n## Using\r\n\r\n```javascript\r\nvar vsctm = require('vscode-textmate');\r\nvar grammarPaths = {\r\n\t'source.js': './javascript.tmbundle/Syntaxes/JavaScript.plist'\r\n};\r\n\r\nvar registry = new vsctm.Registry({\r\n\tloadGrammar: function (scopeName) {\r\n\t\tvar path = grammarPaths[scopeName];\r\n\t\tif (path) {\r\n\t\t\treturn new Promise((c,e) => {\r\n\t\t\t\tfs.readFile(path, (error, content) => {\r\n\t\t\t\t\tif (error) {\r\n\t\t\t\t\t\te(error);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tvar rawGrammar = vsctm.parseRawGrammar(content.toString(), path);\r\n\t\t\t\t\t\tc(rawGrammar);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n});\r\n\r\n// Load the JavaScript grammar and any other grammars included by it async.\r\nregistry.loadGrammar('source.js').then(grammar => {\r\n\t// at this point `grammar` is available...\r\n\tvar lineTokens = grammar.tokenizeLine('function add(a,b) { return a+b; }');\r\n\tfor (var i = 0; i < lineTokens.tokens.length; i++) {\r\n\t\tvar token = lineTokens.tokens[i];\r\n\t\tconsole.log('Token from ' + token.startIndex + ' to ' + token.endIndex + ' with scopes ' + token.scopes);\r\n\t}\r\n});\r\n\r\n```\r\n\r\n## Tokenizing multiple lines\r\n\r\nTo tokenize multiple lines, you must pass in the previous returned `ruleStack`.\r\n\r\n```javascript\r\nvar ruleStack = null;\r\nfor (var i = 0; i < lines.length; i++) {\r\n\tvar r = grammar.tokenizeLine(lines[i], ruleStack);\r\n\tconsole.log('Line: #' + i + ', tokens: ' + r.tokens);\r\n\truleStack = r.ruleStack;\r\n}\r\n```\r\n\r\n## API doc\r\n\r\nSee [the main.ts file](./src/main.ts)\r\n\r\n## Developing\r\n\r\n* Clone the repository\r\n* Run `npm install`\r\n* Compile in the background with `npm run watch`\r\n* Run tests with `npm test`\r\n* Run benchmark with `npm run benchmark`\r\n* Troubleshoot a grammar with `npm run inspect -- PATH_TO_GRAMMAR PATH_TO_FILE`\r\n\r\n## Code of Conduct\r\n\r\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.\r\n\r\n\r\n## License\r\n[MIT](https://github.com/Microsoft/vscode-textmate/blob/master/LICENSE.md)\r\n\r\n","readmeFilename":"README.md","gitHead":"187dbe03b4667f7b1a501e5631daab7cfb09265d","homepage":"https://github.com/Microsoft/vscode-textmate#readme","_id":"vscode-textmate@4.0.0-next.3","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"aeschli","email":"martinae@microsoft.com"},"dist":{"integrity":"sha512-EpKK2McGNH+K5pvj+227RzDgFyaoTYi75Cr163sTBPElP0u8bYoHPnZEHJxCriXDZrrQZU8MhXttB2vhV+zvbw==","shasum":"238ded8024be3da13df69d777295399e6606bd6c","tarball":"http://registry-npm.ywwl.com/vscode-textmate/download/vscode-textmate-4.0.0-next.3.tgz","fileCount":6,"unpackedSize":154182,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbKRD8CRA9TVsSAnZWagAAHjIP/AlmV3jNw0kQ19IsbB8Z\ndPG4n1kD3gQxVo7iA2oIPy8N+Jn5hYSA5Hbxrh1Q/4c/xv9jKl5E/3vOkAmT\ncQTtdzxMWs3s3PJgCgwjXscCSL+yHm5qBBMSK+rNIIPIQ9min6V8WZ7o+Oum\nFz1hsB6Njd8yN8KAy44AWCmN9ko62xQfHYCSlSDYTDvgl5fK8jGNTZDjh++3\n/YUJw2e0RMilWkfpz8mS/S/cGrTXj+IrMvaw4kB9NdXUNqQ1dRKeMPriZnOh\nAAvloJQCZPzCw9N8r+/lxCYaSGUMUPFx+J/XCS5Rox/B4g96+PN2osznWxjc\ngz5xr+xFzmKA/zVxnpcQjaOqDYI96rZLzylPUbKpDlsa72xHgbwneG3tcCz9\nUYa48yYTXfbQ4yQ4WGNRxoGTU6grTWUE8DVN9aBbf9vdG+fW07Mi8O39/+N5\nkuO1vyvKAhcgAls3cYOTLpk8pphjXJ78GaSyrn+a41elLB3lRcxDV3tF12nv\nGz9A/fJaOd0Iy8704H47J4kS26Ow3v6FoLFCNGp/0eNNrwHanqoVl33GY51c\nwRe0TU6+s4GxZNOsbqHiGU5qQXweCZHVvaxQpH+Aars/c0u6hUhHliGrLoFG\n6cgcJu9IklE1S3MWWwCuVcwEUWGSdkZMEwVIm0CRwn3OuXSIkBNj21SUTVci\nMIa6\r\n=IDwR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEjpMABr4R6BWyrGLc27dr/YKgQgB5fl/E7ZgPmAJdrRAiEAx5terK5PJAR8k292KQblg+zHG3QCTMDyX0psO3MFS7E="}],"size":29203,"noattachment":false,"key":"/vscode-textmate/-/vscode-textmate-4.0.0-next.3.tgz"},"maintainers":[{"name":"aeschli","email":"martinae@microsoft.com"},{"name":"alexandrudima","email":"alexdima@microsoft.com"},{"name":"bpasero","email":"benjpas@microsoft.com"},{"name":"egamma","email":"egamma@microsoft.com"},{"name":"mattbierner","email":"mattbierner@gmail.com"},{"name":"microsoft","email":"npmjs@microsoft.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vscode-textmate_4.0.0-next.3_1529417979662_0.23051883427762365"},"_hasShrinkwrap":false,"publish_time":1529417979739,"_cnpm_publish_time":1529417979739,"dist-tags":{"latest":"9.3.2","next":"4.0.0-next.3"}}