本文整理匯總了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);