Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = (options, mode, previousPhases) => {
if (typeof options.resolveAlias !== 'function') {
return identity;
}
const preAliasLexer = compose.apply(null, previousPhases.reverse());
const visitor = expandAlias(preAliasLexer, options.resolveAlias, values(mode.enums.reservedWords));
return compose(
merge,
map(
tokens.applyTokenizerVisitor(visitor)
)
);
};
module.exports = (options, mode, previousPhases) => {
if (typeof options.resolveAlias !== 'function') {
return identity;
}
const preAliasLexer = compose.apply(null, previousPhases.reverse());
const visitor = expandAlias(preAliasLexer, options.resolveAlias);
return compose(
merge,
map(
tokens.applyTokenizerVisitor(visitor)
)
);
};
setInput(source) {
const tokenizer = mode.tokenizer(options);
let previousPhases = [tokenizer];
const phases = [tokenizer]
.concat(mode.lexerPhases.map(phase => {
const ph = phase(options, mode, previousPhases);
previousPhases = previousPhases.concat(ph);
return ph;
}));
const tokenize = compose.apply(null, phases.reverse());
this.tokenizer = tokenize(source);
}
});