[REBOL] Re: [REBOL parse] Parsing AEIOU and sometimes Y
From: lmecir:mbox:vol:cz at: 3-May-2007 8:48
OK, Ed, a commented version:
> That's really great Ladislav.
> The only thing that saddens me somewhat is that I would probably never
> arrive at a solution like this on my own (the same goes for the other
> solutions offered, of course).
> For those new to 'parse, would you be so kind as to step through your
> code and explain it? If you prefer, you can send your comments to me
> directly and I will work with you to produce a short explanation that
> may be appropriate for newbies.
> >From here, I'll complete the algorithm, create a tag-cloud indexer and
> see if I can call an old favor from Oldes to generate a Flash
> Best regards and thanks to all,
; vowel variants
vowel-after-consonant: charset "aeiouAEIOU"
vowel-otherwise: charset "aeiouyAEIOUY"
; consonant variants
consonant-after-consonant: exclude charset [
#"a" - #"z" #"A" - #"Z"
consonant-otherwise: union consonant-after-consonant charset "yY"
; adjusting the Vowel and Consonant rules to the Otherwise state
otherwise: first [
; vowel detection does not change state
; consonant detection changes state to After-consonant
consonant: [consonant-otherwise after-consonant]
; adjusting the Vowel and Consonant rules to the After-consonant state
after-consonant: first [
; vowel detection provokes transition to the Otherwise state
vowel: [vowel-after-consonant otherwise]
; consonant detection does not change state
; zeroing the counter
; setting the state to Otherwise
; initialization end
any [some vowel some consonant (m: m + 1)]