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

Parsing Rebol source code

 [1/2] from: robert::muench::robertmuench::de at: 31-Dec-2001 15:53


Hi, I want to parse some Rebol source code. For this I use load/next the following way: ; parse the sourcefile blk-rule: [ some [ str: newline | ";" [thru newline | to end] | [ "[" | "(" ] blk-rule | [ "]" | ")"] | skip ( set [value new] load/next str ?? value ) :new ] ] parse sourcefile blk-rule This works and you can see 'value being set to all the available value step-by-step. Now try chaing the ?? into probe and it won't work anymore! Why this? I want to get the type? of value but using: print type? value results in an error. -- Robert M. Münch IT & Management Freelancer Mobile: +49 (0)177 2452 802 Fax : +49 (0)721 8408 9112 Web : http://www.robertmuench.de

 [2/2] from: robert:muench:robertmuench at: 31-Dec-2001 16:38


> -----Original Message----- > From: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]On Behalf Of
<<quoted lines omitted: 6>>
> this? I want to get the type? of value but using: print type? value results in > an error.
Hi, well I solved it, stupid thing. If you use probe you have to use :value ;-)) Anyway, here is one more. I refer to the source from my last post. load/next will return the rest of the script as string, and that's what 'new is being set to. By being a string all the type information ist lost. I can't write a rule like this and insert it into the some scoped rule block: | 'include file! With this rule, I want to parse for the word 'include (which has type word!) and for a file! type following it. That's not possible because the input to parse is now a string and file! hasn't a meaning for the string parts... Any idea how to use parse and load/next to get all the type information Rebol has too? Robert

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted