{"_id":"rst-selector-parser","_rev":"362961","name":"rst-selector-parser","description":"A CSS-based selector parser for React Standard Tree (RST) traversal","dist-tags":{"latest":"2.2.3"},"maintainers":[{"name":"aweary","email":""}],"time":{"modified":"2021-07-13T08:57:21.000Z","created":"2017-08-22T14:19:31.530Z","2.2.3":"2017-10-20T16:33:17.449Z","2.2.2":"2017-09-26T15:57:22.388Z","2.2.1":"2017-09-17T16:27:59.795Z","2.2.0":"2017-08-22T15:31:22.905Z","2.1.0":"2017-08-22T15:08:19.556Z","2.0.0":"2017-08-22T14:19:31.530Z"},"users":{},"author":{"name":"Gajus Kuizinas","email":"gajus@gajus.com","url":"http://gajus.com"},"repository":{"type":"git","url":"git+https://github.com/aweary/rst-selector-parser.git"},"versions":{"2.2.3":{"author":{"name":"Gajus Kuizinas","email":"gajus@gajus.com","url":"http://gajus.com"},"ava":{"babel":"inherit","require":["babel-register"]},"dependencies":{"lodash.flattendeep":"^4.4.0","nearley":"^2.7.10"},"description":"A CSS-based selector parser for React Standard Tree (RST) traversal","devDependencies":{"ava":"^0.17.0","babel-cli":"^6.22.2","babel-loader":"^6.2.10","babel-plugin-transform-flow-comments":"^6.22.0","babel-preset-env":"^1.1.8","babel-register":"^6.22.0","eslint":"^3.13.1","eslint-config-canonical":"^7.1.0","flow-bin":"^0.38.0","husky":"^0.13.0-1","semantic-release":"^6.3.2","webpack":"^2.2.0"},"keywords":["css","selector","parser"],"license":"BSD-3-Clause","main":"./dist/index.js","name":"rst-selector-parser","repository":{"type":"git","url":"git+https://github.com/aweary/rst-selector-parser.git"},"scripts":{"build":"npm run compile-grammar && babel ./src --out-dir ./dist --copy-files --source-maps","compile-grammar":"nearleyc ./src/grammar.ne --out ./src/grammar.js","lint":"eslint ./src ./test && flow","precommit":"npm run lint && npm run test","test":"ava --verbose"},"version":"2.2.3","gitHead":"6ff4af1a2d0e769e3b8a04ac6ba7e98fd12be0f9","bugs":{"url":"https://github.com/aweary/rst-selector-parser/issues"},"homepage":"https://github.com/aweary/rst-selector-parser#readme","_id":"rst-selector-parser@2.2.3","_shasum":"81b230ea2fcc6066c89e3472de794285d9b03d91","_from":".","_npmVersion":"2.15.11","_nodeVersion":"0.12.18","_npmUser":{"name":"aweary","email":"Kierkegaurd@gmail.com"},"dist":{"shasum":"81b230ea2fcc6066c89e3472de794285d9b03d91","size":66555,"noattachment":false,"key":"/rst-selector-parser/-/rst-selector-parser-2.2.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/rst-selector-parser/download/rst-selector-parser-2.2.3.tgz"},"maintainers":[{"name":"aweary","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rst-selector-parser-2.2.3.tgz_1508517197328_0.4197701341472566"},"directories":{},"publish_time":1508517197449,"_hasShrinkwrap":false,"_cnpm_publish_time":1508517197449},"2.2.2":{"author":{"name":"Gajus Kuizinas","email":"gajus@gajus.com","url":"http://gajus.com"},"ava":{"babel":"inherit","require":["babel-register"]},"dependencies":{"lodash.flattendeep":"^4.4.0","nearley":"^2.7.10"},"description":"A CSS-based selector parser for React Standard Tree (RST) traversal","devDependencies":{"ava":"^0.17.0","babel-cli":"^6.22.2","babel-loader":"^6.2.10","babel-plugin-transform-flow-comments":"^6.22.0","babel-preset-env":"^1.1.8","babel-register":"^6.22.0","eslint":"^3.13.1","eslint-config-canonical":"^7.1.0","flow-bin":"^0.38.0","husky":"^0.13.0-1","semantic-release":"^6.3.2","webpack":"^2.2.0"},"engines":{"node":">=5"},"keywords":["css","selector","parser"],"license":"BSD-3-Clause","main":"./dist/index.js","name":"rst-selector-parser","repository":{"type":"git","url":"git+https://github.com/aweary/rst-selector-parser.git"},"scripts":{"build":"npm run compile-grammar && babel ./src --out-dir ./dist --copy-files --source-maps","compile-grammar":"nearleyc ./src/grammar.ne --out ./src/grammar.js","lint":"eslint ./src ./test && flow","precommit":"npm run lint && npm run test","test":"ava --verbose"},"version":"2.2.2","gitHead":"6a676d45cfc04237dd23c061a33a0255e1db4faf","bugs":{"url":"https://github.com/aweary/rst-selector-parser/issues"},"homepage":"https://github.com/aweary/rst-selector-parser#readme","_id":"rst-selector-parser@2.2.2","_npmVersion":"5.4.2","_nodeVersion":"8.4.0","_npmUser":{"name":"aweary","email":"Kierkegaurd@gmail.com"},"dist":{"shasum":"9927b619bd5af8dc23a76c64caef04edf90d2c65","size":64023,"noattachment":false,"key":"/rst-selector-parser/-/rst-selector-parser-2.2.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/rst-selector-parser/download/rst-selector-parser-2.2.2.tgz"},"maintainers":[{"name":"aweary","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rst-selector-parser-2.2.2.tgz_1506441442284_0.7224349768366665"},"directories":{},"publish_time":1506441442388,"_cnpm_publish_time":1506441442388,"_hasShrinkwrap":false},"2.2.1":{"author":{"name":"Gajus Kuizinas","email":"gajus@gajus.com","url":"http://gajus.com"},"ava":{"babel":"inherit","require":["babel-register"]},"dependencies":{"lodash.flattendeep":"^4.4.0","nearley":"^2.7.10"},"description":"A CSS-based selector parser for React Standard Tree (RST) traversal","devDependencies":{"ava":"^0.17.0","babel-cli":"^6.22.2","babel-loader":"^6.2.10","babel-plugin-transform-flow-comments":"^6.22.0","babel-preset-env":"^1.1.8","babel-register":"^6.22.0","eslint":"^3.13.1","eslint-config-canonical":"^7.1.0","flow-bin":"^0.38.0","husky":"^0.13.0-1","semantic-release":"^6.3.2","webpack":"^2.2.0"},"engines":{"node":">=5"},"keywords":["css","selector","parser"],"license":"BSD-3-Clause","main":"./dist/index.js","name":"rst-selector-parser","repository":{"type":"git","url":"git+https://github.com/aweary/rst-selector-parser.git"},"scripts":{"build":"npm run compile-grammar && babel ./src --out-dir ./dist --copy-files --source-maps","compile-grammar":"nearleyc ./src/grammar.ne --out ./src/grammar.js","lint":"eslint ./src ./test && flow","precommit":"npm run lint && npm run test","test":"ava --verbose"},"version":"2.2.1","gitHead":"bdce827fe1d9564ed3ac9106aa5337f0cddce25d","bugs":{"url":"https://github.com/aweary/rst-selector-parser/issues"},"homepage":"https://github.com/aweary/rst-selector-parser#readme","_id":"rst-selector-parser@2.2.1","_npmVersion":"5.4.2","_nodeVersion":"8.4.0","_npmUser":{"name":"aweary","email":"Kierkegaurd@gmail.com"},"dist":{"shasum":"6fd271194e410dbbc72c2b1fac4d8a148b227fc5","size":64025,"noattachment":false,"key":"/rst-selector-parser/-/rst-selector-parser-2.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/rst-selector-parser/download/rst-selector-parser-2.2.1.tgz"},"maintainers":[{"name":"aweary","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rst-selector-parser-2.2.1.tgz_1505665679691_0.03746066917665303"},"directories":{},"publish_time":1505665679795,"_cnpm_publish_time":1505665679795,"_hasShrinkwrap":false},"2.2.0":{"author":{"name":"Gajus Kuizinas","email":"gajus@gajus.com","url":"http://gajus.com"},"ava":{"babel":"inherit","require":["babel-register"]},"dependencies":{"lodash.flattendeep":"^4.4.0","nearley":"^2.7.10"},"description":"A CSS-based selector parser for React Standard Tree (RST) traversal","devDependencies":{"ava":"^0.17.0","babel-cli":"^6.22.2","babel-loader":"^6.2.10","babel-plugin-transform-flow-comments":"^6.22.0","babel-preset-env":"^1.1.8","babel-register":"^6.22.0","eslint":"^3.13.1","eslint-config-canonical":"^7.1.0","flow-bin":"^0.38.0","husky":"^0.13.0-1","semantic-release":"^6.3.2","webpack":"^2.2.0"},"engines":{"node":">=5"},"keywords":["css","selector","parser"],"license":"BSD-3-Clause","main":"./dist/index.js","name":"rst-selector-parser","repository":{"type":"git","url":"git+https://github.com/aweary/rst-selector-parser.git"},"scripts":{"build":"npm run compile-grammar && babel ./src --out-dir ./dist --copy-files --source-maps","compile-grammar":"nearleyc ./src/grammar.ne --out ./src/grammar.js","lint":"eslint ./src ./test && flow","precommit":"npm run lint && npm run test","test":"ava --verbose"},"version":"2.2.0","gitHead":"2c7d00919e0901f8b0699f0634bd8b63baa17c29","bugs":{"url":"https://github.com/aweary/rst-selector-parser/issues"},"homepage":"https://github.com/aweary/rst-selector-parser#readme","_id":"rst-selector-parser@2.2.0","_npmVersion":"5.3.0","_nodeVersion":"8.2.1","_npmUser":{"name":"aweary","email":"Kierkegaurd@gmail.com"},"dist":{"shasum":"23fc2311de96cb4dbf0ad7e2cb63c0f54768c244","size":15148,"noattachment":false,"key":"/rst-selector-parser/-/rst-selector-parser-2.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/rst-selector-parser/download/rst-selector-parser-2.2.0.tgz"},"maintainers":[{"name":"aweary","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rst-selector-parser-2.2.0.tgz_1503415881753_0.3051461880095303"},"directories":{},"publish_time":1503415882905,"_hasShrinkwrap":false,"_cnpm_publish_time":1503415882905},"2.1.0":{"author":{"name":"Gajus Kuizinas","email":"gajus@gajus.com","url":"http://gajus.com"},"ava":{"babel":"inherit","require":["babel-register"]},"dependencies":{"lodash.flattendeep":"^4.4.0","nearley":"^2.7.10"},"description":"A CSS-based selector parser for React Standard Tree (RST) traversal","devDependencies":{"ava":"^0.17.0","babel-cli":"^6.22.2","babel-loader":"^6.2.10","babel-plugin-transform-flow-comments":"^6.22.0","babel-preset-env":"^1.1.8","babel-register":"^6.22.0","eslint":"^3.13.1","eslint-config-canonical":"^7.1.0","flow-bin":"^0.38.0","husky":"^0.13.0-1","semantic-release":"^6.3.2","webpack":"^2.2.0"},"engines":{"node":">=5"},"keywords":["css","selector","parser"],"license":"BSD-3-Clause","main":"./dist/index.js","name":"rst-selector-parser","repository":{"type":"git","url":"git+https://github.com/aweary/rst-selector-parser.git"},"scripts":{"build":"npm run compile-grammar && babel ./src --out-dir ./dist --copy-files --source-maps","compile-grammar":"nearleyc ./src/grammar.ne --out ./src/grammar.js","lint":"eslint ./src ./test && flow","precommit":"npm run lint && npm run test","test":"ava --verbose"},"version":"2.1.0","gitHead":"245a8a9e1a65848a0d31867c07e5986dae08274a","bugs":{"url":"https://github.com/aweary/rst-selector-parser/issues"},"homepage":"https://github.com/aweary/rst-selector-parser#readme","_id":"rst-selector-parser@2.1.0","_npmVersion":"5.3.0","_nodeVersion":"8.2.1","_npmUser":{"name":"aweary","email":"Kierkegaurd@gmail.com"},"dist":{"shasum":"7c420e037ee9fd740fa9855c7858ba060af6ccaf","size":14723,"noattachment":false,"key":"/rst-selector-parser/-/rst-selector-parser-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/rst-selector-parser/download/rst-selector-parser-2.1.0.tgz"},"maintainers":[{"name":"aweary","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rst-selector-parser-2.1.0.tgz_1503414498358_0.2506903938483447"},"directories":{},"publish_time":1503414499556,"_cnpm_publish_time":1503414499556,"_hasShrinkwrap":false},"2.0.0":{"author":{"name":"Gajus Kuizinas","email":"gajus@gajus.com","url":"http://gajus.com"},"ava":{"babel":"inherit","require":["babel-register"]},"dependencies":{"lodash.flattendeep":"^4.4.0","nearley":"^2.7.10"},"description":"A CSS-based selector parser for React Standard Tree (RST) traversal","devDependencies":{"ava":"^0.17.0","babel-cli":"^6.22.2","babel-loader":"^6.2.10","babel-plugin-transform-flow-comments":"^6.22.0","babel-preset-env":"^1.1.8","babel-register":"^6.22.0","eslint":"^3.13.1","eslint-config-canonical":"^7.1.0","flow-bin":"^0.38.0","husky":"^0.13.0-1","semantic-release":"^6.3.2","webpack":"^2.2.0"},"engines":{"node":">=5"},"keywords":["css","selector","parser"],"license":"BSD-3-Clause","main":"./dist/index.js","name":"rst-selector-parser","repository":{"type":"git","url":"git+https://github.com/aweary/rst-selector-parser.git"},"scripts":{"build":"npm run compile-grammar && babel ./src --out-dir ./dist --copy-files --source-maps","compile-grammar":"nearleyc ./src/grammar.ne --out ./src/grammar.js","lint":"eslint ./src ./test && flow","precommit":"npm run lint && npm run test","test":"ava --verbose"},"version":"2.0.0","gitHead":"fc106ddbb0c714a92a1fb0343af879e1283201a1","bugs":{"url":"https://github.com/aweary/rst-selector-parser/issues"},"homepage":"https://github.com/aweary/rst-selector-parser#readme","_id":"rst-selector-parser@2.0.0","_npmVersion":"5.3.0","_nodeVersion":"8.2.1","_npmUser":{"name":"aweary","email":"Kierkegaurd@gmail.com"},"dist":{"shasum":"94bf309d52b6880de7871b2e70c8f1bd0ae176d7","size":13814,"noattachment":false,"key":"/rst-selector-parser/-/rst-selector-parser-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/rst-selector-parser/download/rst-selector-parser-2.0.0.tgz"},"maintainers":[{"name":"aweary","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rst-selector-parser-2.0.0.tgz_1503411570514_0.20896189962513745"},"directories":{},"publish_time":1503411571530,"_hasShrinkwrap":false,"_cnpm_publish_time":1503411571530}},"readme":"# rst-selector-parser\n\nThis is a fork of [scalpel](https://github.com/gajus/scalpel/) intended for use with [enzyme](https://github.com/airbnb/enzyme/) for traversing\na React Standard Tree (RST) using [CSS selectors](https://www.w3.org/TR/css3-selectors/), with minor divergences.\n\n* [Usage](#usage)\n* [Token types](#token-types)\n* [Fields](#fields)\n  * [`adjacentSiblingCombinator`](#adjacentsiblingcombinator)\n  * [`attributePresenceSelector`](#attributepresenceselector)\n  * [`attributeValueSelector`](#attributevalueselector)\n  * [`childCombinator`](#childcombinator)\n  * [`classSelector`](#classselector)\n  * [`descendantCombinator`](#descendantcombinator)\n  * [`generalSiblingCombinator`](#generalsiblingcombinator)\n  * [`idSelector`](#idselector)\n  * [`pseudoClassSelector`](#pseudoclassselector)\n  * [`pseudoElementSelector`](#pseudoelementselector)\n  * [`typeSelector`](#typeselector)\n  * [`universalSelector`](#universalselector)\n* [Development](#development)\n\n## Usage\n\n```js\nimport {\n  createGenerator,\n  createParser\n} from 'rst-selector-parser';\n\nconst generator = createGenerator();\nconst parser = createParser();\n\nconst tokens: Array<SelectorTokenType | CombinatorTokenType> = parser.parse('.foo.bar');\n\n// [\n//   {\n//     type: 'selector',\n//     body: [\n//       {\n//         type: 'classSelector',\n//         name: 'foo'\n//       },\n//       {\n//         type: 'classSelector',\n//         name: 'bar'\n//       }\n//     ]\n//   }\n// ]\n\nconst selector: string = generator.generate(token);\n\n// .foo.bar\n\n```\n\n> Note:\n>\n> For programmatic type definitions, refer to [`./src/types.js`](./src/types.js).\n\n## Token types\n\n|Type|Description|Example|\n|---|---|---|\n|[`adjacentSiblingCombinator`](#adjacentsiblingcombinator)|An [adjacent sibling combinator](https://www.w3.org/TR/css3-selectors/#adjacent-sibling-combinators).|`.baz0 + .baz1`|\n|[`attributePresenceSelector`](#attributepresenceselector)|An [attribute presence selector](https://www.w3.org/TR/css3-selectors/#attribute-selectors).|`[qux]`|\n|[`attributeValueSelector`](#attributevalueselector)|An [attribute value selector](https://www.w3.org/TR/css3-selectors/#attribute-selectors).|`[qux=val]`, `[qux~=val]`|\n|[`childCombinator`](#childcombinator)|A [child combinator](https://www.w3.org/TR/css3-selectors/#child-combinators).|`.baz0 > .baz1`|\n|[`classSelector`](#classselector)|A [class selector](https://www.w3.org/TR/css3-selectors/#class-html).|`.baz`|\n|[`descendantCombinator`](#descendantcombinator)|A [descendant combinator](https://www.w3.org/TR/css3-selectors/#descendant-combinators).|`.baz0 .baz1`|\n|[`generalSiblingCombinator`](#generalsiblingcombinator)|A [general sibling combinator](https://www.w3.org/TR/css3-selectors/#general-sibling-combinators).|`.baz0 ~ .baz1`|\n|[`idSelector`](#idselector)|An [ID selector](https://www.w3.org/TR/css3-selectors/#id-selectors)|`#bar`|\n|[`pseudoClassSelector`](#pseudoclassselector)|A [pseudo-class selector](https://www.w3.org/TR/css3-selectors/#pseudo-classes).|`:corge`, `:corge()`, `:corge(val0, 'val1', \"val2\")`|\n|[`pseudoElementSelector`](#pseudoelementselector)|A [pseudo-element selector](https://www.w3.org/TR/css3-selectors/#pseudo-elements).|`::grault`|\n|[`typeSelector`](#typeselector)|A [type selector](https://www.w3.org/TR/css3-selectors/#type-selectors).|`foo`|\n|[`universalSelector`](#universalselector)|A [universal selector](https://www.w3.org/TR/css3-selectors/#universal-selector).|`*`|\n\n## Fields\n\nTokens have fields that describe additional information about the token. Fields are [token type](#token-types) specific.\n\n### `adjacentSiblingCombinator`\n\n|Name|Description|Example|\n|---|---|---|\n|`type`|Name of the token type.|\"adjacentSiblingCombinator\"|\n\n### `attributePresenceSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`name`|Name of the element attribute.|\"qux\" in `[qux]`|\n|`type`|Name of the token type.|\"attributePresenceSelector\"|\n\n### `attributeValueSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`name`|Name of the element attribute.|\"qux\" in `[qux]`|\n|`operator`|Operator of the expression.|\"\\*=\" in `[qux*=val]`|\n|`type`|Name of the token type.|\"attributeValueSelector\"|\n|`value`|Value of the expression.|\"val\" in `[qux=val]`|\n\n### `childCombinator`\n\n|Name|Description|Example|\n|---|---|---|\n|`type`|Name of the token type.|\"childCombinator\"|\n\n### `classSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`name`|Class name.|\"baz\" in `.baz[qux]`|\n|`type`|Name of the token type.|\"classSelector\"|\n\n### `descendantCombinator`\n\n|Name|Description|Example|\n|---|---|---|\n|`type`|Name of the token type.|\"descendantCombinator\"|\n\n### `generalSiblingCombinator`\n\n|Name|Description|Example|\n|---|---|---|\n|`type`|Name of the token type.|\"generalSiblingCombinator\"|\n\n### `idSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`name`|Name of the ID.|\"bar\" in `#bar:corge()`|\n|`type`|Name of the token type.|\"idSelector\"|\n\n### `pseudoClassSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`name`|Name of the pseudo-class.|\"corge\" in `#bar:corge()`|\n|`parameters`|Array of parameter values.|\"var0\", \"var1\" and \"var2\" in `:corge(var0, 'var1', \"var2\")`|\n|`type`|Name of the token type.|\"pseudoClassSelector\"|\n\n### `pseudoElementSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`name`|Name of the pseudo-element.|\"grault\" in `#bar::grault`|\n|`type`|Name of the token type.|\"pseudoElementSelector\"|\n\n### `typeSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`name`|Name of the node.|\"foo\" in `foo#bar.baz`|\n|`type`|Name of the token type.|\"typeSelector\"|\n\n### `universalSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`type`|Name of the token type.|\"universalSelector\"|\n\n## Development\n\n```bash\ngit pull git@github.com:gajus/scalpel.git\ncd ./scalpel\nnpm install\nnpm run test\n```\n\nThe parser grammar is in the [`./src/grammar.ne`](./src/grammar.ne) file. After making changes to the parser grammar, you need to compile the parser using `npm run compile-grammar` command.\n\n> Note:\n>\n> This parser could be extended to support the entire CSS grammar.\n> I don't have such a use case. However, should you want to add new grammar, [raise an issue](https://github.com/gajus/scalpel/issues/new).\n\n* [Usage](#usage)\n* [Token types](#token-types)\n* [Fields](#fields)\n  * [`adjacentSiblingCombinator`](#adjacentsiblingcombinator)\n  * [`attributePresenceSelector`](#attributepresenceselector)\n  * [`attributeValueSelector`](#attributevalueselector)\n  * [`childCombinator`](#childcombinator)\n  * [`classSelector`](#classselector)\n  * [`descendantCombinator`](#descendantcombinator)\n  * [`generalSiblingCombinator`](#generalsiblingcombinator)\n  * [`idSelector`](#idselector)\n  * [`pseudoClassSelector`](#pseudoclassselector)\n  * [`pseudoElementSelector`](#pseudoelementselector)\n  * [`typeSelector`](#typeselector)\n  * [`universalSelector`](#universalselector)\n* [Development](#development)\n\n## Usage\n\n```js\nimport {\n  createGenerator,\n  createParser\n} from 'scalpel';\n\nconst generator = createGenerator();\nconst parser = createParser();\n\nconst tokens: Array<SelectorTokenType | CombinatorTokenType> = parser.parse('.foo.bar');\n\n// [\n//   {\n//     type: 'selector',\n//     body: [\n//       {\n//         type: 'classSelector',\n//         name: 'foo'\n//       },\n//       {\n//         type: 'classSelector',\n//         name: 'bar'\n//       }\n//     ]\n//   }\n// ]\n\nconst selector: string = generator.generate(token);\n\n// .foo.bar\n\n```\n\n> Note:\n>\n> For programmatic type definitions, refer to [`./src/types.js`](./src/types.js).\n\n## Token types\n\n|Type|Description|Example|\n|---|---|---|\n|[`adjacentSiblingCombinator`](#adjacentsiblingcombinator)|An [adjacent sibling combinator](https://www.w3.org/TR/css3-selectors/#adjacent-sibling-combinators).|`.baz0 + .baz1`|\n|[`attributePresenceSelector`](#attributepresenceselector)|An [attribute presence selector](https://www.w3.org/TR/css3-selectors/#attribute-selectors).|`[qux]`|\n|[`attributeValueSelector`](#attributevalueselector)|An [attribute value selector](https://www.w3.org/TR/css3-selectors/#attribute-selectors).|`[qux=val]`, `[qux~=val]`|\n|[`childCombinator`](#childcombinator)|A [child combinator](https://www.w3.org/TR/css3-selectors/#child-combinators).|`.baz0 > .baz1`|\n|[`classSelector`](#classselector)|A [class selector](https://www.w3.org/TR/css3-selectors/#class-html).|`.baz`|\n|[`descendantCombinator`](#descendantcombinator)|A [descendant combinator](https://www.w3.org/TR/css3-selectors/#descendant-combinators).|`.baz0 .baz1`|\n|[`generalSiblingCombinator`](#generalsiblingcombinator)|A [general sibling combinator](https://www.w3.org/TR/css3-selectors/#general-sibling-combinators).|`.baz0 ~ .baz1`|\n|[`idSelector`](#idselector)|An [ID selector](https://www.w3.org/TR/css3-selectors/#id-selectors)|`#bar`|\n|[`pseudoClassSelector`](#pseudoclassselector)|A [pseudo-class selector](https://www.w3.org/TR/css3-selectors/#pseudo-classes).|`:corge`, `:corge()`, `:corge(val0, 'val1', \"val2\")`|\n|[`pseudoElementSelector`](#pseudoelementselector)|A [pseudo-element selector](https://www.w3.org/TR/css3-selectors/#pseudo-elements).|`::grault`|\n|[`typeSelector`](#typeselector)|A [type selector](https://www.w3.org/TR/css3-selectors/#type-selectors).|`foo`|\n|[`universalSelector`](#universalselector)|A [universal selector](https://www.w3.org/TR/css3-selectors/#universal-selector).|`*`|\n\n## Fields\n\nTokens have fields that describe additional information about the token. Fields are [token type](#token-types) specific.\n\n### `adjacentSiblingCombinator`\n\n|Name|Description|Example|\n|---|---|---|\n|`type`|Name of the token type.|\"adjacentSiblingCombinator\"|\n\n### `attributePresenceSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`name`|Name of the element attribute.|\"qux\" in `[qux]`|\n|`type`|Name of the token type.|\"attributePresenceSelector\"|\n\n### `attributeValueSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`name`|Name of the element attribute.|\"qux\" in `[qux]`|\n|`operator`|Operator of the expression.|\"\\*=\" in `[qux*=val]`|\n|`type`|Name of the token type.|\"attributeValueSelector\"|\n|`value`|Value of the expression.|\"val\" in `[qux=val]`|\n\n### `childCombinator`\n\n|Name|Description|Example|\n|---|---|---|\n|`type`|Name of the token type.|\"childCombinator\"|\n\n### `classSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`name`|Class name.|\"baz\" in `.baz[qux]`|\n|`type`|Name of the token type.|\"classSelector\"|\n\n### `descendantCombinator`\n\n|Name|Description|Example|\n|---|---|---|\n|`type`|Name of the token type.|\"descendantCombinator\"|\n\n### `generalSiblingCombinator`\n\n|Name|Description|Example|\n|---|---|---|\n|`type`|Name of the token type.|\"generalSiblingCombinator\"|\n\n### `idSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`name`|Name of the ID.|\"bar\" in `#bar:corge()`|\n|`type`|Name of the token type.|\"idSelector\"|\n\n### `pseudoClassSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`name`|Name of the pseudo-class.|\"corge\" in `#bar:corge()`|\n|`parameters`|Array of parameter values.|\"var0\", \"var1\" and \"var2\" in `:corge(var0, 'var1', \"var2\")`|\n|`type`|Name of the token type.|\"pseudoClassSelector\"|\n\n### `pseudoElementSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`name`|Name of the pseudo-element.|\"grault\" in `#bar::grault`|\n|`type`|Name of the token type.|\"pseudoElementSelector\"|\n\n### `typeSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`name`|Name of the node.|\"foo\" in `foo#bar.baz`|\n|`type`|Name of the token type.|\"typeSelector\"|\n\n### `universalSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`type`|Name of the token type.|\"universalSelector\"|\n\n## Development\n\n```bash\ngit pull git@github.com:gajus/scalpel.git\ncd ./scalpel\nnpm install\nnpm run test\n```\n\nThe parser grammar is in the [`./src/grammar.ne`](./src/grammar.ne) file. After making changes to the parser grammar, you need to compile the parser using `npm run compile-grammar` command.\n\n> Note:\n>\n> This parser could be extended to support the entire CSS grammar.\n> I don't have such a use case. However, should you want to add new grammar, [raise an issue](https://github.com/gajus/scalpel/issues/new).\n\n* [Usage](#usage)\n* [Token types](#token-types)\n* [Fields](#fields)\n  * [`adjacentSiblingCombinator`](#adjacentsiblingcombinator)\n  * [`attributePresenceSelector`](#attributepresenceselector)\n  * [`attributeValueSelector`](#attributevalueselector)\n  * [`childCombinator`](#childcombinator)\n  * [`classSelector`](#classselector)\n  * [`descendantCombinator`](#descendantcombinator)\n  * [`generalSiblingCombinator`](#generalsiblingcombinator)\n  * [`idSelector`](#idselector)\n  * [`pseudoClassSelector`](#pseudoclassselector)\n  * [`pseudoElementSelector`](#pseudoelementselector)\n  * [`typeSelector`](#typeselector)\n  * [`universalSelector`](#universalselector)\n* [Development](#development)\n\n## Usage\n\n```js\nimport {\n  createGenerator,\n  createParser\n} from 'scalpel';\n\nconst generator = createGenerator();\nconst parser = createParser();\n\nconst tokens: Array<SelectorTokenType | CombinatorTokenType> = parser.parse('.foo.bar');\n\n// [\n//   {\n//     type: 'selector',\n//     body: [\n//       {\n//         type: 'classSelector',\n//         name: 'foo'\n//       },\n//       {\n//         type: 'classSelector',\n//         name: 'bar'\n//       }\n//     ]\n//   }\n// ]\n\nconst selector: string = generator.generate(token);\n\n// .foo.bar\n\n```\n\n> Note:\n>\n> For programmatic type definitions, refer to [`./src/types.js`](./src/types.js).\n\n## Token types\n\n|Type|Description|Example|\n|---|---|---|\n|[`adjacentSiblingCombinator`](#adjacentsiblingcombinator)|An [adjacent sibling combinator](https://www.w3.org/TR/css3-selectors/#adjacent-sibling-combinators).|`.baz0 + .baz1`|\n|[`attributePresenceSelector`](#attributepresenceselector)|An [attribute presence selector](https://www.w3.org/TR/css3-selectors/#attribute-selectors).|`[qux]`|\n|[`attributeValueSelector`](#attributevalueselector)|An [attribute value selector](https://www.w3.org/TR/css3-selectors/#attribute-selectors).|`[qux=val]`, `[qux~=val]`|\n|[`childCombinator`](#childcombinator)|A [child combinator](https://www.w3.org/TR/css3-selectors/#child-combinators).|`.baz0 > .baz1`|\n|[`classSelector`](#classselector)|A [class selector](https://www.w3.org/TR/css3-selectors/#class-html).|`.baz`|\n|[`descendantCombinator`](#descendantcombinator)|A [descendant combinator](https://www.w3.org/TR/css3-selectors/#descendant-combinators).|`.baz0 .baz1`|\n|[`generalSiblingCombinator`](#generalsiblingcombinator)|A [general sibling combinator](https://www.w3.org/TR/css3-selectors/#general-sibling-combinators).|`.baz0 ~ .baz1`|\n|[`idSelector`](#idselector)|An [ID selector](https://www.w3.org/TR/css3-selectors/#id-selectors)|`#bar`|\n|[`pseudoClassSelector`](#pseudoclassselector)|A [pseudo-class selector](https://www.w3.org/TR/css3-selectors/#pseudo-classes).|`:corge`, `:corge()`, `:corge(val0, 'val1', \"val2\")`|\n|[`pseudoElementSelector`](#pseudoelementselector)|A [pseudo-element selector](https://www.w3.org/TR/css3-selectors/#pseudo-elements).|`::grault`|\n|[`typeSelector`](#typeselector)|A [type selector](https://www.w3.org/TR/css3-selectors/#type-selectors).|`foo`|\n|[`universalSelector`](#universalselector)|A [universal selector](https://www.w3.org/TR/css3-selectors/#universal-selector).|`*`|\n\n## Fields\n\nTokens have fields that describe additional information about the token. Fields are [token type](#token-types) specific.\n\n### `adjacentSiblingCombinator`\n\n|Name|Description|Example|\n|---|---|---|\n|`type`|Name of the token type.|\"adjacentSiblingCombinator\"|\n\n### `attributePresenceSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`name`|Name of the element attribute.|\"qux\" in `[qux]`|\n|`type`|Name of the token type.|\"attributePresenceSelector\"|\n\n### `attributeValueSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`name`|Name of the element attribute.|\"qux\" in `[qux]`|\n|`operator`|Operator of the expression.|\"\\*=\" in `[qux*=val]`|\n|`type`|Name of the token type.|\"attributeValueSelector\"|\n|`value`|Value of the expression.|\"val\" in `[qux=val]`|\n\n### `childCombinator`\n\n|Name|Description|Example|\n|---|---|---|\n|`type`|Name of the token type.|\"childCombinator\"|\n\n### `classSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`name`|Class name.|\"baz\" in `.baz[qux]`|\n|`type`|Name of the token type.|\"classSelector\"|\n\n### `descendantCombinator`\n\n|Name|Description|Example|\n|---|---|---|\n|`type`|Name of the token type.|\"descendantCombinator\"|\n\n### `generalSiblingCombinator`\n\n|Name|Description|Example|\n|---|---|---|\n|`type`|Name of the token type.|\"generalSiblingCombinator\"|\n\n### `idSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`name`|Name of the ID.|\"bar\" in `#bar:corge()`|\n|`type`|Name of the token type.|\"idSelector\"|\n\n### `pseudoClassSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`name`|Name of the pseudo-class.|\"corge\" in `#bar:corge()`|\n|`parameters`|Array of parameter values.|\"var0\", \"var1\" and \"var2\" in `:corge(var0, 'var1', \"var2\")`|\n|`type`|Name of the token type.|\"pseudoClassSelector\"|\n\n### `pseudoElementSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`name`|Name of the pseudo-element.|\"grault\" in `#bar::grault`|\n|`type`|Name of the token type.|\"pseudoElementSelector\"|\n\n### `typeSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`name`|Name of the node.|\"foo\" in `foo#bar.baz`|\n|`type`|Name of the token type.|\"typeSelector\"|\n\n### `universalSelector`\n\n|Name|Description|Example|\n|---|---|---|\n|`type`|Name of the token type.|\"universalSelector\"|\n\n## Development\n\n```bash\ngit pull git@github.com:gajus/scalpel.git\ncd ./scalpel\nnpm install\nnpm run test\n```\n\nThe parser grammar is in the [`./src/grammar.ne`](./src/grammar.ne) file. After making changes to the parser grammar, you need to compile the parser using `npm run compile-grammar` command.\n","_attachments":{},"homepage":"https://github.com/aweary/rst-selector-parser#readme","bugs":{"url":"https://github.com/aweary/rst-selector-parser/issues"},"license":"BSD-3-Clause"}