It is a function that returns nested blocks and words that represent the structure of your input, basedupon parse rules that you give it.
If you have parse rules that validate some input, you can use this function to give you a REBOL representationof that input, without coding any actions in your parse rules.
For example, this code:
; Parse rules digit: charset {0123456789} hex-digit: charset {0123456789ABCDEF} letter: charset [#"a" - #"z" #"A" - #"Z"] word: [some letter] phrase: [some [word | { }]] number: [some digit] hex-literal: [#"$" some hex-digit] item: [phrase | hex-literal | number | { }] ; The information we want to appear in the structure. structure-terms: [phrase word hex-literal number] data: {There were 374 brown foxes and $0001 mottley one.} print mold load-parse-stree structure-terms [parse/all data [any item]]
Produces this output:
[ phrase [ word "There" word "were" ] number "374" phrase [ word "brown" word "foxes" word "and" ] hex-literal "$0001" phrase [ word "mottley" word "one" ] ]
if not value? 'script-manager [ script-manager: func ['word /local needs][ if any [ :word <> 'do-needs none? in system/script/header 'needs none? needs: system/script/header/needs ][return] if not parse needs: compose [(:needs)] [some file!][make error! {Expected a NEEDS block consisting of file!.}] foreach [file] needs [do file] ] ]
As for the parse-analysis.r functions on which this function is based:
Therefore the best use of this script is in an ad-hoc fashion by developers, I'm not sure how it would go as part of production programs.
Changing the input or the rules as parse executes. If you have the skills to do this you should be able to work out if you can use this function with your dynamic parse programming.
Brett Handley started programming REBOL early 2000 and maintains a site of REBOL information and scripts at: