[REBOL] Dialecting......
From: idsrini:g:mail at: 28-May-2008 20:56
Hi Gregg,
I had a look at dialects and managed to get a simple one working using
Blocks using Parse (not string parsing)...
I was wondering if you or someone else could throw some light (with
examples) on more complex parsing. Like recursive parsing for nested blocks
For example, if I need to parse the block
[IF A > B
[SET VALUE OF DISCOUNT TO 10]
ELSEIF A = B
[SET VALUE OF DISCOUNT TO 15]
ELSE
[SET VALUE OF DISCOUNT TO 20]
]
Next Example
[IF A > B
[IF CUSTOMER-TYPE = "VIP"]
[SET VALUE OF DISCOUNT = 30]
[ELSEIF CUSTOMER-TYPE = "REGULAR"]
[SET VALUE OF DISCOUNT = 20]
[ELSE]
[SET VALUE OF DISCOUNT = 15]
]
[ELSEIF A = B]
[SET VALUE OF DISCOUNT TO 15]
ELSE
[SET VALUE OF DISCOUNT TO 20]
]
Hope I have been able to communicate the query .........
Basically, if I could get the code to do nested blocks, then it becomes very
helpful.....
Regards,
Srini