aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/examples/parsed-to.frt
blob: 8c06769f9638d91b0c52e2e4f716c86eebb0d07c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

\ prepend -> to a value name and act like TO
\   42 to answer 
\ is the same as 
  \ 42 ->answer
\ The -> should be made a synonymous to TO
\
\ actions
:noname defer! ;
:noname postpone literal postpone defer! ;
:noname postpone 2literal ;
recognizer: r:parsed-to

: rec-parsed-to ( addr len -- addr r:parsed-to | r:fail )
   over @ $3e2d = ( -> ) 0= if 2drop r:fail exit then
   \ something left?
   2 /string dup 0= if 2drop r:fail exit then
   \ search for the name
   find-name 0= if r:fail exit then
   ( -- xt )
   r:parsed-to
;