xref: /freebsd/stand/ficl/softwords/ficllocal.fr (revision 62cfcf62f627e5093fb37026a6d8c98e4d2ef04c)
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\ $FreeBSD$
11
12hide
130 constant zero
14
15: ?--   s" --" compare 0= ;
16: ?}}   s" }}" compare 0= ;
17
18set-current
19
20: {{
21    0 dup  locals| nLocs locstate |
22    begin
23        parse-word
24        ?dup 0= abort" Error: out of text without seeing }}"
25        2dup 2dup  ?-- -rot ?}} or 0=
26    while
27        nLocs 1+ to nLocs
28    repeat
29
30    ?-- if 1 to locstate endif
31
32    nLocs 0 do
33        (local)
34    loop
35
36    locstate 1 = if
37        begin
38            parse-word
39            2dup ?}} 0=
40        while
41            postpone zero  (local)
42        repeat
43        2drop
44    endif
45
46    0 0 (local)
47; immediate compile-only
48
49previous
50