6.17.5.2 Recognizer order

You may prefer to use a different recognizer sequence, but with (some of the) existing recognizers. You can use the following words for that:

rec-forth ( c-addr u – ... translate-xt  ) recognizer

The system recognizer: rec-forth is a deferred word that contains a recognizer (sequence). The system’s text interpreter calls rec-forth.

rec-sequence: ( xt1 .. xtn n "name" –  ) gforth-experimental “rec-sequence-colon”

Define name, a recognizer sequence that first searches xtn and last searches xt1. name is a recognizer itself, which makes recognizer sequences nestable. The order of operands is inspired by get-order and set-order.

get-recs ( recs-xt – xtu .. xt1 u  ) gforth-experimental

Obtain the xts the recognizer sequence recs-xt in the same order as used to define it.

set-recs ( xu .. xt1 u recs-xt –  ) gforth-experimental

Set the xts the recognizer sequence recs-xt in the same order as used to define it.

You probably don’t want to create a new recognizer sequence every time you want to change the system recognizer sequence. There are two ways to change an existing recognizer sequence:

rec-none ( c-addr u – translate-none  ) gforth-experimental

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:

' rec-none action-of forth-recognize >body >back