xref: /freebsd/stand/ficl/softwords/ficllocal.fr (revision 26a58599a09a6181e0f5abe624021865a0c23186)
1\ ** ficl/softwords/ficllocal.fr
2\ ** stack comment style local syntax...
3\ {{ a b c -- d e }}
4\ variables before the "--" are initialized in reverse order
5\ from the stack. Those after the "--" are zero initialized
6\ Uses locals...
7\ locstate: 0 = looking for -- or }}
8\           1 = found --
9\
10
11hide
120 constant zero
13
14: ?--   s" --" compare 0= ;
15: ?}}   s" }}" compare 0= ;
16
17set-current
18
19: {{
20    0 dup  locals| nLocs locstate |
21    begin
22        parse-word
23        ?dup 0= abort" Error: out of text without seeing }}"
24        2dup 2dup  ?-- -rot ?}} or 0=
25    while
26        nLocs 1+ to nLocs
27    repeat
28
29    ?-- if 1 to locstate endif
30
31    nLocs 0 do
32        (local)
33    loop
34
35    locstate 1 = if
36        begin
37            parse-word
38            2dup ?}} 0=
39        while
40            postpone zero  (local)
41        repeat
42        2drop
43    endif
44
45    0 0 (local)
46; immediate compile-only
47
48previous
49