Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
itr++;
}
token.nextToken();
}
workingpath.push(attrs);
}
if(listening && (_.indexOf(TERMINATORS, token.type.label) > -1 || _.indexOf(TERMINATORS, token.value) > -1)){
workingpath = _.reduce(workingpath, reduceMemos, ['']);
finishedPaths = _.compact(_.union(finishedPaths, workingpath));
workingpath = [];
listening--;
}
} while (token.start !== token.end && token.type !== tokTypes.eof);
// Save our finished paths directly on the function
prop.__params = finishedPaths;
// Return the dependancies list
return finishedPaths;
}
constructor(input, options = {}) {
this.toks = tokenizer(input, options)
this.options = this.toks.options
this.input = this.toks.input
this.tok = this.last = {type: tt.eof, start: 0, end: 0}
if (this.options.locations) {
let here = this.toks.curPosition()
this.tok.loc = new SourceLocation(this.toks, here, here)
}
this.ahead = [] // Tokens ahead
this.context = [] // Indentation contexted
this.curIndent = 0
this.curLineStart = 0
this.nextLineStart = this.lineEnd(this.curLineStart) + 1
// Load plugins
this.options.pluginsLoose = options.pluginsLoose || {}
this.loadPlugins(this.options.pluginsLoose)
}
CustomParser.prototype.nextToken = function nextToken() { // eslint-disable-line no-restricted-syntax
Parser.prototype.nextToken.call( this );
if ( this.type === tokTypes.eof ) {
debug( 'Detected an error after an `eof` token.' );
this.HAS_MULTILINE_ERROR = true;
}
};
canInsertSemicolon() {
return this.tok.type === tt.eof || this.tok.type === tt.braceR ||
lineBreak.test(this.input.slice(this.last.end, this.tok.start))
}
lp.parseTopLevel = function() {
let node = this.startNodeAt(this.options.locations ? [0, getLineInfo(this.input, 0)] : 0)
node.body = []
while (this.tok.type !== tt.eof) node.body.push(this.parseStatement())
this.last = this.tok
if (this.options.ecmaVersion >= 6) {
node.sourceType = this.options.sourceType
}
return this.finishNode(node, "Program")
}
closes(closeTok, indent, line, blockHeuristic) {
if (this.tok.type === closeTok || this.tok.type === tt.eof) return true
return line !== this.curLineStart && this.curIndent < indent && this.tokenStartsLine() &&
(!blockHeuristic || this.nextLineStart >= this.input.length ||
this.indentationAfter(this.nextLineStart) < indent)
}
parseTopLevel(node) {
if (!node.cells) node.cells = [];
while (this.type !== tt.eof) {
const cell = this.parseCell(this.startNode());
cell.input = this.input;
node.cells.push(cell);
}
this.next();
return this.finishNode(node, "Program");
}
}
lp.parseTopLevel = function() {
let node = this.startNodeAt(this.options.locations ? [0, getLineInfo(this.input, 0)] : 0)
node.body = []
while (this.tok.type !== tt.eof) node.body.push(this.parseStatement())
this.toks.adaptDirectivePrologue(node.body)
this.last = this.tok
node.sourceType = this.options.sourceType
return this.finishNode(node, "Program")
}
return this.finishNode(node, "EmptyStatement")
case tt._class:
return this.parseClass(true)
case tt._import:
return this.parseImport()
case tt._export:
return this.parseExport()
default:
let expr = this.parseExpression()
if (isDummy(expr)) {
this.next()
if (this.tok.type === tt.eof) return this.finishNode(node, "EmptyStatement")
return this.parseStatement()
} else if (starttype === tt.name && expr.type === "Identifier" && this.eat(tt.colon)) {
node.body = this.parseStatement()
node.label = expr
return this.finishNode(node, "LabeledStatement")
} else {
node.expression = expr
this.semicolon()
return this.finishNode(node, "ExpressionStatement")
}
}
}
unexpected(pos) {
this.raise(
pos != null ? pos : this.start,
this.type === tt.eof ? "Unexpected end of input" : "Unexpected token"
);
}
parseMaybeKeywordExpression(keyword, type) {