{"name":"vscode-textmate","version":"4.0.0-next.1","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":{"fast-plist":"^0.1.2","oniguruma":"^6.0.1"},"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":"7d87dd3149efa482efd650e84269ab0ff7ab260f","homepage":"https://github.com/Microsoft/vscode-textmate#readme","_id":"vscode-textmate@4.0.0-next.1","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"aeschli","email":"martinae@microsoft.com"},"dist":{"integrity":"sha512-1Yp1p/C0cbjcKcXW3NgOJUiaPzTJTnuAy5bmRkGHiCjzZcAY4o+en8buc2iyVZSVJE7CmWfnj8NwDFs4PVLNPA==","shasum":"7a8ec11a0d09cdca60d8294f8ea507260559b7c3","tarball":"http://registry-npm.ywwl.com/vscode-textmate/download/vscode-textmate-4.0.0-next.1.tgz","fileCount":6,"unpackedSize":140981,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbJ43cCRA9TVsSAnZWagAAz4MP/jp+KfAjYzDZl1+4QXMd\ndYdEmL7kAnEOirxiSxYDMSt6t0kMk280VPk0ZPyuBOs2/Ofhn1WUTNkTjX2i\nnCBmcBJsqXDugGc+2UCtLEfmdCZOqrcVVzpvwdFm1vMGRqO0vv90c99mVizc\nrPSFOP9Jg9UPRi0kro929sdcJYzPq7R9XC94ZCO7wAPFPpNTHZ3Zmm7n2gw8\nB+migEs3xemg+kBCCX0/eo78hwV7tGaEFgKMeyfgLEbBc34kKiBMF8Nl2Psy\nq3kvnILW/crFWCf4dSpZs3jWFOdNiBXYjs70FsyoMGQoH4L/Cuz5IYgGsxke\njIWB4lauLSNKw9+olgGf9IibeMoB0Fd8PQYQoLyX7HA8eP/STW/M4I5uoFEv\n/1s0auQJVgqEu3Da7M2VHDlC/SSQj6LLaMz2+epfh/W3ikZdtc3lACq7DJme\na0J6FE/DEmQZnF8hy63r+BkBJEXprO38ndv/MA2DtSHrId7mhoB+TXcHX9Ib\nLEYrelNSLdlPJirCuwaH/oHkxNiXDCpw1sr5eKaoCnsiGZ686lQMn5cguhYG\n+9kHuOS7PpH6HTx4qTeXiN90ZMNSISaef2SSX2BNwCL0JgMRVwdvhjWzL4Wb\nT4yVMGcLq7RsZNvCjtRQ8j/DYLsEgUxeRHZlppfgTYtunXu1quxrZEliY2XW\n5to9\r\n=PKzN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBr097ZsJcgIeuH2iVjB/jlRwXCrqe4mpId7LRLsYtNrAiEA8w8Bdupe60BgfxD84uIzK6NUz6IBDMFwXLLnadjl+wA="}],"size":27474,"noattachment":false,"key":"/vscode-textmate/-/vscode-textmate-4.0.0-next.1.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.1_1529318876608_0.8320175129478229"},"_hasShrinkwrap":false,"publish_time":1529318876695,"_cnpm_publish_time":1529318876695,"dist-tags":{"latest":"9.3.2","next":"4.0.0-next.3"}}