I am trying to parse some data which is formatted as follows.
data: [a b x b x x b a a x x b b x ]
What I need it to extract the a's and b's in order and perform a different action for each a and b.
The expected output would be:
a
b
b
b
a
a
b
b
== true
I have come up with this so far, but it fails for repeated a's.
parse data [
some [
thru 'a (print "a")
some [
any [
to 'b (print "b")
]
to 'a
]
]
to end
]
Any pointers? Thanks
>> data: [a b x b x x b a a x x b b x ]
== [a b x b x x b a a x x b b x]
>> parse data [ some [ 'a (print "a") | 'b (print "b") | skip ] ]
a
b
b
b
a
a
b
b
== true