Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Calling local functions from parse rules...

From: carl::cybercraft::co::nz at: 29-Mar-2002 21:02

Hello all, I'm trying to write a function that does some parsing within it and the parse rules require a local function to be called, but I can't get parse to recognise the function. Here's an example of the problem... parse-this: func [blk rules /local str local-func value][ str: copy "" local-func: func [n][append str n] parse blk rules print str ] Which give this error...
>> parse-this ["abc"][set value string! (local-func value)]
** Script Error: local-func has no value ** Where: parse-this ** Near: local-func value How do I get it to recognise 'local-func without making 'local-func a global function? By using 'bind perhaps? But how? No way I've tried has worked. Also, 'value in the parse rule there becomes global...
>> ? value
VALUE is a string of value: "abc" I want that kept local to the function too. Any help appreciated... -- Carl Read