|
Pages: [1]
|
 |
|
Author
|
Topic: New parsing problem (Read 234 times)
|
parser
Guest
|
I really don't understand why it gives "command1 <" instead of {command1 command1 command2}
rules: [
any [ [ some newline copy command to " " "<" copy param to ">" ">" some newline (probe command) ] | [ some newline copy Command to newline some newline (probe command) ]
] some newline to end ]
list-commands: { command1 < test1 >
command1
command2 < test2 >
}
parse/all list-commands rules
>> parse/all list-commands rules "command1 <" == false >>
|
|
|
|
|
Logged
|
|
|
|
Guest
Guest
|
I don't have enough time to explain where you went wrong, but, if you need to extract the commands I can give you a different approach that might suit your needs. parse/all list-commands [any [ to "<" tag-start: thru ">" tag-end: (remove/part a B) :a ] to end ] This will remove the "tags" in list-commands (assuming they are all well-formed), leaving behind the commands and some whitespace. If your tags didn't span multiple lines like that, REBOL could have recognized the tags, and then we could just use load/markup and remove-each. See the one-liner from Carl ( http://www.rebol.com/oneliners.html) for an example.
|
|
|
|
|
Logged
|
|
|
|
Guest
Guest
|
Sorry, got tangle up in emoticons. Here's that code again:
parse/all list-commands [any [ to "<" tag-start: thru ">" tag-end: (remove/part tag-start tag-end) :tag-start ] to end ]
|
|
|
|
|
Logged
|
|
|
|
|
|
Pages: [1]
|
|
|
 |