1 | Shift Parser
|
2 | ============
|
3 |
|
4 |
|
5 | ## About
|
6 |
|
7 | This module provides an [ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm)
|
8 | parser that produces a [Shift format](https://github.com/shapesecurity/shift-spec) AST.
|
9 |
|
10 |
|
11 | ## Status
|
12 |
|
13 | [Stable](http://nodejs.org/api/documentation.html#documentation_stability_index).
|
14 |
|
15 | The parser supports version 6 (release candidate 2) of the ECMA-262 standard.
|
16 |
|
17 |
|
18 | ## Installation
|
19 |
|
20 | ```sh
|
21 | npm install shift-parser
|
22 | ```
|
23 |
|
24 |
|
25 | ## Usage
|
26 |
|
27 | ```es6
|
28 | import parse from "shift-parser";
|
29 | let ast = parse("/* ECMAScript program text */");
|
30 | ```
|
31 |
|
32 | ```es6
|
33 | import {parseScript, parseModule} from "shift-parser";
|
34 | let scriptAST = parseScript("/* ECMAScript Script text */");
|
35 | let moduleAST = parseModule("/* ECMAScript Module text */");
|
36 | ```
|
37 |
|
38 | Or in node.js:
|
39 |
|
40 | ```js
|
41 | var parseScript = require("shift-parser").parseScript;
|
42 | var scriptAST = parseScript("/* ECMAScript Script text */");
|
43 | ```
|
44 |
|
45 |
|
46 | ## Contributing
|
47 |
|
48 | * Open a Github issue with a description of your desired change. If one exists already, leave a message stating that you are working on it with the date you expect it to be complete.
|
49 | * Fork this repo, and clone the forked repo.
|
50 | * Install dependencies with `npm install`.
|
51 | * Build and test in your environment with `npm run build && npm test`.
|
52 | * Create a feature branch. Make your changes. Add tests.
|
53 | * Build and test in your environment with `npm run build && npm test`.
|
54 | * Make a commit that includes the text "fixes #*XX*" where *XX* is the Github issue.
|
55 | * Open a Pull Request on Github.
|
56 |
|
57 |
|
58 | ## License
|
59 |
|
60 | Copyright 2014 Shape Security, Inc.
|
61 |
|
62 | Licensed under the Apache License, Version 2.0 (the "License");
|
63 | you may not use this file except in compliance with the License.
|
64 | You may obtain a copy of the License at
|
65 |
|
66 | http://www.apache.org/licenses/LICENSE-2.0
|
67 |
|
68 | Unless required by applicable law or agreed to in writing, software
|
69 | distributed under the License is distributed on an "AS IS" BASIS,
|
70 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
71 | See the License for the specific language governing permissions and
|
72 | limitations under the License.
|