shithub: 9ficl

ref: 7c76dac1b268038f567939a70a18228e790a5cbc
dir: /softcore/ficllocal.fr/

View raw version
\ ** ficl/softwords/ficllocal.fr
\ ** stack comment style local syntax...
\ {{ a b c -- d e }}
\ variables before the "--" are initialized in reverse order
\ from the stack. Those after the "--" are zero initialized
\ Uses locals...
\ locstate: 0 = looking for -- or }}
\           1 = found --
hide
0 constant zero

: ?--   s" --" compare 0= ;
: ?}}   s" }}" compare 0= ;

set-current

: {{
    0 dup  locals| nLocs locstate |
    begin
        parse-word 
        ?dup 0= abort" Error: out of text without seeing }}"
        2dup 2dup  ?-- -rot ?}} or 0=
    while
        nLocs 1+ to nLocs
    repeat

    ?-- if 1 to locstate endif

    nLocs 0 do
        (local) 
    loop

    locstate 1 = if
        begin
            parse-word
            2dup ?}} 0=
        while
            postpone zero  (local)
        repeat
        2drop
    endif

    0 0 (local)
; immediate compile-only
 
previous