regi-interpret

regi-interpret is a compiled Lisp function in `regi.el'.

(regi-interpret FRAME &optional START END)

Interpret the regi frame FRAME.
If optional START and END are supplied, they indicate the region of
interest, and the buffer is narrowed to the beginning of the line
containing START, and beginning of the line after the line containing
END. Otherwise, point and mark are not set and processing continues
until your FUNC returns the `abort' symbol (see below). Beware! Not
supplying a START or END could put you in an infinite loop.

A regi frame is a list of entries of the form:

(PRED FUNC [NEGATE-P [CASE-FOLD-SEARCH]])

PRED is a predicate against which each line in the region is tested,
and if a match occurs, FUNC is `eval'd. Point is then moved to the
beginning of the next line, the frame is reset and checking continues.
If a match doesn't occur, the next entry is checked against the
current line until all entries in the frame are checked. At this
point, if no match occurred, the frame is reset and point is moved to
the next line. Checking continues until every line in the region is
checked. Optional NEGATE-P inverts the result of PRED before FUNC is
called and `case-fold-search' is bound to the optional value of
CASE-FOLD-SEARCH for the PRED check.

PRED can be a string, variable, function or one of the following
symbols: t, nil, `begin', `end', and `every'. If PRED is a string, or
a variable or list that evaluates to a string, it is interpreted as a
regular expression and is matched against the current line (from the
beginning) using `looking-at'. If PRED does not evaluate to a string,
it is interpreted as a binary value (nil or non-nil).

PRED can also be one of the following symbols:

t -- always produces a true outcome
`begin' -- always executes before anything else
`end' -- always executes after everything else
`every' -- execute after frame is matched on a line

Note that NEGATE-P and CASE-FOLD-SEARCH are meaningless if PRED is one
of these special symbols. Only the first occurrence of each symbol in
a frame entry is used, the rest are ignored.

Your FUNC can return values which control regi processing. If a list
is returned from your function, it can contain any combination of the
following elements:

the symbol `continue'
Tells regi to continue processing frame-entries after a match,
instead of resetting to the first entry and advancing to the next
line, as is the default behavior. When returning this symbol,
you must take care not to enter an infinite loop.

the symbol `abort'
Tells regi to terminate processing this frame. any end
frame-entry is still processed.

the list `(frame . NEWFRAME)'
Tells regi to use NEWFRAME as its current frame. In other words,
your FUNC can modify the executing regi frame on the fly.

the list `(step . STEP)'
Tells regi to move STEP number of lines forward during normal
processing. By default, regi moves forward 1 line. STEP can be
negative, but be careful of infinite loops.

You should usually take care to explicitly return nil from your
function if no action is to take place. Your FUNC will always be
`eval'ed. The following variables will be temporarily bound to some
useful information:

`curline'
the current line in the buffer, as a string

`curframe'
the full, current frame being executed

`curentry'
the current frame entry being executed.