Tidy up the parser
This commit is contained in:
parent
02e6f1b76c
commit
c896fe1d4d
@ -8,12 +8,12 @@ export type Race = [number, number];
|
||||
const timeName = string('Time:').pipe(then(spaces1()));
|
||||
const distanceName = string('Distance:').pipe(then(spaces1()));
|
||||
|
||||
const timeParser = anyCharOf("0123456789").pipe(manySepBy(whitespace().pipe(exactly(2))), stringify(), between(timeName, whitespace()));
|
||||
const distanceParser = anyCharOf("0123456789").pipe(manySepBy(whitespace().pipe(exactly(2))), stringify(), between(distanceName, whitespace()));
|
||||
const numbersParser = anyCharOf("0123456789").pipe(manySepBy(whitespace().pipe(exactly(2))), stringify());
|
||||
const timeParser = numbersParser.pipe(between(timeName, whitespace()));
|
||||
const distanceParser = numbersParser.pipe(between(distanceName, whitespace()));
|
||||
|
||||
const parser = timeParser.pipe(then(distanceParser));
|
||||
|
||||
|
||||
export class BoatRace {
|
||||
private readonly race: Race;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user