This library provides an abstraction for parsing, representing, and operating on ed addresses. Conceptually, the library distinguishes single addresses and ranges. The latter consisting of a start and end address as well as a address separator (as defined in POSIX). The parse-addrs procedure returns a list of address ranges. The editor implementation is capable of converting this list to a pair of line numbers using the addrlst->lpair procedure. Command implementations expecting a range address receive this pair, commands which only expect a single address only receive the last element of the pair as an argument.
Procedures which create single address and range values.
Create a single address with an optional offset.
make-addrCreate an address range consisting of two addresses.
make-rangePredicate which returns true if the parsed address is a range.
(range? obj)Convert the given address to a range.
(addr->range addr)Convert the given range to an address.
(range->addr addr)Predicate which returns true if the given obj constitutes an address separator.
(address-separator? obj)Edward parser combinators for parsing ed addresses.
Addresses can be followed by zero or more address offsets, optionally
separated by blanks. Offsets are a decimal number optionally prefixed by
+ or - character. A + or - character not followed by a
decimal number shall be interpreted as +1/-1. This procedure is
responsible for parsing an address with an optional offset.
parse-addr-with-offThis procedure expands a given parsed address according to the omission rules mandated by the POSIX standard. The procedure receives an address parsed by parse-addrs as an input value and returns an address-range.
expand-addrParse an address chain consisting of multiple addresses separated by
, or ;. Returns an address list which can be converted to a line
pair using the addrlst->lpair procedure.
parse-addrs