aboutsummaryrefslogtreecommitdiff
path: root/node_modules/babylon/lib/parser/index.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2016-11-03 01:33:53 +0100
committerFlorian Dold <florian.dold@gmail.com>2016-11-03 01:33:53 +0100
commitd1291f67551c58168af43698a359cb5ddfd266b0 (patch)
tree55a13ed29fe1915e3f42f1b1b7038dafa2e975a7 /node_modules/babylon/lib/parser/index.js
parentd0a0695fb5d34996850723f7d4b1b59c3df909c2 (diff)
node_modules
Diffstat (limited to 'node_modules/babylon/lib/parser/index.js')
-rw-r--r--node_modules/babylon/lib/parser/index.js102
1 files changed, 0 insertions, 102 deletions
diff --git a/node_modules/babylon/lib/parser/index.js b/node_modules/babylon/lib/parser/index.js
deleted file mode 100644
index e8398929d..000000000
--- a/node_modules/babylon/lib/parser/index.js
+++ /dev/null
@@ -1,102 +0,0 @@
-"use strict";
-
-exports.__esModule = true;
-exports.plugins = undefined;
-
-var _identifier = require("../util/identifier");
-
-var _options = require("../options");
-
-var _tokenizer = require("../tokenizer");
-
-var _tokenizer2 = _interopRequireDefault(_tokenizer);
-
-function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-
-function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
-
-function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
-
-var plugins = exports.plugins = {};
-
-var Parser = function (_Tokenizer) {
- _inherits(Parser, _Tokenizer);
-
- function Parser(options, input) {
- _classCallCheck(this, Parser);
-
- options = (0, _options.getOptions)(options);
-
- var _this = _possibleConstructorReturn(this, _Tokenizer.call(this, options, input));
-
- _this.options = options;
- _this.inModule = _this.options.sourceType === "module";
- _this.isReservedWord = _identifier.reservedWords[6];
- _this.input = input;
- _this.plugins = _this.loadPlugins(_this.options.plugins);
- _this.filename = options.sourceFilename;
-
- // If enabled, skip leading hashbang line.
- if (_this.state.pos === 0 && _this.input[0] === "#" && _this.input[1] === "!") {
- _this.skipLineComment(2);
- }
- return _this;
- }
-
- Parser.prototype.hasPlugin = function hasPlugin(name) {
- return !!(this.plugins["*"] || this.plugins[name]);
- };
-
- Parser.prototype.extend = function extend(name, f) {
- this[name] = f(this[name]);
- };
-
- Parser.prototype.loadPlugins = function loadPlugins(plugins) {
- var pluginMap = {};
-
- if (plugins.indexOf("flow") >= 0) {
- // ensure flow plugin loads last
- plugins = plugins.filter(function (plugin) {
- return plugin !== "flow";
- });
- plugins.push("flow");
- }
-
- for (var _iterator = plugins, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
- var _ref;
-
- if (_isArray) {
- if (_i >= _iterator.length) break;
- _ref = _iterator[_i++];
- } else {
- _i = _iterator.next();
- if (_i.done) break;
- _ref = _i.value;
- }
-
- var name = _ref;
-
- if (!pluginMap[name]) {
- pluginMap[name] = true;
-
- var plugin = exports.plugins[name];
- if (plugin) plugin(this);
- }
- }
-
- return pluginMap;
- };
-
- Parser.prototype.parse = function parse() {
- var file = this.startNode();
- var program = this.startNode();
- this.nextToken();
- return this.parseTopLevel(file, program);
- };
-
- return Parser;
-}(_tokenizer2.default);
-
-exports.default = Parser; \ No newline at end of file