Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 1x 1x 1x 1x 1x 108x 1x 1x 1x 27x 27x 27x 27x 27x 1x 1x | import { pipe } from "@reactive-js/core/lib/functions"; import { satisfy, string, manySatisfy, pDquote, optional, parseWith, CharStreamLike, parseWithOrThrow, } from "@reactive-js/core/lib/internal/parserCombinators"; import { isSome } from "@reactive-js/core/lib/option"; import { ASCII } from "./httpGrammar"; import { EntityTag } from "./interfaces"; export const entityTagToString = ({ isWeak, tag }: EntityTag): string => isWeak ? `\\W"${tag}"` : `"${tag}"`; const pETagc = satisfy( c => c >= 33 && c <= 256 /* VCHAR */ && c !== ASCII.DQOUTE, ); const parseIsWeak = optional(string("W/")); const parseTag = manySatisfy()(pETagc); export const pETag = (charStream: CharStreamLike): EntityTag => { const isWeak = pipe(charStream, parseIsWeak, isSome); pDquote(charStream); const tag = parseTag(charStream); pDquote(charStream); return { isWeak, tag }; }; export const parseETag = parseWith(pETag); export const parseETagOrThrow = parseWithOrThrow(pETag); |