Search code examples
parsingsyntaxrebol

rebol parse problem


simple parse example:

ab: charset "ab"
parse "aaa" [some ab]  
; == true

if i wanted one-liner (define ab in place), how do i do it?

parse "aaa" [some [charset "ab"]]
; ** Script Error: Invalid argument: ?function?

parse "aaa" [some (charset "ab")]
; (INTERPRETER HANGS UP)

i use REBOL 2.7.7.4.2

UPDATE

in rebol 3:

parse "aaa" [some (charset "ab")]
; == false

Solution

  • You're looking for 'compose

    >> parse "aaa" compose [ some (charset [#"a" #"b"] ) ]
    == true