You may prefer to use a different recognizer sequence, but with (some of the) existing recognizers. You can use the following words for that:
The system recognizer: rec-forth
is a defer
red
word that contains a recognizer (sequence). The system’s text
interpreter calls rec-forth
.
Define a recognizer sequence name. xtu..xt1 are
xts of recognizers, and are the initial contents of the
recognizer sequence, with xt1 searched first. The order of
operands is inspired by get-order
and set-order
.
name execution: ( c-addr u – translation )
Execute the first xt in the recognizer sequence name. If
the resulting translation has a translation token other than
translate-none
, this is the result of name and no
further recognizers are tried. Otherwise, the stacks are
restored to the initial state (c-addr u), and the next xt
is tried. If all xts produce translate-none
,
translation is translate-none
. name is a
recognizer itself, which makes recognizer sequences nestable.
Recs-xt is the execution token of a recognizer sequence. xt1
is the first recognizer searched by this sequence, xtu is
the last one. If recs-xt refers to a deferred word, perform
defer@ get-recs
.
rec-xt is the execution token of a recognizer sequence.
Replace the contents of this sequence with xtu...xt_1,
where xt1 is searched first, and xtu is searched last.
If recs-xt refers to a deferred word, perform
defer@ set-recs
.
You probably don’t want to create a new recognizer sequence every time you want to change the system recognizer sequence. There are several ways to change an existing recognizer sequence:
defer
red words in a recognizer sequence, and
change the recognizer in this word later. If you do not want such a
deferred word to recognize anything for now, put rec-none
in
it.
set-recs
on the recognizer sequence, possibly after getting
the current sequence with get-recs
and modifying it.
stack
(see User-defined Stacks), and you can use the words for
manipulating stacks on it. In particular, if you add a recognizer
with >stack
, that recognizer will be tried first; if you add it
with >back
, it will be tried last.
This recognizer recognizes nothing. It can be useful as a placeholder.
Here is an example of adding rec-none
as last recognizer to
the system recognizers: