root/trunk/orca/tests/working/parse_str.r

Revision 1, 1.1 kB (checked in by krobillard, 3 years ago)

Import orca & thune.

Line 
1REBOL []
2
3str: {context: func [blk [block!]] [make object! blk]
4    probe: func [value] [print mold :value :value]
5    true: yes: on: make logic! 1
6    false: no: off: make logic! 0
7    empty?: :tail?
8    q: :quit
9    system: context [
10        console: context [
11            history: []
12            prompt: ">> "]
13        error: context [
14            msg: type: id: near: none]]
15    protect 'system
16    append: func [
17        series value /only] [
18        head either only [insert/only
19            tail series :value] [
20            insert tail series :value]]
21    rejoin: func [
22        block [block!]] [
23        if empty? block: reduce block [return block]
24        append either series? first block [
25            copy first block] [
26            form first block]
27        next block]
28    forall: func [
29        'word
30        body [block!]] [
31        while [not tail? get word] [
32            do body
33            set word next get word]]
34    time-block: func [blk /local a b] [a: now do blk b: now b - a]]
35}
36
37probe replace/all copy str "[" "<-"
38probe replace/all copy str "func" "funky"
39
40blk: parse/all str "^/"
41forall blk [
42    probe blk/1
43]
44
45
46;eof
Note: See TracBrowser for help on using the browser.