parjs
Version:
Library for building parsers using combinators.
23 lines • 819 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.wrapImplicit = exports.convertibleSymbol = void 0;
const parser_1 = require("./parser");
/** A {@link Parjser} or a literal value convertible to a {@link Parjser}. */
/**
* @private Should Not be used from user code. Used to implement implicit parser literals.
* @type {symbol}
*/
exports.convertibleSymbol = Symbol("ParjsConvertibleLiteral");
function wrapImplicit(scalarOrParjser) {
if (typeof scalarOrParjser === "string") {
return (0, parser_1.string)(scalarOrParjser);
}
else if (scalarOrParjser instanceof RegExp) {
return (0, parser_1.regexp)(scalarOrParjser);
}
else {
return scalarOrParjser;
}
}
exports.wrapImplicit = wrapImplicit;
//# sourceMappingURL=wrap-implicit.js.map