{"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":{"integrity":"sha512-2PfqDucHj9ArVWykMfSM+02U6bvZNRCrXmzpwp76dc9kLwWX+ZcK1ILh16RQ2qYGyOccxQABONOY720B4mXmtg==","shasum":"7c420e037ee9fd740fa9855c7858ba060af6ccaf","tarball":"http://registry-npm.ywwl.com/rst-selector-parser/download/rst-selector-parser-2.1.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDOVIUJ1BFue+1ND8aav82+wZQba3uANX4BIJ+ds38iKQIgQHXODY2EzTqu1lxDgQIpzKH8/TrZetADW5UW6jEzDyA="}],"size":14723,"noattachment":false,"key":"/rst-selector-parser/-/rst-selector-parser-2.1.0.tgz"},"maintainers":[{"name":"aweary","email":"Kierkegaurd@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rst-selector-parser-2.1.0.tgz_1503414498358_0.2506903938483447"},"directories":{},"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","publish_time":1503414499556,"_cnpm_publish_time":1503414499556,"dist-tags":{"latest":"2.2.3"}}