Rebol 编程/collect-words
外观
< Rebol 编程
COLLECT-WORDS block /deep /set /ignore words
收集块中使用的唯一单词(用于构建上下文)。
COLLECT-WORDS 是一个函数值。
- block -- (类型:块)
- /deep -- 包括嵌套块
- /set -- 只包含设置单词
- /ignore -- 忽略之前的单词
- words -- 要忽略的单词 (类型:对象 端口 块)
collect-words: func [ {Collect unique words used in a block (used for context construction).} block [block!] /deep "Include nested blocks" /set "Only include set-words" /ignore "Ignore prior words" words [object! port! block!] "Words to ignore" /local rule word blk w ][ deep: either deep [[path! | set-path! | lit-path! | into rule]] [any-block!] word: either set [set-word!] [any-word!] blk: [] parse block rule: [ set w word (insert tail blk to-word to-string w) | deep | skip ] also either ignore [ unless block? words [words: words-of words] difference blk intersect blk words ] [ unique blk ] (clear blk set [block words] none) ]