Pep and Nom

home | documentation | examples | translators | download | blog | all blog posts

the ℕ𝕠𝕞 "clip" command

clip one character from the end of the 'workspace' buffer (and send it into the void).

It deletes it. The character is removed from the end of the workspace, and so, it represents the last character which would have been added to the workspace from a previous read operation.

The command is useful, for example, when parsing quoted text, used in conjunction with the 'until' command. The following script only prints text which is contained within double quote characters, from the input.

parse and print quoted text


  read; '"' { clear; until '"'; clip; print; }
  "\"" { clear; until "\""; clip; print; }
 

If the above script receives the text 'this “big” and “small” things' as it’s input, then the output will be 'big small' .That is, only that which is within double quotes will be printed.

The script above can be translated into plain English as follows

a- If the workspace is a " character then

see also

clop , clear , replace