edward.ed.addr

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.

Index

Table of contents

Address Constructors

Procedures which create single address and range values.

constant make-addr

Create a single address with an optional offset.

make-addr

constant make-range

Create an address range consisting of two addresses.

make-range

procedure range?

Predicate which returns true if the parsed address is a range.

(range? obj)

procedure addr->range

Convert the given address to a range.

(addr->range addr)

procedure range->addr

Convert the given range to an address.

(range->addr addr)

procedure address-separator?

Predicate which returns true if the given obj constitutes an address separator.

(address-separator? obj)

Parser Combinators

Edward parser combinators for parsing ed addresses.

constant parse-addr-with-off

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-off

constant expand-addr

This 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-addr

constant parse-addrs

Parse 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