ℙ𝕖𝕡 🙴 ℕ𝕠𝕞

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

The monkey knows which tree it is climbing up. Colombian saying

the ℕ𝕠𝕞 "while" command

Read the input stream while the peep register contains the given character class

The 'while' command in the pattern-parse language reads the input stream while the ℙ𝕖𝕡 virtual machine peep buffer is any one of the characters or character sets mentioned in the argument. The command is written

an example while command
 while [cdef];

The command takes one argument. This argument may also include character classes as well as literal characters. From example,

 while [:space:];

reads the input stream while the peep buffer is a space character The read characters are appended to the 'workspace' buffer. The while command cannot take a quoted argument ("xxx").

Negation for the character class is currently supported using the whilenot command.

notes

The while command is designed to be used mainly in the tokenising phase of the nom script: that is, it consumes the input stream so that a new parse token can be created and push ed onto the parse stack . And the corresponding text is put into the tape string array .

The [:space:] class will match all white space including newlines. But [:blank:] should match all white-space except newlines. These classes should follow the rules of the ctype.h classes. When a nom script is translated to another language (for example: rust | dart | perl | lua | go | java | javascript | ruby | python | tcl | c ) then these character classes should become unicode-aware if I dare use that term. But this may also depend on the target language and my implementation of the translator for that language.

see also