{
  "_args": [
    [
      "fastparse@https://registry.npmjs.org/fastparse/-/fastparse-1.1.1.tgz",
      "/Users/nw/flint/packages/flint"
    ]
  ],
  "_from": "fastparse@>=1.1.1 <2.0.0",
  "_id": "fastparse@1.1.1",
  "_inCache": true,
  "_location": "/fastparse",
  "_phantomChildren": {},
  "_requested": {
    "name": "fastparse",
    "raw": "fastparse@https://registry.npmjs.org/fastparse/-/fastparse-1.1.1.tgz",
    "rawSpec": "https://registry.npmjs.org/fastparse/-/fastparse-1.1.1.tgz",
    "scope": null,
    "spec": "https://registry.npmjs.org/fastparse/-/fastparse-1.1.1.tgz",
    "type": "remote"
  },
  "_requiredBy": [
    "/css-selector-tokenizer"
  ],
  "_resolved": "https://registry.npmjs.org/fastparse/-/fastparse-1.1.1.tgz",
  "_shasum": "d1e2643b38a94d7583b479060e6c4affc94071f8",
  "_shrinkwrap": null,
  "_spec": "fastparse@https://registry.npmjs.org/fastparse/-/fastparse-1.1.1.tgz",
  "_where": "/Users/nw/flint/packages/flint",
  "author": {
    "name": "Tobias Koppers @sokra"
  },
  "bugs": {
    "url": "https://github.com/webpack/fastparse/issues"
  },
  "dependencies": {},
  "description": "A very simple and stupid parser, based on a statemachine and regular expressions.",
  "devDependencies": {
    "coveralls": "^2.11.2",
    "eslint": "^0.21.2",
    "istanbul": "^0.3.14",
    "mocha": "^2.2.5",
    "should": "^6.0.3"
  },
  "homepage": "https://github.com/webpack/fastparse",
  "keywords": [
    "parser",
    "regexp"
  ],
  "license": "MIT",
  "main": "lib/Parser.js",
  "name": "fastparse",
  "optionalDependencies": {},
  "readme": "# fastparse\r\n\r\nA very simple and stupid parser, based on a statemachine and regular expressions.\r\n\r\nIt's not intended for complex languages. It's intended to easily write a simple parser for a simple language.\r\n\r\n\r\n\r\n## Usage\r\n\r\nPass a description of statemachine to the constructor. The description must be in this form:\r\n\r\n``` javascript\r\nnew Parser(description)\r\n\r\ndescription is {\r\n\t// The key is the name of the state\r\n\t// The value is an object containing possible transitions\r\n\t\"state-name\": {\r\n\t\t// The key is a regular expression\r\n\t\t// If the regular expression matches the transition is executed\r\n\t\t// The value can be \"true\", a other state name or a function\r\n\r\n\t\t\"a\": true,\r\n\t\t// true will make the parser stay in the current state\r\n\t\t\r\n\t\t\"b\": \"other-state-name\",\r\n\t\t// a string will make the parser transit to a new state\r\n\t\t\r\n\t\t\"[cde]\": function(match, index, matchLength) {\r\n\t\t\t// \"match\" will be the matched string\r\n\t\t\t// \"index\" will be the position in the complete string\r\n\t\t\t// \"matchLength\" will be \"match.length\"\r\n\t\t\t\r\n\t\t\t// \"this\" will be the \"context\" passed to the \"parse\" method\"\r\n\t\t\t\r\n\t\t\t// A new state name (string) can be returned\r\n\t\t\treturn \"other-state-name\";\r\n\t\t},\r\n\t\t\r\n\t\t\"([0-9]+)(\\\\.[0-9]+)?\": function(match, first, second, index, matchLength) {\r\n\t\t\t// groups can be used in the regular expression\r\n\t\t\t// they will match to arguments \"first\", \"second\"\r\n\t\t},\r\n\t\t\r\n\t\t// the parser stops when it cannot match the string anymore\r\n\t\t\r\n\t\t// order of keys is the order in which regular expressions are matched\r\n\t\t// if the javascript runtime preserves the order of keys in an object\r\n\t\t// (this is not standardized, but it's a de-facto standard)\r\n\t}\r\n}\r\n```\r\n\r\nThe statemachine is compiled down to a single regular expression per state. So basically the parsing work is delegated to the (native) regular expression logic of the javascript runtime.\r\n\r\n\r\n``` javascript\r\nParser.prototype.parse(initialState: String, parsedString: String, context: Object)\r\n```\r\n\r\n`initialState`: state where the parser starts to parse.\r\n\r\n`parsedString`: the string which should be parsed.\r\n\r\n`context`: an object which can be used to save state and results. Available as `this` in transition functions.\r\n\r\nreturns `context`\r\n\r\n\r\n\r\n\r\n## Example\r\n\r\n``` javascript\r\nvar Parser = require(\"fastparse\");\r\n\r\n// A simple parser that extracts @licence ... from comments in a JS file\r\nvar parser = new Parser({\r\n\t// The \"source\" state\r\n\t\"source\": {\r\n\t\t// matches comment start\r\n\t\t\"/\\\\*\": \"comment\",\r\n\t\t\"//\": \"linecomment\",\r\n\t\t\r\n\t\t// this would be necessary for a complex language like JS\r\n\t\t// but omitted here for simplicity\r\n\t\t// \"\\\"\": \"string1\",\r\n\t\t// \"\\'\": \"string2\",\r\n\t\t// \"\\/\": \"regexp\"\r\n\t\t\r\n\t},\r\n\t// The \"comment\" state\r\n\t\"comment\": {\r\n\t\t\"\\\\*/\": \"source\",\r\n\t\t\"@licen[cs]e\\\\s((?:[^*\\n]|\\\\*+[^*/\\n])*)\": function(match, licenseText) {\r\n\t\t\tthis.licences.push(licenseText.trim());\r\n\t\t}\r\n\t},\r\n\t// The \"linecomment\" state\r\n\t\"linecomment\": {\r\n\t\t\"\\n\": \"source\",\r\n\t\t\"@licen[cs]e\\\\s(.*)\": function(match, licenseText) {\r\n\t\t\tthis.licences.push(licenseText.trim());\r\n\t\t}\r\n\t}\r\n});\r\n\r\nvar licences = parser.parse(\"source\", sourceCode, { licences: [] }).licences;\r\n\r\nconsole.log(licences);\r\n```\r\n\r\n\r\n\r\n## License\r\n\r\nMIT (http://www.opensource.org/licenses/mit-license.php)\r\n",
  "readmeFilename": "README.md",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/webpack/fastparse.git"
  },
  "scripts": {
    "cover": "istanbul cover node_modules/mocha/bin/_mocha",
    "lint": "eslint lib",
    "precover": "npm run lint",
    "pretest": "npm run lint",
    "publish-patch": "mocha && npm version patch && git push && git push --tags && npm publish",
    "test": "mocha",
    "travis": "npm run cover -- --report lcovonly"
  },
  "version": "1.1.1"
}
