本文整理汇总了TypeScript中@jonggrang/parsing.many函数的典型用法代码示例。如果您正苦于以下问题:TypeScript many函数的具体用法?TypeScript many怎么用?TypeScript many使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了many函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
const userinfo: PS.Parser<string> = PS.co(function* () {
const uu: L.List<string> = yield PS.many(uchar(';:&=+$,'));
yield PS.char('@');
return PS.pure(joinStr(uu) + '@');
});
示例2: joinStr
const pathRootLess: PS.Parser<string> = PS.co(function* () {
const s1: string = yield segmentNz;
const ss: L.List<string> = yield PS.many(slashSegment);
return PS.pure(s1 + joinStr(ss));
});
示例3: uchar
const ipLiteral: PS.Parser<string> = PS.between(
PS.char('['),
PS.char(']'),
ipv6addrz.alt(ipvFuture).map(ua => `[${ua}]`)
);
function uchar(c: string): PS.Parser<string> {
return unreservedChar.alt(escaped).alt(subDelims).alt(PS.oneOf(c.split('')));
}
const pchar = uchar(':@');
const regName: PS.Parser<string> = countMinMax(0, 255, nameChar).map(joinStr);
const uquery: PS.Parser<string> = PS.many(uchar(':@/?')).map(x => `?${joinStr(x)}`);
const ufragment: PS.Parser<string> = PS.many(uchar(':@/?')).map(x => `#${joinStr(x)}`);
const host: PS.Parser<string> = ipLiteral.alt(PS.attempt(ipv4address)).alt(regName);
const port: PS.Parser<string> = PS.char(':').chain(() => PS.many(PS.anyDigit)).map(xs => `:${joinStr(xs)}`);
const segment = PS.many(pchar).map(joinStr);
const slashSegment = PS.char('/').chain(() => segment).map(x => `/${x}`);
const segmentNz = PS.many1(pchar).map(joinStr);
const segmentNzc = PS.many1(uchar('@')).map(joinStr);