[REBOL] parse question Re:
From: jeff:rebol at: 14-Sep-2000 11:37
Neat stuff. Planning on making web page out of the result?
> In order to improve my skills with the REBOL parse word, I thought I would go
> through "Mastering Regular Expressions" by Jeffrey Freidl and do all the
> examples in REBOL. Here is my first attempt and it does not work.
[ . . .]
> rules: [
> to "resetsize" (size-cmds: size-cmds - 1) | to
> "setsize" (size-cmds: size-cmds + 1)
> proc: func [ filenames [block!] ] [
> foreach file filenames [
> size-cmds: 0 parse read to-file file rules prin
> reform [ "in" file ": " ] either size-cmds = 0 [
> print "resetsize cmds matched # of setsize
> ][ either size-cmds > 0 [
> print "resetsize cmds > # of setsize cmds"
> ][ print "resetsize cmds < # of setsize cmds" ]
> ] ]
s-size: ["setsize" (size-cmds: size-cmds + 1)]
rs-size: ["resetsize" (size-cmds: size-cmds - 1)]
rules: [some [rs-size | s-size]]