강현태

카톡 로그인 기능 백엔드로 바꿈

Showing 1000 changed files with 3835 additions and 23 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<project version="4">
3 + <component name="dataSourceStorageLocal">
4 + <data-source name="YTMT@nomock.com" uuid="01265fc0-37d6-481f-ac14-42262cda0ac3">
5 + <database-info product="MySQL" version="5.7.20-0ubuntu0.16.04.1" jdbc-version="4.0" driver-name="MySQL Connector Java" driver-version="mysql-connector-java-5.1.44 ( Revision: b3cda4f864902ffdde495b9df93937c3e20009be )">
6 + <extra-name-characters>#@</extra-name-characters>
7 + <identifier-quote-string>`</identifier-quote-string>
8 + </database-info>
9 + <case-sensitivity plain-identifiers="exact" quoted-identifiers="exact" />
10 + <secret-storage>master_key</secret-storage>
11 + <user-name>ytmt</user-name>
12 + <introspection-schemas>*:YTMT</introspection-schemas>
13 + </data-source>
14 + </component>
15 +</project>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<project version="4">
3 + <component name="DataSourceManagerImpl" format="xml" multifile-model="true">
4 + <data-source source="LOCAL" name="YTMT@nomock.com" uuid="01265fc0-37d6-481f-ac14-42262cda0ac3">
5 + <driver-ref>mysql</driver-ref>
6 + <synchronize>true</synchronize>
7 + <jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver>
8 + <jdbc-url>jdbc:mysql://nomock.com:3306/YTMT</jdbc-url>
9 + <driver-properties>
10 + <property name="autoReconnect" value="true" />
11 + <property name="zeroDateTimeBehavior" value="convertToNull" />
12 + <property name="tinyInt1isBit" value="false" />
13 + <property name="characterEncoding" value="utf8" />
14 + <property name="characterSetResults" value="utf8" />
15 + <property name="yearIsDateType" value="false" />
16 + </driver-properties>
17 + </data-source>
18 + </component>
19 +</project>
...\ No newline at end of file ...\ No newline at end of file
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<dataSource name="YTMT@nomock.com">
3 + <database-model serializer="dbm" rdbms="MYSQL" format-version="4.4">
4 + <root id="1"/>
5 + <schema id="2" parent="1" name="YTMT">
6 + <Current>1</Current>
7 + <Visible>1</Visible>
8 + </schema>
9 + <schema id="3" parent="1" name="information_schema"/>
10 + <table id="4" parent="2" name="toon"/>
11 + <table id="5" parent="2" name="user"/>
12 + <table id="6" parent="2" name="user_toon_relation"/>
13 + <column id="7" parent="4" name="toon_index">
14 + <Position>1</Position>
15 + <DataType>int(11)|0</DataType>
16 + <NotNull>1</NotNull>
17 + </column>
18 + <column id="8" parent="4" name="name">
19 + <Position>2</Position>
20 + <DataType>text|0</DataType>
21 + <NotNull>1</NotNull>
22 + </column>
23 + <column id="9" parent="4" name="thum_link">
24 + <Position>3</Position>
25 + <DataType>text|0</DataType>
26 + <NotNull>1</NotNull>
27 + </column>
28 + <column id="10" parent="4" name="webtoon_link">
29 + <Position>4</Position>
30 + <DataType>text|0</DataType>
31 + <NotNull>1</NotNull>
32 + </column>
33 + <column id="11" parent="4" name="week">
34 + <Position>5</Position>
35 + <DataType>text|0</DataType>
36 + <NotNull>1</NotNull>
37 + </column>
38 + <key id="12" parent="4" name="PRIMARY">
39 + <NameSurrogate>1</NameSurrogate>
40 + <ColNames>toon_index</ColNames>
41 + <Primary>1</Primary>
42 + </key>
43 + <column id="13" parent="5" name="id">
44 + <Position>1</Position>
45 + <DataType>bigint(20)|0</DataType>
46 + <NotNull>1</NotNull>
47 + </column>
48 + <key id="14" parent="5" name="PRIMARY">
49 + <NameSurrogate>1</NameSurrogate>
50 + <ColNames>id</ColNames>
51 + <Primary>1</Primary>
52 + </key>
53 + <column id="15" parent="6" name="user_id">
54 + <Position>1</Position>
55 + <DataType>bigint(20)|0</DataType>
56 + <NotNull>1</NotNull>
57 + </column>
58 + <column id="16" parent="6" name="toon_index">
59 + <Position>2</Position>
60 + <DataType>int(11)|0</DataType>
61 + <NotNull>1</NotNull>
62 + </column>
63 + <column id="17" parent="6" name="recent">
64 + <Position>3</Position>
65 + <DataType>text|0</DataType>
66 + <NotNull>1</NotNull>
67 + </column>
68 + <index id="18" parent="6" name="toon_index">
69 + <ColNames>toon_index</ColNames>
70 + </index>
71 + <index id="19" parent="6" name="user_id">
72 + <ColNames>user_id</ColNames>
73 + </index>
74 + <foreign-key id="20" parent="6" name="user_toon_relation_ibfk_1">
75 + <ColNames>user_id</ColNames>
76 + <RefSchemaName>YTMT</RefSchemaName>
77 + <RefTableName>user</RefTableName>
78 + <RefColNames>id</RefColNames>
79 + </foreign-key>
80 + <foreign-key id="21" parent="6" name="user_toon_relation_ibfk_2">
81 + <ColNames>toon_index</ColNames>
82 + <RefSchemaName>YTMT</RefSchemaName>
83 + <RefTableName>toon</RefTableName>
84 + <RefColNames>toon_index</RefColNames>
85 + </foreign-key>
86 + </database-model>
87 +</dataSource>
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
...@@ -5,11 +5,24 @@ var logger = require('morgan'); ...@@ -5,11 +5,24 @@ var logger = require('morgan');
5 var cookieParser = require('cookie-parser'); 5 var cookieParser = require('cookie-parser');
6 var bodyParser = require('body-parser'); 6 var bodyParser = require('body-parser');
7 7
8 +var mysql = require('mysql');
8 var cheerio = require('cheerio'); 9 var cheerio = require('cheerio');
9 var request = require('request'); 10 var request = require('request');
10 var index = require('./routes/index'); 11 var index = require('./routes/index');
11 var users = require('./routes/users'); 12 var users = require('./routes/users');
12 var mytoons = require('./routes/mytoons'); 13 var mytoons = require('./routes/mytoons');
14 +var passport = require('passport');
15 +var setting = require('./routes/setting');
16 +var session = require('express-session');
17 +
18 +passport.serializeUser(function(user, done) {
19 + console.log('serialize');
20 + done(null, user);
21 +});
22 +passport.deserializeUser(function(obj, done) {
23 + console.log('deserialize');
24 + done(null, obj);
25 +});
13 26
14 var app = express(); 27 var app = express();
15 28
...@@ -25,9 +38,26 @@ app.use(bodyParser.urlencoded({ extended: false })); ...@@ -25,9 +38,26 @@ app.use(bodyParser.urlencoded({ extended: false }));
25 app.use(cookieParser()); 38 app.use(cookieParser());
26 app.use(express.static(path.join(__dirname, 'public'))); 39 app.use(express.static(path.join(__dirname, 'public')));
27 40
41 +connection = mysql.createConnection({
42 + host : 'nomock.com',
43 + user : 'ytmt',
44 + password : 'ytmt',
45 + port : 3306,
46 + database : 'YTMT'
47 +});
48 +
49 +app.use(session({
50 + secret: 'secrettexthere',
51 + saveUninitialized: true,
52 + resave: true
53 +}));
54 +
55 +app.use(passport.initialize());
56 +app.use(passport.session());
28 app.use('/', index); 57 app.use('/', index);
29 app.use('/users', users); 58 app.use('/users', users);
30 app.use('/mytoons', mytoons); 59 app.use('/mytoons', mytoons);
60 +app.use('/setting', setting);
31 61
32 //app.use(express.static('views')); 62 //app.use(express.static('views'));
33 63
...@@ -49,29 +79,6 @@ app.use(function(err, req, res, next) { ...@@ -49,29 +79,6 @@ app.use(function(err, req, res, next) {
49 res.render('error'); 79 res.render('error');
50 }); 80 });
51 81
52 -updatedToon = new Array();
53 -
54 -getUpdatedToons();
55 -
56 -function getUpdatedToons(){
57 -
58 - var allToonsUrl = "http://comic.naver.com/webtoon/weekday.nhn";
59 - request(allToonsUrl, function(err, res, html){
60 - if(!err){
61 - var $ = cheerio.load(html);
62 -
63 - $(".thumb").has('.ico_updt').next().each(function() {
64 - var link = $(this);
65 -
66 - var toonName = link.text();
67 - var toonHref = link.attr('href');
68 - updatedToon[toonName]=toonHref;
69 - });
70 -
71 - }
72 - });
73 -}
74 -
75 82
76 83
77 84
......
1 +../acorn/bin/acorn
...\ No newline at end of file ...\ No newline at end of file
1 +../babel-cli/bin/babel.js
...\ No newline at end of file ...\ No newline at end of file
1 +../babel-cli/bin/babel-doctor.js
...\ No newline at end of file ...\ No newline at end of file
1 +../babel-cli/bin/babel-external-helpers.js
...\ No newline at end of file ...\ No newline at end of file
1 +../babel-cli/bin/babel-node.js
...\ No newline at end of file ...\ No newline at end of file
1 +../babylon/bin/babylon.js
...\ No newline at end of file ...\ No newline at end of file
1 +../eslint/bin/eslint.js
...\ No newline at end of file ...\ No newline at end of file
1 +../esprima/bin/esparse.js
...\ No newline at end of file ...\ No newline at end of file
1 +../esprima/bin/esvalidate.js
...\ No newline at end of file ...\ No newline at end of file
1 +../hogan.js/bin/hulk
...\ No newline at end of file ...\ No newline at end of file
1 +../js-yaml/bin/js-yaml.js
...\ No newline at end of file ...\ No newline at end of file
1 +../jsesc/bin/jsesc
...\ No newline at end of file ...\ No newline at end of file
1 +../json5/lib/cli.js
...\ No newline at end of file ...\ No newline at end of file
1 +../knex/bin/cli.js
...\ No newline at end of file ...\ No newline at end of file
1 +../loose-envify/cli.js
...\ No newline at end of file ...\ No newline at end of file
1 +../nopt/bin/nopt.js
...\ No newline at end of file ...\ No newline at end of file
1 +../regjsparser/bin/parser
...\ No newline at end of file ...\ No newline at end of file
1 +../semver/bin/semver
...\ No newline at end of file ...\ No newline at end of file
1 +../shelljs/bin/shjs
...\ No newline at end of file ...\ No newline at end of file
1 +../user-home/cli.js
...\ No newline at end of file ...\ No newline at end of file
1 +This software is dual-licensed under the ISC and MIT licenses.
2 +You may use this software under EITHER of the following licenses.
3 +
4 +----------
5 +
6 +The ISC License
7 +
8 +Copyright (c) Isaac Z. Schlueter and Contributors
9 +
10 +Permission to use, copy, modify, and/or distribute this software for any
11 +purpose with or without fee is hereby granted, provided that the above
12 +copyright notice and this permission notice appear in all copies.
13 +
14 +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15 +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16 +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17 +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18 +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19 +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
20 +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 +
22 +----------
23 +
24 +Copyright Isaac Z. Schlueter and Contributors
25 +All rights reserved.
26 +
27 +Permission is hereby granted, free of charge, to any person
28 +obtaining a copy of this software and associated documentation
29 +files (the "Software"), to deal in the Software without
30 +restriction, including without limitation the rights to use,
31 +copy, modify, merge, publish, distribute, sublicense, and/or sell
32 +copies of the Software, and to permit persons to whom the
33 +Software is furnished to do so, subject to the following
34 +conditions:
35 +
36 +The above copyright notice and this permission notice shall be
37 +included in all copies or substantial portions of the Software.
38 +
39 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
40 +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
41 +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
42 +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
43 +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
44 +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
45 +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
46 +OTHER DEALINGS IN THE SOFTWARE.
1 +# abbrev-js
2 +
3 +Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).
4 +
5 +Usage:
6 +
7 + var abbrev = require("abbrev");
8 + abbrev("foo", "fool", "folding", "flop");
9 +
10 + // returns:
11 + { fl: 'flop'
12 + , flo: 'flop'
13 + , flop: 'flop'
14 + , fol: 'folding'
15 + , fold: 'folding'
16 + , foldi: 'folding'
17 + , foldin: 'folding'
18 + , folding: 'folding'
19 + , foo: 'foo'
20 + , fool: 'fool'
21 + }
22 +
23 +This is handy for command-line scripts, or other cases where you want to be able to accept shorthands.
1 +module.exports = exports = abbrev.abbrev = abbrev
2 +
3 +abbrev.monkeyPatch = monkeyPatch
4 +
5 +function monkeyPatch () {
6 + Object.defineProperty(Array.prototype, 'abbrev', {
7 + value: function () { return abbrev(this) },
8 + enumerable: false, configurable: true, writable: true
9 + })
10 +
11 + Object.defineProperty(Object.prototype, 'abbrev', {
12 + value: function () { return abbrev(Object.keys(this)) },
13 + enumerable: false, configurable: true, writable: true
14 + })
15 +}
16 +
17 +function abbrev (list) {
18 + if (arguments.length !== 1 || !Array.isArray(list)) {
19 + list = Array.prototype.slice.call(arguments, 0)
20 + }
21 + for (var i = 0, l = list.length, args = [] ; i < l ; i ++) {
22 + args[i] = typeof list[i] === "string" ? list[i] : String(list[i])
23 + }
24 +
25 + // sort them lexicographically, so that they're next to their nearest kin
26 + args = args.sort(lexSort)
27 +
28 + // walk through each, seeing how much it has in common with the next and previous
29 + var abbrevs = {}
30 + , prev = ""
31 + for (var i = 0, l = args.length ; i < l ; i ++) {
32 + var current = args[i]
33 + , next = args[i + 1] || ""
34 + , nextMatches = true
35 + , prevMatches = true
36 + if (current === next) continue
37 + for (var j = 0, cl = current.length ; j < cl ; j ++) {
38 + var curChar = current.charAt(j)
39 + nextMatches = nextMatches && curChar === next.charAt(j)
40 + prevMatches = prevMatches && curChar === prev.charAt(j)
41 + if (!nextMatches && !prevMatches) {
42 + j ++
43 + break
44 + }
45 + }
46 + prev = current
47 + if (j === cl) {
48 + abbrevs[current] = current
49 + continue
50 + }
51 + for (var a = current.substr(0, j) ; j <= cl ; j ++) {
52 + abbrevs[a] = current
53 + a += current.charAt(j)
54 + }
55 + }
56 + return abbrevs
57 +}
58 +
59 +function lexSort (a, b) {
60 + return a === b ? 0 : a > b ? 1 : -1
61 +}
1 +{
2 + "_args": [
3 + [
4 + {
5 + "raw": "abbrev@1",
6 + "scope": null,
7 + "escapedName": "abbrev",
8 + "name": "abbrev",
9 + "rawSpec": "1",
10 + "spec": ">=1.0.0 <2.0.0",
11 + "type": "range"
12 + },
13 + "/Users/kanghyeontae/IdeaProjects/YTMT/node_modules/nopt"
14 + ]
15 + ],
16 + "_from": "abbrev@>=1.0.0 <2.0.0",
17 + "_id": "abbrev@1.1.1",
18 + "_inCache": true,
19 + "_location": "/abbrev",
20 + "_nodeVersion": "8.5.0",
21 + "_npmOperationalInternal": {
22 + "host": "s3://npm-registry-packages",
23 + "tmp": "tmp/abbrev-1.1.1.tgz_1506566833068_0.05750026390887797"
24 + },
25 + "_npmUser": {
26 + "name": "isaacs",
27 + "email": "i@izs.me"
28 + },
29 + "_npmVersion": "5.4.2",
30 + "_phantomChildren": {},
31 + "_requested": {
32 + "raw": "abbrev@1",
33 + "scope": null,
34 + "escapedName": "abbrev",
35 + "name": "abbrev",
36 + "rawSpec": "1",
37 + "spec": ">=1.0.0 <2.0.0",
38 + "type": "range"
39 + },
40 + "_requiredBy": [
41 + "/nopt"
42 + ],
43 + "_resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz",
44 + "_shasum": "f8f2c887ad10bf67f634f005b6987fed3179aac8",
45 + "_shrinkwrap": null,
46 + "_spec": "abbrev@1",
47 + "_where": "/Users/kanghyeontae/IdeaProjects/YTMT/node_modules/nopt",
48 + "author": {
49 + "name": "Isaac Z. Schlueter",
50 + "email": "i@izs.me"
51 + },
52 + "bugs": {
53 + "url": "https://github.com/isaacs/abbrev-js/issues"
54 + },
55 + "dependencies": {},
56 + "description": "Like ruby's abbrev module, but in js",
57 + "devDependencies": {
58 + "tap": "^10.1"
59 + },
60 + "directories": {},
61 + "dist": {
62 + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
63 + "shasum": "f8f2c887ad10bf67f634f005b6987fed3179aac8",
64 + "tarball": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz"
65 + },
66 + "files": [
67 + "abbrev.js"
68 + ],
69 + "gitHead": "a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb",
70 + "homepage": "https://github.com/isaacs/abbrev-js#readme",
71 + "license": "ISC",
72 + "main": "abbrev.js",
73 + "maintainers": [
74 + {
75 + "name": "gabra",
76 + "email": "jerry+1@npmjs.com"
77 + },
78 + {
79 + "name": "isaacs",
80 + "email": "i@izs.me"
81 + }
82 + ],
83 + "name": "abbrev",
84 + "optionalDependencies": {},
85 + "readme": "ERROR: No README data found!",
86 + "repository": {
87 + "type": "git",
88 + "url": "git+ssh://git@github.com/isaacs/abbrev-js.git"
89 + },
90 + "scripts": {
91 + "postpublish": "git push origin --all; git push origin --tags",
92 + "postversion": "npm publish",
93 + "preversion": "npm test",
94 + "test": "tap test.js --100"
95 + },
96 + "version": "1.1.1"
97 +}
1 +Copyright (C) 2012-2014 by Ingvar Stepanyan
2 +
3 +Permission is hereby granted, free of charge, to any person obtaining a copy
4 +of this software and associated documentation files (the "Software"), to deal
5 +in the Software without restriction, including without limitation the rights
6 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 +copies of the Software, and to permit persons to whom the Software is
8 +furnished to do so, subject to the following conditions:
9 +
10 +The above copyright notice and this permission notice shall be included in
11 +all copies or substantial portions of the Software.
12 +
13 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 +THE SOFTWARE.
1 +# Acorn-JSX
2 +
3 +[![Build Status](https://travis-ci.org/RReverser/acorn-jsx.svg?branch=master)](https://travis-ci.org/RReverser/acorn-jsx)
4 +[![NPM version](https://img.shields.io/npm/v/acorn-jsx.svg)](https://www.npmjs.org/package/acorn-jsx)
5 +
6 +This is plugin for [Acorn](http://marijnhaverbeke.nl/acorn/) - a tiny, fast JavaScript parser, written completely in JavaScript.
7 +
8 +It was created as an experimental alternative, faster [React.js JSX](http://facebook.github.io/react/docs/jsx-in-depth.html) parser.
9 +
10 +According to [benchmarks](https://github.com/RReverser/acorn-jsx/blob/master/test/bench.html), Acorn-JSX is 2x faster than official [Esprima-based parser](https://github.com/facebook/esprima) when location tracking is turned on in both (call it "source maps enabled mode"). At the same time, it consumes all the ES6+JSX syntax that can be consumed by Esprima-FB (this is proved by [official tests](https://github.com/RReverser/acorn-jsx/blob/master/test/tests-jsx.js)).
11 +
12 +**UPDATE [14-Apr-2015]**: Facebook implementation started [deprecation process](https://github.com/facebook/esprima/issues/111) in favor of Acorn + Acorn-JSX + Babel for parsing and transpiling JSX syntax.
13 +
14 +## Transpiler
15 +
16 +Please note that this tool only parses source code to JSX AST, which is useful for various language tools and services. If you want to transpile your code to regular ES5-compliant JavaScript with source map, check out the [babel transpiler](https://babeljs.io/) which uses `acorn-jsx` under the hood.
17 +
18 +## Usage
19 +
20 +You can use module directly in order to get Acorn instance with plugin installed:
21 +
22 +```javascript
23 +var acorn = require('acorn-jsx');
24 +```
25 +
26 +Or you can use `inject.js` for injecting plugin into your own version of Acorn like following:
27 +
28 +```javascript
29 +var acorn = require('acorn-jsx/inject')(require('./custom-acorn'));
30 +```
31 +
32 +Then, use `plugins` option whenever you need to support JSX while parsing:
33 +
34 +```javascript
35 +var ast = acorn.parse(code, {
36 + plugins: { jsx: true }
37 +});
38 +```
39 +
40 +Note that official spec doesn't support mix of XML namespaces and object-style access in tag names (#27) like in `<namespace:Object.Property />`, so it was deprecated in `acorn-jsx@3.0`. If you still want to opt-in to support of such constructions, you can pass the following option:
41 +
42 +```javascript
43 +var ast = acorn.parse(code, {
44 + plugins: {
45 + jsx: { allowNamespacedObjects: true }
46 + }
47 +});
48 +```
49 +
50 +Also, since most apps use pure React transformer, a new option was introduced that allows to prohibit namespaces completely:
51 +
52 +```javascript
53 +var ast = acorn.parse(code, {
54 + plugins: {
55 + jsx: { allowNamespaces: false }
56 + }
57 +});
58 +```
59 +
60 +Note that by default `allowNamespaces` is enabled for spec compliancy.
61 +
62 +## License
63 +
64 +This plugin is issued under the [MIT license](./LICENSE).
1 +'use strict';
2 +
3 +module.exports = require('./inject')(require('acorn'));
This diff is collapsed. Click to expand it.
1 +../acorn/bin/acorn
...\ No newline at end of file ...\ No newline at end of file
1 +root = true
2 +
3 +[*]
4 +indent_style = space
5 +indent_size = 2
6 +end_of_line = lf
7 +insert_final_newline = true
1 +{
2 + "plugins": {
3 + "node": true,
4 + "es_modules": true
5 + }
6 +}
...\ No newline at end of file ...\ No newline at end of file
1 +language: node_js
2 +sudo: false
3 +node_js:
4 + - '0.12'
5 + - '4'
6 + - '5'
7 + - '6'
1 +List of Acorn contributors. Updated before every release.
2 +
3 +Adrian Rakovsky
4 +Alistair Braidwood
5 +Amila Welihinda
6 +Andres Suarez
7 +Angelo
8 +Aparajita Fishman
9 +Arian Stolwijk
10 +Artem Govorov
11 +Brandon Mills
12 +Charles Hughes
13 +Conrad Irwin
14 +Daniel Tschinder
15 +David Bonnet
16 +Domenico Matteo
17 +ForbesLindesay
18 +Forbes Lindesay
19 +Gilad Peleg
20 +impinball
21 +Ingvar Stepanyan
22 +Jackson Ray Hamilton
23 +Jesse McCarthy
24 +Jiaxing Wang
25 +Joel Kemp
26 +Johannes Herr
27 +Jordan Klassen
28 +Jürg Lehni
29 +keeyipchan
30 +Keheliya Gallaba
31 +Kevin Irish
32 +Kevin Kwok
33 +krator
34 +Marijn Haverbeke
35 +Martin Carlberg
36 +Mathias Bynens
37 +Mathieu 'p01' Henri
38 +Matthew Bastien
39 +Max Schaefer
40 +Max Zerzouri
41 +Mihai Bazon
42 +Mike Rennie
43 +Nicholas C. Zakas
44 +Nick Fitzgerald
45 +Olivier Thomann
46 +Oskar Schöldström
47 +Paul Harper
48 +Peter Rust
49 +PlNG
50 +Prayag Verma
51 +ReadmeCritic
52 +r-e-d
53 +Richard Gibson
54 +Rich Harris
55 +Rich-Harris
56 +Sebastian McKenzie
57 +Timothy Gu
58 +Toru Nagashima
59 +zsjforcn
1 +## 3.3.0 (2016-07-25)
2 +
3 +### Bug fixes
4 +
5 +Fix bug in tokenizing of regexp operator after a function declaration.
6 +
7 +Fix parser crash when parsing an array pattern with a hole.
8 +
9 +### New features
10 +
11 +Implement check against complex argument lists in functions that
12 +enable strict mode in ES7.
13 +
14 +## 3.2.0 (2016-06-07)
15 +
16 +### Bug fixes
17 +
18 +Improve handling of lack of unicode regexp support in host
19 +environment.
20 +
21 +Properly reject shorthand properties whose name is a keyword.
22 +
23 +Don't crash when the loose parser is called without options object.
24 +
25 +### New features
26 +
27 +Visitors created with `visit.make` now have their base as _prototype_,
28 +rather than copying properties into a fresh object.
29 +
30 +Make it possible to use `visit.ancestor` with a walk state.
31 +
32 +## 3.1.0 (2016-04-18)
33 +
34 +### Bug fixes
35 +
36 +Fix issue where the loose parser created invalid TemplateElement nodes
37 +for unclosed template literals.
38 +
39 +Properly tokenize the division operator directly after a function
40 +expression.
41 +
42 +Allow trailing comma in destructuring arrays.
43 +
44 +### New features
45 +
46 +The walker now allows defining handlers for `CatchClause` nodes.
47 +
48 +## 3.0.4 (2016-02-25)
49 +
50 +### Fixes
51 +
52 +Allow update expressions as left-hand-side of the ES7 exponential
53 +operator.
54 +
55 +## 3.0.2 (2016-02-10)
56 +
57 +### Fixes
58 +
59 +Fix bug that accidentally made `undefined` a reserved word when
60 +parsing ES7.
61 +
62 +## 3.0.0 (2016-02-10)
63 +
64 +### Breaking changes
65 +
66 +The default value of the `ecmaVersion` option is now 6 (used to be 5).
67 +
68 +Support for comprehension syntax (which was dropped from the draft
69 +spec) has been removed.
70 +
71 +### Fixes
72 +
73 +`let` and `yield` are now “contextual keywords”, meaning you can
74 +mostly use them as identifiers in ES5 non-strict code.
75 +
76 +A parenthesized class or function expression after `export default` is
77 +now parsed correctly.
78 +
79 +### New features
80 +
81 +When `ecmaVersion` is set to 7, Acorn will parse the exponentiation
82 +operator (`**`).
83 +
84 +The identifier character ranges are now based on Unicode 8.0.0.
85 +
86 +Plugins can now override the `raiseRecoverable` method to override the
87 +way non-critical errors are handled.
88 +
89 +## 2.7.0 (2016-01-04)
90 +
91 +### Fixes
92 +
93 +Stop allowing rest parameters in setters.
94 +
95 +Make sure the loose parser always attaches a `local` property to
96 +`ImportNamespaceSpecifier` nodes.
97 +
98 +Disallow `y` rexexp flag in ES5.
99 +
100 +Disallow `\00` and `\000` escapes in strict mode.
101 +
102 +Raise an error when an import name is a reserved word.
103 +
104 +## 2.6.4 (2015-11-12)
105 +
106 +### Fixes
107 +
108 +Fix crash in loose parser when parsing invalid object pattern.
109 +
110 +### New features
111 +
112 +Support plugins in the loose parser.
113 +
114 +## 2.6.2 (2015-11-10)
115 +
116 +### Fixes
117 +
118 +Don't crash when no options object is passed.
119 +
120 +## 2.6.0 (2015-11-09)
121 +
122 +### Fixes
123 +
124 +Add `await` as a reserved word in module sources.
125 +
126 +Disallow `yield` in a parameter default value for a generator.
127 +
128 +Forbid using a comma after a rest pattern in an array destructuring.
129 +
130 +### New features
131 +
132 +Support parsing stdin in command-line tool.
133 +
134 +## 2.5.2 (2015-10-27)
135 +
136 +### Fixes
137 +
138 +Fix bug where the walker walked an exported `let` statement as an
139 +expression.
140 +
141 +## 2.5.0 (2015-10-27)
142 +
143 +### Fixes
144 +
145 +Fix tokenizer support in the command-line tool.
146 +
147 +In the loose parser, don't allow non-string-literals as import
148 +sources.
149 +
150 +Stop allowing `new.target` outside of functions.
151 +
152 +Remove legacy `guard` and `guardedHandler` properties from try nodes.
153 +
154 +Stop allowing multiple `__proto__` properties on an object literal in
155 +strict mode.
156 +
157 +Don't allow rest parameters to be non-identifier patterns.
158 +
159 +Check for duplicate paramter names in arrow functions.
1 +Copyright (C) 2012-2016 by various contributors (see AUTHORS)
2 +
3 +Permission is hereby granted, free of charge, to any person obtaining a copy
4 +of this software and associated documentation files (the "Software"), to deal
5 +in the Software without restriction, including without limitation the rights
6 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 +copies of the Software, and to permit persons to whom the Software is
8 +furnished to do so, subject to the following conditions:
9 +
10 +The above copyright notice and this permission notice shall be included in
11 +all copies or substantial portions of the Software.
12 +
13 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 +THE SOFTWARE.
This diff is collapsed. Click to expand it.
1 +#!/usr/bin/env node
2 +'use strict';
3 +
4 +var path = require('path');
5 +var fs = require('fs');
6 +var acorn = require('../dist/acorn.js');
7 +
8 +var infile;
9 +var forceFile;
10 +var silent = false;
11 +var compact = false;
12 +var tokenize = false;
13 +var options = {}
14 +
15 +function help(status) {
16 + var print = (status == 0) ? console.log : console.error
17 + print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7]")
18 + print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]")
19 + process.exit(status)
20 +}
21 +
22 +for (var i = 2; i < process.argv.length; ++i) {
23 + var arg = process.argv[i]
24 + if ((arg == "-" || arg[0] != "-") && !infile) infile = arg
25 + else if (arg == "--" && !infile && i + 2 == process.argv.length) forceFile = infile = process.argv[++i]
26 + else if (arg == "--ecma3") options.ecmaVersion = 3
27 + else if (arg == "--ecma5") options.ecmaVersion = 5
28 + else if (arg == "--ecma6") options.ecmaVersion = 6
29 + else if (arg == "--ecma7") options.ecmaVersion = 7
30 + else if (arg == "--locations") options.locations = true
31 + else if (arg == "--allow-hash-bang") options.allowHashBang = true
32 + else if (arg == "--silent") silent = true
33 + else if (arg == "--compact") compact = true
34 + else if (arg == "--help") help(0)
35 + else if (arg == "--tokenize") tokenize = true
36 + else if (arg == "--module") options.sourceType = 'module'
37 + else help(1)
38 +}
39 +
40 +function run(code) {
41 + var result
42 + if (!tokenize) {
43 + try { result = acorn.parse(code, options) }
44 + catch(e) { console.error(e.message); process.exit(1) }
45 + } else {
46 + result = []
47 + var tokenizer = acorn.tokenizer(code, options), token
48 + while (true) {
49 + try { token = tokenizer.getToken() }
50 + catch(e) { console.error(e.message); process.exit(1) }
51 + result.push(token)
52 + if (token.type == acorn.tokTypes.eof) break
53 + }
54 + }
55 + if (!silent) console.log(JSON.stringify(result, null, compact ? null : 2))
56 +}
57 +
58 +if (forceFile || infile && infile != "-") {
59 + run(fs.readFileSync(infile, "utf8"))
60 +} else {
61 + var code = ""
62 + process.stdin.resume()
63 + process.stdin.on("data", function (chunk) { return code += chunk; })
64 + process.stdin.on("end", function () { return run(code); })
65 +}
...\ No newline at end of file ...\ No newline at end of file
1 +'use strict';
2 +
3 +// Which Unicode version should be used?
4 +var version = '9.0.0';
5 +
6 +var start = require('unicode-' + version + '/Binary_Property/ID_Start/code-points.js')
7 + .filter(function(ch) { return ch > 0x7f; });
8 +var last = -1;
9 +var cont = [0x200c, 0x200d].concat(require('unicode-' + version + '/Binary_Property/ID_Continue/code-points.js')
10 + .filter(function(ch) { return ch > 0x7f && search(start, ch, last + 1) == -1; }));
11 +
12 +function search(arr, ch, starting) {
13 + for (var i = starting; arr[i] <= ch && i < arr.length; last = i++)
14 + if (arr[i] === ch)
15 + return i;
16 + return -1;
17 +}
18 +
19 +function pad(str, width) {
20 + while (str.length < width) str = "0" + str;
21 + return str;
22 +}
23 +
24 +function esc(code) {
25 + var hex = code.toString(16);
26 + if (hex.length <= 2) return "\\x" + pad(hex, 2);
27 + else return "\\u" + pad(hex, 4);
28 +}
29 +
30 +function generate(chars) {
31 + var astral = [], re = "";
32 + for (var i = 0, at = 0x10000; i < chars.length; i++) {
33 + var from = chars[i], to = from;
34 + while (i < chars.length - 1 && chars[i + 1] == to + 1) {
35 + i++;
36 + to++;
37 + }
38 + if (to <= 0xffff) {
39 + if (from == to) re += esc(from);
40 + else if (from + 1 == to) re += esc(from) + esc(to);
41 + else re += esc(from) + "-" + esc(to);
42 + } else {
43 + astral.push(from - at, to - from);
44 + at = to;
45 + }
46 + }
47 + return {nonASCII: re, astral: astral};
48 +}
49 +
50 +var startData = generate(start), contData = generate(cont);
51 +
52 +console.log("let nonASCIIidentifierStartChars = \"" + startData.nonASCII + "\"");
53 +console.log("let nonASCIIidentifierChars = \"" + contData.nonASCII + "\"");
54 +console.log("const astralIdentifierStartCodes = " + JSON.stringify(startData.astral));
55 +console.log("const astralIdentifierCodes = " + JSON.stringify(contData.astral));
1 +# Combine existing list of authors with everyone known in git, sort, add header.
2 +tail --lines=+3 AUTHORS > AUTHORS.tmp
3 +git log --format='%aN' | grep -v abraidwood >> AUTHORS.tmp
4 +echo -e "List of Acorn contributors. Updated before every release.\n" > AUTHORS
5 +sort -u AUTHORS.tmp >> AUTHORS
6 +rm -f AUTHORS.tmp
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +{
2 + "_args": [
3 + [
4 + {
5 + "raw": "acorn@^3.0.4",
6 + "scope": null,
7 + "escapedName": "acorn",
8 + "name": "acorn",
9 + "rawSpec": "^3.0.4",
10 + "spec": ">=3.0.4 <4.0.0",
11 + "type": "range"
12 + },
13 + "/Users/kanghyeontae/IdeaProjects/YTMT/node_modules/acorn-jsx"
14 + ]
15 + ],
16 + "_from": "acorn@>=3.0.4 <4.0.0",
17 + "_id": "acorn@3.3.0",
18 + "_inCache": true,
19 + "_location": "/acorn-jsx/acorn",
20 + "_nodeVersion": "6.3.0",
21 + "_npmOperationalInternal": {
22 + "host": "packages-16-east.internal.npmjs.com",
23 + "tmp": "tmp/acorn-3.3.0.tgz_1469481913382_0.3856039580423385"
24 + },
25 + "_npmUser": {
26 + "name": "marijn",
27 + "email": "marijnh@gmail.com"
28 + },
29 + "_npmVersion": "3.10.3",
30 + "_phantomChildren": {},
31 + "_requested": {
32 + "raw": "acorn@^3.0.4",
33 + "scope": null,
34 + "escapedName": "acorn",
35 + "name": "acorn",
36 + "rawSpec": "^3.0.4",
37 + "spec": ">=3.0.4 <4.0.0",
38 + "type": "range"
39 + },
40 + "_requiredBy": [
41 + "/acorn-jsx"
42 + ],
43 + "_resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz",
44 + "_shasum": "45e37fb39e8da3f25baee3ff5369e2bb5f22017a",
45 + "_shrinkwrap": null,
46 + "_spec": "acorn@^3.0.4",
47 + "_where": "/Users/kanghyeontae/IdeaProjects/YTMT/node_modules/acorn-jsx",
48 + "bin": {
49 + "acorn": "./bin/acorn"
50 + },
51 + "bugs": {
52 + "url": "https://github.com/ternjs/acorn/issues"
53 + },
54 + "contributors": [
55 + {
56 + "name": "List of Acorn contributors. Updated before every release."
57 + },
58 + {
59 + "name": "Adrian Rakovsky"
60 + },
61 + {
62 + "name": "Alistair Braidwood"
63 + },
64 + {
65 + "name": "Amila Welihinda"
66 + },
67 + {
68 + "name": "Andres Suarez"
69 + },
70 + {
71 + "name": "Angelo"
72 + },
73 + {
74 + "name": "Aparajita Fishman"
75 + },
76 + {
77 + "name": "Arian Stolwijk"
78 + },
79 + {
80 + "name": "Artem Govorov"
81 + },
82 + {
83 + "name": "Brandon Mills"
84 + },
85 + {
86 + "name": "Charles Hughes"
87 + },
88 + {
89 + "name": "Conrad Irwin"
90 + },
91 + {
92 + "name": "Daniel Tschinder"
93 + },
94 + {
95 + "name": "David Bonnet"
96 + },
97 + {
98 + "name": "Domenico Matteo"
99 + },
100 + {
101 + "name": "ForbesLindesay"
102 + },
103 + {
104 + "name": "Forbes Lindesay"
105 + },
106 + {
107 + "name": "Gilad Peleg"
108 + },
109 + {
110 + "name": "impinball"
111 + },
112 + {
113 + "name": "Ingvar Stepanyan"
114 + },
115 + {
116 + "name": "Jackson Ray Hamilton"
117 + },
118 + {
119 + "name": "Jesse McCarthy"
120 + },
121 + {
122 + "name": "Jiaxing Wang"
123 + },
124 + {
125 + "name": "Joel Kemp"
126 + },
127 + {
128 + "name": "Johannes Herr"
129 + },
130 + {
131 + "name": "Jordan Klassen"
132 + },
133 + {
134 + "name": "Jürg Lehni"
135 + },
136 + {
137 + "name": "keeyipchan"
138 + },
139 + {
140 + "name": "Keheliya Gallaba"
141 + },
142 + {
143 + "name": "Kevin Irish"
144 + },
145 + {
146 + "name": "Kevin Kwok"
147 + },
148 + {
149 + "name": "krator"
150 + },
151 + {
152 + "name": "Marijn Haverbeke"
153 + },
154 + {
155 + "name": "Martin Carlberg"
156 + },
157 + {
158 + "name": "Mathias Bynens"
159 + },
160 + {
161 + "name": "Mathieu 'p01' Henri"
162 + },
163 + {
164 + "name": "Matthew Bastien"
165 + },
166 + {
167 + "name": "Max Schaefer"
168 + },
169 + {
170 + "name": "Max Zerzouri"
171 + },
172 + {
173 + "name": "Mihai Bazon"
174 + },
175 + {
176 + "name": "Mike Rennie"
177 + },
178 + {
179 + "name": "Nicholas C. Zakas"
180 + },
181 + {
182 + "name": "Nick Fitzgerald"
183 + },
184 + {
185 + "name": "Olivier Thomann"
186 + },
187 + {
188 + "name": "Oskar Schöldström"
189 + },
190 + {
191 + "name": "Paul Harper"
192 + },
193 + {
194 + "name": "Peter Rust"
195 + },
196 + {
197 + "name": "PlNG"
198 + },
199 + {
200 + "name": "Prayag Verma"
201 + },
202 + {
203 + "name": "ReadmeCritic"
204 + },
205 + {
206 + "name": "r-e-d"
207 + },
208 + {
209 + "name": "Richard Gibson"
210 + },
211 + {
212 + "name": "Rich Harris"
213 + },
214 + {
215 + "name": "Rich-Harris"
216 + },
217 + {
218 + "name": "Sebastian McKenzie"
219 + },
220 + {
221 + "name": "Timothy Gu"
222 + },
223 + {
224 + "name": "Toru Nagashima"
225 + },
226 + {
227 + "name": "zsjforcn"
228 + }
229 + ],
230 + "dependencies": {},
231 + "description": "ECMAScript parser",
232 + "devDependencies": {
233 + "rollup": "^0.34.1",
234 + "rollup-plugin-buble": "^0.11.0",
235 + "unicode-9.0.0": "^0.7.0"
236 + },
237 + "directories": {},
238 + "dist": {
239 + "shasum": "45e37fb39e8da3f25baee3ff5369e2bb5f22017a",
240 + "tarball": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz"
241 + },
242 + "engines": {
243 + "node": ">=0.4.0"
244 + },
245 + "gitHead": "693c5fe9257c3e114a7097dc9196d6e484e52809",
246 + "homepage": "https://github.com/ternjs/acorn",
247 + "jsnext:main": "dist/acorn.es.js",
248 + "license": "MIT",
249 + "main": "dist/acorn.js",
250 + "maintainers": [
251 + {
252 + "name": "marijn",
253 + "email": "marijnh@gmail.com"
254 + },
255 + {
256 + "name": "rreverser",
257 + "email": "me@rreverser.com"
258 + }
259 + ],
260 + "name": "acorn",
261 + "optionalDependencies": {},
262 + "readme": "ERROR: No README data found!",
263 + "repository": {
264 + "type": "git",
265 + "url": "git+https://github.com/ternjs/acorn.git"
266 + },
267 + "scripts": {
268 + "build": "npm run build:main && npm run build:walk && npm run build:loose && npm run build:bin",
269 + "build:bin": "rollup -c rollup/config.bin.js",
270 + "build:loose": "rollup -c rollup/config.loose.js",
271 + "build:main": "rollup -c rollup/config.main.js",
272 + "build:walk": "rollup -c rollup/config.walk.js",
273 + "prepublish": "npm test",
274 + "pretest": "npm run build",
275 + "test": "node test/run.js"
276 + },
277 + "version": "3.3.0"
278 +}
1 +import buble from 'rollup-plugin-buble'
2 +
3 +export default {
4 + entry: 'src/bin/acorn.js',
5 + dest: 'bin/acorn',
6 + format: 'cjs',
7 + banner: '#!/usr/bin/env node',
8 + external: [ 'fs', 'path', 'acorn' ],
9 + paths: {
10 + acorn: '../dist/acorn.js'
11 + },
12 + plugins: [
13 + buble()
14 + ]
15 +}
1 +import buble from 'rollup-plugin-buble'
2 +
3 +export default {
4 + entry: 'src/loose/index.js',
5 + moduleName: 'acorn.loose',
6 + external: [ 'acorn' ],
7 + paths: {
8 + acorn: './acorn.js'
9 + },
10 + globals: {
11 + acorn: 'acorn'
12 + },
13 + targets: [
14 + { dest: 'dist/acorn_loose.js', format: 'umd' },
15 + { dest: 'dist/acorn_loose.es.js', format: 'es' }
16 + ],
17 + plugins: [
18 + buble()
19 + ]
20 +}
1 +import buble from 'rollup-plugin-buble';
2 +
3 +export default {
4 + entry: 'src/index.js',
5 + moduleName: 'acorn',
6 + plugins: [ buble() ],
7 + targets: [
8 + { dest: 'dist/acorn.js', format: 'umd' },
9 + { dest: 'dist/acorn.es.js', format: 'es' }
10 + ]
11 +};
1 +import buble from 'rollup-plugin-buble';
2 +
3 +export default {
4 + entry: 'src/walk/index.js',
5 + moduleName: 'acorn.walk',
6 + plugins: [ buble() ],
7 + targets: [
8 + { dest: 'dist/walk.js', format: 'umd' },
9 + { dest: 'dist/walk.es.js', format: 'es' }
10 + ]
11 +};
1 +import {basename} from "path"
2 +import {readFileSync as readFile} from "fs"
3 +import * as acorn from "acorn"
4 +
5 +let infile, forceFile, silent = false, compact = false, tokenize = false
6 +const options = {}
7 +
8 +function help(status) {
9 + const print = (status == 0) ? console.log : console.error
10 + print("usage: " + basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7]")
11 + print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]")
12 + process.exit(status)
13 +}
14 +
15 +for (let i = 2; i < process.argv.length; ++i) {
16 + const arg = process.argv[i]
17 + if ((arg == "-" || arg[0] != "-") && !infile) infile = arg
18 + else if (arg == "--" && !infile && i + 2 == process.argv.length) forceFile = infile = process.argv[++i]
19 + else if (arg == "--ecma3") options.ecmaVersion = 3
20 + else if (arg == "--ecma5") options.ecmaVersion = 5
21 + else if (arg == "--ecma6") options.ecmaVersion = 6
22 + else if (arg == "--ecma7") options.ecmaVersion = 7
23 + else if (arg == "--locations") options.locations = true
24 + else if (arg == "--allow-hash-bang") options.allowHashBang = true
25 + else if (arg == "--silent") silent = true
26 + else if (arg == "--compact") compact = true
27 + else if (arg == "--help") help(0)
28 + else if (arg == "--tokenize") tokenize = true
29 + else if (arg == "--module") options.sourceType = 'module'
30 + else help(1)
31 +}
32 +
33 +function run(code) {
34 + let result
35 + if (!tokenize) {
36 + try { result = acorn.parse(code, options) }
37 + catch(e) { console.error(e.message); process.exit(1) }
38 + } else {
39 + result = []
40 + let tokenizer = acorn.tokenizer(code, options), token
41 + while (true) {
42 + try { token = tokenizer.getToken() }
43 + catch(e) { console.error(e.message); process.exit(1) }
44 + result.push(token)
45 + if (token.type == acorn.tokTypes.eof) break
46 + }
47 + }
48 + if (!silent) console.log(JSON.stringify(result, null, compact ? null : 2))
49 +}
50 +
51 +if (forceFile || infile && infile != "-") {
52 + run(readFile(infile, "utf8"))
53 +} else {
54 + let code = ""
55 + process.stdin.resume()
56 + process.stdin.on("data", chunk => code += chunk)
57 + process.stdin.on("end", () => run(code))
58 +}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +// Acorn is a tiny, fast JavaScript parser written in JavaScript.
2 +//
3 +// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and
4 +// various contributors and released under an MIT license.
5 +//
6 +// Git repositories for Acorn are available at
7 +//
8 +// http://marijnhaverbeke.nl/git/acorn
9 +// https://github.com/ternjs/acorn.git
10 +//
11 +// Please use the [github bug tracker][ghbt] to report issues.
12 +//
13 +// [ghbt]: https://github.com/ternjs/acorn/issues
14 +//
15 +// This file defines the main parser interface. The library also comes
16 +// with a [error-tolerant parser][dammit] and an
17 +// [abstract syntax tree walker][walk], defined in other files.
18 +//
19 +// [dammit]: acorn_loose.js
20 +// [walk]: util/walk.js
21 +
22 +import {Parser} from "./state"
23 +import "./parseutil"
24 +import "./statement"
25 +import "./lval"
26 +import "./expression"
27 +import "./location"
28 +
29 +export {Parser, plugins} from "./state"
30 +export {defaultOptions} from "./options"
31 +export {Position, SourceLocation, getLineInfo} from "./locutil"
32 +export {Node} from "./node"
33 +export {TokenType, types as tokTypes} from "./tokentype"
34 +export {TokContext, types as tokContexts} from "./tokencontext"
35 +export {isIdentifierChar, isIdentifierStart} from "./identifier"
36 +export {Token} from "./tokenize"
37 +export {isNewLine, lineBreak, lineBreakG} from "./whitespace"
38 +
39 +export const version = "3.3.0"
40 +
41 +// The main exported interface (under `self.acorn` when in the
42 +// browser) is a `parse` function that takes a code string and
43 +// returns an abstract syntax tree as specified by [Mozilla parser
44 +// API][api].
45 +//
46 +// [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API
47 +
48 +export function parse(input, options) {
49 + return new Parser(options, input).parse()
50 +}
51 +
52 +// This function tries to parse a single expression at a given
53 +// offset in a string. Useful for parsing mixed-language formats
54 +// that embed JavaScript expressions.
55 +
56 +export function parseExpressionAt(input, pos, options) {
57 + let p = new Parser(options, input, pos)
58 + p.nextToken()
59 + return p.parseExpression()
60 +}
61 +
62 +// Acorn is organized as a tokenizer and a recursive-descent parser.
63 +// The `tokenizer` export provides an interface to the tokenizer.
64 +
65 +export function tokenizer(input, options) {
66 + return new Parser(options, input)
67 +}
1 +import {Parser} from "./state"
2 +import {Position, getLineInfo} from "./locutil"
3 +
4 +const pp = Parser.prototype
5 +
6 +// This function is used to raise exceptions on parse errors. It
7 +// takes an offset integer (into the current `input`) to indicate
8 +// the location of the error, attaches the position to the end
9 +// of the error message, and then raises a `SyntaxError` with that
10 +// message.
11 +
12 +pp.raise = function(pos, message) {
13 + let loc = getLineInfo(this.input, pos)
14 + message += " (" + loc.line + ":" + loc.column + ")"
15 + let err = new SyntaxError(message)
16 + err.pos = pos; err.loc = loc; err.raisedAt = this.pos
17 + throw err
18 +}
19 +
20 +pp.raiseRecoverable = pp.raise
21 +
22 +pp.curPosition = function() {
23 + if (this.options.locations) {
24 + return new Position(this.curLine, this.pos - this.lineStart)
25 + }
26 +}
1 +import {lineBreakG} from "./whitespace"
2 +
3 +// These are used when `options.locations` is on, for the
4 +// `startLoc` and `endLoc` properties.
5 +
6 +export class Position {
7 + constructor(line, col) {
8 + this.line = line
9 + this.column = col
10 + }
11 +
12 + offset(n) {
13 + return new Position(this.line, this.column + n)
14 + }
15 +}
16 +
17 +export class SourceLocation {
18 + constructor(p, start, end) {
19 + this.start = start
20 + this.end = end
21 + if (p.sourceFile !== null) this.source = p.sourceFile
22 + }
23 +}
24 +
25 +// The `getLineInfo` function is mostly useful when the
26 +// `locations` option is off (for performance reasons) and you
27 +// want to find the line/column position for a given character
28 +// offset. `input` should be the code string that the offset refers
29 +// into.
30 +
31 +export function getLineInfo(input, offset) {
32 + for (let line = 1, cur = 0;;) {
33 + lineBreakG.lastIndex = cur
34 + let match = lineBreakG.exec(input)
35 + if (match && match.index < offset) {
36 + ++line
37 + cur = match.index + match[0].length
38 + } else {
39 + return new Position(line, offset - cur)
40 + }
41 + }
42 +}
1 +// Acorn: Loose parser
2 +//
3 +// This module provides an alternative parser (`parse_dammit`) that
4 +// exposes that same interface as `parse`, but will try to parse
5 +// anything as JavaScript, repairing syntax error the best it can.
6 +// There are circumstances in which it will raise an error and give
7 +// up, but they are very rare. The resulting AST will be a mostly
8 +// valid JavaScript AST (as per the [Mozilla parser API][api], except
9 +// that:
10 +//
11 +// - Return outside functions is allowed
12 +//
13 +// - Label consistency (no conflicts, break only to existing labels)
14 +// is not enforced.
15 +//
16 +// - Bogus Identifier nodes with a name of `"✖"` are inserted whenever
17 +// the parser got too confused to return anything meaningful.
18 +//
19 +// [api]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API
20 +//
21 +// The expected use for this is to *first* try `acorn.parse`, and only
22 +// if that fails switch to `parse_dammit`. The loose parser might
23 +// parse badly indented code incorrectly, so **don't** use it as
24 +// your default parser.
25 +//
26 +// Quite a lot of acorn.js is duplicated here. The alternative was to
27 +// add a *lot* of extra cruft to that file, making it less readable
28 +// and slower. Copying and editing the code allowed me to make
29 +// invasive changes and simplifications without creating a complicated
30 +// tangle.
31 +
32 +import acorn from "acorn"
33 +import {LooseParser, pluginsLoose} from "./state"
34 +import "./tokenize"
35 +import "./statement"
36 +import "./expression"
37 +
38 +export {LooseParser, pluginsLoose} from "./state"
39 +
40 +acorn.defaultOptions.tabSize = 4
41 +
42 +export function parse_dammit(input, options) {
43 + let p = new LooseParser(input, options)
44 + p.next()
45 + return p.parseTopLevel()
46 +}
47 +
48 +acorn.parse_dammit = parse_dammit
49 +acorn.LooseParser = LooseParser
50 +acorn.pluginsLoose = pluginsLoose
1 +export function isDummy(node) { return node.name == "✖" }
...\ No newline at end of file ...\ No newline at end of file
1 +import {tokenizer, SourceLocation, tokTypes as tt, Node, lineBreak, isNewLine} from "acorn"
2 +
3 +// Registered plugins
4 +export const pluginsLoose = {}
5 +
6 +export class LooseParser {
7 + constructor(input, options = {}) {
8 + this.toks = tokenizer(input, options)
9 + this.options = this.toks.options
10 + this.input = this.toks.input
11 + this.tok = this.last = {type: tt.eof, start: 0, end: 0}
12 + if (this.options.locations) {
13 + let here = this.toks.curPosition()
14 + this.tok.loc = new SourceLocation(this.toks, here, here)
15 + }
16 + this.ahead = [] // Tokens ahead
17 + this.context = [] // Indentation contexted
18 + this.curIndent = 0
19 + this.curLineStart = 0
20 + this.nextLineStart = this.lineEnd(this.curLineStart) + 1
21 + // Load plugins
22 + this.options.pluginsLoose = options.pluginsLoose || {}
23 + this.loadPlugins(this.options.pluginsLoose)
24 + }
25 +
26 + startNode() {
27 + return new Node(this.toks, this.tok.start, this.options.locations ? this.tok.loc.start : null)
28 + }
29 +
30 + storeCurrentPos() {
31 + return this.options.locations ? [this.tok.start, this.tok.loc.start] : this.tok.start
32 + }
33 +
34 + startNodeAt(pos) {
35 + if (this.options.locations) {
36 + return new Node(this.toks, pos[0], pos[1])
37 + } else {
38 + return new Node(this.toks, pos)
39 + }
40 + }
41 +
42 + finishNode(node, type) {
43 + node.type = type
44 + node.end = this.last.end
45 + if (this.options.locations)
46 + node.loc.end = this.last.loc.end
47 + if (this.options.ranges)
48 + node.range[1] = this.last.end
49 + return node
50 + }
51 +
52 + dummyNode(type) {
53 + let dummy = this.startNode()
54 + dummy.type = type
55 + dummy.end = dummy.start
56 + if (this.options.locations)
57 + dummy.loc.end = dummy.loc.start
58 + if (this.options.ranges)
59 + dummy.range[1] = dummy.start
60 + this.last = {type: tt.name, start: dummy.start, end: dummy.start, loc: dummy.loc}
61 + return dummy
62 + }
63 +
64 + dummyIdent() {
65 + let dummy = this.dummyNode("Identifier")
66 + dummy.name = "✖"
67 + return dummy
68 + }
69 +
70 + dummyString() {
71 + let dummy = this.dummyNode("Literal")
72 + dummy.value = dummy.raw = "✖"
73 + return dummy
74 + }
75 +
76 + eat(type) {
77 + if (this.tok.type === type) {
78 + this.next()
79 + return true
80 + } else {
81 + return false
82 + }
83 + }
84 +
85 + isContextual(name) {
86 + return this.tok.type === tt.name && this.tok.value === name
87 + }
88 +
89 + eatContextual(name) {
90 + return this.tok.value === name && this.eat(tt.name)
91 + }
92 +
93 + canInsertSemicolon() {
94 + return this.tok.type === tt.eof || this.tok.type === tt.braceR ||
95 + lineBreak.test(this.input.slice(this.last.end, this.tok.start))
96 + }
97 +
98 + semicolon() {
99 + return this.eat(tt.semi)
100 + }
101 +
102 + expect(type) {
103 + if (this.eat(type)) return true
104 + for (let i = 1; i <= 2; i++) {
105 + if (this.lookAhead(i).type == type) {
106 + for (let j = 0; j < i; j++) this.next()
107 + return true
108 + }
109 + }
110 + }
111 +
112 + pushCx() {
113 + this.context.push(this.curIndent)
114 + }
115 +
116 + popCx() {
117 + this.curIndent = this.context.pop()
118 + }
119 +
120 + lineEnd(pos) {
121 + while (pos < this.input.length && !isNewLine(this.input.charCodeAt(pos))) ++pos
122 + return pos
123 + }
124 +
125 + indentationAfter(pos) {
126 + for (let count = 0;; ++pos) {
127 + let ch = this.input.charCodeAt(pos)
128 + if (ch === 32) ++count
129 + else if (ch === 9) count += this.options.tabSize
130 + else return count
131 + }
132 + }
133 +
134 + closes(closeTok, indent, line, blockHeuristic) {
135 + if (this.tok.type === closeTok || this.tok.type === tt.eof) return true
136 + return line != this.curLineStart && this.curIndent < indent && this.tokenStartsLine() &&
137 + (!blockHeuristic || this.nextLineStart >= this.input.length ||
138 + this.indentationAfter(this.nextLineStart) < indent)
139 + }
140 +
141 + tokenStartsLine() {
142 + for (let p = this.tok.start - 1; p >= this.curLineStart; --p) {
143 + let ch = this.input.charCodeAt(p)
144 + if (ch !== 9 && ch !== 32) return false
145 + }
146 + return true
147 + }
148 +
149 + extend(name, f) {
150 + this[name] = f(this[name])
151 + }
152 +
153 + loadPlugins(pluginConfigs) {
154 + for (let name in pluginConfigs) {
155 + let plugin = pluginsLoose[name]
156 + if (!plugin) throw new Error("Plugin '" + name + "' not found")
157 + plugin(this, pluginConfigs[name])
158 + }
159 + }
160 +}
This diff is collapsed. Click to expand it.
1 +import {tokTypes as tt, Token, isNewLine, SourceLocation, getLineInfo, lineBreakG} from "acorn"
2 +import {LooseParser} from "./state"
3 +
4 +const lp = LooseParser.prototype
5 +
6 +function isSpace(ch) {
7 + return (ch < 14 && ch > 8) || ch === 32 || ch === 160 || isNewLine(ch)
8 +}
9 +
10 +lp.next = function() {
11 + this.last = this.tok
12 + if (this.ahead.length)
13 + this.tok = this.ahead.shift()
14 + else
15 + this.tok = this.readToken()
16 +
17 + if (this.tok.start >= this.nextLineStart) {
18 + while (this.tok.start >= this.nextLineStart) {
19 + this.curLineStart = this.nextLineStart
20 + this.nextLineStart = this.lineEnd(this.curLineStart) + 1
21 + }
22 + this.curIndent = this.indentationAfter(this.curLineStart)
23 + }
24 +}
25 +
26 +lp.readToken = function() {
27 + for (;;) {
28 + try {
29 + this.toks.next()
30 + if (this.toks.type === tt.dot &&
31 + this.input.substr(this.toks.end, 1) === "." &&
32 + this.options.ecmaVersion >= 6) {
33 + this.toks.end++
34 + this.toks.type = tt.ellipsis
35 + }
36 + return new Token(this.toks)
37 + } catch(e) {
38 + if (!(e instanceof SyntaxError)) throw e
39 +
40 + // Try to skip some text, based on the error message, and then continue
41 + let msg = e.message, pos = e.raisedAt, replace = true
42 + if (/unterminated/i.test(msg)) {
43 + pos = this.lineEnd(e.pos + 1)
44 + if (/string/.test(msg)) {
45 + replace = {start: e.pos, end: pos, type: tt.string, value: this.input.slice(e.pos + 1, pos)}
46 + } else if (/regular expr/i.test(msg)) {
47 + let re = this.input.slice(e.pos, pos)
48 + try { re = new RegExp(re) } catch(e) {}
49 + replace = {start: e.pos, end: pos, type: tt.regexp, value: re}
50 + } else if (/template/.test(msg)) {
51 + replace = {start: e.pos, end: pos,
52 + type: tt.template,
53 + value: this.input.slice(e.pos, pos)}
54 + } else {
55 + replace = false
56 + }
57 + } else if (/invalid (unicode|regexp|number)|expecting unicode|octal literal|is reserved|directly after number|expected number in radix/i.test(msg)) {
58 + while (pos < this.input.length && !isSpace(this.input.charCodeAt(pos))) ++pos
59 + } else if (/character escape|expected hexadecimal/i.test(msg)) {
60 + while (pos < this.input.length) {
61 + let ch = this.input.charCodeAt(pos++)
62 + if (ch === 34 || ch === 39 || isNewLine(ch)) break
63 + }
64 + } else if (/unexpected character/i.test(msg)) {
65 + pos++
66 + replace = false
67 + } else if (/regular expression/i.test(msg)) {
68 + replace = true
69 + } else {
70 + throw e
71 + }
72 + this.resetTo(pos)
73 + if (replace === true) replace = {start: pos, end: pos, type: tt.name, value: "✖"}
74 + if (replace) {
75 + if (this.options.locations)
76 + replace.loc = new SourceLocation(
77 + this.toks,
78 + getLineInfo(this.input, replace.start),
79 + getLineInfo(this.input, replace.end))
80 + return replace
81 + }
82 + }
83 + }
84 +}
85 +
86 +lp.resetTo = function(pos) {
87 + this.toks.pos = pos
88 + let ch = this.input.charAt(pos - 1)
89 + this.toks.exprAllowed = !ch || /[\[\{\(,;:?\/*=+\-~!|&%^<>]/.test(ch) ||
90 + /[enwfd]/.test(ch) &&
91 + /\b(keywords|case|else|return|throw|new|in|(instance|type)of|delete|void)$/.test(this.input.slice(pos - 10, pos))
92 +
93 + if (this.options.locations) {
94 + this.toks.curLine = 1
95 + this.toks.lineStart = lineBreakG.lastIndex = 0
96 + let match
97 + while ((match = lineBreakG.exec(this.input)) && match.index < pos) {
98 + ++this.toks.curLine
99 + this.toks.lineStart = match.index + match[0].length
100 + }
101 + }
102 +}
103 +
104 +lp.lookAhead = function(n) {
105 + while (n > this.ahead.length)
106 + this.ahead.push(this.readToken())
107 + return this.ahead[n - 1]
108 +}
1 +import {types as tt} from "./tokentype"
2 +import {Parser} from "./state"
3 +import {has} from "./util"
4 +
5 +const pp = Parser.prototype
6 +
7 +// Convert existing expression atom to assignable pattern
8 +// if possible.
9 +
10 +pp.toAssignable = function(node, isBinding) {
11 + if (this.options.ecmaVersion >= 6 && node) {
12 + switch (node.type) {
13 + case "Identifier":
14 + case "ObjectPattern":
15 + case "ArrayPattern":
16 + break
17 +
18 + case "ObjectExpression":
19 + node.type = "ObjectPattern"
20 + for (let i = 0; i < node.properties.length; i++) {
21 + let prop = node.properties[i]
22 + if (prop.kind !== "init") this.raise(prop.key.start, "Object pattern can't contain getter or setter")
23 + this.toAssignable(prop.value, isBinding)
24 + }
25 + break
26 +
27 + case "ArrayExpression":
28 + node.type = "ArrayPattern"
29 + this.toAssignableList(node.elements, isBinding)
30 + break
31 +
32 + case "AssignmentExpression":
33 + if (node.operator === "=") {
34 + node.type = "AssignmentPattern"
35 + delete node.operator
36 + // falls through to AssignmentPattern
37 + } else {
38 + this.raise(node.left.end, "Only '=' operator can be used for specifying default value.")
39 + break
40 + }
41 +
42 + case "AssignmentPattern":
43 + if (node.right.type === "YieldExpression")
44 + this.raise(node.right.start, "Yield expression cannot be a default value")
45 + break
46 +
47 + case "ParenthesizedExpression":
48 + node.expression = this.toAssignable(node.expression, isBinding)
49 + break
50 +
51 + case "MemberExpression":
52 + if (!isBinding) break
53 +
54 + default:
55 + this.raise(node.start, "Assigning to rvalue")
56 + }
57 + }
58 + return node
59 +}
60 +
61 +// Convert list of expression atoms to binding list.
62 +
63 +pp.toAssignableList = function(exprList, isBinding) {
64 + let end = exprList.length
65 + if (end) {
66 + let last = exprList[end - 1]
67 + if (last && last.type == "RestElement") {
68 + --end
69 + } else if (last && last.type == "SpreadElement") {
70 + last.type = "RestElement"
71 + let arg = last.argument
72 + this.toAssignable(arg, isBinding)
73 + if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern")
74 + this.unexpected(arg.start)
75 + --end
76 + }
77 +
78 + if (isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier")
79 + this.unexpected(last.argument.start)
80 + }
81 + for (let i = 0; i < end; i++) {
82 + let elt = exprList[i]
83 + if (elt) this.toAssignable(elt, isBinding)
84 + }
85 + return exprList
86 +}
87 +
88 +// Parses spread element.
89 +
90 +pp.parseSpread = function(refDestructuringErrors) {
91 + let node = this.startNode()
92 + this.next()
93 + node.argument = this.parseMaybeAssign(false, refDestructuringErrors)
94 + return this.finishNode(node, "SpreadElement")
95 +}
96 +
97 +pp.parseRest = function(allowNonIdent) {
98 + let node = this.startNode()
99 + this.next()
100 +
101 + // RestElement inside of a function parameter must be an identifier
102 + if (allowNonIdent) node.argument = this.type === tt.name ? this.parseIdent() : this.unexpected()
103 + else node.argument = this.type === tt.name || this.type === tt.bracketL ? this.parseBindingAtom() : this.unexpected()
104 +
105 + return this.finishNode(node, "RestElement")
106 +}
107 +
108 +// Parses lvalue (assignable) atom.
109 +
110 +pp.parseBindingAtom = function() {
111 + if (this.options.ecmaVersion < 6) return this.parseIdent()
112 + switch (this.type) {
113 + case tt.name:
114 + return this.parseIdent()
115 +
116 + case tt.bracketL:
117 + let node = this.startNode()
118 + this.next()
119 + node.elements = this.parseBindingList(tt.bracketR, true, true)
120 + return this.finishNode(node, "ArrayPattern")
121 +
122 + case tt.braceL:
123 + return this.parseObj(true)
124 +
125 + default:
126 + this.unexpected()
127 + }
128 +}
129 +
130 +pp.parseBindingList = function(close, allowEmpty, allowTrailingComma, allowNonIdent) {
131 + let elts = [], first = true
132 + while (!this.eat(close)) {
133 + if (first) first = false
134 + else this.expect(tt.comma)
135 + if (allowEmpty && this.type === tt.comma) {
136 + elts.push(null)
137 + } else if (allowTrailingComma && this.afterTrailingComma(close)) {
138 + break
139 + } else if (this.type === tt.ellipsis) {
140 + let rest = this.parseRest(allowNonIdent)
141 + this.parseBindingListItem(rest)
142 + elts.push(rest)
143 + if (this.type === tt.comma) this.raise(this.start, "Comma is not permitted after the rest element")
144 + this.expect(close)
145 + break
146 + } else {
147 + let elem = this.parseMaybeDefault(this.start, this.startLoc)
148 + this.parseBindingListItem(elem)
149 + elts.push(elem)
150 + }
151 + }
152 + return elts
153 +}
154 +
155 +pp.parseBindingListItem = function(param) {
156 + return param
157 +}
158 +
159 +// Parses assignment pattern around given atom if possible.
160 +
161 +pp.parseMaybeDefault = function(startPos, startLoc, left) {
162 + left = left || this.parseBindingAtom()
163 + if (this.options.ecmaVersion < 6 || !this.eat(tt.eq)) return left
164 + let node = this.startNodeAt(startPos, startLoc)
165 + node.left = left
166 + node.right = this.parseMaybeAssign()
167 + return this.finishNode(node, "AssignmentPattern")
168 +}
169 +
170 +// Verify that a node is an lval — something that can be assigned
171 +// to.
172 +
173 +pp.checkLVal = function(expr, isBinding, checkClashes) {
174 + switch (expr.type) {
175 + case "Identifier":
176 + if (this.strict && this.reservedWordsStrictBind.test(expr.name))
177 + this.raiseRecoverable(expr.start, (isBinding ? "Binding " : "Assigning to ") + expr.name + " in strict mode")
178 + if (checkClashes) {
179 + if (has(checkClashes, expr.name))
180 + this.raiseRecoverable(expr.start, "Argument name clash")
181 + checkClashes[expr.name] = true
182 + }
183 + break
184 +
185 + case "MemberExpression":
186 + if (isBinding) this.raiseRecoverable(expr.start, (isBinding ? "Binding" : "Assigning to") + " member expression")
187 + break
188 +
189 + case "ObjectPattern":
190 + for (let i = 0; i < expr.properties.length; i++)
191 + this.checkLVal(expr.properties[i].value, isBinding, checkClashes)
192 + break
193 +
194 + case "ArrayPattern":
195 + for (let i = 0; i < expr.elements.length; i++) {
196 + let elem = expr.elements[i]
197 + if (elem) this.checkLVal(elem, isBinding, checkClashes)
198 + }
199 + break
200 +
201 + case "AssignmentPattern":
202 + this.checkLVal(expr.left, isBinding, checkClashes)
203 + break
204 +
205 + case "RestElement":
206 + this.checkLVal(expr.argument, isBinding, checkClashes)
207 + break
208 +
209 + case "ParenthesizedExpression":
210 + this.checkLVal(expr.expression, isBinding, checkClashes)
211 + break
212 +
213 + default:
214 + this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " rvalue")
215 + }
216 +}
1 +import {Parser} from "./state"
2 +import {SourceLocation} from "./locutil"
3 +
4 +export class Node {
5 + constructor(parser, pos, loc) {
6 + this.type = ""
7 + this.start = pos
8 + this.end = 0
9 + if (parser.options.locations)
10 + this.loc = new SourceLocation(parser, loc)
11 + if (parser.options.directSourceFile)
12 + this.sourceFile = parser.options.directSourceFile
13 + if (parser.options.ranges)
14 + this.range = [pos, 0]
15 + }
16 +}
17 +
18 +// Start an AST node, attaching a start offset.
19 +
20 +const pp = Parser.prototype
21 +
22 +pp.startNode = function() {
23 + return new Node(this, this.start, this.startLoc)
24 +}
25 +
26 +pp.startNodeAt = function(pos, loc) {
27 + return new Node(this, pos, loc)
28 +}
29 +
30 +// Finish an AST node, adding `type` and `end` properties.
31 +
32 +function finishNodeAt(node, type, pos, loc) {
33 + node.type = type
34 + node.end = pos
35 + if (this.options.locations)
36 + node.loc.end = loc
37 + if (this.options.ranges)
38 + node.range[1] = pos
39 + return node
40 +}
41 +
42 +pp.finishNode = function(node, type) {
43 + return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc)
44 +}
45 +
46 +// Finish node at given position
47 +
48 +pp.finishNodeAt = function(node, type, pos, loc) {
49 + return finishNodeAt.call(this, node, type, pos, loc)
50 +}
1 +import {has, isArray} from "./util"
2 +import {SourceLocation} from "./locutil"
3 +
4 +// A second optional argument can be given to further configure
5 +// the parser process. These options are recognized:
6 +
7 +export const defaultOptions = {
8 + // `ecmaVersion` indicates the ECMAScript version to parse. Must
9 + // be either 3, or 5, or 6. This influences support for strict
10 + // mode, the set of reserved words, support for getters and
11 + // setters and other features. The default is 6.
12 + ecmaVersion: 6,
13 + // Source type ("script" or "module") for different semantics
14 + sourceType: "script",
15 + // `onInsertedSemicolon` can be a callback that will be called
16 + // when a semicolon is automatically inserted. It will be passed
17 + // th position of the comma as an offset, and if `locations` is
18 + // enabled, it is given the location as a `{line, column}` object
19 + // as second argument.
20 + onInsertedSemicolon: null,
21 + // `onTrailingComma` is similar to `onInsertedSemicolon`, but for
22 + // trailing commas.
23 + onTrailingComma: null,
24 + // By default, reserved words are only enforced if ecmaVersion >= 5.
25 + // Set `allowReserved` to a boolean value to explicitly turn this on
26 + // an off. When this option has the value "never", reserved words
27 + // and keywords can also not be used as property names.
28 + allowReserved: null,
29 + // When enabled, a return at the top level is not considered an
30 + // error.
31 + allowReturnOutsideFunction: false,
32 + // When enabled, import/export statements are not constrained to
33 + // appearing at the top of the program.
34 + allowImportExportEverywhere: false,
35 + // When enabled, hashbang directive in the beginning of file
36 + // is allowed and treated as a line comment.
37 + allowHashBang: false,
38 + // When `locations` is on, `loc` properties holding objects with
39 + // `start` and `end` properties in `{line, column}` form (with
40 + // line being 1-based and column 0-based) will be attached to the
41 + // nodes.
42 + locations: false,
43 + // A function can be passed as `onToken` option, which will
44 + // cause Acorn to call that function with object in the same
45 + // format as tokens returned from `tokenizer().getToken()`. Note
46 + // that you are not allowed to call the parser from the
47 + // callback—that will corrupt its internal state.
48 + onToken: null,
49 + // A function can be passed as `onComment` option, which will
50 + // cause Acorn to call that function with `(block, text, start,
51 + // end)` parameters whenever a comment is skipped. `block` is a
52 + // boolean indicating whether this is a block (`/* */`) comment,
53 + // `text` is the content of the comment, and `start` and `end` are
54 + // character offsets that denote the start and end of the comment.
55 + // When the `locations` option is on, two more parameters are
56 + // passed, the full `{line, column}` locations of the start and
57 + // end of the comments. Note that you are not allowed to call the
58 + // parser from the callback—that will corrupt its internal state.
59 + onComment: null,
60 + // Nodes have their start and end characters offsets recorded in
61 + // `start` and `end` properties (directly on the node, rather than
62 + // the `loc` object, which holds line/column data. To also add a
63 + // [semi-standardized][range] `range` property holding a `[start,
64 + // end]` array with the same numbers, set the `ranges` option to
65 + // `true`.
66 + //
67 + // [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678
68 + ranges: false,
69 + // It is possible to parse multiple files into a single AST by
70 + // passing the tree produced by parsing the first file as
71 + // `program` option in subsequent parses. This will add the
72 + // toplevel forms of the parsed file to the `Program` (top) node
73 + // of an existing parse tree.
74 + program: null,
75 + // When `locations` is on, you can pass this to record the source
76 + // file in every node's `loc` object.
77 + sourceFile: null,
78 + // This value, if given, is stored in every node, whether
79 + // `locations` is on or off.
80 + directSourceFile: null,
81 + // When enabled, parenthesized expressions are represented by
82 + // (non-standard) ParenthesizedExpression nodes
83 + preserveParens: false,
84 + plugins: {}
85 +}
86 +
87 +// Interpret and default an options object
88 +
89 +export function getOptions(opts) {
90 + let options = {}
91 + for (let opt in defaultOptions)
92 + options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt]
93 + if (options.allowReserved == null)
94 + options.allowReserved = options.ecmaVersion < 5
95 +
96 + if (isArray(options.onToken)) {
97 + let tokens = options.onToken
98 + options.onToken = (token) => tokens.push(token)
99 + }
100 + if (isArray(options.onComment))
101 + options.onComment = pushComment(options, options.onComment)
102 +
103 + return options
104 +}
105 +
106 +function pushComment(options, array) {
107 + return function (block, text, start, end, startLoc, endLoc) {
108 + let comment = {
109 + type: block ? 'Block' : 'Line',
110 + value: text,
111 + start: start,
112 + end: end
113 + }
114 + if (options.locations)
115 + comment.loc = new SourceLocation(this, startLoc, endLoc)
116 + if (options.ranges)
117 + comment.range = [start, end]
118 + array.push(comment)
119 + }
120 +}
121 +
1 +import {types as tt} from "./tokentype"
2 +import {Parser} from "./state"
3 +import {lineBreak} from "./whitespace"
4 +
5 +const pp = Parser.prototype
6 +
7 +// ## Parser utilities
8 +
9 +// Test whether a statement node is the string literal `"use strict"`.
10 +
11 +pp.isUseStrict = function(stmt) {
12 + return this.options.ecmaVersion >= 5 && stmt.type === "ExpressionStatement" &&
13 + stmt.expression.type === "Literal" &&
14 + stmt.expression.raw.slice(1, -1) === "use strict"
15 +}
16 +
17 +// Predicate that tests whether the next token is of the given
18 +// type, and if yes, consumes it as a side effect.
19 +
20 +pp.eat = function(type) {
21 + if (this.type === type) {
22 + this.next()
23 + return true
24 + } else {
25 + return false
26 + }
27 +}
28 +
29 +// Tests whether parsed token is a contextual keyword.
30 +
31 +pp.isContextual = function(name) {
32 + return this.type === tt.name && this.value === name
33 +}
34 +
35 +// Consumes contextual keyword if possible.
36 +
37 +pp.eatContextual = function(name) {
38 + return this.value === name && this.eat(tt.name)
39 +}
40 +
41 +// Asserts that following token is given contextual keyword.
42 +
43 +pp.expectContextual = function(name) {
44 + if (!this.eatContextual(name)) this.unexpected()
45 +}
46 +
47 +// Test whether a semicolon can be inserted at the current position.
48 +
49 +pp.canInsertSemicolon = function() {
50 + return this.type === tt.eof ||
51 + this.type === tt.braceR ||
52 + lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
53 +}
54 +
55 +pp.insertSemicolon = function() {
56 + if (this.canInsertSemicolon()) {
57 + if (this.options.onInsertedSemicolon)
58 + this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc)
59 + return true
60 + }
61 +}
62 +
63 +// Consume a semicolon, or, failing that, see if we are allowed to
64 +// pretend that there is a semicolon at this position.
65 +
66 +pp.semicolon = function() {
67 + if (!this.eat(tt.semi) && !this.insertSemicolon()) this.unexpected()
68 +}
69 +
70 +pp.afterTrailingComma = function(tokType) {
71 + if (this.type == tokType) {
72 + if (this.options.onTrailingComma)
73 + this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc)
74 + this.next()
75 + return true
76 + }
77 +}
78 +
79 +// Expect a token of a given type. If found, consume it, otherwise,
80 +// raise an unexpected token error.
81 +
82 +pp.expect = function(type) {
83 + this.eat(type) || this.unexpected()
84 +}
85 +
86 +// Raise an unexpected token error.
87 +
88 +pp.unexpected = function(pos) {
89 + this.raise(pos != null ? pos : this.start, "Unexpected token")
90 +}
91 +
92 +export class DestructuringErrors {
93 + constructor() {
94 + this.shorthandAssign = 0
95 + this.trailingComma = 0
96 + }
97 +}
98 +
99 +pp.checkPatternErrors = function(refDestructuringErrors, andThrow) {
100 + let trailing = refDestructuringErrors && refDestructuringErrors.trailingComma
101 + if (!andThrow) return !!trailing
102 + if (trailing) this.raise(trailing, "Comma is not permitted after the rest element")
103 +}
104 +
105 +pp.checkExpressionErrors = function(refDestructuringErrors, andThrow) {
106 + let pos = refDestructuringErrors && refDestructuringErrors.shorthandAssign
107 + if (!andThrow) return !!pos
108 + if (pos) this.raise(pos, "Shorthand property assignments are valid only in destructuring patterns")
109 +}
1 +import {reservedWords, keywords} from "./identifier"
2 +import {types as tt} from "./tokentype"
3 +import {lineBreak} from "./whitespace"
4 +import {getOptions} from "./options"
5 +
6 +// Registered plugins
7 +export const plugins = {}
8 +
9 +function keywordRegexp(words) {
10 + return new RegExp("^(" + words.replace(/ /g, "|") + ")$")
11 +}
12 +
13 +export class Parser {
14 + constructor(options, input, startPos) {
15 + this.options = options = getOptions(options)
16 + this.sourceFile = options.sourceFile
17 + this.keywords = keywordRegexp(keywords[options.ecmaVersion >= 6 ? 6 : 5])
18 + let reserved = options.allowReserved ? "" :
19 + reservedWords[options.ecmaVersion] + (options.sourceType == "module" ? " await" : "")
20 + this.reservedWords = keywordRegexp(reserved)
21 + let reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict
22 + this.reservedWordsStrict = keywordRegexp(reservedStrict)
23 + this.reservedWordsStrictBind = keywordRegexp(reservedStrict + " " + reservedWords.strictBind)
24 + this.input = String(input)
25 +
26 + // Used to signal to callers of `readWord1` whether the word
27 + // contained any escape sequences. This is needed because words with
28 + // escape sequences must not be interpreted as keywords.
29 + this.containsEsc = false
30 +
31 + // Load plugins
32 + this.loadPlugins(options.plugins)
33 +
34 + // Set up token state
35 +
36 + // The current position of the tokenizer in the input.
37 + if (startPos) {
38 + this.pos = startPos
39 + this.lineStart = Math.max(0, this.input.lastIndexOf("\n", startPos))
40 + this.curLine = this.input.slice(0, this.lineStart).split(lineBreak).length
41 + } else {
42 + this.pos = this.lineStart = 0
43 + this.curLine = 1
44 + }
45 +
46 + // Properties of the current token:
47 + // Its type
48 + this.type = tt.eof
49 + // For tokens that include more information than their type, the value
50 + this.value = null
51 + // Its start and end offset
52 + this.start = this.end = this.pos
53 + // And, if locations are used, the {line, column} object
54 + // corresponding to those offsets
55 + this.startLoc = this.endLoc = this.curPosition()
56 +
57 + // Position information for the previous token
58 + this.lastTokEndLoc = this.lastTokStartLoc = null
59 + this.lastTokStart = this.lastTokEnd = this.pos
60 +
61 + // The context stack is used to superficially track syntactic
62 + // context to predict whether a regular expression is allowed in a
63 + // given position.
64 + this.context = this.initialContext()
65 + this.exprAllowed = true
66 +
67 + // Figure out if it's a module code.
68 + this.strict = this.inModule = options.sourceType === "module"
69 +
70 + // Used to signify the start of a potential arrow function
71 + this.potentialArrowAt = -1
72 +
73 + // Flags to track whether we are in a function, a generator.
74 + this.inFunction = this.inGenerator = false
75 + // Labels in scope.
76 + this.labels = []
77 +
78 + // If enabled, skip leading hashbang line.
79 + if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === '#!')
80 + this.skipLineComment(2)
81 + }
82 +
83 + // DEPRECATED Kept for backwards compatibility until 3.0 in case a plugin uses them
84 + isKeyword(word) { return this.keywords.test(word) }
85 + isReservedWord(word) { return this.reservedWords.test(word) }
86 +
87 + extend(name, f) {
88 + this[name] = f(this[name])
89 + }
90 +
91 + loadPlugins(pluginConfigs) {
92 + for (let name in pluginConfigs) {
93 + let plugin = plugins[name]
94 + if (!plugin) throw new Error("Plugin '" + name + "' not found")
95 + plugin(this, pluginConfigs[name])
96 + }
97 + }
98 +
99 + parse() {
100 + let node = this.options.program || this.startNode()
101 + this.nextToken()
102 + return this.parseTopLevel(node)
103 + }
104 +}
This diff is collapsed. Click to expand it.
1 +// The algorithm used to determine whether a regexp can appear at a
2 +// given point in the program is loosely based on sweet.js' approach.
3 +// See https://github.com/mozilla/sweet.js/wiki/design
4 +
5 +import {Parser} from "./state"
6 +import {types as tt} from "./tokentype"
7 +import {lineBreak} from "./whitespace"
8 +
9 +export class TokContext {
10 + constructor(token, isExpr, preserveSpace, override) {
11 + this.token = token
12 + this.isExpr = !!isExpr
13 + this.preserveSpace = !!preserveSpace
14 + this.override = override
15 + }
16 +}
17 +
18 +export const types = {
19 + b_stat: new TokContext("{", false),
20 + b_expr: new TokContext("{", true),
21 + b_tmpl: new TokContext("${", true),
22 + p_stat: new TokContext("(", false),
23 + p_expr: new TokContext("(", true),
24 + q_tmpl: new TokContext("`", true, true, p => p.readTmplToken()),
25 + f_expr: new TokContext("function", true)
26 +}
27 +
28 +const pp = Parser.prototype
29 +
30 +pp.initialContext = function() {
31 + return [types.b_stat]
32 +}
33 +
34 +pp.braceIsBlock = function(prevType) {
35 + if (prevType === tt.colon) {
36 + let parent = this.curContext()
37 + if (parent === types.b_stat || parent === types.b_expr)
38 + return !parent.isExpr
39 + }
40 + if (prevType === tt._return)
41 + return lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
42 + if (prevType === tt._else || prevType === tt.semi || prevType === tt.eof || prevType === tt.parenR)
43 + return true
44 + if (prevType == tt.braceL)
45 + return this.curContext() === types.b_stat
46 + return !this.exprAllowed
47 +}
48 +
49 +pp.updateContext = function(prevType) {
50 + let update, type = this.type
51 + if (type.keyword && prevType == tt.dot)
52 + this.exprAllowed = false
53 + else if (update = type.updateContext)
54 + update.call(this, prevType)
55 + else
56 + this.exprAllowed = type.beforeExpr
57 +}
58 +
59 +// Token-specific context update code
60 +
61 +tt.parenR.updateContext = tt.braceR.updateContext = function() {
62 + if (this.context.length == 1) {
63 + this.exprAllowed = true
64 + return
65 + }
66 + let out = this.context.pop()
67 + if (out === types.b_stat && this.curContext() === types.f_expr) {
68 + this.context.pop()
69 + this.exprAllowed = false
70 + } else if (out === types.b_tmpl) {
71 + this.exprAllowed = true
72 + } else {
73 + this.exprAllowed = !out.isExpr
74 + }
75 +}
76 +
77 +tt.braceL.updateContext = function(prevType) {
78 + this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr)
79 + this.exprAllowed = true
80 +}
81 +
82 +tt.dollarBraceL.updateContext = function() {
83 + this.context.push(types.b_tmpl)
84 + this.exprAllowed = true
85 +}
86 +
87 +tt.parenL.updateContext = function(prevType) {
88 + let statementParens = prevType === tt._if || prevType === tt._for || prevType === tt._with || prevType === tt._while
89 + this.context.push(statementParens ? types.p_stat : types.p_expr)
90 + this.exprAllowed = true
91 +}
92 +
93 +tt.incDec.updateContext = function() {
94 + // tokExprAllowed stays unchanged
95 +}
96 +
97 +tt._function.updateContext = function(prevType) {
98 + if (prevType.beforeExpr && prevType !== tt.semi && prevType !== tt._else &&
99 + !((prevType === tt.colon || prevType === tt.braceL) && this.curContext() === types.b_stat))
100 + this.context.push(types.f_expr)
101 + this.exprAllowed = false
102 +}
103 +
104 +tt.backQuote.updateContext = function() {
105 + if (this.curContext() === types.q_tmpl)
106 + this.context.pop()
107 + else
108 + this.context.push(types.q_tmpl)
109 + this.exprAllowed = false
110 +}
This diff is collapsed. Click to expand it.
1 +// ## Token types
2 +
3 +// The assignment of fine-grained, information-carrying type objects
4 +// allows the tokenizer to store the information it has about a
5 +// token in a way that is very cheap for the parser to look up.
6 +
7 +// All token type variables start with an underscore, to make them
8 +// easy to recognize.
9 +
10 +// The `beforeExpr` property is used to disambiguate between regular
11 +// expressions and divisions. It is set on all token types that can
12 +// be followed by an expression (thus, a slash after them would be a
13 +// regular expression).
14 +//
15 +// The `startsExpr` property is used to check if the token ends a
16 +// `yield` expression. It is set on all token types that either can
17 +// directly start an expression (like a quotation mark) or can
18 +// continue an expression (like the body of a string).
19 +//
20 +// `isLoop` marks a keyword as starting a loop, which is important
21 +// to know when parsing a label, in order to allow or disallow
22 +// continue jumps to that label.
23 +
24 +export class TokenType {
25 + constructor(label, conf = {}) {
26 + this.label = label
27 + this.keyword = conf.keyword
28 + this.beforeExpr = !!conf.beforeExpr
29 + this.startsExpr = !!conf.startsExpr
30 + this.isLoop = !!conf.isLoop
31 + this.isAssign = !!conf.isAssign
32 + this.prefix = !!conf.prefix
33 + this.postfix = !!conf.postfix
34 + this.binop = conf.binop || null
35 + this.updateContext = null
36 + }
37 +}
38 +
39 +function binop(name, prec) {
40 + return new TokenType(name, {beforeExpr: true, binop: prec})
41 +}
42 +const beforeExpr = {beforeExpr: true}, startsExpr = {startsExpr: true}
43 +
44 +// Map keyword names to token types.
45 +
46 +export const keywords = {}
47 +
48 +// Succinct definitions of keyword token types
49 +function kw(name, options = {}) {
50 + options.keyword = name
51 + return keywords[name] = new TokenType(name, options)
52 +}
53 +
54 +export const types = {
55 + num: new TokenType("num", startsExpr),
56 + regexp: new TokenType("regexp", startsExpr),
57 + string: new TokenType("string", startsExpr),
58 + name: new TokenType("name", startsExpr),
59 + eof: new TokenType("eof"),
60 +
61 + // Punctuation token types.
62 + bracketL: new TokenType("[", {beforeExpr: true, startsExpr: true}),
63 + bracketR: new TokenType("]"),
64 + braceL: new TokenType("{", {beforeExpr: true, startsExpr: true}),
65 + braceR: new TokenType("}"),
66 + parenL: new TokenType("(", {beforeExpr: true, startsExpr: true}),
67 + parenR: new TokenType(")"),
68 + comma: new TokenType(",", beforeExpr),
69 + semi: new TokenType(";", beforeExpr),
70 + colon: new TokenType(":", beforeExpr),
71 + dot: new TokenType("."),
72 + question: new TokenType("?", beforeExpr),
73 + arrow: new TokenType("=>", beforeExpr),
74 + template: new TokenType("template"),
75 + ellipsis: new TokenType("...", beforeExpr),
76 + backQuote: new TokenType("`", startsExpr),
77 + dollarBraceL: new TokenType("${", {beforeExpr: true, startsExpr: true}),
78 +
79 + // Operators. These carry several kinds of properties to help the
80 + // parser use them properly (the presence of these properties is
81 + // what categorizes them as operators).
82 + //
83 + // `binop`, when present, specifies that this operator is a binary
84 + // operator, and will refer to its precedence.
85 + //
86 + // `prefix` and `postfix` mark the operator as a prefix or postfix
87 + // unary operator.
88 + //
89 + // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as
90 + // binary operators with a very low precedence, that should result
91 + // in AssignmentExpression nodes.
92 +
93 + eq: new TokenType("=", {beforeExpr: true, isAssign: true}),
94 + assign: new TokenType("_=", {beforeExpr: true, isAssign: true}),
95 + incDec: new TokenType("++/--", {prefix: true, postfix: true, startsExpr: true}),
96 + prefix: new TokenType("prefix", {beforeExpr: true, prefix: true, startsExpr: true}),
97 + logicalOR: binop("||", 1),
98 + logicalAND: binop("&&", 2),
99 + bitwiseOR: binop("|", 3),
100 + bitwiseXOR: binop("^", 4),
101 + bitwiseAND: binop("&", 5),
102 + equality: binop("==/!=", 6),
103 + relational: binop("</>", 7),
104 + bitShift: binop("<</>>", 8),
105 + plusMin: new TokenType("+/-", {beforeExpr: true, binop: 9, prefix: true, startsExpr: true}),
106 + modulo: binop("%", 10),
107 + star: binop("*", 10),
108 + slash: binop("/", 10),
109 + starstar: new TokenType("**", {beforeExpr: true}),
110 +
111 + // Keyword token types.
112 + _break: kw("break"),
113 + _case: kw("case", beforeExpr),
114 + _catch: kw("catch"),
115 + _continue: kw("continue"),
116 + _debugger: kw("debugger"),
117 + _default: kw("default", beforeExpr),
118 + _do: kw("do", {isLoop: true, beforeExpr: true}),
119 + _else: kw("else", beforeExpr),
120 + _finally: kw("finally"),
121 + _for: kw("for", {isLoop: true}),
122 + _function: kw("function", startsExpr),
123 + _if: kw("if"),
124 + _return: kw("return", beforeExpr),
125 + _switch: kw("switch"),
126 + _throw: kw("throw", beforeExpr),
127 + _try: kw("try"),
128 + _var: kw("var"),
129 + _const: kw("const"),
130 + _while: kw("while", {isLoop: true}),
131 + _with: kw("with"),
132 + _new: kw("new", {beforeExpr: true, startsExpr: true}),
133 + _this: kw("this", startsExpr),
134 + _super: kw("super", startsExpr),
135 + _class: kw("class"),
136 + _extends: kw("extends", beforeExpr),
137 + _export: kw("export"),
138 + _import: kw("import"),
139 + _null: kw("null", startsExpr),
140 + _true: kw("true", startsExpr),
141 + _false: kw("false", startsExpr),
142 + _in: kw("in", {beforeExpr: true, binop: 7}),
143 + _instanceof: kw("instanceof", {beforeExpr: true, binop: 7}),
144 + _typeof: kw("typeof", {beforeExpr: true, prefix: true, startsExpr: true}),
145 + _void: kw("void", {beforeExpr: true, prefix: true, startsExpr: true}),
146 + _delete: kw("delete", {beforeExpr: true, prefix: true, startsExpr: true})
147 +}
1 +export function isArray(obj) {
2 + return Object.prototype.toString.call(obj) === "[object Array]"
3 +}
4 +
5 +// Checks if an object has a property.
6 +
7 +export function has(obj, propName) {
8 + return Object.prototype.hasOwnProperty.call(obj, propName)
9 +}
This diff is collapsed. Click to expand it.
1 +// Matches a whole line break (where CRLF is considered a single
2 +// line break). Used to count lines.
3 +
4 +export const lineBreak = /\r\n?|\n|\u2028|\u2029/
5 +export const lineBreakG = new RegExp(lineBreak.source, "g")
6 +
7 +export function isNewLine(code) {
8 + return code === 10 || code === 13 || code === 0x2028 || code == 0x2029
9 +}
10 +
11 +export const nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/
12 +
13 +export const skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g
1 +{
2 + "_args": [
3 + [
4 + {
5 + "raw": "acorn-jsx@^3.0.0",
6 + "scope": null,
7 + "escapedName": "acorn-jsx",
8 + "name": "acorn-jsx",
9 + "rawSpec": "^3.0.0",
10 + "spec": ">=3.0.0 <4.0.0",
11 + "type": "range"
12 + },
13 + "/Users/kanghyeontae/IdeaProjects/YTMT/node_modules/espree"
14 + ]
15 + ],
16 + "_from": "acorn-jsx@>=3.0.0 <4.0.0",
17 + "_id": "acorn-jsx@3.0.1",
18 + "_inCache": true,
19 + "_location": "/acorn-jsx",
20 + "_nodeVersion": "6.0.0",
21 + "_npmOperationalInternal": {
22 + "host": "packages-12-west.internal.npmjs.com",
23 + "tmp": "tmp/acorn-jsx-3.0.1.tgz_1462206645285_0.17844340158626437"
24 + },
25 + "_npmUser": {
26 + "name": "rreverser",
27 + "email": "me@rreverser.com"
28 + },
29 + "_npmVersion": "3.8.6",
30 + "_phantomChildren": {},
31 + "_requested": {
32 + "raw": "acorn-jsx@^3.0.0",
33 + "scope": null,
34 + "escapedName": "acorn-jsx",
35 + "name": "acorn-jsx",
36 + "rawSpec": "^3.0.0",
37 + "spec": ">=3.0.0 <4.0.0",
38 + "type": "range"
39 + },
40 + "_requiredBy": [
41 + "/espree"
42 + ],
43 + "_resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz",
44 + "_shasum": "afdf9488fb1ecefc8348f6fb22f464e32a58b36b",
45 + "_shrinkwrap": null,
46 + "_spec": "acorn-jsx@^3.0.0",
47 + "_where": "/Users/kanghyeontae/IdeaProjects/YTMT/node_modules/espree",
48 + "bugs": {
49 + "url": "https://github.com/RReverser/acorn-jsx/issues"
50 + },
51 + "dependencies": {
52 + "acorn": "^3.0.4"
53 + },
54 + "description": "Alternative, faster React.js JSX parser",
55 + "devDependencies": {
56 + "chai": "^3.0.0",
57 + "mocha": "^2.2.5"
58 + },
59 + "directories": {},
60 + "dist": {
61 + "shasum": "afdf9488fb1ecefc8348f6fb22f464e32a58b36b",
62 + "tarball": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz"
63 + },
64 + "gitHead": "05852d8ae9476b7f8a25e417665e2265528d5fb9",
65 + "homepage": "https://github.com/RReverser/acorn-jsx",
66 + "license": "MIT",
67 + "maintainers": [
68 + {
69 + "name": "rreverser",
70 + "email": "me@rreverser.com"
71 + }
72 + ],
73 + "name": "acorn-jsx",
74 + "optionalDependencies": {},
75 + "readme": "ERROR: No README data found!",
76 + "repository": {
77 + "type": "git",
78 + "url": "git+https://github.com/RReverser/acorn-jsx.git"
79 + },
80 + "scripts": {
81 + "test": "node test/run.js"
82 + },
83 + "version": "3.0.1"
84 +}
1 +module.exports = {
2 + quot: '\u0022',
3 + amp: '&',
4 + apos: '\u0027',
5 + lt: '<',
6 + gt: '>',
7 + nbsp: '\u00A0',
8 + iexcl: '\u00A1',
9 + cent: '\u00A2',
10 + pound: '\u00A3',
11 + curren: '\u00A4',
12 + yen: '\u00A5',
13 + brvbar: '\u00A6',
14 + sect: '\u00A7',
15 + uml: '\u00A8',
16 + copy: '\u00A9',
17 + ordf: '\u00AA',
18 + laquo: '\u00AB',
19 + not: '\u00AC',
20 + shy: '\u00AD',
21 + reg: '\u00AE',
22 + macr: '\u00AF',
23 + deg: '\u00B0',
24 + plusmn: '\u00B1',
25 + sup2: '\u00B2',
26 + sup3: '\u00B3',
27 + acute: '\u00B4',
28 + micro: '\u00B5',
29 + para: '\u00B6',
30 + middot: '\u00B7',
31 + cedil: '\u00B8',
32 + sup1: '\u00B9',
33 + ordm: '\u00BA',
34 + raquo: '\u00BB',
35 + frac14: '\u00BC',
36 + frac12: '\u00BD',
37 + frac34: '\u00BE',
38 + iquest: '\u00BF',
39 + Agrave: '\u00C0',
40 + Aacute: '\u00C1',
41 + Acirc: '\u00C2',
42 + Atilde: '\u00C3',
43 + Auml: '\u00C4',
44 + Aring: '\u00C5',
45 + AElig: '\u00C6',
46 + Ccedil: '\u00C7',
47 + Egrave: '\u00C8',
48 + Eacute: '\u00C9',
49 + Ecirc: '\u00CA',
50 + Euml: '\u00CB',
51 + Igrave: '\u00CC',
52 + Iacute: '\u00CD',
53 + Icirc: '\u00CE',
54 + Iuml: '\u00CF',
55 + ETH: '\u00D0',
56 + Ntilde: '\u00D1',
57 + Ograve: '\u00D2',
58 + Oacute: '\u00D3',
59 + Ocirc: '\u00D4',
60 + Otilde: '\u00D5',
61 + Ouml: '\u00D6',
62 + times: '\u00D7',
63 + Oslash: '\u00D8',
64 + Ugrave: '\u00D9',
65 + Uacute: '\u00DA',
66 + Ucirc: '\u00DB',
67 + Uuml: '\u00DC',
68 + Yacute: '\u00DD',
69 + THORN: '\u00DE',
70 + szlig: '\u00DF',
71 + agrave: '\u00E0',
72 + aacute: '\u00E1',
73 + acirc: '\u00E2',
74 + atilde: '\u00E3',
75 + auml: '\u00E4',
76 + aring: '\u00E5',
77 + aelig: '\u00E6',
78 + ccedil: '\u00E7',
79 + egrave: '\u00E8',
80 + eacute: '\u00E9',
81 + ecirc: '\u00EA',
82 + euml: '\u00EB',
83 + igrave: '\u00EC',
84 + iacute: '\u00ED',
85 + icirc: '\u00EE',
86 + iuml: '\u00EF',
87 + eth: '\u00F0',
88 + ntilde: '\u00F1',
89 + ograve: '\u00F2',
90 + oacute: '\u00F3',
91 + ocirc: '\u00F4',
92 + otilde: '\u00F5',
93 + ouml: '\u00F6',
94 + divide: '\u00F7',
95 + oslash: '\u00F8',
96 + ugrave: '\u00F9',
97 + uacute: '\u00FA',
98 + ucirc: '\u00FB',
99 + uuml: '\u00FC',
100 + yacute: '\u00FD',
101 + thorn: '\u00FE',
102 + yuml: '\u00FF',
103 + OElig: '\u0152',
104 + oelig: '\u0153',
105 + Scaron: '\u0160',
106 + scaron: '\u0161',
107 + Yuml: '\u0178',
108 + fnof: '\u0192',
109 + circ: '\u02C6',
110 + tilde: '\u02DC',
111 + Alpha: '\u0391',
112 + Beta: '\u0392',
113 + Gamma: '\u0393',
114 + Delta: '\u0394',
115 + Epsilon: '\u0395',
116 + Zeta: '\u0396',
117 + Eta: '\u0397',
118 + Theta: '\u0398',
119 + Iota: '\u0399',
120 + Kappa: '\u039A',
121 + Lambda: '\u039B',
122 + Mu: '\u039C',
123 + Nu: '\u039D',
124 + Xi: '\u039E',
125 + Omicron: '\u039F',
126 + Pi: '\u03A0',
127 + Rho: '\u03A1',
128 + Sigma: '\u03A3',
129 + Tau: '\u03A4',
130 + Upsilon: '\u03A5',
131 + Phi: '\u03A6',
132 + Chi: '\u03A7',
133 + Psi: '\u03A8',
134 + Omega: '\u03A9',
135 + alpha: '\u03B1',
136 + beta: '\u03B2',
137 + gamma: '\u03B3',
138 + delta: '\u03B4',
139 + epsilon: '\u03B5',
140 + zeta: '\u03B6',
141 + eta: '\u03B7',
142 + theta: '\u03B8',
143 + iota: '\u03B9',
144 + kappa: '\u03BA',
145 + lambda: '\u03BB',
146 + mu: '\u03BC',
147 + nu: '\u03BD',
148 + xi: '\u03BE',
149 + omicron: '\u03BF',
150 + pi: '\u03C0',
151 + rho: '\u03C1',
152 + sigmaf: '\u03C2',
153 + sigma: '\u03C3',
154 + tau: '\u03C4',
155 + upsilon: '\u03C5',
156 + phi: '\u03C6',
157 + chi: '\u03C7',
158 + psi: '\u03C8',
159 + omega: '\u03C9',
160 + thetasym: '\u03D1',
161 + upsih: '\u03D2',
162 + piv: '\u03D6',
163 + ensp: '\u2002',
164 + emsp: '\u2003',
165 + thinsp: '\u2009',
166 + zwnj: '\u200C',
167 + zwj: '\u200D',
168 + lrm: '\u200E',
169 + rlm: '\u200F',
170 + ndash: '\u2013',
171 + mdash: '\u2014',
172 + lsquo: '\u2018',
173 + rsquo: '\u2019',
174 + sbquo: '\u201A',
175 + ldquo: '\u201C',
176 + rdquo: '\u201D',
177 + bdquo: '\u201E',
178 + dagger: '\u2020',
179 + Dagger: '\u2021',
180 + bull: '\u2022',
181 + hellip: '\u2026',
182 + permil: '\u2030',
183 + prime: '\u2032',
184 + Prime: '\u2033',
185 + lsaquo: '\u2039',
186 + rsaquo: '\u203A',
187 + oline: '\u203E',
188 + frasl: '\u2044',
189 + euro: '\u20AC',
190 + image: '\u2111',
191 + weierp: '\u2118',
192 + real: '\u211C',
193 + trade: '\u2122',
194 + alefsym: '\u2135',
195 + larr: '\u2190',
196 + uarr: '\u2191',
197 + rarr: '\u2192',
198 + darr: '\u2193',
199 + harr: '\u2194',
200 + crarr: '\u21B5',
201 + lArr: '\u21D0',
202 + uArr: '\u21D1',
203 + rArr: '\u21D2',
204 + dArr: '\u21D3',
205 + hArr: '\u21D4',
206 + forall: '\u2200',
207 + part: '\u2202',
208 + exist: '\u2203',
209 + empty: '\u2205',
210 + nabla: '\u2207',
211 + isin: '\u2208',
212 + notin: '\u2209',
213 + ni: '\u220B',
214 + prod: '\u220F',
215 + sum: '\u2211',
216 + minus: '\u2212',
217 + lowast: '\u2217',
218 + radic: '\u221A',
219 + prop: '\u221D',
220 + infin: '\u221E',
221 + ang: '\u2220',
222 + and: '\u2227',
223 + or: '\u2228',
224 + cap: '\u2229',
225 + cup: '\u222A',
226 + 'int': '\u222B',
227 + there4: '\u2234',
228 + sim: '\u223C',
229 + cong: '\u2245',
230 + asymp: '\u2248',
231 + ne: '\u2260',
232 + equiv: '\u2261',
233 + le: '\u2264',
234 + ge: '\u2265',
235 + sub: '\u2282',
236 + sup: '\u2283',
237 + nsub: '\u2284',
238 + sube: '\u2286',
239 + supe: '\u2287',
240 + oplus: '\u2295',
241 + otimes: '\u2297',
242 + perp: '\u22A5',
243 + sdot: '\u22C5',
244 + lceil: '\u2308',
245 + rceil: '\u2309',
246 + lfloor: '\u230A',
247 + rfloor: '\u230B',
248 + lang: '\u2329',
249 + rang: '\u232A',
250 + loz: '\u25CA',
251 + spades: '\u2660',
252 + clubs: '\u2663',
253 + hearts: '\u2665',
254 + diams: '\u2666'
255 +};
1 +List of Acorn contributors. Updated before every release.
2 +
3 +Adrian Rakovsky
4 +Alistair Braidwood
5 +Amila Welihinda
6 +Andres Suarez
7 +Angelo
8 +Aparajita Fishman
9 +Arian Stolwijk
10 +Artem Govorov
11 +Bradley Heinz
12 +Brandon Mills
13 +Charles Hughes
14 +Conrad Irwin
15 +Daniel Tschinder
16 +David Bonnet
17 +Domenico Matteo
18 +ehmicky
19 +Forbes Lindesay
20 +Gilad Peleg
21 +impinball
22 +Ingvar Stepanyan
23 +Jackson Ray Hamilton
24 +Jesse McCarthy
25 +Jiaxing Wang
26 +Joel Kemp
27 +Johannes Herr
28 +John-David Dalton
29 +Jordan Klassen
30 +Jürg Lehni
31 +Kai Cataldo
32 +keeyipchan
33 +Keheliya Gallaba
34 +Kevin Irish
35 +Kevin Kwok
36 +krator
37 +Marek
38 +Marijn Haverbeke
39 +Martin Carlberg
40 +Mat Garcia
41 +Mathias Bynens
42 +Mathieu 'p01' Henri
43 +Matthew Bastien
44 +Max Schaefer
45 +Max Zerzouri
46 +Mihai Bazon
47 +Mike Rennie
48 +naoh
49 +Nicholas C. Zakas
50 +Nick Fitzgerald
51 +Olivier Thomann
52 +Oskar Schöldström
53 +Paul Harper
54 +Peter Rust
55 +PlNG
56 +Prayag Verma
57 +ReadmeCritic
58 +r-e-d
59 +Richard Gibson
60 +Rich Harris
61 +Sebastian McKenzie
62 +Shahar Soel
63 +Simen Bekkhus
64 +Teddy Katz
65 +Timothy Gu
66 +Toru Nagashima
67 +Victor Homyakov
68 +Wexpo Lyu
69 +zsjforcn
1 +## 5.2.1 (2017-10-30)
2 +
3 +### Bug fixes
4 +
5 +Fix a token context corruption bug.
6 +
7 +## 5.2.0 (2017-10-30)
8 +
9 +### Bug fixes
10 +
11 +Fix token context tracking for `class` and `function` in property-name position.
12 +
13 +Make sure `%*` isn't parsed as a valid operator.
14 +
15 +The `full` and `fullAncestor` walkers no longer visit nodes multiple times.
16 +
17 +Allow shorthand properties `get` and `set` to be followed by default values.
18 +
19 +Disallow `super` when not in callee or object position.
20 +
21 +### New features
22 +
23 +Support [`directive` property](https://github.com/estree/estree/compare/b3de58c9997504d6fba04b72f76e6dd1619ee4eb...1da8e603237144f44710360f8feb7a9977e905e0) on directive expression statements.
24 +
25 +## 5.1.2 (2017-09-04)
26 +
27 +### Bug fixes
28 +
29 +Disable parsing of legacy HTML-style comments in modules.
30 +
31 +Fix parsing of async methods whose names are keywords.
32 +
33 +## 5.1.1 (2017-07-06)
34 +
35 +### Bug fixes
36 +
37 +Fix problem with disambiguating regexp and division after a class.
38 +
39 +## 5.1.0 (2017-07-05)
40 +
41 +### Bug fixes
42 +
43 +Fix tokenizing of regexps in an object-desctructuring `for`/`of` loop and after `yield`.
44 +
45 +Parse zero-prefixed numbers with non-octal digits as decimal.
46 +
47 +Allow object/array patterns in rest parameters.
48 +
49 +Don't error when `yield` is used as a property name.
50 +
51 +Allow `async` as a shorthand object property.
52 +
53 +Make the ES module version of the loose parser actually work.
54 +
55 +### New features
56 +
57 +Implement the [template literal revision proposal](https://github.com/tc39/proposal-template-literal-revision) for ES9.
58 +
59 +New walker functions `full` and `fullAncestor`.
60 +
61 +## 5.0.3 (2017-04-01)
62 +
63 +### Bug fixes
64 +
65 +Fix spurious duplicate variable definition errors for named functions.
66 +
67 +## 5.0.2 (2017-03-30)
68 +
69 +### Bug fixes
70 +
71 +A binary operator after a parenthesized arrow expression is no longer incorrectly treated as an error.
72 +
73 +## 5.0.0 (2017-03-28)
74 +
75 +### Bug fixes
76 +
77 +Raise an error for duplicated lexical bindings.
78 +
79 +Fix spurious error when an assignement expression occurred after a spread expression.
80 +
81 +Accept regular expressions after `of` (in `for`/`of`), `yield` (in a generator), and braced arrow functions.
82 +
83 +Allow labels in front or `var` declarations, even in strict mode.
84 +
85 +### Breaking changes
86 +
87 +Parse declarations following `export default` as declaration nodes, not expressions. This means that class and function declarations nodes can now have `null` as their `id`.
88 +
89 +## 4.0.11 (2017-02-07)
90 +
91 +### Bug fixes
92 +
93 +Allow all forms of member expressions to be parenthesized as lvalue.
94 +
95 +## 4.0.10 (2017-02-07)
96 +
97 +### Bug fixes
98 +
99 +Don't expect semicolons after default-exported functions or classes,
100 +even when they are expressions.
101 +
102 +Check for use of `'use strict'` directives in non-simple parameter
103 +functions, even when already in strict mode.
104 +
105 +## 4.0.9 (2017-02-06)
106 +
107 +### Bug fixes
108 +
109 +Fix incorrect error raised for parenthesized simple assignment
110 +targets, so that `(x) = 1` parses again.
111 +
112 +## 4.0.8 (2017-02-03)
113 +
114 +### Bug fixes
115 +
116 +Solve spurious parenthesized pattern errors by temporarily erring on
117 +the side of accepting programs that our delayed errors don't handle
118 +correctly yet.
119 +
120 +## 4.0.7 (2017-02-02)
121 +
122 +### Bug fixes
123 +
124 +Accept invalidly rejected code like `(x).y = 2` again.
125 +
126 +Don't raise an error when a function _inside_ strict code has a
127 +non-simple parameter list.
128 +
129 +## 4.0.6 (2017-02-02)
130 +
131 +### Bug fixes
132 +
133 +Fix exponential behavior (manifesting itself as a complete hang for
134 +even relatively small source files) introduced by the new 'use strict'
135 +check.
136 +
137 +## 4.0.5 (2017-02-02)
138 +
139 +### Bug fixes
140 +
141 +Disallow parenthesized pattern expressions.
142 +
143 +Allow keywords as export names.
144 +
145 +Don't allow the `async` keyword to be parenthesized.
146 +
147 +Properly raise an error when a keyword contains a character escape.
148 +
149 +Allow `"use strict"` to appear after other string literal expressions.
150 +
151 +Disallow labeled declarations.
152 +
153 +## 4.0.4 (2016-12-19)
154 +
155 +### Bug fixes
156 +
157 +Fix issue with loading acorn_loose.js with an AMD loader.
158 +
159 +Fix crash when `export` was followed by a keyword that can't be
160 +exported.
161 +
162 +## 4.0.3 (2016-08-16)
163 +
164 +### Bug fixes
165 +
166 +Allow regular function declarations inside single-statement `if`
167 +branches in loose mode. Forbid them entirely in strict mode.
168 +
169 +Properly parse properties named `async` in ES2017 mode.
170 +
171 +Fix bug where reserved words were broken in ES2017 mode.
172 +
173 +## 4.0.2 (2016-08-11)
174 +
175 +### Bug fixes
176 +
177 +Don't ignore period or 'e' characters after octal numbers.
178 +
179 +Fix broken parsing for call expressions in default parameter values
180 +of arrow functions.
181 +
182 +## 4.0.1 (2016-08-08)
183 +
184 +### Bug fixes
185 +
186 +Fix false positives in duplicated export name errors.
187 +
188 +## 4.0.0 (2016-08-07)
189 +
190 +### Breaking changes
191 +
192 +The default `ecmaVersion` option value is now 7.
193 +
194 +A number of internal method signatures changed, so plugins might need
195 +to be updated.
196 +
197 +### Bug fixes
198 +
199 +The parser now raises errors on duplicated export names.
200 +
201 +`arguments` and `eval` can now be used in shorthand properties.
202 +
203 +Duplicate parameter names in non-simple argument lists now always
204 +produce an error.
205 +
206 +### New features
207 +
208 +The `ecmaVersion` option now also accepts year-style version numbers
209 +(2015, etc).
210 +
211 +Support for `async`/`await` syntax when `ecmaVersion` is >= 8.
212 +
213 +Support for trailing commas in call expressions when `ecmaVersion`
214 +is >= 8.
215 +
216 +## 3.3.0 (2016-07-25)
217 +
218 +### Bug fixes
219 +
220 +Fix bug in tokenizing of regexp operator after a function declaration.
221 +
222 +Fix parser crash when parsing an array pattern with a hole.
223 +
224 +### New features
225 +
226 +Implement check against complex argument lists in functions that
227 +enable strict mode in ES7.
228 +
229 +## 3.2.0 (2016-06-07)
230 +
231 +### Bug fixes
232 +
233 +Improve handling of lack of unicode regexp support in host
234 +environment.
235 +
236 +Properly reject shorthand properties whose name is a keyword.
237 +
238 +Don't crash when the loose parser is called without options object.
239 +
240 +### New features
241 +
242 +Visitors created with `visit.make` now have their base as _prototype_,
243 +rather than copying properties into a fresh object.
244 +
245 +Make it possible to use `visit.ancestor` with a walk state.
246 +
247 +## 3.1.0 (2016-04-18)
248 +
249 +### Bug fixes
250 +
251 +Fix issue where the loose parser created invalid TemplateElement nodes
252 +for unclosed template literals.
253 +
254 +Properly tokenize the division operator directly after a function
255 +expression.
256 +
257 +Allow trailing comma in destructuring arrays.
258 +
259 +### New features
260 +
261 +The walker now allows defining handlers for `CatchClause` nodes.
262 +
263 +## 3.0.4 (2016-02-25)
264 +
265 +### Fixes
266 +
267 +Allow update expressions as left-hand-side of the ES7 exponential
268 +operator.
269 +
270 +## 3.0.2 (2016-02-10)
271 +
272 +### Fixes
273 +
274 +Fix bug that accidentally made `undefined` a reserved word when
275 +parsing ES7.
276 +
277 +## 3.0.0 (2016-02-10)
278 +
279 +### Breaking changes
280 +
281 +The default value of the `ecmaVersion` option is now 6 (used to be 5).
282 +
283 +Support for comprehension syntax (which was dropped from the draft
284 +spec) has been removed.
285 +
286 +### Fixes
287 +
288 +`let` and `yield` are now “contextual keywords”, meaning you can
289 +mostly use them as identifiers in ES5 non-strict code.
290 +
291 +A parenthesized class or function expression after `export default` is
292 +now parsed correctly.
293 +
294 +### New features
295 +
296 +When `ecmaVersion` is set to 7, Acorn will parse the exponentiation
297 +operator (`**`).
298 +
299 +The identifier character ranges are now based on Unicode 8.0.0.
300 +
301 +Plugins can now override the `raiseRecoverable` method to override the
302 +way non-critical errors are handled.
303 +
304 +## 2.7.0 (2016-01-04)
305 +
306 +### Fixes
307 +
308 +Stop allowing rest parameters in setters.
309 +
310 +Make sure the loose parser always attaches a `local` property to
311 +`ImportNamespaceSpecifier` nodes.
312 +
313 +Disallow `y` rexexp flag in ES5.
314 +
315 +Disallow `\00` and `\000` escapes in strict mode.
316 +
317 +Raise an error when an import name is a reserved word.
318 +
319 +## 2.6.4 (2015-11-12)
320 +
321 +### Fixes
322 +
323 +Fix crash in loose parser when parsing invalid object pattern.
324 +
325 +### New features
326 +
327 +Support plugins in the loose parser.
328 +
329 +## 2.6.2 (2015-11-10)
330 +
331 +### Fixes
332 +
333 +Don't crash when no options object is passed.
334 +
335 +## 2.6.0 (2015-11-09)
336 +
337 +### Fixes
338 +
339 +Add `await` as a reserved word in module sources.
340 +
341 +Disallow `yield` in a parameter default value for a generator.
342 +
343 +Forbid using a comma after a rest pattern in an array destructuring.
344 +
345 +### New features
346 +
347 +Support parsing stdin in command-line tool.
348 +
349 +## 2.5.2 (2015-10-27)
350 +
351 +### Fixes
352 +
353 +Fix bug where the walker walked an exported `let` statement as an
354 +expression.
355 +
356 +## 2.5.0 (2015-10-27)
357 +
358 +### Fixes
359 +
360 +Fix tokenizer support in the command-line tool.
361 +
362 +In the loose parser, don't allow non-string-literals as import
363 +sources.
364 +
365 +Stop allowing `new.target` outside of functions.
366 +
367 +Remove legacy `guard` and `guardedHandler` properties from try nodes.
368 +
369 +Stop allowing multiple `__proto__` properties on an object literal in
370 +strict mode.
371 +
372 +Don't allow rest parameters to be non-identifier patterns.
373 +
374 +Check for duplicate paramter names in arrow functions.
1 +Copyright (C) 2012-2017 by various contributors (see AUTHORS)
2 +
3 +Permission is hereby granted, free of charge, to any person obtaining a copy
4 +of this software and associated documentation files (the "Software"), to deal
5 +in the Software without restriction, including without limitation the rights
6 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 +copies of the Software, and to permit persons to whom the Software is
8 +furnished to do so, subject to the following conditions:
9 +
10 +The above copyright notice and this permission notice shall be included in
11 +all copies or substantial portions of the Software.
12 +
13 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 +THE SOFTWARE.
This diff is collapsed. Click to expand it.
1 +#!/usr/bin/env node
2 +'use strict';
3 +
4 +var path = require('path');
5 +var fs = require('fs');
6 +var acorn = require('../dist/acorn.js');
7 +
8 +var infile;
9 +var forceFile;
10 +var silent = false;
11 +var compact = false;
12 +var tokenize = false;
13 +var options = {};
14 +
15 +function help(status) {
16 + var print = (status == 0) ? console.log : console.error;
17 + print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|...|--ecma2015|--ecma2016|--ecma2017|--ecma2018|...]");
18 + print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]");
19 + process.exit(status);
20 +}
21 +
22 +for (var i = 2; i < process.argv.length; ++i) {
23 + var arg = process.argv[i];
24 + if ((arg == "-" || arg[0] != "-") && !infile) { infile = arg; }
25 + else if (arg == "--" && !infile && i + 2 == process.argv.length) { forceFile = infile = process.argv[++i]; }
26 + else if (arg == "--locations") { options.locations = true; }
27 + else if (arg == "--allow-hash-bang") { options.allowHashBang = true; }
28 + else if (arg == "--silent") { silent = true; }
29 + else if (arg == "--compact") { compact = true; }
30 + else if (arg == "--help") { help(0); }
31 + else if (arg == "--tokenize") { tokenize = true; }
32 + else if (arg == "--module") { options.sourceType = "module"; }
33 + else {
34 + var match = arg.match(/^--ecma(\d+)$/);
35 + if (match)
36 + { options.ecmaVersion = +match[1]; }
37 + else
38 + { help(1); }
39 + }
40 +}
41 +
42 +function run(code) {
43 + var result;
44 + try {
45 + if (!tokenize) {
46 + result = acorn.parse(code, options);
47 + } else {
48 + result = [];
49 + var tokenizer$$1 = acorn.tokenizer(code, options), token;
50 + do {
51 + token = tokenizer$$1.getToken();
52 + result.push(token);
53 + } while (token.type != acorn.tokTypes.eof)
54 + }
55 + } catch (e) {
56 + console.error(e.message);
57 + process.exit(1);
58 + }
59 + if (!silent) { console.log(JSON.stringify(result, null, compact ? null : 2)); }
60 +}
61 +
62 +if (forceFile || infile && infile != "-") {
63 + run(fs.readFileSync(infile, "utf8"));
64 +} else {
65 + var code = "";
66 + process.stdin.resume();
67 + process.stdin.on("data", function (chunk) { return code += chunk; });
68 + process.stdin.on("end", function () { return run(code); });
69 +}
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +{
2 + "_args": [
3 + [
4 + {
5 + "raw": "acorn@^5.2.1",
6 + "scope": null,
7 + "escapedName": "acorn",
8 + "name": "acorn",
9 + "rawSpec": "^5.2.1",
10 + "spec": ">=5.2.1 <6.0.0",
11 + "type": "range"
12 + },
13 + "/Users/kanghyeontae/IdeaProjects/YTMT/node_modules/espree"
14 + ]
15 + ],
16 + "_from": "acorn@>=5.2.1 <6.0.0",
17 + "_id": "acorn@5.2.1",
18 + "_inCache": true,
19 + "_location": "/acorn",
20 + "_nodeVersion": "8.4.0",
21 + "_npmOperationalInternal": {
22 + "host": "s3://npm-registry-packages",
23 + "tmp": "tmp/acorn-5.2.1.tgz_1509295079758_0.15344050084240735"
24 + },
25 + "_npmUser": {
26 + "name": "marijn",
27 + "email": "marijnh@gmail.com"
28 + },
29 + "_npmVersion": "5.5.1",
30 + "_phantomChildren": {},
31 + "_requested": {
32 + "raw": "acorn@^5.2.1",
33 + "scope": null,
34 + "escapedName": "acorn",
35 + "name": "acorn",
36 + "rawSpec": "^5.2.1",
37 + "spec": ">=5.2.1 <6.0.0",
38 + "type": "range"
39 + },
40 + "_requiredBy": [
41 + "/espree"
42 + ],
43 + "_resolved": "https://registry.npmjs.org/acorn/-/acorn-5.2.1.tgz",
44 + "_shasum": "317ac7821826c22c702d66189ab8359675f135d7",
45 + "_shrinkwrap": null,
46 + "_spec": "acorn@^5.2.1",
47 + "_where": "/Users/kanghyeontae/IdeaProjects/YTMT/node_modules/espree",
48 + "bin": {
49 + "acorn": "./bin/acorn"
50 + },
51 + "bugs": {
52 + "url": "https://github.com/ternjs/acorn/issues"
53 + },
54 + "contributors": [
55 + {
56 + "name": "List of Acorn contributors. Updated before every release."
57 + },
58 + {
59 + "name": "Adrian Rakovsky"
60 + },
61 + {
62 + "name": "Alistair Braidwood"
63 + },
64 + {
65 + "name": "Amila Welihinda"
66 + },
67 + {
68 + "name": "Andres Suarez"
69 + },
70 + {
71 + "name": "Angelo"
72 + },
73 + {
74 + "name": "Aparajita Fishman"
75 + },
76 + {
77 + "name": "Arian Stolwijk"
78 + },
79 + {
80 + "name": "Artem Govorov"
81 + },
82 + {
83 + "name": "Bradley Heinz"
84 + },
85 + {
86 + "name": "Brandon Mills"
87 + },
88 + {
89 + "name": "Charles Hughes"
90 + },
91 + {
92 + "name": "Conrad Irwin"
93 + },
94 + {
95 + "name": "Daniel Tschinder"
96 + },
97 + {
98 + "name": "David Bonnet"
99 + },
100 + {
101 + "name": "Domenico Matteo"
102 + },
103 + {
104 + "name": "ehmicky"
105 + },
106 + {
107 + "name": "Forbes Lindesay"
108 + },
109 + {
110 + "name": "Gilad Peleg"
111 + },
112 + {
113 + "name": "impinball"
114 + },
115 + {
116 + "name": "Ingvar Stepanyan"
117 + },
118 + {
119 + "name": "Jackson Ray Hamilton"
120 + },
121 + {
122 + "name": "Jesse McCarthy"
123 + },
124 + {
125 + "name": "Jiaxing Wang"
126 + },
127 + {
128 + "name": "Joel Kemp"
129 + },
130 + {
131 + "name": "Johannes Herr"
132 + },
133 + {
134 + "name": "John-David Dalton"
135 + },
136 + {
137 + "name": "Jordan Klassen"
138 + },
139 + {
140 + "name": "Jürg Lehni"
141 + },
142 + {
143 + "name": "Kai Cataldo"
144 + },
145 + {
146 + "name": "keeyipchan"
147 + },
148 + {
149 + "name": "Keheliya Gallaba"
150 + },
151 + {
152 + "name": "Kevin Irish"
153 + },
154 + {
155 + "name": "Kevin Kwok"
156 + },
157 + {
158 + "name": "krator"
159 + },
160 + {
161 + "name": "Marek"
162 + },
163 + {
164 + "name": "Marijn Haverbeke"
165 + },
166 + {
167 + "name": "Martin Carlberg"
168 + },
169 + {
170 + "name": "Mat Garcia"
171 + },
172 + {
173 + "name": "Mathias Bynens"
174 + },
175 + {
176 + "name": "Mathieu 'p01' Henri"
177 + },
178 + {
179 + "name": "Matthew Bastien"
180 + },
181 + {
182 + "name": "Max Schaefer"
183 + },
184 + {
185 + "name": "Max Zerzouri"
186 + },
187 + {
188 + "name": "Mihai Bazon"
189 + },
190 + {
191 + "name": "Mike Rennie"
192 + },
193 + {
194 + "name": "naoh"
195 + },
196 + {
197 + "name": "Nicholas C. Zakas"
198 + },
199 + {
200 + "name": "Nick Fitzgerald"
201 + },
202 + {
203 + "name": "Olivier Thomann"
204 + },
205 + {
206 + "name": "Oskar Schöldström"
207 + },
208 + {
209 + "name": "Paul Harper"
210 + },
211 + {
212 + "name": "Peter Rust"
213 + },
214 + {
215 + "name": "PlNG"
216 + },
217 + {
218 + "name": "Prayag Verma"
219 + },
220 + {
221 + "name": "ReadmeCritic"
222 + },
223 + {
224 + "name": "r-e-d"
225 + },
226 + {
227 + "name": "Richard Gibson"
228 + },
229 + {
230 + "name": "Rich Harris"
231 + },
232 + {
233 + "name": "Sebastian McKenzie"
234 + },
235 + {
236 + "name": "Shahar Soel"
237 + },
238 + {
239 + "name": "Simen Bekkhus"
240 + },
241 + {
242 + "name": "Teddy Katz"
243 + },
244 + {
245 + "name": "Timothy Gu"
246 + },
247 + {
248 + "name": "Toru Nagashima"
249 + },
250 + {
251 + "name": "Victor Homyakov"
252 + },
253 + {
254 + "name": "Wexpo Lyu"
255 + },
256 + {
257 + "name": "zsjforcn"
258 + }
259 + ],
260 + "dependencies": {},
261 + "description": "ECMAScript parser",
262 + "devDependencies": {
263 + "eslint": "^3.18.0",
264 + "eslint-config-standard": "^7.1.0",
265 + "eslint-plugin-import": "^2.2.0",
266 + "eslint-plugin-promise": "^3.5.0",
267 + "eslint-plugin-standard": "^2.1.1",
268 + "rollup": "^0.43.0",
269 + "rollup-plugin-buble": "^0.15.0",
270 + "unicode-9.0.0": "^0.7.0"
271 + },
272 + "directories": {},
273 + "dist": {
274 + "integrity": "sha512-jG0u7c4Ly+3QkkW18V+NRDN+4bWHdln30NL1ZL2AvFZZmQe/BfopYCtghCKKVBUSetZ4QKcyA0pY6/4Gw8Pv8w==",
275 + "shasum": "317ac7821826c22c702d66189ab8359675f135d7",
276 + "tarball": "https://registry.npmjs.org/acorn/-/acorn-5.2.1.tgz"
277 + },
278 + "engines": {
279 + "node": ">=0.4.0"
280 + },
281 + "gitHead": "9924efe268e899665daeeaded9bf452ff1cb510b",
282 + "homepage": "https://github.com/ternjs/acorn",
283 + "license": "MIT",
284 + "main": "dist/acorn.js",
285 + "maintainers": [
286 + {
287 + "name": "marijn",
288 + "email": "marijnh@gmail.com"
289 + }
290 + ],
291 + "module": "dist/acorn.es.js",
292 + "name": "acorn",
293 + "optionalDependencies": {},
294 + "readme": "ERROR: No README data found!",
295 + "repository": {
296 + "type": "git",
297 + "url": "git+https://github.com/ternjs/acorn.git"
298 + },
299 + "scripts": {
300 + "build": "npm run build:main && npm run build:walk && npm run build:loose && npm run build:bin",
301 + "build:bin": "rollup -c rollup/config.bin.js",
302 + "build:loose": "rollup -c rollup/config.loose.js && rollup -c rollup/config.loose_es.js",
303 + "build:main": "rollup -c rollup/config.main.js",
304 + "build:walk": "rollup -c rollup/config.walk.js",
305 + "lint": "eslint src/",
306 + "prepare": "npm test",
307 + "pretest": "npm run build:main && npm run build:loose",
308 + "test": "node test/run.js && node test/lint.js"
309 + },
310 + "version": "5.2.1"
311 +}
1 +The MIT License (MIT)
2 +
3 +Copyright (c) 2016 Evgeny Poberezkin
4 +
5 +Permission is hereby granted, free of charge, to any person obtaining a copy
6 +of this software and associated documentation files (the "Software"), to deal
7 +in the Software without restriction, including without limitation the rights
8 +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 +copies of the Software, and to permit persons to whom the Software is
10 +furnished to do so, subject to the following conditions:
11 +
12 +The above copyright notice and this permission notice shall be included in all
13 +copies or substantial portions of the Software.
14 +
15 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 +SOFTWARE.
This diff is collapsed. Click to expand it.
1 +'use strict';
2 +
3 +var KEYWORDS = require('./keywords');
4 +
5 +module.exports = defineKeywords;
6 +
7 +
8 +/**
9 + * Defines one or several keywords in ajv instance
10 + * @param {Ajv} ajv validator instance
11 + * @param {String|Array<String>|undefined} keyword keyword(s) to define
12 + * @return {Ajv} ajv instance (for chaining)
13 + */
14 +function defineKeywords(ajv, keyword) {
15 + if (Array.isArray(keyword)) {
16 + for (var i=0; i<keyword.length; i++)
17 + get(keyword[i])(ajv);
18 + return ajv;
19 + }
20 + if (keyword) {
21 + get(keyword)(ajv);
22 + return ajv;
23 + }
24 + for (keyword in KEYWORDS) get(keyword)(ajv);
25 + return ajv;
26 +}
27 +
28 +
29 +defineKeywords.get = get;
30 +
31 +function get(keyword) {
32 + var defFunc = KEYWORDS[keyword];
33 + if (!defFunc) throw new Error('Unknown keyword ' + keyword);
34 + return defFunc;
35 +}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.