tags:

views:

145

answers:

1

I am having a problem with:

>> parse [a / b] ['a '/ 'b]
** Syntax Error: Invalid word-lit -- '
** Near: (line 1) parse [a / b] ['a '/ 'b]
>>
+1  A: 

REBOL's interpreter has some limitations on what you can happily write on the command line. You can't get a lit-word by writing '/ -- it throws an error because REBOL knows that / is the op! for division:

'/
** Syntax Error: Invalid word-lit -- '

But you can create '/ as a lit-word, starting with a string:

to-lit-word "/"
== '/

A solution to your code issue:

parse [a / b] compose ['a (to-lit-word "/") 'b]
=== true
  • compose [...] -- means we'll selectively evaluate part of the block before the parse
  • (...) -- is the part that is selectively evaluated, thus creating the desired '/ lit-word
Sunanda
Great just need a refinement now see below :)
Rebol Tutorial
See rather http://stackoverflow.com/questions/1458139/rebol-parse-rule-with-compose-deep-and-append-function because it's another question
Rebol Tutorial