backslah inside dialect ?
[1/2] from: arngar:gm:ail at: 10-Jun-2007 10:59
hello,
how to insert a backslah inside a dialect ?
rules: [
any [
'\og ( print "open") |
'\fg (print "close")
]
]
parse ["this is \og an example \fg "] rules
thanks,
Arnaud
[2/2] from: gregg::pointillistic::com at: 10-Jun-2007 7:27
[parse] backslah inside dialect ?
Hi Arnaud,
AG> how to insert a backslah inside a dialect ?
Do you want to do string or block parsing? If you want to do string
parsing, you're close; if you want to do block parsing, you're out of
luck, because a backslash-prefixed word isn't valid REBOL. In that
case, I would use refinements.
; string
rules: [
any [
"\og" ( print "open")
| "\fg" (print "close")
| skip
]
]
parse "this is \og an example \fg" rules
; block
rules: [
any [
/og (print "open")
| /fg (print "close")
| skip
]
]
parse [this is /og an example /fg] rules
HTH!
-- Gregg