Um, not really. I used it a lot in an ad-hoc fashion, extracting structured data from webpages and things where a pattern was evident. I'll include a different example further down.
At the risk of talking about too much old stuff, I'm going to add some more thoughts on complex parse work. I realise, that these may not be your priorities, but I'm adding them here because this is a reasonably relevant time to contribute to thinking about "things people might want to do with parsing" and what facilities could support those goals.
-
A complex use of load-parse-tree was part of a process to automatedly extract and translate Augmented Backus–Naur form (ABNF) from RFC documents to Rebol 2 parse rules (abnf-parser.r). The block returned by load-parse-tree was rewritten to become parse rules.
-
It occurred to me at some point that allocating new memory for constant patterns (literals) was a waste of memory, particularly for large input sources. I took a stab at distinguishing non-terminals, terminals and literals in an early ren-c version of get-parse-tree.r. It's the same essential logic as load-parse-tree but returns a more complex result. It has some rudimentary tests.
-
Once input was broken into tokens, it was hard to easily represent these tokens in a linear parse-able stream but type them. It seems like a facility to be able break up the inputs and annotate the parts in a more efficient way might be interesting.
Note: See also post on Visual Parse Debugging
I think these things encompass most of the things I've found interesting with parse over the years.
For the sake of completeness and to give another "test" for load-parse-tree.r I'll add the commands and sources below.
Here is the setup. (Note that json-structure is defined in https://github.com/codebybrett/rebol2/blob/master/working/misc/json-structure.r)
t: read %example.json
j: context json-structure
Running load-parse-tree:
>> print mold load-parse-tree/ignore j/grammar [parse/all t j/grammar/json] [wsp string value]
[
json [
object [
member [
json-string "menu"
object [
member [
json-string "id"
json-string "file"
]
member [
json-string "value"
json-string "File"
]
member [
json-string "popup"
object [
member [
json-string "menuitem"
array [
object [
member [
json-string "value"
json-string "New"
]
member [
json-string "onclick"
json-string "CreateNewDoc()"
]
]
object [
member [
json-string "value"
json-string "Open"
]
member [
json-string "onclick"
json-string "OpenDoc()"
]
]
object [
member [
json-string "value"
json-string "Close"
]
member [
json-string "onclick"
json-string "CloseDoc()"
]
]
]
]
]
]
]
]
]
]
]
Example.json:
{"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
}}