Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: [REBOL parse] Parsing AEIOU and sometimes Y

From: anton:wilddsl:au at: 2-May-2007 16:33

Hi Ed, Here's my go at it: ; y can't be a consonant, if it's preceded by a consonant vow: charset "aeiouAEIOU" y: charset "yY" con: exclude charset [#"a" - #"z" #"A" - #"Z"] union vow y y-as-vowel: [y (print "y = vowel")] y-as-consonant: [y pos: vow :pos (print "y = consonant")] ; to be interpreted as a consonant, y must also be followed by a vowel vowel: [[vow | y-as-vowel] (consonant/1: [con | y-as-consonant])] ; enable y as a consonant consonant: [[con | y-as-consonant] (consonant/1: [con])] ; disable y as a consonant rule: [(consonant/1: [con | y-as-consonant]) any [consonant | vowel]] parse "toy" rule ; y = vowel parse "crazy" rule ; y = vowel parse "crybaby" rule ; y = vowel; y = vowel parse "yay" rule ; y = consonant ; y = vowel parse "yoyo" rule ; y = consonant ; y = consonant The whole Y issue is complicated, isn't it ? Y can be a vowel, consonant or semi-vowel (a type of consonant)... Regards, Anton.