Documention for: parse-analysis-view.r
Created by: brett
on: 18-Dec-2004
Last updated by: brett on: 6-Mar-2013
Format: html
Downloaded on: 29-Nov-2021

Parse Analysis Toolset /View

1. What is this for?

Uses REBOL/View to visualise the results of Parse. Currently provides a View representation on the results from the Tokenise-parse (see parse-analysis.r script and documentation).

2. Why is it useful?

3. What is in the script?

4. How do you use it?

        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
                if not parse needs: compose [(:needs)] [some file!][make error! {Expected a NEEDS block consisting of file!.}]
                foreach [file] needs [do file]

4.1 Example

Here we specify the parse rules and the text.

    mygrammar: context [
        alpha: charset [#"A" - #"Z" #"a" - #"z"]
        digit: charset {0123456789}
        word: [some alpha]
        number: [some digit]
        main: [
            some [word | number | skip]
    text: {Word 123 +=+ 45 End}
    visualise-parse/ignore text mygrammar [parse/all text mygrammar/main] [alpha digit]

Another example. In this example we are going leverage the built-inxml rules of REBOL. That is why the BIND is used below.

    ; An old xml example
    xml: {<movie>
        <title>Star Trek: Insurrection</title>
        <star>Patrick Stewart</star>
        <star>Brent Spiner</star>
            <theater-name>MonoPlex 2000</theater-name>
            <price adult="8.50" child="5.00" />
        <theater price="6.00">
            <theater-name>Bigscreen 1</theater-name>

    rules: bind [
        element name content attribute attr-value
    ] xml-language

    visualise-parse xml rules [parse-xml xml]

4.2 What should I do with these examples?

4.2.1 Thinking about what you are seeing

5. About the script author

Brett Handley started programming REBOL early 2000 and maintains a site of REBOL information and scripts at: