{"name":"vscode-textmate","version":"4.0.0-next.2","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":"^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":"d9106a0e3ba03eb7426d855702ce2a81b26a44bd","homepage":"https://github.com/Microsoft/vscode-textmate#readme","_id":"vscode-textmate@4.0.0-next.2","_npmVersion":"5.5.1","_nodeVersion":"8.9.1","_npmUser":{"name":"aeschli","email":"martinae@microsoft.com"},"dist":{"integrity":"sha512-vxJwI7rx1q6k5epoqpAnQ5vRxRXuetfbRaTKGW26zLVWkUgoKRUTWW1wKy4MlQqPQCOzHV4MvmNSa8fjQC4u6w==","shasum":"03b6c1feb7d297cb70e24cc1166ce2d5c619e440","tarball":"http://registry-npm.ywwl.com/vscode-textmate/download/vscode-textmate-4.0.0-next.2.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\nwsFcBAEBCAAQBQJbJ7y2CRA9TVsSAnZWagAAuewP/36zOoZJray5klJ9qa5V\nSK4K/niiD5F49/c2rtgPDsy6lnDHYmgXKwGxVhOcyBMY88BKNjBMVKeeXUVQ\n9SqatcbK5pk/ZB4fnFLW9ExwFLEzfMlEBULatiiR8NPdQoAWnz68NCTkDDOu\nBMfEdvCKaFbQIYDf6vDopbdguPkwkYg3u6CQnlRgmhCo8c6jKVZq7gV5T6mb\nTEWqw97XGwnkueB1SFjdGA3Rtx+JD+XKfO2Q1RG+j8M2m2Sp/Pw912sizK+c\nyjR+k62o8STGe29QcjcWdxCr+pU20nlkpZKrEcN5hA/BWRYEiUbf+nkGY04m\nU0r0SzWncIGhLBTLpQOF2yqeE+A7L2iYvS09+kAtd2o8leIf/wk58lbFEwr8\nGJZeLgPB4b4ZFvyQtZQ+VPKtEJsOTwdpM+aPANW+yPqY+PYqHLxw+v9qXKAx\nbFlgi4ULj5iwX8o4K7EYoBKQyuLFgOaMRRuUEhgkM0/x+hrtBAZJpaCWa2vr\nNE37Fzm/kcSIamihUZn/ceWbOW7IV+ikAbK21MgScAYFGKyoujC7fyOf+pgL\nHFnVdQgzF9u8dSRn4durrE1P89vc+s63/aZOm073SlQ7X2AxAmBT4EaTdPKq\nqepnE6+FKJnHcdCLr+yZITUr+Q+3mQBf/UgjOI32hPu6Nv8I1YlXSr3nooPY\nxefX\r\n=QycR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCnRTP1nnQB1l8objA4HsFlHkUbWwOaqGvRL53kYaOUVgIgAo3E/3emTGP6N7y61Tj38RLI/vagwLccDhS4fcP2syc="}],"size":27472,"noattachment":false,"key":"/vscode-textmate/-/vscode-textmate-4.0.0-next.2.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.2_1529330870220_0.8728438945433723"},"_hasShrinkwrap":false,"publish_time":1529330870275,"_cnpm_publish_time":1529330870275,"dist-tags":{"latest":"9.3.2","next":"4.0.0-next.3"}}