{
  "name": "acorn",
  "description": "ECMAScript parser",
  "homepage": "http://marijnhaverbeke.nl/acorn/",
  "main": "acorn.js",
  "version": "0.10.0",
  "engines": {
    "node": ">=0.4.0"
  },
  "maintainers": [
    {
      "name": "Marijn Haverbeke",
      "email": "marijnh@gmail.com",
      "url": "http://marijnhaverbeke.nl"
    }
  ],
  "repository": {
    "type": "git",
    "url": "http://marijnhaverbeke.nl/git/acorn"
  },
  "licenses": [
    {
      "type": "MIT",
      "url": "http://marijnhaverbeke.nl/acorn/LICENSE"
    }
  ],
  "scripts": {
    "test": "node test/run.js",
    "prepublish": "bin/without_eval > acorn_csp.js"
  },
  "bin": {
    "acorn": "./bin/acorn"
  },
  "devDependencies": {
    "regenerate": "~0.6.2",
    "unicode-7.0.0": "~0.1.5"
  },
  "contributors": [
    {
      "name": "List of Acorn contributors. Updated before every release."
    },
    {
      "name": "Alistair Braidwood"
    },
    {
      "name": "Aparajita Fishman"
    },
    {
      "name": "Arian Stolwijk"
    },
    {
      "name": "Artem Govorov"
    },
    {
      "name": "Brandon Mills"
    },
    {
      "name": "Charles Hughes"
    },
    {
      "name": "Conrad Irwin"
    },
    {
      "name": "David Bonnet"
    },
    {
      "name": "impinball"
    },
    {
      "name": "Ingvar Stepanyan"
    },
    {
      "name": "Jiaxing Wang"
    },
    {
      "name": "Johannes Herr"
    },
    {
      "name": "Jürg Lehni"
    },
    {
      "name": "keeyipchan"
    },
    {
      "name": "krator"
    },
    {
      "name": "Marijn Haverbeke"
    },
    {
      "name": "Martin Carlberg"
    },
    {
      "name": "Mathias Bynens"
    },
    {
      "name": "Mathieu 'p01' Henri"
    },
    {
      "name": "Max Schaefer"
    },
    {
      "name": "Mihai Bazon"
    },
    {
      "name": "Mike Rennie"
    },
    {
      "name": "Oskar Schöldström"
    },
    {
      "name": "Paul Harper"
    },
    {
      "name": "Peter Rust"
    },
    {
      "name": "PlNG"
    },
    {
      "name": "r-e-d"
    },
    {
      "name": "Rich Harris"
    },
    {
      "name": "Sebastian McKenzie"
    },
    {
      "name": "zsjforcn"
    }
  ],
  "readme": "# Acorn\n\n[![Build Status](https://travis-ci.org/marijnh/acorn.svg?branch=master)](https://travis-ci.org/marijnh/acorn)\n\nA tiny, fast JavaScript parser, written completely in JavaScript.\n\n## Installation\n\nThe easiest way to install acorn is with [`npm`][npm].\n\n[npm]: http://npmjs.org\n\n```sh\nnpm install acorn\n```\n\nAlternately, download the source.\n\n```sh\ngit clone https://github.com/marijnh/acorn.git\n```\n\n## Components\n\nWhen run in a CommonJS (node.js) or AMD environment, exported values\nappear in the interfaces exposed by the individual files, as usual.\nWhen loaded in the browser (Acorn works in any JS-enabled browser more\nrecent than IE5) without any kind of module management, a single\nglobal object `acorn` will be defined, and all the exported properties\nwill be added to that.\n\n### acorn.js\n\nThis file contains the actual parser (and is what you get when you\n`require(\"acorn\")` in node.js).\n\n**parse**`(input, options)` is used to parse a JavaScript program.\nThe `input` parameter is a string, `options` can be undefined or an\nobject setting some of the options listed below. The return value will\nbe an abstract syntax tree object as specified by the\n[Mozilla Parser API][mozapi].\n\nWhen  encountering   a  syntax   error,  the   parser  will   raise  a\n`SyntaxError` object with a meaningful  message. The error object will\nhave a `pos` property that indicates the character offset at which the\nerror occurred,  and a `loc`  object that contains a  `{line, column}`\nobject referring to that same position.\n\n[mozapi]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API\n\n- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be\n  either 3, 5, or 6. This influences support for strict mode, the set\n  of reserved words, and support for new syntax features. Default is 5.\n\n- **strictSemicolons**: If `true`, prevents the parser from doing\n  automatic semicolon insertion, and statements that do not end with\n  a semicolon will generate an error. Defaults to `false`.\n\n- **allowTrailingCommas**: If `false`, the parser will not allow\n  trailing commas in array and object literals. Default is `true`.\n\n- **forbidReserved**: If `true`, using a reserved word will generate\n  an error. Defaults to `false`. When given the value `\"everywhere\"`,\n  reserved words and keywords can also not be used as property names\n  (as in Internet Explorer's old parser).\n  \n- **allowReturnOutsideFunction**: By default, a return statement at\n  the top level raises an error. Set this to `true` to accept such\n  code.\n\n- **allowImportExportEverywhere**: By default, `import` and `export`\n  declarations can only appear at a program's top level. Setting this\n  option to `true` allows them anywhere where a statement is allowed.\n\n- **locations**: When `true`, each node has a `loc` object attached\n  with `start` and `end` subobjects, each of which contains the\n  one-based line and zero-based column numbers in `{line, column}`\n  form. Default is `false`.\n\n- **onToken**: If a function is passed for this option, each found\n  token will be passed in same format as `tokenize()` returns.\n\n  If array is passed, each found token is pushed to it.\n\n  Note that you are not allowed to call the parser from the\n  callback—that will corrupt its internal state.\n\n- **onComment**: If a function is passed for this option, whenever a\n  comment is encountered the function will be called with the\n  following parameters:\n\n  - `block`: `true` if the comment is a block comment, false if it\n    is a line comment.\n  - `text`: The content of the comment.\n  - `start`: Character offset of the start of the comment.\n  - `end`: Character offset of the end of the comment.\n\n  When the `locations` options is on, the `{line, column}` locations\n  of the comment’s start and end are passed as two additional\n  parameters.\n\n  If array is passed for this option, each found comment is pushed\n  to it as object in Esprima format:\n  \n  ```javascript\n  {\n    \"type\": \"Line\" | \"Block\",\n    \"value\": \"comment text\",\n    \"range\": ...,\n    \"loc\": ...\n  }\n  ```\n\n  Note that you are not allowed to call the parser from the\n  callback—that will corrupt its internal state.\n\n- **ranges**: Nodes have their start and end characters offsets\n  recorded in `start` and `end` properties (directly on the node,\n  rather than the `loc` object, which holds line/column data. To also\n  add a [semi-standardized][range] \"range\" property holding a\n  `[start, end]` array with the same numbers, set the `ranges` option\n  to `true`.\n\n- **program**: It is possible to parse multiple files into a single\n  AST by passing the tree produced by parsing the first file as the\n  `program` option in subsequent parses. This will add the toplevel\n  forms of the parsed file to the \"Program\" (top) node of an existing\n  parse tree.\n\n- **sourceFile**: When the `locations` option is `true`, you can pass\n  this option to add a `source` attribute in every node’s `loc`\n  object. Note that the contents of this option are not examined or\n  processed in any way; you are free to use whatever format you\n  choose.\n\n- **directSourceFile**: Like `sourceFile`, but a `sourceFile` property\n  will be added directly to the nodes, rather than the `loc` object.\n\n- **preserveParens**: If this option is `true`, parenthesized expressions\n  are represented by (non-standard) `ParenthesizedExpression` nodes\n  that have a single `expression` property containing the expression\n  inside parentheses.\n\n[range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678\n\n**parseExpressionAt**`(input, offset, options)` will parse a single\nexpression in a string, and return its AST. It will not complain if\nthere is more of the string left after the expression.\n\n**getLineInfo**`(input, offset)` can be used to get a `{line,\ncolumn}` object for a given program string and character offset.\n\n**tokenize**`(input, options)` exports a primitive interface to\nAcorn's tokenizer. The function takes an input string and options\nsimilar to `parse` (though only some options are meaningful here), and\nreturns a function that can be called repeatedly to read a single\ntoken, and returns a `{start, end, type, value}` object (with added\n`loc` property when the `locations` option is enabled and `range`\nproperty when the `ranges` option is enabled).\n\n**tokTypes** holds an object mapping names to the token type objects\nthat end up in the `type` properties of tokens.\n\n#### Note on using with [Escodegen][escodegen]\n\nEscodegen supports generating comments from AST, attached in\nEsprima-specific format. In order to simulate same format in\nAcorn, consider following example:\n\n```javascript\nvar comments = [], tokens = [];\n\nvar ast = acorn.parse('var x = 42; // answer', {\n\t// collect ranges for each node\n\tranges: true,\n\t// collect comments in Esprima's format\n\tonComment: comments,\n\t// collect token ranges\n\tonToken: tokens\n});\n\n// attach comments using collected information\nescodegen.attachComments(ast, comments, tokens);\n\n// generate code\nconsole.log(escodegen.generate(ast, {comment: true}));\n// > 'var x = 42;    // answer'\n```\n\n[escodegen]: https://github.com/Constellation/escodegen\n\n#### Using Acorn in an environment with a Content Security Policy\n\nSome contexts, such as Chrome Web Apps, disallow run-time code evaluation.\nAcorn uses `new Function` to generate fast functions that test whether\na word is in a given set, and will trigger a security error when used\nin a context with such a\n[Content Security Policy](http://www.html5rocks.com/en/tutorials/security/content-security-policy/#eval-too)\n(see [#90](https://github.com/marijnh/acorn/issues/90) and\n[#123](https://github.com/marijnh/acorn/issues/123)).\n\nThe `bin/without_eval` script can be used to generate a version of\n`acorn.js` that has the generated code inlined, and can thus run\nwithout evaluating anything. In versions of this library downloaded\nfrom NPM, this script will be available as `acorn_csp.js`.\n\n### acorn_loose.js ###\n\nThis file implements an error-tolerant parser. It exposes a single\nfunction.\n\n**parse_dammit**`(input, options)` takes the same arguments and\nreturns the same syntax tree as the `parse` function in `acorn.js`,\nbut never raises an error, and will do its best to parse syntactically\ninvalid code in as meaningful a way as it can. It'll insert identifier\nnodes with name `\"✖\"` as placeholders in places where it can't make\nsense of the input. Depends on `acorn.js`, because it uses the same\ntokenizer. The loose parser does not support ECMAScript 6 syntax yet.\n\n### util/walk.js ###\n\nImplements an abstract syntax tree walker. Will store its interface in\n`acorn.walk` when used without a module system.\n\n**simple**`(node, visitors, base, state)` does a 'simple' walk over\na tree. `node` should be the AST node to walk, and `visitors` an\nobject with properties whose names correspond to node types in the\n[Mozilla Parser API][mozapi]. The properties should contain functions\nthat will be called with the node object and, if applicable the state\nat that point. The last two arguments are optional. `base` is a walker\nalgorithm, and `state` is a start state. The default walker will\nsimply visit all statements and expressions and not produce a\nmeaningful state. (An example of a use of state it to track scope at\neach point in the tree.)\n\n**ancestor**`(node, visitors, base, state)` does a 'simple' walk over\na tree, building up an array of ancestor nodes (including the current node)\nand passing the array to callbacks in the `state` parameter.\n\n**recursive**`(node, state, functions, base)` does a 'recursive'\nwalk, where the walker functions are responsible for continuing the\nwalk on the child nodes of their target node. `state` is the start\nstate, and `functions` should contain an object that maps node types\nto walker functions. Such functions are called with `(node, state, c)`\narguments, and can cause the walk to continue on a sub-node by calling\nthe `c` argument on it with `(node, state)` arguments. The optional\n`base` argument provides the fallback walker functions for node types\nthat aren't handled in the `functions` object. If not given, the\ndefault walkers will be used.\n\n**make**`(functions, base)` builds a new walker object by using the\nwalker functions in `functions` and filling in the missing ones by\ntaking defaults from `base`.\n\n**findNodeAt**`(node, start, end, test, base, state)` tries to\nlocate a node in a tree at the given start and/or end offsets, which\nsatisfies the predicate `test`. `start` end `end` can be either `null`\n(as wildcard) or a number. `test` may be a string (indicating a node\ntype) or a function that takes `(nodeType, node)` arguments and\nreturns a boolean indicating whether this node is interesting. `base`\nand `state` are optional, and can be used to specify a custom walker.\nNodes are tested from inner to outer, so if two nodes match the\nboundaries, the inner one will be preferred.\n\n**findNodeAround**`(node, pos, test, base, state)` is a lot like\n`findNodeAt`, but will match any node that exists 'around' (spanning)\nthe given position.\n\n**findNodeAfter**`(node, pos, test, base, state)` is similar to\n`findNodeAround`, but will match all nodes *after* the given position\n(testing outer nodes before inner nodes).\n\n## Command line interface\n\nThe `bin/acorn` utility can be used to parse a file from the command\nline. It accepts as arguments its input file and the following\noptions:\n\n- `--ecma3|--ecma5|--ecma6`: Sets the ECMAScript version to parse. Default is\n  version 5.\n\n- `--strictSemicolons`: Prevents the parser from doing automatic\n  semicolon insertion. Statements that do not end in semicolons will\n  generate an error.\n\n- `--locations`: Attaches a \"loc\" object to each node with \"start\" and\n  \"end\" subobjects, each of which contains the one-based line and\n  zero-based column numbers in `{line, column}` form.\n\n- `--compact`: No whitespace is used in the AST output.\n\n- `--silent`: Do not output the AST, just return the exit status.\n\n- `--help`: Print the usage information and quit.\n\nThe utility spits out the syntax tree as JSON data.\n",
  "readmeFilename": "README.md",
  "_id": "acorn@0.10.0",
  "_from": "acorn@0.10.0"
}
