index.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _exportNames = {
  6. parse: true
  7. };
  8. exports.parse = parse;
  9. var parser = _interopRequireWildcard(require("./grammar"));
  10. var _tokenizer = require("./tokenizer");
  11. var _numberLiterals = require("./number-literals");
  12. Object.keys(_numberLiterals).forEach(function (key) {
  13. if (key === "default" || key === "__esModule") return;
  14. if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  15. Object.defineProperty(exports, key, {
  16. enumerable: true,
  17. get: function get() {
  18. return _numberLiterals[key];
  19. }
  20. });
  21. });
  22. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
  23. function parse(source) {
  24. var tokens = (0, _tokenizer.tokenize)(source); // We pass the source here to show code frames
  25. var ast = parser.parse(tokens, source);
  26. return ast;
  27. }