The cleverman spoke precisely, humanity he said was done It’s creed of greed could not proceed if our struggle’s to be won. Kev Carmody
Mark the current tape cell with the given name.
The mark command adds a text “tag” to the current tape-cell.
This allows the tape cell to be accessed later in the script with
the go
command. The mark and go commands should allow “offside
” or indent parsing (such as for the
python language)
The mark command has 2 formats, one with a parameter and one without:
mark; mark "here";
When the mark command has no explicit text tag, then the current tape cell is used as the mark to jump to.
See the go
command for an example.
See the script /eg/tocfoot.tohtml.pss
for an example of using
the “mark” and “go” commands to create a table of contents for
a document from markdown-style underline headings.
It has occurred to me that it would be convenient to introduce
a new version of the get
command that would take a text tag
as an argument, as below:
mark 'here'; go 'tag'; get; go 'here';
As can be seen above the get "<mark>"; command could be implemented as a macro that just goes to a particular mark, gets the text at that tapecell (appends it to the workspace buffer) and then return to the original tape cell.
The technique of using mark and go for creating footers and headers seems to work well. But I haven't yet used it to do type-checking in nom.
begin {
mark "header"; ++; mark "footer"; ++;
}
# script.
begin { mark "top"; ++; }
while [:space:]; clear;
whilenot [:space:]; !"" {
put;
"fluffy","fofo","flop" {
mark "here"; go "top";
# ... create a reference here
go "here";
}
clear; add "word*"; push; .reparse
}
parse>
pop;pop;
"word*word*","text*word*" {
# reduce here
}
(eof) { quit; }
push;push;