>>>>> "AH" == Austin Hastings <[EMAIL PROTECTED]> writes:

  AH> grammar Rainbow;

  AH> rule color {...};  # this one's on you.

  AH> rule same_color($color is Colorific)
  AH> {
  AH>   <color> ::: { fail unless $1.looks_like($color); }
  AH> }

  AH> rule band($color is Colorific)
  AH> {
  AH>   <same_color($color)>+
  AH> }

  AH> rule Rainbow
  AH> {
  AH>   <band(new Color("red"))>
  AH>   <band(new Color("orange"))>
  AH>   <band(new Color("yellow"))>
  AH>   <band(new Color("green"))>
  AH>   <band(new Color("blue"))>
  AH>   <band(new Color("indigo"))>
  AH>   <band(new Color("violet"))>
  AH>   <pot_o_gold>?
  AH> }

for the p6 regex impaired among us, please explain that. it might make a
nice tute for the docs. i get the general picture but i don't follow how
it works regarding the color checking.

uri

-- 
Uri Guttman  ------  [EMAIL PROTECTED]  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org

Reply via email to