UNPKG

673 BJavaScriptView Raw
1
2/**
3 * Copyright (c) Facebook, Inc. and its affiliates.
4 *
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the root directory of this source tree.
7 */
8
9'use strict';
10
11module.exports = function getParser(parserName, options) {
12 switch (parserName) {
13 case 'babylon':
14 return require('../parser/babylon')(options);
15 case 'flow':
16 return require('../parser/flow')(options);
17 case 'ts':
18 return require('../parser/ts')(options);
19 case 'tsx':
20 return require('../parser/tsx')(options);
21 case 'babel':
22 default:
23 return require('../parser/babel5Compat')(options);
24 }
25};