etherforth_logo

Node 113

Words defined here move cursor pointer between words, i.e. they can make difference between character strings and tokens so we don't need to care about this feature anymore. We also provide access to some earlier words to navigator.

Source code

editor node 213 node 112 node 113
113 words
+t 00 12006 +t !b ;
-t 02 1200F -t !b ;
+x 04 12016 +x !b ;
-x 06 12018 -x !b ;
sym 08 -s 1201A sym !b @p . !p .. !b @b ;
ptr 0C -p 12020 ptr !b @p . !p .. !b @b ;
home 10 dup or dup
ptr! 11 p 5624 ptr! !b !b ;
tag? 13 30 sym over and or if drop ; then drop -
tok? 19 sym E and . if drop ; then drop - +x ;
-tag? 20 sym E and if drop ; then drop - a ptr! -x ;
-tok? 27 sym 3E and 30 or if drop ; then drop -
-w 2E f-f ptr a! if -x -tok? ; then -t -tag? ;
+w 34 f-f if +x tag? ; then +t tok? ; 39

init dup or up b! r--- ; 3D

5 d 4 r 0 ether

Definitions

+t, -t
Call +t and -t in 213.
+x, -x
Call +x and -x in 213.
sym
Call sym in node 213 to get symbol s under current pointer.
ptr
Call ptr in node 213 to get current pointer p.
home
Set pointer to zero.
ptr!
Set pointer to value p.
tag?
Used after right cursor move from tokens. If the current symbol (i.e. where pointer ptr in node 212 points to) is a tag, invert flag on stack.
tok?
Used after right cursor move from strings. If the current symbol is a token (tags 30 and 31) invert the flag and move cursor one symbol right (so that we end up at the first token and not the token tag itself).
-tag?
Used after left cursor move from tokens. If the current symbol is a token then invert the flag, restore pointer with the value stored (in -w) in A so pointer is moved back where it was before -w has been called, then move one symbol left.
-tok?
Used after left cursor move from strings. If the current symbol is a token invert the flag. Then fall through to -w, because if moved left from a token to a token tag (30 and 31) we must move left one more time (token tags are not displayed, see node 412).
+w, -w
Move cursor pointer left and right by words, regardless of whether it is a character string or a token. In -w we first store the current pointer in A and if in tokens (flag is non-zero) move one symbol left with -x and test with -tok? if still in tokens. Else move one tag left with -t and test with -tag? if the new tag is not a token. In +w we don't need to keep pointer so if in tokens (non-zero flag) we move right by +x and jump to -w else we move right by +t and jump to tag?.
init
Set zero flag (thus each block must start with a string, not tokens; usually not a problem as we start block with comment line), set register B, and jump to RIGHT.

Description