Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80738 views
1
define(
2
["./parser","./ast","./whitespace-control","./helpers","../utils","exports"],
3
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __exports__) {
4
"use strict";
5
var parser = __dependency1__["default"];
6
var AST = __dependency2__["default"];
7
var WhitespaceControl = __dependency3__["default"];
8
var Helpers = __dependency4__;
9
var extend = __dependency5__.extend;
10
11
__exports__.parser = parser;
12
13
var yy = {};
14
extend(yy, Helpers, AST);
15
16
function parse(input, options) {
17
// Just return if an already-compiled AST was passed in.
18
if (input.type === 'Program') { return input; }
19
20
parser.yy = yy;
21
22
// Altering the shared object here, but this is ok as parser is a sync operation
23
yy.locInfo = function(locInfo) {
24
return new yy.SourceLocation(options && options.srcName, locInfo);
25
};
26
27
var strip = new WhitespaceControl();
28
return strip.accept(parser.parse(input));
29
}
30
31
__exports__.parse = parse;
32
});
33