getParser.js 612 B

1234567891011121314151617181920212223
  1. /*
  2. * Copyright (c) 2015-present, Facebook, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. *
  9. */
  10. 'use strict';
  11. module.exports = function getParser(parserName) {
  12. switch (parserName) {
  13. case 'babylon':
  14. return require('../parser/babylon');
  15. case 'flow':
  16. return require('../parser/flow');
  17. case 'babel':
  18. default:
  19. return require('../parser/babel5Compat');
  20. }
  21. };