[REBOL] Re: [parse] Special characters in block parsing
From: volker::nitsch::gmail::com at: 3-Apr-2005 16:48
Composing was my first thought too.
But this looks cleaner (with complex rules):
divide-word: to-lit-word "/"
probe parse [/][ set word divide-word ]
On Apr 3, 2005 4:39 PM, Anton Rolls <[antonr--lexicon--net]> wrote:
> Hi Arie,
> >> parse [/] compose [set word (to-lit-word first [/])]
> == true
> >> word
> == /
> > Hi all,
> > while experimenting with a small dialect for calculations, I stumbled
> > into a problem.
> > I've done simple things like:
> > >> parse [6 * 3] [set num1 number! '* set num2 number! (print num1 *
> > num2) ]
> > 18
> > == true
> > However, when I try:
> > >> parse [6 / 3] [set num1 number! '/ set num2 number! (print num1 /
> > num2) ]
> > ** Syntax Error: Invalid word-lit -- '
> > ** Near: (line 1) parse [6 / 3] [set num1 number! '/ set num2 number!
> > (print num1 / num2
> > ) ]
> > REBOL complains, because (of course) '/ is not a proper lit-word.
> > How can I still parse the / ? I already tried a charset, but I suppose
> > that's only possible with string-parsing, or not?
> > TIA
> > Arie
> To unsubscribe from the list, just send an email to
> lists at rebol.com with unsubscribe as the subject.
Any problem in computer science can be solved with another layer of
indirection. But that usually will create another problem.