{"name":"cspell-grammar","version":"0.1.0","keywords":["grammar","tmlanguage"],"author":{"name":"Jason Dent"},"license":"MIT","_id":"cspell-grammar@0.1.0","homepage":"https://github.com/Jason3S/cspell-grammar#readme","bugs":{"url":"https://github.com/Jason3S/cspell-grammar/issues"},"bin":{"cspell-grammar":"./dist/app.js"},"nyc":{"exclude":["src/**/*.test.ts"],"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["json","html"],"extension":[".ts"]},"dist":{"shasum":"849950538dfddf5409bf3929f1b495ee94a0f751","tarball":"http://registry-npm.ywwl.com/cspell-grammar/download/cspell-grammar-0.1.0.tgz","fileCount":81,"integrity":"sha512-Ngtvjlr2wqKBBJZngty3Ilgc8krcA9bt9zQ7x/5CJzGGMkcInvLFZTCYXbkt/F9NiM1eV4VTgXnu0RJkpVRb2Q==","signatures":[{"sig":"MEUCIBrJiqz8n2SEe93UFOANN4X15ZeghTphjZhq8D7CmhrXAiEA7Em87Xj5WCcH+RxyRh8va5GiTKWcXxTZ2SjasciI7IE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":116676,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa8ML1CRA9TVsSAnZWagAAAowP/0wl46tNM/ci6PgwU3Ya\nGdHX6DaQaVpZFYWlqSunH1QDCLFki8GdkPTfw6D1dsRVxqJafJVCiazf6sQr\nS06gSIjFPIq25iy/yAUqrfVSI3st/3NUI6lDcWxIeWagzVFC9k/Fa0lBXuKn\nt/LPGyXVnJyEyDHHOFJqkqt+tYZ4AdQt4bBXuK6WxnC5wibJfrcB4l+rhGXb\nT6P1FJUnzerThcqeJSZnxhIQWMfpKGGRpw5JUBbtbZdK8Nx4vQgG+2z+AQGA\nOijOh0Cs7WKDI1vpa8uwsjdrkgxCTByhXPKnDVLTdZPqyBNx4ejTGPUEv/2+\nybk8qV8iWw/u7XEnckEIXjZkA0V8MEQcLccWmKxtkSBFHoExZUN2cBgKmWc3\nvM6UL4Kc5JYborNGVy/s6d/iycDJnqGP1G45ZUD6O3qpN3WDskm69CwiLshf\nBDCFx9dtJwzm1MkCcZyJcyTb7a1kQI9GAe5LR9VhD6yJfxH9JYyLHFQdINDB\n6jV0UCUtGnIUrKYZ3cWiWSKvSyvSgftDCDLFQjIKKUArJjZbNRheBcBoLsVF\nWR8ziB+IxVKUUqoyUxKY94thcCxQvlQRER3FIKGuWzPZJTxV8QRINxi4RY6p\njnhMh0Zv6ADYy/USxaEN16p5SZjBqBz1krQS7njq/pOeCnCHGd9CkuerZqkK\nEjuR\r\n=pYaf\r\n-----END PGP SIGNATURE-----\r\n","size":29201,"noattachment":false,"key":"/cspell-grammar/-/cspell-grammar-0.1.0.tgz"},"main":"dist/index.js","files":["dist/**","src/**","!**/*.test.*"],"engines":{"node":">=8.0.0"},"scripts":{"tsc":"tsc -p .","lint":"tslint --force --format verbose \"src/**/*.ts\"","test":"npm run test-unit","tscv":"tsc -v","build":"npm run compile","clean":"rimraf ./dist","watch":"tsc --watch -p .","compile":"tsc -p .","test-ts":"NODE_ENV=test mocha --exit --require ts-node/register --recursive --bail \"src/**/*.test.ts\"","coverage":"npm run generate-code-coverage","test-unit":"mocha --recursive \"dist/**/*.test.js\"","prepublish":"npm run lint && npm run clean-build && npm test","test-watch":"npm run build && mocha --exit --require ts-node/register --watch --recursive \"src/**/*.test.ts\"","clean-build":"npm run clean && npm run build","lint-travis":"tslint \"src/**/*.ts\"","test-ts-file":"NODE_ENV=test mocha --exit --require ts-node/register","travis-coverage":"npm run generate-code-coverage && npm run coverage-coveralls","coverage-coveralls":"nyc report --reporter=text-lcov | coveralls","generate-code-coverage":"NODE_ENV=test nyc npm run test-ts"},"typings":"dist/index.d.ts","_npmUser":{"name":"jason-dent","email":"jason@streetsidesoftware.nl"},"repository":{"url":"git+https://github.com/Jason3S/cspell-grammar.git","type":"git"},"_npmVersion":"5.6.0","description":"A tmLanguage based Grammar Parser for cSpell","directories":{},"_nodeVersion":"8.11.1","dependencies":{"chalk":"^2.4.1","xregexp":"^4.1.1","fs-extra":"^6.0.0","commander":"^2.15.0","comment-json":"^1.1.3"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^11.7.1","chai":"^4.1.2","lerna":"^2.11.0","mocha":"^5.1.1","rimraf":"^2.6.2","tslint":"^5.10.0","ts-node":"^6.0.2","coveralls":"^3.0.1","typescript":"^2.8.3","@types/chai":"^4.1.3","@types/node":"^8.10.12","@types/mocha":"^5.2.0","@types/xregexp":"^3.0.29","@types/fs-extra":"^5.0.2"},"_npmOperationalInternal":{"tmp":"tmp/cspell-grammar_0.1.0_1525727988221_0.507532508878386","host":"s3://npm-registry-packages"},"readme":"# `cspell-grammar`\n\nCSpell Grammar is used to generate a parser. The Parser is used to add context / scope to parts of a document, making it easier to define the parts to spell spell checked.\n\nThis is to address the issues and limitations related to `ignoreRegExpList` and `includeRegExpList`.\n\nThe parser is use to add `scope` to sections of a document. The `scope` can then be used to apply spell checking rules.\n\nExample: Only check comments and strings\n\n```yaml\nrules:\n  '*': false\n  comment: true\n  string: true\n```\n\nIt can be even more powerful like controlling the language settings based upon scope.\n\n```yaml\nrules:\n  comment:\n    language: en\n  string:\n    language: en,fr\n    dictionaries: ['marketing-terms'],\n    caseSensitive: true\n  string.javascript:\n    caseSensitive: false\n```\n\nRules are applied in the order they match the scope of the text.\n\nWhen checking JavaScript files with the above example rules:\n\n- strings will:\n  - use the locale `en,fr`\n  - the `marketing-terms` dictionary will be enabled\n  - `caseSensitive` will be `true`\n- everything else:\n  - locale: `en`\n  - `caseSensitive` will be `false`\n\nAt its core, `cspell-grammar` uses a simplified form of the TextMate grammar.\n\n## Reasoning\n\nWhy use a grammar parser? Couldn't a colorizer / highlighter or a language AST be used?\nAt one level, needs of the spell checker are simpler and different from colorizers or language AST parsers.\nThe goal of a spell checker is to spell check **_relevant_** text. The spell check does not need to care about\nthe syntactical correctness of a document or presentation.\n\nThe goal of a grammar parser for the spell checker is to allow the user to decide:\n\n1. What text should be checked.\n1. Which dictionaries (or languages) should be used.\n1. Are accents and case important\n\nNote: CSpell is a pure JavaScript application, so including the Oniguruma is not an option.\n\n### Considerations\n\n- Parsing a document should be fast - meaning the grammar should be as simple as possible to meet\n  the needs of the spell checker and not focus on scope detail. This is where a colorizer grammar is\n  not a good fit to be used.\n- AST's are a bit of an overkill for a spell checker. They provide too much detail while not bringing much benefit\n  from the detail.\n\n## Transformation\n\nConsider the following bit of LaTeX:\n\n```latex\nk\\\"{o}nnen\nkönnen\n```\n\n<!--- cspell:ignore können nnen   -->\n\nFor the spell checker to work correctly, the `\\\"{o}` should be transformed into `ö` before it is checked against the German dictionary.\n\nThis creates a few challenges.\n\nPossible options:\n\n1. Simple whole document substitution\n   - Challenges\n     - It is not context aware and might replace the wrong text.\n     - It changes the location of the words and messes up issue reporting (some sort of Map would be needed to get the correct line / character offset).\n\n- Advantages\n  - Easy to implement except for the context and mapping.\n\n1. Scope level substitution\n   Transformations occur at the scope level.\n   - Challenges\n     - offset mapping is still and issue (maybe)\n     - need a way to merge text with adjacent scopes after transformation\n   - Advantages\n     - it is context aware\n","publish_time":1525727988322,"maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"_cnpm_publish_time":1525727988322,"dist-tags":{"latest":"10.4.0","next":"10.4.0-alpha.1"}}