import { SameLine as _ } from "../../peg-whitespace" import { RestOfLine } from "../../peg-rest-of-line" { const syncpipe = require("syncpipe"); const mapVersionTitle = require("../map-version-title"); } Output = entries:VersionLine+ { // FIXME/MARKER: Build a generic abstraction for fromNamedEntries or so return syncpipe(entries, [ (_) => _.map(({ key, value }) => [ key, value ]), (_) => Object.fromEntries(_) ]); } VersionLine = _ label:$[A-Za-z ]+ ":" _ version:RestOfLine { return { key: mapVersionTitle(label), // FIXME/MARKER: Rename to mapVersionLabel value: version.trim() }; }