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: gregg::pointillistic::com at: 1-May-2007 17:00

Hi Ed, EOC> "A consonant in a word is a letter other than A, E, I, O or U, and other EOC> than Y preceded by a consonant." EOC> In other words, the letter "y" is considered to be a consonant when it EOC> is preceded by a vowel. When "y" is preceded by another consonant is EOC> to be interpreted as a vowel. Having not read the algorithm spec, is this on track? vow: charset "aeiouAEIOU" y: charset "yY" con: exclude charset [#"a" - #"z" #"A" - #"Z"] union vow y ycon: [vow y (print "y = consonant")] yvow: [con y (print "y = vowel")] just-y: [y (print "y = consonant")] rule: [some [yvow | ycon | con | vow | just-y]] parse "toy" rule ; y = consonant parse "crazy" rule ; y = vowel parse "crybaby" rule ; y = vowel; y = vowel parse "yay" rule ; y = consonant ; y = consonant parse "yoyo" rule ; y = consonant ; y = consonant -- Gregg